Number
This is the Number class.
A number is a basic datatype for an arithmetical value which represents a particular quantity. Numbers are useful for counting things and for performing mathematical calculations.
This class encompasses all sorts of real numbers, including integers and inexact floatingpoint values in the native architecture's doubleprecision representation; as well as the more abstract concepts of infinity and NaN.
The Number class is only concerned with real numbers, but Ferret has native support for complex numbers as well through the Complex class.
Methods
even
$number.even
Property. Boolean evenness of the number.
odd
$number.odd
Property. Boolean oddness of the number.
round
$number.round
Property. Nearest integer to the number.
Examples: 3.5
> 4
, 3.4
> 3
.
ceil
$number.ceil
Property. Smallest integer that is greater than or equal to the number.
Example: 3.001.ceil
> 4
.
floor
$number.floor
Property. Greatest integer less than or equal to the number.
Example: 3.999
> 3
.
square
$number.square
Property. Square of the number (n ^ 2
).
Example: 2.square
> 4
.
sqrt
$number.sqrt
Property. Square root of the number (n ^ (1/2)
).
Returns a complex number if n < 0
.
Example: 4.sqrt
> 2
.
cbrt
$number.cbrt
Property. Cube root of the number (n ^ (1/3)
).
Example: 8.cbrt
> 2
.
root
$number.root($root: Num)
Mth root of the number N (N ^ (1/M)
).
Returns a complex number if M
is even and N < 0
.
Example: 8.root(3)
> 2
.
Arguments

root: Num  Root. For example,
3
is the cube root.
factorial
$number.factorial()
The number's factorial (n!
). This can also be written n!
because
"calling" a number yields its factorial. Nonintegers are transformed with
.floor
.
Class properties
Inf
Number.Inf
Infinity. Alias Inf
exists in the global context.
NaN
Number.NaN
Not a number. Alias NaN
exists in the global context.
Type interfaces
Even
An interface to which only even numbers conform.
Restraints and transforms
In order to comply, the object must satisfy each of the following conditions.
Odd
An interface to which only odd numbers conform.
Restraints and transforms
In order to comply, the object must satisfy each of the following conditions.
Integer
This interface promises an integer value, returning the .floor
property
of floatingpoint numbers. Alias Int
exists in the global context.
Restraints and transforms
In order to comply, the object must satisfy each of the following conditions.
End of the Number class.
This file was generated automatically by the Ferret compiler from Number.frtdoc.