fx-utils

  1. fx-utils
  2. Documentation
    1. Fixnum Computations
      1. Usage
      2. fxrandom
      3. fxlog2
      4. fxpow2log2
      5. fxdistance
      6. fxdistance*
      7. fxquo-and-mod
      8. fxmax-and-min
    2. Fixnum Inlines
      1. Usage
      2. fxzero?
      3. fxpositive?
      4. fxcardinal?
      5. fxnegative?
      6. fxclosed-right?
      7. fxclosedr?
      8. fxclosed?
      9. fxclosed-left?
      10. fxclosedl?
      11. fxadd1
      12. fxsub1
      13. fxabs
      14. fxsqr
      15. fxcub
  3. Author
  4. Repository
  5. Version history
  6. License

Documentation

Additional fixnum routines.

Fixnum Computations

Usage

(import fx-utils)

N N1 ... X1 ... Y1 ... below are fixnum.

fxrandom

[procedure] (fxrandom [N]) -> fixnum

N fixnum limit.

fxlog2

[procedure] (fxlog2 N) -> fixnum

Returns index of highest bit set, so N is treated as unsigned.

fxpow2log2

[procedure] (fxpow2log2 N) -> fixnum

Returns fixnum 2^N.

fxdistance

[procedure] (fxdistance X1 Y1 X2 Y2) -> fixnum

Pythagorean distance between the points X1 Y1 and X2 Y2.

fxdistance*

[procedure] (fxdistance* X1 Y1 X2 Y2) -> fixnum

Pythagorean distance, inaccurate but useful for relative comparisons.

fxquo-and-mod

[procedure] (fxquo-and-mod N D) -> (values fixnum fixnum)

Returns the quotient & remainder values for fixnums D & D.

fxmax-and-min

[procedure] (fxmax-and-min N ...) -> (values fixnum fixnum)

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

Fixnum Inlines

Usage

(import fx-inlines)

N N1 ... X1 ... Y1 ... below are fixnum.

fxzero?

[procedure] (fxzero? N) -> boolean

fxpositive?

[procedure] (fxpositive? N) -> boolean

fxcardinal?

[procedure] (fxcardinal? N) -> boolean

fxnegative?

[procedure] (fxnegative? N) -> boolean

fxclosed-right?

fxclosedr?

[procedure] (fxclosed-right? L N H) -> boolean
[procedure] (fxclosedr? L N H) -> boolean

Returns N in (L .. H].

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

fxclosed?

Returns N in [L .. H].

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

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

fxclosed-left?

fxclosedl?

Returns N in [L .. H).

[procedure] (fxclosed-left? L N H) -> boolean
[procedure] (fxclosedl? L N H) -> boolean

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

fxadd1

[procedure] (fxadd1 N) -> fixnum

fxsub1

[procedure] (fxsub1 N) -> fixnum

fxabs

[procedure] (fxabs N) -> fixnum

fxsqr

[procedure] (fxsqr N) -> fixnum

fxcub

[procedure] (fxcub N) -> fixnum

Author

Kon Lovett

Repository

This egg is hosted on the CHICKEN Subversion repository:

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

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

Version history

4.0.0
C5 port.

License

This code is in the public domain.