Numeric Procedures

Numeric procedures cover exact arithmetic, mixed finite-real arithmetic, exact comparison, integer division families, rounding, gcd/lcm, integer exponentiation, and exact integer square root.

See it run

LISPEX
(call-with-values (lambda () (exact-integer-sqrt 20)) list)

Observed result

OUTPUT
(4 4)

How to reason about it

  • + - * / are specified to take any number of arguments. Comparisons require at least two arguments, and integer-domain operations reject non-integers.
  • floor/ and truncate/ return quotient and remainder as two values.
  • expt accepts an exact-integer exponent, and exact-integer-sqrt returns root and remainder.

Numeric signatures

SignatureResultFault boundary
(+ number ...) / (* number ...)number, exact unless any operand is inexactE312 wrong type, E314 non-finite
(/ number number ...)exact rational or finite realE313 zero divisor, E314 non-finite
(floor/ integer integer)two values, the quotient and the remainderE312 non-integer, E313 zero divisor
(expt number exact-integer)number preserving base exactnessE313 exact zero to a negative power, E314 unrepresentable
(exact-integer-sqrt exact-nonnegative-integer)two exact values, the root and the remainderE312 wrong domain

A common mistake

General transcendental functions and non-finite values are absent.

Keep going

The manual explains the exactness and contagion rules behind these signatures, and the index places them among the other families.

Exact and Inexact Numbers · Procedure Index