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.
Changed in version 7.0.0.13 of package base: Allow zero or more arguments for fl+ and fl* and one or more arguments for fl- and fl/ .
Changed in version 7.0.0.13 of package base: Allow one argument, in addition to allowing two or more.
procedure
( fltruncate a)→flonum?
a:flonum?
Using flsingle on the arguments and results of fl+ , fl- , fl* , fl/ , and flsqrt —that is, performing double-precision operations on values representable in single precision and then rounding the result to single precision—is always the same as performing the corresponding single-precision operation [Roux14]. (For other operations, the IEEE floating-point specification does not make enough guarantees to say more about the interaction with flsingle .)
Added in version 7.8.0.7 of package base.
procedure
( flbit-field astartend)→exact-nonnegative-integer?
a:flonum?
1
"b43544f2"
Added in version 8.15.0.3 of package base.
procedure
a:flonum?
procedure
( flreal-part a)→flonum?
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 equal? .
A printed flvector starts with #fl(, optionally with a number between the #fl and (. See Reading Vectors for information on read ing flvectors and Printing Vectors for information on print ing flvectors.
(flvector 2.0 3.0 4.0 5.0)
procedure
( make-flvector size[x])→flvector?
(flvector 3.0 3.0 3.0 3.0)
procedure
vec:flvector?
procedure
( flvector-ref vecpos)→flonum?
vec:flvector?
procedure
( flvector-set! vecposx)→flonum?
vec:flvector?x:flonum?
procedure
( flvector-copy vec[startend])→flvector?
vec:flvector?
procedure
( in-flvector vec[startstopstep])→sequence?
vec:flvector?
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.
syntax
( for/flvector maybe-length(for-clause...)body...)
syntax
( for*/flvector maybe-length(for-clause...)body...)
maybe-length =| #:lengthlength-expr| #:lengthlength-expr#:fillfill-exprlength-expr : exact-nonnegative-integer?fill-expr : flonum?
procedure
( shared-flvector x...)→flvector?
x:flonum?
(flvector 2.0 3.0 4.0 5.0)
procedure
( make-shared-flvector size[x])→flvector?
(flvector 3.0 3.0 3.0 3.0)