Next: , Previous: , Up: syslib   [Index]


12.7 Low level ratnum operations

The arguments rat to these operations must be ratnums, the arguments num and den must be references to either fixnums or bignums. The following bindings are exported by the library (vicare system $ratnums). iklib numerics for more functions acting on ratnums.

Unsafe Operation: $make-ratnum num den

Allocate a new ratnum memory block, store num as reference to the numerator and den as reference to the denominator; return a reference to the ratnum.

The following conditions must be met, else the returned value will be invalid:

Unsafe Operation: $ratnum-num rat

Return the reference to the numerator.

Unsafe Operation: $ratnum-den rat

Return the reference to the denominator.

Unsafe Operation: $ratnum->flonum rat

Return a flonum object representing rat as inexact number.

Unsafe Operation: $ratnum-positive? rat
Unsafe Operation: $ratnum-negative? rat

Return #t if rat is, respectively, positive or negative; otherwise return #f.

Unsafe Operation: $ratnum-non-positive? rat
Unsafe Operation: $ratnum-non-negative? rat

Return #t if rat is, respectively, non–positive or non–negative; otherwise return #f.