## Documentation

### float Computations

#### Usage

`(import fp-utils)`

N N1 ... X1 ... Y1 ... below are float.

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 float in [0 1).

N
fixnum or float limit.

#### fpmodulo

fpmodulo N1 N2procedure

#### fpquotient

fpquotient N1 N2procedure

#### fpremainder

fpremainder N1 N2procedure

#### fptruncate-with-precision

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

#### fpround-with-precision

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

#### fpceiling-with-precision

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

#### fpfloor-with-precision

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

#### fpmax-and-min

fpmax-and-min N ...procedure

Returns the maximum & minimum values for the floats 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 float-epsilon]) -> floatprocedure

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

fp~<= Nprocedure

fp~>= Nprocedure

### float Inlines

#### Usage

`(import fp-inlines)`

N N1 ... X1 ... Y1 ... below are float.

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

#### fpclosedr?

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

Returns N in (L .. H].

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

#### fpclosed?

Returns N in [L .. H].

fpclosed? L N Hprocedure

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

#### fpclosedl?

Returns N in [L .. H).

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

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

#### fpsub1

fpsub1 Nprocedure

#### fpfraction

fpfraction Nprocedure

fpsqr Nprocedure

fpcub Nprocedure

#### fpavg

fpavg N1 N2procedure

#### fp%

fp% N1 Pprocedure

: P ; (or float fixnum) ; percentage

#### fplog2

fplog2 Nprocedure

#### fplog10

fplog10 Nprocedure

#### fpprecision-factor

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

Returns factor for P decimal digits precision.

: P ; (or float fixnum) ; precision

#### fpprecision-epsilon

(fpprecision-epsilon P [BASE 10.0]) -> floatprocedure

Returns inverse factor for P decimal digits precision.

: P ; (or float fixnum) ; precision

Kon Lovett

## Repository

This egg is hosted on the CHICKEN Subversion repository:

https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/fp-utils

If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.

4.0.0
C5 port.