Changeset 34099 in project
 Timestamp:
 05/28/17 20:48:03 (5 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

wiki/eggref/4/mathh
r33626 r34099 162 162 163 163 164 === Math Constants 164 === Math Constants (Module) 165 166 ==== Usage 167 168 <enscript language=scheme> 169 (requireextension mathhconsts) 170 </enscript> 171 172 ==== Constants 173 174 These are all {{flonum}}. 175 176 ; e : e 177 ; 1/e : 1/e 178 ; e^2 : e^2 179 ; e^pi/4 : e^(pi/4) 180 ; log2e : log2(e) 181 ; log10e : log10(e) 182 ; ln2 : log(2) 183 ; ln3 : ln(3) 184 ; lnpi : ln(pi) 185 ; ln10 : log(10) 186 ; 1/ln2 : 1/ln(2) 187 ; 1/ln10 : 1/ln(10) 188 ; pi : pi 189 ; pi/2 : pi/2 190 ; pi/4 : pi/4 191 ; 1/pi : 1/pi 192 ; 2/pi : 2/pi 193 ; 2/sqrtpi : 2/sqrt(pi) 194 ; sqrtpi : sqrt(pi) 195 ; pi^2 : pi^2 196 ; degree : pi/180 197 ; sqrt2 : sqrt(2) 198 ; 1/sqrt2 : 1/sqrt(2) 199 ; sqrt3 : sqrt(3) 200 ; sqrt5 : sqrt(5) 201 ; sqrt10 : sqrt(10) 202 ; cubert2 : cubert(2) 203 ; cubert3 : cubert(3) 204 ; 4thrt2 : fourthrt(2) 205 ; gamma1/2 : gamma(1/2) 206 ; gamma1/3 : gamma(1/3) 207 ; gamma2/3 : gamma(2/3) 208 ; phi : phi 209 ; lnphi : ln(phi) 210 ; 1/lnphi : 1/ln(phi) 211 ; euler : euler 212 ; e^euler : e^euler 213 ; sin1 : sin(1) 214 ; cos1 : cos(1) 215 ; zeta3 : theta(3) 216 217 218 === Flonum Utilities 219 220 ==== Usage 221 222 <enscript language=scheme> 223 (requireextension fputils) 224 </enscript> 225 226 {{N N1 ... X1 ... Y1 ...}} below are {{flonum}}. 227 228 {{P}} is the precision in decimal digits, an {{integer}}. 229 230 ==== fpzero? 231 232 <procedure>(fpzero? N) => boolean</procedure> 233 234 ==== fppositive? 235 236 <procedure>(fppositive? N) => boolean</procedure> 237 238 ==== fpnegative? 239 240 <procedure>(fpnegative? N) => boolean</procedure> 241 242 ==== fpeven? 243 244 <procedure>(fpeven? N) => boolean</procedure> 245 246 ==== fpodd? 247 248 <procedure>(fpodd? N) => boolean</procedure> 249 250 ==== fpmodulo 251 252 <procedure>(fpmodulo N1 N2) => flonum</procedure> 253 254 ==== fpquotient 255 256 <procedure>(fpquotient N1 N2) => flonum</procedure> 257 258 ==== fpremainder 259 260 <procedure>(fpremainder N1 N2) => flonum</procedure> 261 262 ==== fpfraction 263 264 <procedure>(fpfraction N) => flonum</procedure> 265 266 ==== fptruncate/precision 267 268 <procedure>(fptruncate/precision N [P 4]) => flonum</procedure> 269 270 ==== fpround/precision 271 272 <procedure>(fpround/precision N [P 4]) => flonum</procedure> 273 274 ==== fpceiling/precision 275 276 <procedure>(fpceiling/precision N [P 4]) => flonum</procedure> 277 278 ==== fpfloor/precision 279 280 <procedure>(fpfloor/precision N [P 4]) => flonum</procedure> 281 282 ==== fp~= 283 284 <procedure>(fp~= N1 N2 [EPS flonumepsilon]) => flonum</procedure> 285 286 Compare floatingpoint values {{N1}} and {{N2}} within some {{flonum}} epsilon 287 {{EPS}}. 288 289 ==== fpsqr 290 291 <procedure>(fpsqr N) => flonum</procedure> 292 293 ==== fpcub 294 295 <procedure>(fpcub N) => flonum</procedure> 296 297 ==== fpdegree>radian 298 299 <procedure>(fpdegree>radian N) => flonum</procedure> 300 301 ==== fpradian>degree 302 303 <procedure>(fpradian>degree N) => flonum</procedure> 304 305 ==== fpdistance 306 307 <procedure>(fpdistance X1 Y1 X2 Y2) => flonum</procedure> 308 309 Pythagorean distance between the points {{X1 Y1}} and {{X2 Y2}}. 310 311 ==== fpdistance* 312 313 <procedure>(fpdistance* X1 Y1 X2 Y2) => flonum</procedure> 314 315 Pythagorean distance, inaccurate but useful for relative comparisons. 316 317 ==== fpprecisionfactor 318 319 <procedure>(fpprecisionfactor P [BASE 10.0]) => flonum</procedure> 320 321 Returns factor for {{P}} decimal digits precision. 322 323 324 === Math Constants (Include) 165 325 166 326 Common constants, using 'defineconstant'. As such they must be textually … … 214 374 ; SIN1 : sin(1) 215 375 ; COS1 : cos(1) 216 ; ZETA3 : theta(3 376 ; ZETA3 : theta(3) 217 377 218 378 … … 259 419 260 420 [[/users/konlovettKon Lovett]] 261 262 421 [[/users/john cowanJohn Cowan]] 263 422 … … 265 424 == Version history 266 425 267 ; 3.0.0 ; Removed copy of ''mathhconstants.scm'' to {{(chickenhome)}}. Ticket #1327 426 ; 3.1.0 ; Added module for ''mathhconstants.scm''. Added ''fputils''. 427 ; 3.0.0 ; Moved copy of ''mathhconstants.scm'' to {{(chickenhome)}}. Ticket #1327 268 428 ; 2.2.6 ; better argvector chicken test 269 429 ; 2.2.5 ; argvector chicken support
Note: See TracChangeset
for help on using the changeset viewer.