(doc-group number «Operations on numbers, mathematical constants.»)(defdoc +most-positive-fixnum+ «A constant integer closest to positive infinity that can be represented by fixnum type on this particular platform.» :doc-group number :doc-see +most-negative-fixnum+)(defdoc +most-negative-fixnum+ «A constant integer closest to negative infinity that can be represented by fixnum type on this particular platform.» :doc-group number :doc-see +most-positive-fixnum+)(defdoc +f32-epsilon+ «A smallest positive floating point number such that `(+ 1.0f +f32-epsilon+)` is not equal to `1.0f`.» :doc-group number :doc-see +f64-epsilon)(defdoc +f64-epsilon+ «A smallest positive floating point number such that `(+ 1.0 +f64-epsilon+)` is not equal to `1.0`.» :doc-group number :doc-see +f32-epsilon)(defdoc (fixnum (n 0)) «Construct a fixnum.» :doc-group number :doc-see fixnum?)(defdoc (u8 (n 0)) «Construct a 8-bit unsigned number.» :doc-group number :doc-see s8)(defdoc (s8 (n 0)) «Construct a 8-bit signed number.» :doc-group number :doc-see u8)(defdoc (u16 (n 0)) «Construct a 16-bit unsigned number.» :doc-group number :doc-see s16)(defdoc (s16 (n 0)) «Construct a 16-bit signed number.» :doc-group number :doc-see u16)(defdoc (u32 (n 0)) «Construct a 32-bit unsigned number.» :doc-group number :doc-see s32)(defdoc (s32 (n 0)) «Construct a 32-bit signed number.» :doc-group number :doc-see u32)(defdoc (u64 (n 0)) «Construct a 64-bit unsigned number.» :doc-group number :doc-see s64)(defdoc (s64 (n 0)) «Construct a 64-bit signed number.» :doc-group number :doc-see u64)(defdoc (f32 (n 0.0)) «Construct a 32-bit floating point number.» :doc-group number :doc-see f64)(defdoc (f64 (n 0.0)) «Construct a 64-bit floating point number.» :doc-group number :doc-see f32)(defdoc (p32 (n 0)) «Construct a 32-bit abstract pointer value.» :doc-group number :doc-see p64 :doc-see ptr)(defdoc (p64 (n 0)) «Construct a 64-bit abstract pointer value.» :doc-group number :doc-see p32 :doc-see ptr)(defdoc (ptr (n 0)) «Construct an abstract pointer value. The bit width is either 32-bit or 64-bit, depending on the platform the code is executing on. Note: certain arithmetic operations on pointers, such as division and multiplication, will throw an error. This is done on purpose since doing that on pointers rarely makes sense.» :doc-group number :doc-see p32 :doc-see p64 :doc-see ptr?)(defdoc (bignum (n 0)) «Construct a bignum. As opposed to a fixnum, its value is not limited.» :doc-group number :doc-see bignum?)(defdoc (floor x) «Return the largest integer that is less than or equal to `x`. Infinity and NaN `floor` to themselves.» :doc-example «(floor 1.2) ; ↳ 1.0» :doc-example «(floor -1.2) ; ↳ -2.0» :doc-example «(floor -5) ; ↳ -5.0» :doc-group number :doc-see ceiling)(defdoc (ceiling x) «Return the smallest integer that is greater than or equal to `x`. Infinity and NaN `ceiling` to themselves.» :doc-example «(ceiling 1.2) ; ↳ 2.0» :doc-example «(ceiling -1.2) ; ↳ -1.0» :doc-example «(ceiling -5) ; ↳ -5.0» :doc-group number :doc-see floor)(defdoc (ash int nbits) «Return the integer shifted by the specified number of bits to the right (negative `nbits`) or left (positive `nbits`).» :doc-example «(ash -3 3) ; ↳ -24» :doc-example «(ash 1 3) ; ↳ 8» :doc-group number)(defdoc (lognot int) «Return the result of bitwise NOT (complement) operation on an integer.» :doc-example «(lognot 0) ; ↳ -1» :doc-example «(lognot #s8(63)) ; ↳ #s8(-64)» :doc-example «(lognot #u16(32767)) ; ↳ #u16(32768)» :doc-group number)(defdoc (logior . ints) «Return the result of bitwise OR (inclusive OR) operation on integers.» :doc-example «(logior) ; ↳ 0» :doc-example «(logior 2) ; ↳ 2» :doc-example «(logior 2 3) ; ↳ 3» :doc-example «(logior 2 3 4) ; ↳ 7» :doc-group number)(defdoc (logand . ints) «Return the result of bitwise AND operation on integers.» :doc-example «(logand) ; ↳ 0» :doc-example «(logand 2) ; ↳ 2» :doc-example «(logand 2 3) ; ↳ 2» :doc-example «(logand 2 3 4) ; ↳ 0» :doc-group number)(defdoc (logxor . ints) «Return the result of bitwise XOR (exclusive OR) operation on integers.» :doc-example «(logxor) ; ↳ 0» :doc-example «(logxor 2) ; ↳ 2» :doc-example «(logxor 2 3) ; ↳ 1» :doc-example «(logxor 2 3 4) ; ↳ 5» :doc-group number)(defdoc +pi+ «Mathematical constant π.» :doc-group number)(defdoc (acos x) «Return the arc cosine of `x` in radians.» :doc-group number)(defdoc (asin x) «Return the arc sine of `x` in radians.» :doc-group number)(defdoc (atan x) «Return the arc tangent of `x` in radians.» :doc-group number)(defdoc (atan y x) «Return the arc tangent of `y/x` in radians.» :doc-group number)(defdoc (cos r) «Return the cosine of `r`, where `r` is given in radians.» :doc-group number)(defdoc (sin r) «Return the sine of `r`, where `r` is given in radians.» :doc-group number)(defdoc (tan r) «Return the tangent of `r`, where `r` is given in radians.» :doc-group number)(defdoc (cosh x) «Return the hyperbolic cosine of `x`.» :doc-group number)(defdoc (sinh r) «Return the hyperbolic sine of `x`.» :doc-group number)(defdoc (tanh r) «Return the hyperbolic tangent of `x`.» :doc-group number)(defdoc (sqrt x) «Return the square root of `x`.» :doc-example «(sqrt 9.0) ; ↳ 3.0» :doc-group number)(defdoc (exp p) «Return the exponential - value of `e` (natural logarithms base) raised to the power of `p`.» :doc-example «(exp 1) ; ↳ 2.71828… ; e» :doc-group number)(defdoc (expt x p) «Return the value of `x` raised to the power of `p`.» :doc-example «(expt 3 3) ; cube of 3 ; ↳ 27» :doc-example «(expt 27 (/ 1 3)) ; cube root of 27 ; ↳ 3» :doc-group number)(defdoc (log x (base (exp 1))) «Return the logarithm of `x` in `base`. Default base is `e`, returning natural logarithm of the first argument.» :doc-example «(log 100 10) ; ↳ 2.0» :doc-example «(log 256 2) ; ↳ 8.0» :doc-example «(log (exp 4)) ; ↳ 4.0» :doc-group number)(defdoc (truncate x) «Return the integer value of `x` rounded toward zero. If `x` is already an integer (or infinite, or NaN), result is `x`.» :doc-example «(truncate -123.45) ; ↳ -123» :doc-example «(truncate 299.9) ; ↳ 299» :doc-group number)(defdoc (int-valued? x) «Return `T` if `x` is a number and is equal (as in `=`) to an integer value of `x`.» :doc-example «(int-valued? -123.0) ; ↳ T» :doc-example «(int-valued? -123.1) ; ↳ NIL» :doc-group number :doc-see int?)
(doc-group number
«Operations on numbers, mathematical constants.»)
(defdoc +most-positive-fixnum+
«A constant integer closest to positive infinity that can be
represented by fixnum type on this particular platform.»
:doc-group number
:doc-see +most-negative-fixnum+)
(defdoc +most-negative-fixnum+
«A constant integer closest to negative infinity that can be
represented by fixnum type on this particular platform.»
:doc-group number
:doc-see +most-positive-fixnum+)
(defdoc +f32-epsilon+
«A smallest positive floating point number such that
`(+ 1.0f +f32-epsilon+)` is not equal to `1.0f`.»
:doc-group number
:doc-see +f64-epsilon)
(defdoc +f64-epsilon+
«A smallest positive floating point number such that
`(+ 1.0 +f64-epsilon+)` is not equal to `1.0`.»
:doc-group number
:doc-see +f32-epsilon)
(defdoc (fixnum (n 0))
«Construct a fixnum.»
:doc-group number
:doc-see fixnum?)
(defdoc (u8 (n 0))
«Construct a 8-bit unsigned number.»
:doc-group number
:doc-see s8)
(defdoc (s8 (n 0))
«Construct a 8-bit signed number.»
:doc-group number
:doc-see u8)
(defdoc (u16 (n 0))
«Construct a 16-bit unsigned number.»
:doc-group number
:doc-see s16)
(defdoc (s16 (n 0))
«Construct a 16-bit signed number.»
:doc-group number
:doc-see u16)
(defdoc (u32 (n 0))
«Construct a 32-bit unsigned number.»
:doc-group number
:doc-see s32)
(defdoc (s32 (n 0))
«Construct a 32-bit signed number.»
:doc-group number
:doc-see u32)
(defdoc (u64 (n 0))
«Construct a 64-bit unsigned number.»
:doc-group number
:doc-see s64)
(defdoc (s64 (n 0))
«Construct a 64-bit signed number.»
:doc-group number
:doc-see u64)
(defdoc (f32 (n 0.0))
«Construct a 32-bit floating point number.»
:doc-group number
:doc-see f64)
(defdoc (f64 (n 0.0))
«Construct a 64-bit floating point number.»
:doc-group number
:doc-see f32)
(defdoc (p32 (n 0))
«Construct a 32-bit abstract pointer value.»
:doc-group number
:doc-see p64
:doc-see ptr)
(defdoc (p64 (n 0))
«Construct a 64-bit abstract pointer value.»
:doc-group number
:doc-see p32
:doc-see ptr)
(defdoc (ptr (n 0))
«Construct an abstract pointer value. The bit width is either 32-bit
or 64-bit, depending on the platform the code is executing on.
Note: certain arithmetic operations on pointers, such as division and
multiplication, will throw an error. This is done on purpose since
doing that on pointers rarely makes sense.»
:doc-group number
:doc-see p32
:doc-see p64
:doc-see ptr?)
(defdoc (bignum (n 0))
«Construct a bignum. As opposed to a fixnum, its value is not limited.»
:doc-group number
:doc-see bignum?)
(defdoc (floor x)
«Return the largest integer that is less than or equal to `x`.
Infinity and NaN `floor` to themselves.»
:doc-example
«(floor 1.2)
; ↳ 1.0»
:doc-example
«(floor -1.2)
; ↳ -2.0»
:doc-example
«(floor -5)
; ↳ -5.0»
:doc-group number
:doc-see ceiling)
(defdoc (ceiling x)
«Return the smallest integer that is greater than or equal to `x`.
Infinity and NaN `ceiling` to themselves.»
:doc-example
«(ceiling 1.2)
; ↳ 2.0»
:doc-example
«(ceiling -1.2)
; ↳ -1.0»
:doc-example
«(ceiling -5)
; ↳ -5.0»
:doc-group number
:doc-see floor)
(defdoc (ash int nbits)
«Return the integer shifted by the specified number of bits to the
right (negative `nbits`) or left (positive `nbits`).»
:doc-example
«(ash -3 3)
; ↳ -24»
:doc-example
«(ash 1 3)
; ↳ 8»
:doc-group number)
(defdoc (lognot int)
«Return the result of bitwise NOT (complement) operation on an integer.»
:doc-example
«(lognot 0)
; ↳ -1»
:doc-example
«(lognot #s8(63))
; ↳ #s8(-64)»
:doc-example
«(lognot #u16(32767))
; ↳ #u16(32768)»
:doc-group number)
(defdoc (logior . ints)
«Return the result of bitwise OR (inclusive OR) operation on integers.»
:doc-example
«(logior)
; ↳ 0»
:doc-example
«(logior 2)
; ↳ 2»
:doc-example
«(logior 2 3)
; ↳ 3»
:doc-example
«(logior 2 3 4)
; ↳ 7»
:doc-group number)
(defdoc (logand . ints)
«Return the result of bitwise AND operation on integers.»
:doc-example
«(logand)
; ↳ 0»
:doc-example
«(logand 2)
; ↳ 2»
:doc-example
«(logand 2 3)
; ↳ 2»
:doc-example
«(logand 2 3 4)
; ↳ 0»
:doc-group number)
(defdoc (logxor . ints)
«Return the result of bitwise XOR (exclusive OR) operation on integers.»
:doc-example
«(logxor)
; ↳ 0»
:doc-example
«(logxor 2)
; ↳ 2»
:doc-example
«(logxor 2 3)
; ↳ 1»
:doc-example
«(logxor 2 3 4)
; ↳ 5»
:doc-group number)
(defdoc +pi+
«Mathematical constant π.»
:doc-group number)
(defdoc (acos x)
«Return the arc cosine of `x` in radians.»
:doc-group number)
(defdoc (asin x)
«Return the arc sine of `x` in radians.»
:doc-group number)
(defdoc (atan x)
«Return the arc tangent of `x` in radians.»
:doc-group number)
(defdoc (atan y x)
«Return the arc tangent of `y/x` in radians.»
:doc-group number)
(defdoc (cos r)
«Return the cosine of `r`, where `r` is given in radians.»
:doc-group number)
(defdoc (sin r)
«Return the sine of `r`, where `r` is given in radians.»
:doc-group number)
(defdoc (tan r)
«Return the tangent of `r`, where `r` is given in radians.»
:doc-group number)
(defdoc (cosh x)
«Return the hyperbolic cosine of `x`.»
:doc-group number)
(defdoc (sinh r)
«Return the hyperbolic sine of `x`.»
:doc-group number)
(defdoc (tanh r)
«Return the hyperbolic tangent of `x`.»
:doc-group number)
(defdoc (sqrt x)
«Return the square root of `x`.»
:doc-example
«(sqrt 9.0)
; ↳ 3.0»
:doc-group number)
(defdoc (exp p)
«Return the exponential - value of `e` (natural logarithms base) raised
to the power of `p`.»
:doc-example
«(exp 1)
; ↳ 2.71828… ; e»
:doc-group number)
(defdoc (expt x p)
«Return the value of `x` raised to the power of `p`.»
:doc-example
«(expt 3 3) ; cube of 3
; ↳ 27»
:doc-example
«(expt 27 (/ 1 3)) ; cube root of 27
; ↳ 3»
:doc-group number)
(defdoc (log x (base (exp 1)))
«Return the logarithm of `x` in `base`.
Default base is `e`, returning natural logarithm of the first
argument.»
:doc-example
«(log 100 10)
; ↳ 2.0»
:doc-example
«(log 256 2)
; ↳ 8.0»
:doc-example
«(log (exp 4))
; ↳ 4.0»
:doc-group number)
(defdoc (truncate x)
«Return the integer value of `x` rounded toward zero.
If `x` is already an integer (or infinite, or NaN), result is `x`.»
:doc-example
«(truncate -123.45)
; ↳ -123»
:doc-example
«(truncate 299.9)
; ↳ 299»
:doc-group number)
(defdoc (int-valued? x)
«Return `T` if `x` is a number and is equal (as in `=`) to an
integer value of `x`.»
:doc-example
«(int-valued? -123.0)
; ↳ T»
:doc-example
«(int-valued? -123.1)
; ↳ NIL»
:doc-group number
:doc-see int?)