Previous: Fixnum Operations, Up: Fixnum and Flonum Operations


4.7.2 Flonum Operations

A flonum is an inexact real number that is implemented as a floating-point number. In MIT/GNU Scheme, all inexact real numbers are flonums. For this reason, constants such as 0. and 2.3 are guaranteed to be flonums.

— procedure: flo:flonum? object

Returns #t if object is a flonum; otherwise returns #f.

— procedure: flo:= flonum1 flonum2
— procedure: flo:< flonum1 flonum2
— procedure: flo:> flonum1 flonum2

These procedures are the standard order and equality predicates on flonums. When compiled, they do not check the types of their arguments.

— procedure: flo:zero? flonum
— procedure: flo:positive? flonum
— procedure: flo:negative? flonum

Each of these procedures compares its argument to zero. When compiled, they do not check the type of their argument.

— procedure: flo:+ flonum1 flonum2
— procedure: flo:- flonum1 flonum2
— procedure: flo:* flonum1 flonum2
— procedure: flo:/ flonum1 flonum2

These procedures are the standard arithmetic operations on flonums. When compiled, they do not check the types of their arguments.

— procedure: flo:finite? flonum

The IEEE floating-point number specification supports three special “numbers”: positive infinity (+inf), negative infinity (-inf), and not-a-number (NaN). This predicate returns #f if flonum is one of these objects, and #t if it is any other floating-point number.

— procedure: flo:negate flonum

This procedure returns the negation of its argument. When compiled, it does not check the type of its argument. Equivalent to (flo:- 0. flonum).

— procedure: flo:abs flonum
— procedure: flo:exp flonum
— procedure: flo:log flonum
— procedure: flo:sin flonum
— procedure: flo:cos flonum
— procedure: flo:tan flonum
— procedure: flo:asin flonum
— procedure: flo:acos flonum
— procedure: flo:atan flonum
— procedure: flo:sqrt flonum
— procedure: flo:expt flonum1 flonum2
— procedure: flo:floor flonum
— procedure: flo:ceiling flonum
— procedure: flo:truncate flonum
— procedure: flo:round flonum
— procedure: flo:floor->exact flonum
— procedure: flo:ceiling->exact flonum
— procedure: flo:truncate->exact flonum
— procedure: flo:round->exact flonum

These procedures are flonum versions of the corresponding procedures. When compiled, they do not check the types of their arguments.

— procedure: flo:atan2 flonum1 flonum2

This is the flonum version of atan with two arguments. When compiled, it does not check the types of its arguments.