The racket/flonum library provides operations like
fl+ that consume and produce only
flonums. Flonum-specific operations can provide better
performance when used consistently, and they are as safe as generic
operations like +.
See also Fixnum and Flonum Optimizations in The Racket Guide.
18.104.22.168 Flonum Arithmetic
, but constrained to consume and produce
. The result is +nan.0
when a number outside
the range -1.0
is given to flasin
, or when a negative number is given to fllog
22.214.171.124 Flonum Vectors
A flvector is like a vector, but it holds only
inexact real numbers. This representation can be more compact, and
unsafe operations on flvectors (see
racket/unsafe/ops) can execute more efficiently than
unsafe operations on vectors of inexact reals.
An f64vector as provided by ffi/vector stores the
same kinds of values as a flvector, but with extra
indirections that make f64vectors more convenient for working with
foreign libraries. The lack of indirections makes unsafe
flvector access more efficient.
Two flvectors are equal? if they have the same length,
and if the values in corresponding slots of the flvectors are
is a flvector
Creates a flvector
containing the given inexact real numbers.
Creates a flvector
elements, where every
slot in the flvector
is filled with x
Returns the length of vec
(i.e., the number of slots in the
Returns the inexact real number in slot pos
. The first slot is position 0
, and the last slot
is one less than (flvector-length vec)
Sets the inexact real number in slot pos
first slot is position 0
, and the last slot is one less than
Creates a fresh flvector
of size (- end start)
, with all of the
elements of vec
Returns a sequence equivalent to vec when no optional
arguments are supplied.
The optional arguments start, stop, and
step are as in in-vector.
A in-flvector application can provide better
performance for flvector iteration when it appears directly in a for clause.