4.3.5 Extflonums

► |  | The Racket Reference

1 | Language Model
2 | Notation for Documentation
3 | Syntactic Forms
4 | Datatypes
5 | Structures
6 | Classes and Objects
7 | Units
8 | Contracts
9 | Pattern Matching
10 | Control Flow
11 | Concurrency and Parallelism
12 | Macros
13 | Input and Output
14 | Reflection and Security
15 | Operating System
16 | Memory Management
17 | Unsafe Operations
18 | Running Racket
| Bibliography
| Index

► | 4 | Datatypes

4.1 | Equality
4.2 | Booleans
4.3 | Numbers
4.4 | Strings
4.5 | Byte Strings
4.6 | Characters
4.7 | Symbols
4.8 | Regular Expressions
4.9 | Keywords
4.10 | Pairs and Lists
4.11 | Mutable Pairs and Lists
4.12 | Vectors
4.13 | Stencil Vectors
4.14 | Boxes
4.15 | Hash Tables
4.16 | Treelists
4.17 | Sequences and Streams
4.18 | Dictionaries
4.19 | Sets
4.20 | Procedures
4.21 | Void
4.22 | Undefined

▼ | 4.3 | Numbers

4.3.1 | Number Types
4.3.2 | Generic Numerics
4.3.3 | Flonums
4.3.4 | Fixnums
4.3.5 | Extflonums

► | 4.3.5 | Extflonums

4.3.5.1 | Extflonum Arithmetic
4.3.5.2 | Extflonum Constants
4.3.5.3 | Extflonum Vectors
4.3.5.4 | Extflonum Byte Strings

On this page:

extflonum?
extflonum-available?
4.3.5.1 Extflonum Arithmetic
extfl+
extfl-
extfl*
extfl/
extflabs
extfl=
extfl<
extfl>
extfl<=
extfl>=
extflmin
extflmax
extflround
extflfloor
extflceiling
extfltruncate
extflsin
extflcos
extfltan
extflasin
extflacos
extflatan
extfllog
extflexp
extflsqrt
extflexpt
->extfl
extfl->exact-integer
real->extfl
extfl->exact
extfl->fx
fx->extfl
extfl->inexact
4.3.5.2 Extflonum Constants
pi.t
4.3.5.3 Extflonum Vectors
extflvector?
extflvector
make-extflvector
extflvector-length
extflvector-ref
extflvector-set!
extflvector-copy
in-extflvector
for/ extflvector
for*/ extflvector
shared-extflvector
make-shared-extflvector
4.3.5.4 Extflonum Byte Strings
floating-point-bytes->extfl
extfl->floating-point-bytes

Racket
top contents ← prev up next →

#### 4.3.5 Extflonums🔗ℹ

(require racket/extflonum) | package: base

An extflonum is an extended-precision (80-bit) floating-point number. Extflonum arithmetic is supported on platforms with extended-precision hardware and where the extflonum implementation does not conflict with normal double-precision arithmetic (i.e., on x86 and x86_64 platforms when Racket is compiled to use SSE instructions for floating-point operations, and on Windows when "longdouble.dll" is available).

A extflonum is not a number in the sense of number?. Only extflonum-specific operations such as extfl+ perform extflonum arithmetic.

A literal extflonum is written like an inexact number, but using an explicit t or T exponent marker (see Reading Extflonums). For example, 3.5t0 is an extflonum. The extflonum values for infinity are +inf.t and -inf.t. The extflonum value for not-a-number is +nan.t or -nan.t.

If (extflonum-available?) produces #f, then all operations exported by racket/extflonum raise exn:fail:unsupported, except for extflonum?, extflonum-available?, and extflvector? (which always work). The reader (see The Reader) always accepts extflonum input; when extflonum operations are not supported, printing an extflonum from the reader uses its source notation (as opposed to normalizing the format).

Two extflonums are equal? along the same lines as flonums: when they are extfl= and have the same sign (which matters for -0.0t0 and +0.0t0), or when they are both +nan.t. If extflonums are not supported on a platform, extflonums are equal? only if they are eq?.

> procedure (extflonum? v) → boolean?
> v : any/c

Returns #t if v is an extflonum, #f otherwise.

> procedure (extflonum-available?) → boolean?

Returns #t if extflonum operations are supported on the current platform, #f otherwise.

##### 4.3.5.1 Extflonum Arithmetic🔗ℹ

> procedure (extfl+ a b) → extflonum?
> a : extflonum?
> b : extflonum?
> procedure (extfl- a b) → extflonum?
> a : extflonum?
> b : extflonum?
> procedure (extfl* a b) → extflonum?
> a : extflonum?
> b : extflonum?
> procedure (extfl/ a b) → extflonum?
> a : extflonum?
> b : extflonum?
> procedure (extflabs a) → extflonum?
> a : extflonum?

Like fl+, fl-, fl*, fl/, and flabs, but for extflonums.

> procedure (extfl= a b) → boolean?
> a : extflonum?
> b : extflonum?
> procedure (extfl< a b) → boolean?
> a : extflonum?
> b : extflonum?
> procedure (extfl> a b) → boolean?
> a : extflonum?
> b : extflonum?
> procedure (extfl<= a b) → boolean?
> a : extflonum?
> b : extflonum?
> procedure (extfl>= a b) → boolean?
> a : extflonum?
> b : extflonum?
> procedure (extflmin a b) → extflonum?
> a : extflonum?
> b : extflonum?
> procedure (extflmax a b) → extflonum?
> a : extflonum?
> b : extflonum?

Like fl=, fl<, fl>, fl<=, fl>=, flmin, and flmax, but for extflonums.

> procedure (extflround a) → extflonum?
> a : extflonum?
> procedure (extflfloor a) → extflonum?
> a : extflonum?
> procedure (extflceiling a) → extflonum?
> a : extflonum?
> procedure (extfltruncate a) → extflonum?
> a : extflonum?

Like flround, flfloor, flceiling, and fltruncate, but for extflonums.

> procedure (extflsin a) → extflonum?
> a : extflonum?
> procedure (extflcos a) → extflonum?
> a : extflonum?
> procedure (extfltan a) → extflonum?
> a : extflonum?
> procedure (extflasin a) → extflonum?
> a : extflonum?
> procedure (extflacos a) → extflonum?
> a : extflonum?
> procedure (extflatan a) → extflonum?
> a : extflonum?
> procedure (extfllog a) → extflonum?
> a : extflonum?
> procedure (extflexp a) → extflonum?
> a : extflonum?
> procedure (extflsqrt a) → extflonum?
> a : extflonum?
> procedure (extflexpt a b) → extflonum?
> a : extflonum?
> b : extflonum?

Like flsin, flcos, fltan, flasin, flacos, flatan, fllog, flexp, and flsqrt, and flexpt, but for extflonums.

> procedure (->extfl a) → extflonum?
> a : exact-integer?
> procedure (extfl->exact-integer a) → exact-integer?
> a : extflonum?
> procedure (real->extfl a) → extflonum?
> a : real?
> procedure (extfl->exact a) → (and/c real? exact?)
> a : extflonum?
> procedure (extfl->fx a) → fixnum?
> a : extflonum?
> procedure (fx->extfl a) → extflonum?
> a : fixnum?
> procedure (extfl->inexact a) → flonum?
> a : extflonum?

The first six are like ->fl, fl->exact-integer, real->double-flonum, inexact->exact, fl->fx, and fx->fl, but for extflonums. The extfl->inexact function converts a extflonum to its closest flonum approximation.

Changed in version 7.7.0.8 of package base: Changed extfl->fx to truncate.

##### 4.3.5.2 Extflonum Constants🔗ℹ

> value pi.t : extflonum?

Like pi, but with 80 bits precision.

##### 4.3.5.3 Extflonum Vectors🔗ℹ

An extflvector is like an flvector, but it holds only extflonums. See also Unsafe Extflonum Operations.

Two extflvectors are equal? if they have the same length, and if the values in corresponding slots of the extflvectors are equal?.

> procedure (extflvector? v) → boolean?
> v : any/c
> procedure (extflvector x ...) → extflvector?
> x : extflonum?
> procedure (make-extflvector size [x]) → extflvector?
> size : exact-nonnegative-integer?
> x : extflonum? = 0.0t0
> procedure (extflvector-length vec) → exact-nonnegative-integer?
> vec : extflvector?
> procedure (extflvector-ref vec pos) → extflonum?
> vec : extflvector?
> pos : exact-nonnegative-integer?
> procedure (extflvector-set! vec pos x) → extflonum?
> vec : extflvector?
> pos : exact-nonnegative-integer?
> x : extflonum?
> procedure (extflvector-copy vec [start end]) → extflvector?
> vec : extflvector?
> start : exact-nonnegative-integer? = 0
> end : exact-nonnegative-integer? = (vector-length v)

Like flvector?, flvector, make-flvector, flvector-length, flvector-ref, flvector-set, and flvector-copy, but for extflvectors.

> procedure (in-extflvector vec [start stop step]) → sequence?
> vec : extflvector?
> start : exact-nonnegative-integer? = 0
> stop : (or/c exact-integer? #f) = #f
> step : (and/c exact-integer? (not/c zero?)) = 1
> syntax (for/extflvector maybe-length (for-clause ...) body ...)
> syntax (for*/extflvector maybe-length (for-clause ...) body ...)
> maybe-length |  | = |  |
> |  | | |  | #:length length-expr
> |  | | |  | #:length length-expr #:fill fill-expr
> > | length-expr |  | : |  | exact-nonnegative-integer?
> > | fill-expr |  | : |  | extflonum?

Like in-flvector, for/flvector, and for*/flvector, but for extflvectors.

> procedure (shared-extflvector x ...) → extflvector?
> x : extflonum?
> procedure (make-shared-extflvector size [x]) → extflvector?
> size : exact-nonnegative-integer?
> x : extflonum? = 0.0t0

Like shared-flvector and make-shared-flvector, but for extflvectors.

##### 4.3.5.4 Extflonum Byte Strings🔗ℹ

> > procedure
> > (floating-point-bytes->extfl |  | bstr |  |  |  |
> > | [ | big-endian? |  |  |  |
> > |  | start |  |  |  |
> > |  | end]) |  | → |  | extflonum?
> bstr : bytes?
> big-endian? : any/c = (system-big-endian?)
> start : exact-nonnegative-integer? = 0
> end : exact-nonnegative-integer? = (bytes-length bstr)

Like floating-point-bytes->real, but for extflonums: Converts the extended-precision floating-point number encoded in bstr from position start (inclusive) to end (exclusive) to an extflonum. The difference between start an end must be 10 bytes.

> > procedure
> > (extfl->floating-point-bytes |  | x |  |  |  |
> > | [ | big-endian? |  |  |  |
> > |  | dest-bstr |  |  |  |
> > |  | start]) |  | → |  | bytes?
> x : extflonum?
> big-endian? : any/c = (system-big-endian?)
> | dest-bstr |  | : |  | (and/c bytes? (not/c immutable?))
> |  |  | = |  | (make-bytes 10)
> start : exact-nonnegative-integer? = 0

Like real->floating-point-bytes, but for extflonums: Converts x to its representation in a byte string of length 10.
top contents ← prev up next →