11 The Built-In Classes
<object>
The class <number>
is open, to allow programmers to create additional numeric classes. The built-in numeric operations do not provide default implementations for <number>
, but for <complex>
, a sealed subclass of <number>
.
<number>
<complex>
defined by the language, but implementations may define such subclasses. Because <complex>
and all its defined subclasses are sealed, implementation-defined subclasses may be added efficiently.
Many built-in functions are defined to have methods on <complex>
. This means that the function is defined on all built-in subclasses of <complex>
. It does not imply that there is a single method specialized on the <complex>
class.
Function | Description | Page | |
---|---|---|---|
= | Compares two objects for equality. | 254 | |
zero? | Tests for the property of being equal to zero. | 260 | |
+ | Returns the sum of its arguments. | 262 | |
* | Returns the product of its arguments. | 263 | |
- | Returns the difference of its arguments. | 263 | |
/ | Returns the quotient of its arguments. | 263 | |
^ | Raises an object to a specified power. | 268 | |
abs | Returns the absolute value of its argument. | 269 |
<complex>
Function | Description | Page | |
---|---|---|---|
floor | Truncates a real number towards negative infinity. | 264 | |
ceiling | Truncates a real number towards positive infinity. | 265 | |
round | Rounds a real number towards the nearest mathematical integer. | 265 | |
truncate | Truncates a real number towards zero. | 266 | |
floor/ | Returns the floor of the quotient of two numbers. | 266 | |
ceiling/ | Returns the ceiling of the quotient of two numbers. | 266 | |
round/ | Rounds off the quotient of two numbers. | 267 | |
truncate/ | Returns the truncated quotient of two numbers. | 267 | |
modulo | Returns the second value of floor/. | 268 | |
remainder | Returns the second value of truncate/. | 268 |
Function | Description | Page | |
---|---|---|---|
< | Returns true if its first operand is less than its second operand. | 256 | |
positive? | Tests for the property of being positive. | 261 | |
negative? | Tests for the property of being negative. | 261 | |
integral? | Tests for the property of being integral. | 261 | |
negative | Returns the negation of an object. | 264 |
<single-float>
and <double-float>
are intended but not required to be the corresponding IEEE types. The class <extended-float>
is intended but not required to have more range and/or precision than <double-float>
.
If an implementation has fewer than three floating point classes, the names <single-float>
, <double-float>
and <extended-float>
may all refer to the same object.
<real>
<float>
<float>
<float>
<double-float>
.
<real>
<rational>
Implementations are required to support integers with at least 28 bits of precision. The overflow and underflow behavior is implementation-defined. (Some implementations may choose to have integers of unlimited size, but this is not required.)
The result of dividing two integers with / is implementation defined. Portable programs should use floor/
, ceiling/
, round/
, or truncate/
to divide two integers.
Function | Description | Page | |
---|---|---|---|
limited | Returns a limited subtype of a class. | 249 |
Generated with Harlequin WebMaker