For more information including compatibility, examples and test cases, see https://github.com/petercrlane/r7rs-libs
0.1. Maths Integer Functions: (import (slib math-integer))
Using the functions in this library means that integer values will return integer results. Using non-integer values generates errors.
Further documentation: http://people.csail.mit.edu/jaffer/slib/Irrational-Integer-Functions.html#Irrational-Integer-Functions
For example:
sash[r7rs]> (expt 2.1 3) 9.261000000000001 sash[r7rs]> (integer-expt 2.1 3) Unhandled exception Condition components: 1. &error 2. &message integer-expt 3. &irritants (2.1 3) 4. &stack-trace ... sash[r7rs]> (integer-expt 2 3) 8
Additionally, in cases where an inexact result might be expected, these functions will return the nearest integer equivalent:
For example:
sash[r7rs]> (sqrt 9) 3 sash[r7rs]> (sqrt 10) 3.1622776601683795 sash[r7rs]> (integer-sqrt 9) 3 sash[r7rs]> (integer-sqrt 10) 3