• egg

## Documentation

### float Computations

#### Usage

`(import fp-utils)`

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

P is the precision in decimal digits, an integer.

#### fpsummation

[procedure] (fpsummation NUMS) -> float

Returns sum of NUMS via Kahan Summation Formula.

NUMS
(list-of float).

#### fprandom

[procedure] (fprandom [N]) -> float

Returns float in [0 1).

N
fixnum or float limit.

#### fpmodulo

[procedure] (fpmodulo N1 N2) -> float

#### fpquotient

[procedure] (fpquotient N1 N2) -> float

#### fpremainder

[procedure] (fpremainder N1 N2) -> float

#### fptruncate-with-precision

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

#### fpround-with-precision

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

#### fpceiling-with-precision

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

#### fpfloor-with-precision

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

#### fpmax-and-min

[procedure] (fpmax-and-min N ...) -> (values float float)

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

#### fpdistance

[procedure] (fpdistance X1 Y1 X2 Y2) -> float

Pythagorean distance between the points X1 Y1 and X2 Y2.

#### fpdistance*

[procedure] (fpdistance* X1 Y1 X2 Y2) -> float

Pythagorean distance, inaccurate but useful for relative comparisons.

#### fp~=

[procedure] (fp~= N1 N2 [EPS float-epsilon]) -> float

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

#### fp~<=

[procedure] (fp~<= N) -> boolean

#### fp~>=

[procedure] (fp~>= N) -> boolean

### float Inlines

#### Usage

`(import fp-inlines)`

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

P is the precision in decimal digits, an integer.

#### fpzero?

[procedure] (fpzero? N) -> boolean

#### fppositive?

[procedure] (fppositive? N) -> boolean

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

#### fpcardinal?

[procedure] (fpcardinal? N) -> boolean

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

#### fpnegative?

[procedure] (fpnegative? N) -> boolean

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

#### fpeven?

[procedure] (fpeven? N) -> boolean

#### fpodd?

[procedure] (fpodd? N) -> boolean

#### fpclosedr?

[procedure] (fpclosed-right? L N H) -> boolean
[procedure] (fpclosedr? L N H) -> boolean

Returns N in (L .. H].

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

#### fpclosed?

Returns N in [L .. H].

[procedure] (fpclosed? L N H) -> boolean

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

#### fpclosedl?

Returns N in [L .. H).

[procedure] (fpclosed-left? L N H) -> boolean
[procedure] (fpclosedl? L N H) -> boolean

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

#### fpsub1

[procedure] (fpsub1 N) -> float

#### fpfraction

[procedure] (fpfraction N) -> float

#### fpsqr

[procedure] (fpsqr N) -> float

#### fpcub

[procedure] (fpcub N) -> float

#### fpavg

[procedure] (fpavg N1 N2) -> float

#### fp%

[procedure] (fp% N1 P) -> float

: P ; (or float fixnum) ; percentage

#### fplog2

[procedure] (fplog2 N) -> float

#### fplog10

[procedure] (fplog10 N) -> float

#### fpprecision-factor

[procedure] (fpprecision-factor P [BASE 10.0]) -> float

Returns factor for P decimal digits precision.

: P ; (or float fixnum) ; precision

#### fpprecision-epsilon

[procedure] (fpprecision-epsilon P [BASE 10.0]) -> float

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.