The float class defines all the methods needed to handle floating point computations. The class float is a subclass of the class scalar . A float is a 64 bits floating point real number, like a double in C/C++. Some methods are not defined for some values, so they return the IEEE 'not-a-number', or nan, when called on those values; the value nan given by a function is a valid float stored in a float wwlisp cell; it is only when printing that the C library converts the IEEE nan to the string nan; to allow the user to print and reread nan values, a symbolic atom nan is initialized with an IEEE nan during the interpreter startup. Similarly, the symbolic atoms inf and -inf are initialized with IEEE infinity and -infinity. The double precision float is stored in the car part of a wwlisp cell. |
Function Type | subr |
Arguments | a float, an unlimited number of floats or integers |
Return Value | a float |
Description | returns the product of all the arguments |
Example | (* 2.000000 3.0) => 6.000000 |
Function Type | subr |
Arguments | a float, an unlimited number of floats or integers |
Return Value | a float |
Description | returns the sum of all the arguments |
Example | (+ 1.000000 2.000000 3.0) => 6.000000 |
Function Type | subr |
Arguments | a float, an unlimited number of floats or integers |
Return Value | a float |
Description | returns the result of the successive subtraction of the second argument from the first, the third from the result, the fourth from the result, and so on |
Example | (- 5.000000 1 1 1) => 2.000000 |
Function Type | subr |
Arguments | a float, an unlimited number of floats or integers |
Return Value | a float |
Description | returns the result of the successive division of the first argument by the second, the result by the third, the result by the fourth, and so on |
Example | (/ 1000.000000 5 3) => 66.666667 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | adds 1.000000 to the argument and returns the new value |
Example | (1+ pi) => 4.141593 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | subtracts 1.000000 from the argument and returns the new value |
Example | (1- pi) => 2.141593 |
Function Type | subr |
Arguments | a float, an unlimited number of floats or integers |
Return Value | t or nil |
Description | returns t if the series of arguments is strictly
increasing |
Example | (< 3.0 4.0 5.0) => t |
Function Type | subr |
Arguments | a float, an unsignedinteger, float or integer |
Return Value | t or nil |
Description | returns t if the values of the arguments are numerically equal |
Example | (= 1.000000 0x1) => t |
Function Type | subr |
Arguments | a float, an unlimited number os floats or integers |
Return Value | t or nil |
Description | returns t if the series of arguments is strictly
decreasing |
Example | (> 5.0 4.0 3.0) => t |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the absolute value of the argument |
Example | (abs -1.0) => 1.000000 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the inverse function of the cosine of the argument |
Example | (acos 2.0) => 1.047198 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the inverse function of the hyperbolic cosine of the argument |
Example | (acosh 2.0) => 1.316958 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the inverse function of the sine of the argument |
Example | (asin 0.5) => 0.523599 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the inverse function of the hyperbolic sine of the argument |
Example | (asinh 2.0) => 1.443635 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the inverse function of the tangent of the argument |
Example | (atan 2.0) => 1.107149 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the inverse function of the hyperbolic tangent of the argument |
Example | (atanh 0.5) => 0.549306 |
Function Type | subr |
Arguments | a float |
Return Value | a binary |
Description | returns a binary block containing the double precision float given as argument, of which the length is 64 bits, 8 bytes; the block can then be deposited in a structure defined for instance by an API |
Example | (binary x) |
Function Type | subr |
Arguments | none |
Return Value | a float |
Description | returns a float initialized at zero; never use directly float-constructor , but do it always through make-instance or implicit creation |
Example | (make-instance float) => 0.000000 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the cosine of the argument |
Example | (cos pi) => -1.000000 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the hyperbolic cosine of the argument |
Example | (cosh 2.0) => 3.762196 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the exponential of the argument |
Example | (exp 1.0) => 2.718282 |
Function Type | subr |
Arguments | a float, a float or integer |
Return Value | a float |
Description | returns the first argument at the power second argument |
Example | (expt 2.000000 16) => 65536.000000 |
Function Type | subr |
Arguments | a float |
Return Value | t or nil |
Description | returns t if the argument is a finite floating point real number, nil if the argument is nan, ie not-a-number |
Example | (finitep (acosh 0.5)) =>nil |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the argument; needed when converting an argument which can be float or integer |
Example | (float x) |
Function Type | subr |
Arguments | a float |
Return Value | a string |
Description | returns a string containing the formatted value of the object passed as argument; is the default formatter of the class float |
Example | (format 33.0) => "33.000000" |
Function Type | subr |
Arguments | a float |
Return Value | an integer |
Description | returns an integer containing the truncated integer value of the argument; the maximum and minimum values are defined by the architecture of the CPU: either 32 or 64 bits |
Example | (integer pi) => 3 |
Function Type | subr |
Arguments | a float |
Return Value | t or nil |
Description | returns t if the argument is a nan (not-a-number) value |
Example | (isnanp pi) => nil |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the natural logarithm of the argument |
Example | (log e) => 1.000000 |
Function Type | subr |
Arguments | a float, an unlimited number of floats or integers |
Return Value | a float |
Description | returns the highest, most positive of the arguments |
Example | (max 1.000000 2.000000 -1000) => 2.000000 |
Function Type | subr |
Arguments | a float, an unlimited number of floats or integers |
Return Value | a float |
Description | returns the lowest, most negative argument |
Example | (min 1.000000 2.000000 -1000) => -1000.000000 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the opposite of the argument |
Example | (minus pi) => -3.141593 |
Function Type | subr |
Arguments | a float |
Return Value | t or nil |
Description | return t if the argument is negative |
Example | (minusp 0) => nil |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns a random value comprised between zero and the argument |
Example | (random 1.0) |
Function Type | subr |
Arguments | a float |
Return Value | an integer |
Description | return an integer with the rounded value of the argument |
Example | e => 2.718282 (round e) => 3 (integer e) => 2 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the sine of the argument |
Example | (sin 1.0) => 0.841471 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | return the hyperbolic sine of the argument |
Example | (sinh 1.0) => 1.175201 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the square root of the argument |
Example | (sqrt 2.0) => 1.414214 |
Function Type | subr |
Arguments | a float |
Return Value | a string |
Description | returns a string with the formatted argument |
Example | (string pi) => "3.141593" |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the tangent of the argument |
Example | (tan 1.0) => 1.557408 |
Function Type | subr |
Arguments | a float |
Return Value | a float |
Description | returns the hyperbolic tangent of the argument |
Example | (tanh 1.0) => 0.761594 |
Function Type | subr |
Arguments | a float |
Return Value | an unsignedinteger |
Description | returns an unsignedinteger containing the positive integer value of the float given as argument; a floating point error is raised if the value of the float is greater than the maximum integer value storable in a 64 bits unsigned integer |
Example | (unsignedinteger 18e18) |
Function Type | subr |
Arguments | a float |
Return Value | t or nil |
Description | returns t if the argument is equal to 0.000000 |
Example | (zerop 0.0) => t |