Documentation
Arithmetic

 Tags: math Authors: Slava Pestov

Words

Builtin classes
 bignum fixnum float

Tuple classes
 Class Superclass Slots complex tuple real imaginary negative-number-expected tuple n non-negative-number-expected tuple n positive-number-expected tuple n ratio tuple numerator denominator

Union classes
 integer number rational real

Generic words
 Word Stack effect * ( x y -- z ) + ( x y -- z ) - ( x y -- z ) / ( x y -- z ) /f ( x y -- z ) /i ( x y -- z ) /mod ( x y -- z w ) < ( x y -- ? ) <= ( x y -- ? ) > ( x y -- ? ) >= ( x y -- ? ) >bignum ( x -- n ) >fixnum ( x -- n ) >float ( x -- y ) >fraction ( a/b -- a b ) >integer ( x -- n ) >rect ( z -- x y ) abs ( x -- y ) bit? ( x n -- ? ) bitand ( x y -- z ) bitnot ( x -- y ) bitor ( x y -- z ) bitxor ( x y -- z ) denominator ( a/b -- b ) fp-infinity? ( x -- ? ) fp-nan-payload ( x -- bits ) fp-nan? ( x -- ? ) fp-qnan? ( x -- ? ) fp-sign ( x -- ? ) fp-snan? ( x -- ? ) fp-special? ( x -- ? ) imaginary-part ( z -- y ) integer>fixnum ( x -- y ) integer>fixnum-strict ( x -- y ) mod ( x y -- z ) neg? ( x -- ? ) next-float ( m -- n ) number= ( x y -- ? ) numerator ( a/b -- a ) prev-float ( m -- n ) real-part ( z -- x ) recip ( x -- y ) shift ( x n -- y ) simple-gcd ( x y -- d ) u< ( x y -- ? ) u<= ( x y -- ? ) u> ( x y -- ? ) u>= ( x y -- ? ) unordered? ( x y -- ? )

Primitives
 Word Stack effect bits>double ( n -- x ) bits>float ( n -- x ) double>bits ( x -- n ) float>bits ( x -- n )

Ordinary words
 Word Stack effect 2/ ( x -- y ) 2^ ( n -- 2^n ) ( payload -- nan ) ?1+ ( x -- y ) align ( m w -- n ) all-integers-from? ( ... from to quot: ( ... i -- ... ? ) -- ... ? ) all-integers? ( ... n quot: ( ... i -- ... ? ) -- ... ? ) assert-negative ( n -- n ) assert-non-negative ( n -- n ) assert-positive ( n -- n ) bit-length ( x -- n ) each-integer ( ... n quot: ( ... i -- ... ) -- ... ) each-integer-from ( ... from to quot: ( ... i -- ... ) -- ... ) even? ( n -- ? ) find-integer ( ... n quot: ( ... i -- ... ? ) -- ... i/f ) find-integer-from ( ... i n quot: ( ... i -- ... ? ) -- ... i/f ) find-last-integer ( ... n quot: ( ... i -- ... ? ) -- ... i/f ) fp-bitwise= ( x y -- ? ) gcd ( x y -- a d ) if-zero ( ..a n quot1: ( ..a -- ..b ) quot2: ( ..a n -- ..b ) -- ..b ) lcm ( a b -- c ) log2 ( x -- n ) neg ( x -- -x ) negative-number-expected ( n -- * ) next-power-of-2 ( m -- n ) non-negative-number-expected ( n -- * ) odd? ( n -- ? ) positive-number-expected ( n -- * ) power-of-2? ( n -- ? ) rect> ( x y -- z ) recursive-hashcode ( n obj quot -- code ) rem ( x y -- z ) sgn ( x -- n ) sq ( x -- y ) times ( ... n quot: ( ... -- ... ) -- ... ) unless-zero ( ... n quot: ( ... n -- ... ) -- ... ) until-zero ( ... n quot: ( ... x -- ... y ) -- ... ) when-zero ( ... n quot: ( ... -- ... x ) -- ... x ) zero? ( x -- ? )

Class predicate words
 Word Stack effect bignum? ( object -- ? ) complex? ( object -- ? ) fixnum? ( object -- ? ) float? ( object -- ? ) integer? ( object -- ? ) negative-number-expected? ( object -- ? ) non-negative-number-expected? ( object -- ? ) number? ( object -- ? ) positive-number-expected? ( object -- ? ) ratio? ( object -- ? ) rational? ( object -- ? ) real? ( object -- ? )

Files

Children from resource:core
 Vocabulary Summary math.floats Floating point number implementation math.integers Integer implementation math.order Generic protocol for totally-ordered objects math.parser Converting numbers to and from strings math.ratios Rational number implementation

Children from resource:basis
 Vocabulary Summary math.bits Virtual sequence for bits of an integer math.bitwise Bitwise arithmetic utilities math.combinatorics Permutations and combinations math.complex Complex number implementation math.constants Mathematical constants math.floating-point math.floats Floating point number implementation math.functions Elementary complex-valued functions math.hashcodes math.intervals Interval arithmetic math.libm Low-level binding to math functions in the C standard library math.matrices Matrix arithmetic math.partial-dispatch Partially-dispatched math operations, used by the compiler math.polynomials Polynomial arithmetic math.primes Prime numbers test and generation math.quaternions Quaternion arithmetic and Euler angles math.rectangles math.statistics Mean, median, standard deviation, and other statistical routines math.vectors Vector arithmetic

Children from resource:extra
 Vocabulary Summary math.affine-transforms Affine transforms for two-dimensional vectors math.algebra Various algebra-related words math.analysis Various special functions from complex analysis math.approx Approximating rational numbers. math.binpack Bin-packing algorithms. math.blas math.cardinality Cardinality estimation math.combinatorics Permutations and combinations math.combinators math.compare Comparison functions. math.continued-fractions Continued fractions math.derivatives math.distances math.dual math.extras math.factorials math.finance Moving averages and other calculations useful for finance. math.function-tools math.matrices Matrix arithmetic math.numerical-integration Numerical integration using Simpson's method math.points math.primes Prime numbers test and generation math.quadratic Quadratic equation solver math.runge-kutta runge-kutta 4-stage implementation for n dimensions math.secant-method math.similarity math.splines Common parametric curves math.text math.transforms math.unicode math.vectors Vector arithmetic

Children
 Vocabulary Summary math.private