Changeset 34133 in project


Ignore:
Timestamp:
05/30/17 19:13:30 (3 months ago)
Author:
kon
Message:

rel 3.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/mathh

    r34099 r34133  
    228228{{P}} is the precision in decimal digits, an {{integer}}.
    229229
     230=== fprandom
     231
     232<procedure>(fprandom [N]) => flonum</procedure>
     233
     234{{N}} {{fixnum}} limit.
     235
    230236==== fpzero?
    231237
     
    236242<procedure>(fppositive? N) => boolean</procedure>
    237243
     244==== fpcardinal?
     245
     246<procedure>(fpcardinal? N) => boolean</procedure>
     247
    238248==== fpnegative?
    239249
     
    247257
    248258<procedure>(fpodd? N) => boolean</procedure>
     259
     260=== fpclosed-right?
     261=== fpclosedr?
     262
     263<procedure>(fpclosed-right? L N H) => boolean</procedure>
     264<procedure>(fpclosedr? L N H) => boolean</procedure>
     265
     266Returns {{N}} in {{(L .. H]}}.
     267
     268{{N}}, {{L}} & {{H}} are {{flonum}} low & high limits.
     269
     270=== fpclosed?
     271
     272Returns {{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=== fpclosed-left?
     279=== fpclosedl?
     280
     281Returns {{N}} in {{[L .. H)}}.
     282
     283<procedure>(fpclosed-left? 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>
    249295
    250296==== fpmodulo
     
    287333{{EPS}}.
    288334
     335=== fp~<=
     336
     337<procedure>(fp~<= N) => boolean</procedure>
     338
     339=== fp~>=
     340
     341<procedure>(fp~>= N) => boolean</procedure>
     342
    289343==== fpsqr
    290344
     
    315369Pythagorean distance, inaccurate but useful for relative comparisons.
    316370
     371==== fpmax-and-min
     372
     373<procedure>(fpmax-and-min N ...) => (values flonum flonum)</procedure>
     374
     375Returns the maximum & minimum values for the {{flonum}}s {{N ...}}.
     376
    317377==== fpprecision-factor
    318378
     
    320380
    321381Returns factor for {{P}} decimal digits precision.
     382
     383
     384=== Fixnum Utilities
     385
     386==== Usage
     387
     388<enscript language=scheme>
     389(require-extension fx-utils)
     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=== fxclosed-right?
     417=== fxclosedr?
     418
     419<procedure>(fxclosed-right? L N H) => boolean</procedure>
     420<procedure>(fxclosedr? L N H) => boolean</procedure>
     421
     422Returns {{N}} in {{(L .. H]}}.
     423
     424{{N}}, {{L}} & {{H}} are {{fixnum}} low & high limits.
     425
     426=== fxclosed?
     427
     428Returns {{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=== fxclosed-left?
     435=== fxclosedl?
     436
     437Returns {{N}} in {{[L .. H)}}.
     438
     439<procedure>(fxclosed-left? 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
     468Returns {{fixnum}} {{2^N}}.
     469
     470==== fxdistance
     471
     472<procedure>(fxdistance X1 Y1 X2 Y2) => fixnum</procedure>
     473
     474Pythagorean distance between the points {{X1 Y1}} and {{X2 Y2}}.
     475
     476==== fxdistance*
     477
     478<procedure>(fxdistance* X1 Y1 X2 Y2) => fixnum</procedure>
     479
     480Pythagorean distance, inaccurate but useful for relative comparisons.
     481
     482==== fxmax-and-min
     483
     484<procedure>(fxmax-and-min N ...) => (values fixnum fixnum)</procedure>
     485
     486Returns the maximum & minimum values for the {{fixnum}}s {{N ...}}.
    322487
    323488
     
    383548
    384549* Some library calls that are not supplied by the platform have rough
    385 implementations provided anyway. See {{Bugs and Limitations}}.
     550implementations supplied. See {{Bugs and Limitations}}.
    386551
    387552* The general naming convention is to use the C library call name as the Scheme
    388553name. But there are exceptions:
    389554
    390 ; fmod : fpmod (Should be in Chicken library?)
     555; fmod : fpmod - ''fp-utils'' {{fpmodulo}} - should be in Chicken library?
    391556; j0 : bessel-j0 (Prefixed to distinguish the names from common variables)
    392557; j1 : bessel-j1
     
    396561; yn : bessel-yn
    397562
    398 
    399563== Bugs and Limitations
    400564
    401565* CHICKEN_INCLUDE_PATH must at least state the value of the
    402 {{(repository-path)}} to include ''mathh-constants.scm''.
     566{{(repository-path)}} to include ''mathh-constants.scm''. Suggest using the
     567module ''mathh-consts''.
    403568
    404569* The types {{integer}} & {{real}} refer to the Chicken "core" concept of a
     
    407572*  Windows does not provide library calls {{lgamma}}, {{gamma}}, {{acosh}},
    408573{{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
     576Usable {{log2}}, {{log1p}}, {{erf}}, {{erfc}}, {{scalbn}} & {{signbit}} are
     577supplied.
     578
     579* FreeBSD does not provide the library call {{log2}}. A usable {{log2}} is
     580supplied.
    414581
    415582* The {{fpclass}} {{quiet-nan}} is only distinguished on Windows.
     583
     584* ''fx-utils.scm'' & ''fp-utils.scm'' belong in own eggs.
    416585
    417586
     
    424593== Version history
    425594
    426 ; 3.1.0 ; Added module for ''mathh-constants.scm''. Added ''fp-utils''.
     595; 3.1.1 ; Fix {{fpodd?}}. Add ''fx-utils.scm''. Extend ''fp-utils.scm''.
     596; 3.2.0 ; Added module for ''mathh-constants.scm''. Added ''fp-utils.scm''.
    427597; 3.0.0 ; Moved copy of ''mathh-constants.scm'' to {{(chicken-home)}}. Ticket #1327
    428598; 2.2.6 ; better argvector chicken test
Note: See TracChangeset for help on using the changeset viewer.