doc clarifications on eqv?
Part of the clarification is duplicating information about numbers and character in the documentation of `eqv?`. Since those two type are the only special cases of `eqv?`, the duplication seems helpful and managable.
This commit is contained in:
parent
68c5d3d1d6
commit
e2261096cb
|
@ -66,8 +66,14 @@ values would be equal. See also @racket[gen:equal+hash] and @racket[prop:imperso
|
||||||
Two values are @racket[eqv?] if and only if they are @racket[eq?],
|
Two values are @racket[eqv?] if and only if they are @racket[eq?],
|
||||||
unless otherwise specified for a particular datatype.
|
unless otherwise specified for a particular datatype.
|
||||||
|
|
||||||
The @tech{number} and @tech{character} datatypes are the only ones for which
|
The @tech{number} and @tech{character} datatypes are the only ones for
|
||||||
@racket[eqv?] differs from @racket[eq?].
|
which @racket[eqv?] differs from @racket[eq?]. Two numbers are
|
||||||
|
@racket[eqv?] when they have the same exactness, precision, and are
|
||||||
|
both equal and non-zero, both @racket[+0.0], both @racket[+0.0f0], both
|
||||||
|
@racket[-0.0], both @racket[-0.0f0], both @racket[+nan.0], or both
|
||||||
|
@racket[+nan.f]---considering real and imaginary components separately
|
||||||
|
in the case of @tech{complex numbers}. Two characters are
|
||||||
|
@racket[eqv?] when their @racket[char->integer] results are equal.
|
||||||
|
|
||||||
@examples[
|
@examples[
|
||||||
(eqv? 'yes 'yes)
|
(eqv? 'yes 'yes)
|
||||||
|
|
|
@ -30,14 +30,14 @@ Orthogonal to those categories, each number is also either an
|
||||||
otherwise specified, computations that involve an inexact number
|
otherwise specified, computations that involve an inexact number
|
||||||
produce inexact results. Certain operations on inexact numbers,
|
produce inexact results. Certain operations on inexact numbers,
|
||||||
however, produce an exact number, such as multiplying an inexact
|
however, produce an exact number, such as multiplying an inexact
|
||||||
number with an exact @racket[0]. Some operations, which can produce an
|
number with an exact @racket[0]. Operations that mathematically produce
|
||||||
irrational number for rational arguments (e.g., @racket[sqrt]), may
|
irrational numbers for some rational arguments (e.g., @racket[sqrt]) may
|
||||||
produce inexact results even for exact arguments.
|
produce inexact results even for exact arguments.
|
||||||
|
|
||||||
In the case of complex numbers, either the real and imaginary parts
|
In the case of complex numbers, either the real and imaginary parts
|
||||||
are both exact or inexact, or the number has an exact zero real part
|
are both exact or inexact with the same precision, or the number has
|
||||||
and an inexact imaginary part; a complex number with an exact zero
|
an exact zero real part and an inexact imaginary part; a complex
|
||||||
imaginary part is a real number.
|
number with an exact zero imaginary part is a real number.
|
||||||
|
|
||||||
Inexact real numbers are implemented as either single- or
|
Inexact real numbers are implemented as either single- or
|
||||||
double-precision @as-index{IEEE floating-point numbers}---the latter
|
double-precision @as-index{IEEE floating-point numbers}---the latter
|
||||||
|
@ -46,11 +46,6 @@ numerical constants specified as single-precision numbers. Inexact
|
||||||
real numbers that are represented as double-precision floating-point
|
real numbers that are represented as double-precision floating-point
|
||||||
numbers are @deftech{flonums}.
|
numbers are @deftech{flonums}.
|
||||||
|
|
||||||
The precision and size of exact numbers is limited only by available
|
|
||||||
memory (and the precision of operations that can produce irrational
|
|
||||||
numbers). In particular, adding, multiplying, subtracting, and
|
|
||||||
dividing exact numbers always produces an exact result.
|
|
||||||
|
|
||||||
Inexact numbers can be coerced to exact form, except for the inexact
|
Inexact numbers can be coerced to exact form, except for the inexact
|
||||||
numbers @racket[+inf.0], @racket[+inf.f],
|
numbers @racket[+inf.0], @racket[+inf.f],
|
||||||
@racket[-inf.0], @racket[-inf.f], @racket[+nan.0], and @racket[+nan.f], which
|
@racket[-inf.0], @racket[-inf.f], @racket[+nan.0], and @racket[+nan.f], which
|
||||||
|
@ -73,6 +68,11 @@ cases where IEEE provides no specification,
|
||||||
the result corresponds to the limit approaching
|
the result corresponds to the limit approaching
|
||||||
infinity, or @racket[+nan.0] or @racket[+nan.f] if no such limit exists.
|
infinity, or @racket[+nan.0] or @racket[+nan.f] if no such limit exists.
|
||||||
|
|
||||||
|
The precision and size of exact numbers is limited only by available
|
||||||
|
memory (and the precision of operations that can produce irrational
|
||||||
|
numbers). In particular, adding, multiplying, subtracting, and
|
||||||
|
dividing exact numbers always produces an exact result.
|
||||||
|
|
||||||
A @deftech{fixnum} is an exact integer whose two's complement
|
A @deftech{fixnum} is an exact integer whose two's complement
|
||||||
representation fit into 31 bits on a 32-bit platform or 63 bits on a
|
representation fit into 31 bits on a 32-bit platform or 63 bits on a
|
||||||
64-bit platform; furthermore, no allocation is required when computing
|
64-bit platform; furthermore, no allocation is required when computing
|
||||||
|
@ -84,10 +84,11 @@ applied to two numbers is undefined, except that numbers produced
|
||||||
by the default reader in @racket[read-syntax] mode are @tech{interned} and therefore @racket[eq?]
|
by the default reader in @racket[read-syntax] mode are @tech{interned} and therefore @racket[eq?]
|
||||||
when they are @racket[eqv?].
|
when they are @racket[eqv?].
|
||||||
|
|
||||||
Two numbers are @racket[eqv?] when they are both inexact with the same precision or both
|
Two real numbers are @racket[eqv?] when they are both inexact with the same precision or both
|
||||||
exact, and when they are @racket[=] (except for @racket[+nan.0], @racket[+nan.f],
|
exact, and when they are @racket[=] (except for @racket[+nan.0], @racket[+nan.f],
|
||||||
@racket[+0.0], @racket[+0.0f0], @racket[-0.0], and @racket[-0.0f0], as noted above). Two numbers are
|
@racket[+0.0], @racket[+0.0f0], @racket[-0.0], and @racket[-0.0f0], as noted above).
|
||||||
@racket[equal?] when they are @racket[eqv?].
|
Two complex numbers are @racket[eqv?] when their real and imaginary parts are @racket[eqv?].
|
||||||
|
Two numbers are @racket[equal?] when they are @racket[eqv?].
|
||||||
|
|
||||||
@see-read-print["number"]{numbers}
|
@see-read-print["number"]{numbers}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user