IEEE 754 floating-point arithmetic, homed on the Float class.
Literal syntax: 3.14. The generic operators dispatch float operands
through the type ops; mixed operands resolve by the from-relation.
number?Test whether a value is a number (integer or float).
Parameters:
ANY — Value to testReturns: BOOL — True if x is a number
real?Test whether a value is a real number (complex.x narrows this to exclude complexes).
Parameters:
ANY — Value to testReturns: BOOL — True if x is a real number
Float(Float float? x)Test whether a value is a float.
Parameters:
ANY — Value to testReturns: BOOL — True if x is a float
(Float inexact? x)Test whether a value is inexact. Equivalent to float?.
Parameters:
ANY — Value to testReturns: BOOL — True if x is a float
(Float integer? x)Test whether a value is an integer (the pre-float number? predicate).
Parameters:
ANY — Value to testReturns: BOOL — True if x is a native integer
(Float real? x)Test whether a value is a real number (numbers minus complexes).
Parameters:
ANY — Value to testReturns: BOOL — True if x is real
(Float bits->str bits)Render a raw IEEE 754 bit pattern as its decimal string – FFI plumbing; value-level work wants (Float from) / the printer.
Parameters:
INT — IEEE 754 double bit patternReturns: STRING — Decimal string representation
(Float bits->int bits)Truncate a raw IEEE 754 bit pattern to a machine integer – FFI plumbing; value-level work wants (Float ->int).
Parameters:
INT — IEEE 754 double bit patternReturns: INT — Truncated integer value
(Float int->bits n)The IEEE 754 bit pattern of an integer’s double value – FFI plumbing, NOT a float constructor; (Float from) builds instances.
Parameters:
INT — Integer valueReturns: INT — IEEE 754 double bit pattern
(Float str->bits s)The IEEE 754 bit pattern of a decimal string’s double value – FFI plumbing, NOT a parser-to-instance; (Float from) builds instances (the old from-str name claimed FLOAT and returned bits, #66).
Parameters:
STRING — Decimal string to parseReturns: INT — IEEE 754 double bit pattern
(Float from x)Construct a float from any convertible value, through the conversion catalog – the generic value door (was exact->inexact, #357). Raises tag ‘type when nothing converts.
Parameters:
ANY — An exact number (int, bigint, rational), a numeric string, or a float (identity)Returns: FLOAT — Float instance
(Float ->int x)Convert an inexact float to an exact integer by truncation.
Parameters:
FLOAT — Float value (machine ints pass through)Returns: INT — Truncated integer value
(Float + a b)Add two floats (other numerics coerce).
Parameters:
NUMBER — First operandNUMBER — Second operandReturns: FLOAT — Sum
(Float - a b)Subtract two floats (other numerics coerce).
Parameters:
NUMBER — First operandNUMBER — Second operandReturns: FLOAT — Difference
(Float * a b)Multiply two floats (other numerics coerce).
Parameters:
NUMBER — First operandNUMBER — Second operandReturns: FLOAT — Product
(Float / a b)Divide two floats (other numerics coerce).
Parameters:
NUMBER — DividendNUMBER — DivisorReturns: FLOAT — Quotient
(Float < a b)Test whether a is less than b (other numerics coerce).
Parameters:
NUMBER — Left operandNUMBER — Right operandReturns: BOOL — True if a < b
(Float = a b)Test whether a equals b (other numerics coerce).
Parameters:
NUMBER — Left operandNUMBER — Right operandReturns: BOOL — True if a equals b
(Float sin x)Compute the sine of a float.
Parameters:
FLOAT — Angle in radiansReturns: FLOAT — Sine of x
(Float cos x)Compute the cosine of a float.
Parameters:
FLOAT — Angle in radiansReturns: FLOAT — Cosine of x
(Float tan x)Compute the tangent of a float.
Parameters:
FLOAT — Angle in radiansReturns: FLOAT — Tangent of x
(Float sqrt x)Compute the square root of a float.
Parameters:
FLOAT — Non-negative floatReturns: FLOAT — Square root of x
(Float exp x)Compute e raised to a power.
Parameters:
FLOAT — ExponentReturns: FLOAT — e raised to the power x
(Float log x)Compute the natural logarithm of a float.
Parameters:
FLOAT — Positive floatReturns: FLOAT — Natural logarithm of x
(Float abs x)Compute the absolute value of a float.
Parameters:
FLOAT — Float valueReturns: FLOAT — Absolute value of x
(Float floor x)Round a float down to the nearest integer.
Parameters:
FLOAT — Float valueReturns: FLOAT — Largest integer not greater than x
(Float ceil x)Round a float up to the nearest integer.
Parameters:
FLOAT — Float valueReturns: FLOAT — Smallest integer not less than x
(Float round x)Round a float to the nearest integer.
Parameters:
FLOAT — Float valueReturns: FLOAT — Nearest integer, ties away from zero
(Float trunc x)Truncate a float toward zero.
Parameters:
FLOAT — Float valueReturns: FLOAT — Integer part of x
(Float rint x)Round a float to the nearest integer using the current rounding mode.
Parameters:
FLOAT — Float valueReturns: FLOAT — Nearest integer
(Float asin x)Compute the arc sine of a float.
Parameters:
FLOAT — Value in [-1, 1]Returns: FLOAT — Arc sine in radians
(Float acos x)Compute the arc cosine of a float.
Parameters:
FLOAT — Value in [-1, 1]Returns: FLOAT — Arc cosine in radians
(Float atan x)Compute the arc tangent of a float.
Parameters:
FLOAT — Float valueReturns: FLOAT — Arc tangent in radians
(Float pow base exponent)Raise a float to a power.
Parameters:
FLOAT — BaseFLOAT — ExponentReturns: FLOAT — base raised to the power exponent
(Float atan2 y x)Compute the arc tangent of y/x, using signs to determine the quadrant.
Parameters:
FLOAT — Y coordinateFLOAT — X coordinateReturns: FLOAT — Angle in radians
(Float log2 x)Compute the base-2 logarithm of a float.
Parameters:
FLOAT — Positive floatReturns: FLOAT — log2(x)
(Float log10 x)Compute the base-10 logarithm of a float.
Parameters:
FLOAT — Positive floatReturns: FLOAT — log10(x)
(Float hypot x y)Compute sqrt(x^2 + y^2) without intermediate overflow (libm hypot).
Parameters:
FLOAT — First legFLOAT — Second legReturns: FLOAT — The hypotenuse
(Float pi)The circle constant pi, 3.14159265…
Returns: FLOAT — pi
(Float e)Euler’s number e, 2.71828182…
Returns: FLOAT — e
(Float tau)The turn constant tau = 2*pi, 6.28318530…
Returns: FLOAT — tau
(Float nan? x)Is x a float NaN? #f for every non-float (an int is never NaN).
Parameters:
ANY — Value to testReturns: BOOL — #t only for a NaN float
(Float inf? x)Is x a float infinity, either sign? #f for every non-float.
Parameters:
ANY — Value to testReturns: BOOL — #t only for an infinite float
(Float finite? x)Is x a finite number? #t for machine INTs and finite floats; #f for float inf/NaN and for everything else (rational/bigint instances answer through their own classes).
Parameters:
ANY — Value to testReturns: BOOL — #t for machine ints and finite floats