float Class Reference


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.


  • float-*
  • float-+
  • float--
  • float-/
  • float-1+
  • float-1-
  • float-<
  • float-=
  • float->
  • float-abs
  • float-acos
  • float-acosh
  • float-asin
  • float-asinh
  • float-atan
  • float-atanh
  • float-binary
  • float-constructor
  • float-cos
  • float-cosh
  • float-exp
  • float-expt
  • float-finitep
  • float-float
  • float-format
  • float-integer
  • float-isnanp
  • float-log
  • float-max
  • float-min
  • float-minus
  • float-minusp
  • float-random
  • float-round
  • float-sin
  • float-sinh
  • float-sqrt
  • float-string
  • float-tan
  • float-tanh
  • float-unsignedinteger
  • float-zerop

  • List of all Inherited Classes

  • scalar
  • class

  • float-*

    (* arg1 ... argn )

    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

    float-+

    (+ arg1 ... argn )

    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

    float--

    (- arg1 ... argn )

    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

    float-/

    (/ arg1 ... argn )

    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

    float-1+

    (1+ arg )

    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

    float-1-

    (1- arg )

    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

    float-<

    (< arg1 ... argn)

    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

    float-=

    (= arg1 arg2 )

    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

    float->

    (> arg1 ... argn)

    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

    float-abs

    (abs arg )

    Function Type subr
    Arguments a float
    Return Value a float
    Description returns the absolute value of the argument
    Example (abs -1.0) => 1.000000

    float-acos

    (acos arg )

    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

    float-acosh

    (acosh arg )

    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

    float-asin

    (asin arg )

    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

    float-asinh

    (asinh arg )

    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

    float-atan

    (atan arg )

    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

    float-atanh

    (atanh arg )

    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

    float-binary

    (binary arg )

    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)

    float-constructor

    (make-instance float)

    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

    float-cos

    (cos arg )

    Function Type subr
    Arguments a float
    Return Value a float
    Description returns the cosine of the argument
    Example (cos pi) => -1.000000

    float-cosh

    (cosh arg )

    Function Type subr
    Arguments a float
    Return Value a float
    Description returns the hyperbolic cosine of the argument
    Example (cosh 2.0) => 3.762196

    float-exp

    (exp arg )

    Function Type subr
    Arguments a float
    Return Value a float
    Description returns the exponential of the argument
    Example (exp 1.0) => 2.718282

    float-expt

    (expt arg1 arg2 )

    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

    float-finitep

    (finitep arg )

    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

    float-float

    (float arg )

    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)

    float-format

    (format arg )

    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"

    float-integer

    (integer arg )

    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

    float-isnanp

    (isnanp arg )

    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

    float-log

    (log arg )

    Function Type subr
    Arguments a float
    Return Value a float
    Description returns the natural logarithm of the argument
    Example (log e) => 1.000000

    float-max

    (max arg1 ... argn )

    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

    float-min

    (min arg1 ... argn )

    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

    float-minus

    (minus arg )

    Function Type subr
    Arguments a float
    Return Value a float
    Description returns the opposite of the argument
    Example (minus pi) => -3.141593

    float-minusp

    (minusp arg )

    Function Type subr
    Arguments a float
    Return Value t or nil
    Description return t if the argument is negative
    Example (minusp 0) => nil

    float-random

    (random arg )

    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)

    float-round

    (round arg )

    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

    float-sin

    (sin arg )

    Function Type subr
    Arguments a float
    Return Value a float
    Description returns the sine of the argument
    Example (sin 1.0) => 0.841471

    float-sinh

    (sinh arg )

    Function Type subr
    Arguments a float
    Return Value a float
    Description return the hyperbolic sine of the argument
    Example (sinh 1.0) => 1.175201

    float-sqrt

    (sqrt arg )

    Function Type subr
    Arguments a float
    Return Value a float
    Description returns the square root of the argument
    Example (sqrt 2.0) => 1.414214

    float-string

    (string arg )

    Function Type subr
    Arguments a float
    Return Value a string
    Description returns a string with the formatted argument
    Example (string pi) => "3.141593"

    float-tan

    (tan arg )

    Function Type subr
    Arguments a float
    Return Value a float
    Description returns the tangent of the argument
    Example (tan 1.0) => 1.557408

    float-tanh

    (tanh arg )

    Function Type subr
    Arguments a float
    Return Value a float
    Description returns the hyperbolic tangent of the argument
    Example (tanh 1.0) => 0.761594

    float-unsignedinteger

    (unsignedinteger arg )

    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)

    float-zerop

    (zerop arg )

    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

    Updated 29/11/2008 Copyright © 2008 Walther Waeles
    SourceForge.net Logo