Changeset 34133 in project
 Timestamp:
 05/30/17 19:13:30 (9 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

wiki/eggref/4/mathh
r34099 r34133 228 228 {{P}} is the precision in decimal digits, an {{integer}}. 229 229 230 === fprandom 231 232 <procedure>(fprandom [N]) => flonum</procedure> 233 234 {{N}} {{fixnum}} limit. 235 230 236 ==== fpzero? 231 237 … … 236 242 <procedure>(fppositive? N) => boolean</procedure> 237 243 244 ==== fpcardinal? 245 246 <procedure>(fpcardinal? N) => boolean</procedure> 247 238 248 ==== fpnegative? 239 249 … … 247 257 248 258 <procedure>(fpodd? N) => boolean</procedure> 259 260 === fpclosedright? 261 === fpclosedr? 262 263 <procedure>(fpclosedright? L N H) => boolean</procedure> 264 <procedure>(fpclosedr? L N H) => boolean</procedure> 265 266 Returns {{N}} in {{(L .. H]}}. 267 268 {{N}}, {{L}} & {{H}} are {{flonum}} low & high limits. 269 270 === fpclosed? 271 272 Returns {{N}} in {{[L .. H]}}. 273 274 <procedure>(fpclosed? L N H) => boolean</procedure> 275 276 {{N}}, {{L}} & {{H}} are {{flonum}} low & high limits. 277 278 === fpclosedleft? 279 === fpclosedl? 280 281 Returns {{N}} in {{[L .. H)}}. 282 283 <procedure>(fpclosedleft? L N H) => boolean</procedure> 284 <procedure>(fpclosedl? L N H) => boolean</procedure> 285 286 {{N}}, {{L}} & {{H}} are {{flonum}} low & high limits. 287 288 === fpadd1 289 290 <procedure>(fpadd1 N) => flonum</procedure> 291 292 === fpsub1 293 294 <procedure>(fpsub1 N) => flonum</procedure> 249 295 250 296 ==== fpmodulo … … 287 333 {{EPS}}. 288 334 335 === fp~<= 336 337 <procedure>(fp~<= N) => boolean</procedure> 338 339 === fp~>= 340 341 <procedure>(fp~>= N) => boolean</procedure> 342 289 343 ==== fpsqr 290 344 … … 315 369 Pythagorean distance, inaccurate but useful for relative comparisons. 316 370 371 ==== fpmaxandmin 372 373 <procedure>(fpmaxandmin N ...) => (values flonum flonum)</procedure> 374 375 Returns the maximum & minimum values for the {{flonum}}s {{N ...}}. 376 317 377 ==== fpprecisionfactor 318 378 … … 320 380 321 381 Returns factor for {{P}} decimal digits precision. 382 383 384 === Fixnum Utilities 385 386 ==== Usage 387 388 <enscript language=scheme> 389 (requireextension fxutils) 390 </enscript> 391 392 {{N N1 ... X1 ... Y1 ...}} below are {{fixnum}}. 393 394 === fxrandom 395 396 <procedure>(fxrandom [N]) => fixnum</procedure> 397 398 {{N}} {{fixnum}} limit. 399 400 ==== fxzero? 401 402 <procedure>(fxzero? N) => boolean</procedure> 403 404 ==== fxpositive? 405 406 <procedure>(fxpositive? N) => boolean</procedure> 407 408 ==== fxcardinal? 409 410 <procedure>(fxcardinal? N) => boolean</procedure> 411 412 ==== fxnegative? 413 414 <procedure>(fxnegative? N) => boolean</procedure> 415 416 === fxclosedright? 417 === fxclosedr? 418 419 <procedure>(fxclosedright? L N H) => boolean</procedure> 420 <procedure>(fxclosedr? L N H) => boolean</procedure> 421 422 Returns {{N}} in {{(L .. H]}}. 423 424 {{N}}, {{L}} & {{H}} are {{fixnum}} low & high limits. 425 426 === fxclosed? 427 428 Returns {{N}} in {{[L .. H]}}. 429 430 <procedure>(fxclosed? L N H) => boolean</procedure> 431 432 {{N}}, {{L}} & {{H}} are {{fixnum}} low & high limits. 433 434 === fxclosedleft? 435 === fxclosedl? 436 437 Returns {{N}} in {{[L .. H)}}. 438 439 <procedure>(fxclosedleft? L N H) => boolean</procedure> 440 <procedure>(fxclosedl? L N H) => boolean</procedure> 441 442 {{N}}, {{L}} & {{H}} are {{fixnum}} low & high limits. 443 444 === fxadd1 445 446 <procedure>(fxadd1 N) => fixnum</procedure> 447 448 === fxsub1 449 450 <procedure>(fxsub1 N) => fixnum</procedure> 451 452 ==== fxabs 453 454 <procedure>(fxabs N) => fixnum</procedure> 455 456 ==== fxsqr 457 458 <procedure>(fxsqr N) => fixnum</procedure> 459 460 ==== fxcub 461 462 <procedure>(fxcub N) => fixnum</procedure> 463 464 ==== fxpow2log2 465 466 <procedure>(fxpow2log2 N) => fixnum</procedure> 467 468 Returns {{fixnum}} {{2^N}}. 469 470 ==== fxdistance 471 472 <procedure>(fxdistance X1 Y1 X2 Y2) => fixnum</procedure> 473 474 Pythagorean distance between the points {{X1 Y1}} and {{X2 Y2}}. 475 476 ==== fxdistance* 477 478 <procedure>(fxdistance* X1 Y1 X2 Y2) => fixnum</procedure> 479 480 Pythagorean distance, inaccurate but useful for relative comparisons. 481 482 ==== fxmaxandmin 483 484 <procedure>(fxmaxandmin N ...) => (values fixnum fixnum)</procedure> 485 486 Returns the maximum & minimum values for the {{fixnum}}s {{N ...}}. 322 487 323 488 … … 383 548 384 549 * Some library calls that are not supplied by the platform have rough 385 implementations provided anyway. See {{Bugs and Limitations}}.550 implementations supplied. See {{Bugs and Limitations}}. 386 551 387 552 * The general naming convention is to use the C library call name as the Scheme 388 553 name. But there are exceptions: 389 554 390 ; fmod : fpmod (Should be in Chicken library?)555 ; fmod : fpmod  ''fputils'' {{fpmodulo}}  should be in Chicken library? 391 556 ; j0 : besselj0 (Prefixed to distinguish the names from common variables) 392 557 ; j1 : besselj1 … … 396 561 ; yn : besselyn 397 562 398 399 563 == Bugs and Limitations 400 564 401 565 * CHICKEN_INCLUDE_PATH must at least state the value of the 402 {{(repositorypath)}} to include ''mathhconstants.scm''. 566 {{(repositorypath)}} to include ''mathhconstants.scm''. Suggest using the 567 module ''mathhconsts''. 403 568 404 569 * The types {{integer}} & {{real}} refer to the Chicken "core" concept of a … … 407 572 * Windows does not provide library calls {{lgamma}}, {{gamma}}, {{acosh}}, 408 573 {{asinh}}, {{atanh}}, {{log2}}, {{log1p}}, {{erf}}, {{erfc}}, {{scalbn}}, 409 {{cbrt}} & {{signbit}}. Usable versions of {{log2}}, {{log1p}}, {{erf}}, 410 {{erfc}}, {{scalbn}} & {{signbit}} are provided anyway. 411 412 * FreeBSD does not provide the library call {{log2}}. Usable version of 413 {{log2}} is provided anyway. 574 {{cbrt}} & {{signbit}}. 575 576 Usable {{log2}}, {{log1p}}, {{erf}}, {{erfc}}, {{scalbn}} & {{signbit}} are 577 supplied. 578 579 * FreeBSD does not provide the library call {{log2}}. A usable {{log2}} is 580 supplied. 414 581 415 582 * The {{fpclass}} {{quietnan}} is only distinguished on Windows. 583 584 * ''fxutils.scm'' & ''fputils.scm'' belong in own eggs. 416 585 417 586 … … 424 593 == Version history 425 594 426 ; 3.1.0 ; Added module for ''mathhconstants.scm''. Added ''fputils''. 595 ; 3.1.1 ; Fix {{fpodd?}}. Add ''fxutils.scm''. Extend ''fputils.scm''. 596 ; 3.2.0 ; Added module for ''mathhconstants.scm''. Added ''fputils.scm''. 427 597 ; 3.0.0 ; Moved copy of ''mathhconstants.scm'' to {{(chickenhome)}}. Ticket #1327 428 598 ; 2.2.6 ; better argvector chicken test
Note: See TracChangeset
for help on using the changeset viewer.