chickadee » fp-utils

mathh

Documentation

Additional flonum routines.

Flonum Computations

Usage

(import fp-utils)

N N1 ... X1 ... Y1 ... below are flonum.

P is the precision in decimal digits, an integer.

fpsummation

fpsummation NUMSprocedure

Returns sum of NUMS via Kahan Summation Formula.

NUMS
(list-of float).

fprandom

fprandom #!optional Nprocedure

Returns flonum in [0 1).

N
fixnum or flonum limit.

fpmodulo

fpmodulo N1 N2procedure

fpquotient

fpquotient N1 N2procedure

fpremainder

fpremainder N1 N2procedure

fptruncate-with-precision

(fptruncate-with-precision N [P 4]) -> flonumprocedure

fpround-with-precision

(fpround-with-precision N [P 4]) -> flonumprocedure

fpceiling-with-precision

(fpceiling-with-precision N [P 4]) -> flonumprocedure

fpfloor-with-precision

(fpfloor-with-precision N [P 4]) -> flonumprocedure

fpmax-and-min

fpmax-and-min N ...procedure

Returns the maximum & minimum values for the flonums N ....

fpdistance

fpdistance X1 Y1 X2 Y2procedure

Pythagorean distance between the points X1 Y1 and X2 Y2.

fpdistance*

fpdistance* X1 Y1 X2 Y2procedure

Pythagorean distance, inaccurate but useful for relative comparisons.

fp~=

(fp~= N1 N2 [EPS flonum-epsilon]) -> flonumprocedure

Compare floating-point values N1 and N2 within some flonum epsilon EPS.

fp~<=

fp~<= Nprocedure

fp~>=

fp~>= Nprocedure

Flonum Inlines

Usage

(import fp-inlines)

N N1 ... X1 ... Y1 ... below are flonum.

P is the precision in decimal digits, an integer.

fpzero?

fpzero? Nprocedure

fppositive?

fppositive? Nprocedure

Note that -0.0 is not positive, due to (fl<? -0.0 0.0).

fpcardinal?

fpcardinal? Nprocedure

Note that -0.0 is not cardinal, due to (fl<? -0.0 0.0).

fpnegative?

fpnegative? Nprocedure

Note that -0.0 is not negative, due to (fl<? -0.0 0.0).

fpeven?

fpeven? Nprocedure

fpodd?

fpodd? Nprocedure

fpclosed-right?

fpclosedr?

fpclosed-right? L N Hprocedure
fpclosedr? L N Hprocedure

Returns N in (L .. H].

N, L & H are flonum low & high limits.

fpclosed?

Returns N in [L .. H].

fpclosed? L N Hprocedure

N, L & H are flonum low & high limits.

fpclosed-left?

fpclosedl?

Returns N in [L .. H).

fpclosed-left? L N Hprocedure
fpclosedl? L N Hprocedure

N, L & H are flonum low & high limits.

fpadd1

fpadd1 Nprocedure

fpsub1

fpsub1 Nprocedure

fpfraction

fpfraction Nprocedure

fpsqr

fpsqr Nprocedure

fpcub

fpcub Nprocedure

fplog2

fplog2 Nprocedure

fplog10

fplog10 Nprocedure

fpdegree->radian

fpdegree->radian Nprocedure

fpradian->degree

fpradian->degree Nprocedure

fpprecision-factor

(fpprecision-factor P [BASE 10.0]) -> flonumprocedure

Returns factor for P decimal digits precision.

Author

Kon Lovett

Version history

4.0.0
C5 port.

License

This code is in the public domain.

Contents »