The values of the doubles of the model #
The doubles of the model (Ratpoints.Double) are bits, with the operations of the C language and of
the C library on them; the specification gives a double its value in ℚ extended by ⊥ and ⊤
(Ratpoints.doubleValue), which is ±∞ for the largest exponent field and the exact value
Ratpoints.Double.toRat otherwise (Ratpoints.Double.doubleValue_bits,
Ratpoints.Double.doubleValue_eq_toRat). This file proves that the operations do on the values what
the C code relies on: a double that is not a NaN has an order value, its bits without the sign bit,
negated when the sign bit is set (Ratpoints.Double.orderValue), in which its value is strictly
increasing (Ratpoints.Double.strictMonoOn_valueOfOrderValue), so that the comparisons of the C
language are the order of the values (Ratpoints.Double.lt_eq_true_iff,
Ratpoints.Double.le_eq_true_iff, Ratpoints.Double.beq_eq_true_iff) and nextafter steps to the
neighbouring double (Ratpoints.Double.orderValue_nextUp, Ratpoints.Double.nextUp_le_of_lt, and
downwards Ratpoints.Double.orderValue_nextDown, the step upwards of the negation by
Ratpoints.Double.nextDown_eq_neg_nextUp_neg); the negation and fabs act on the sign of the
value; the double that Ratpoints.Double.assemble makes from a significand M and the exponent q
of its last place has the fields of a subnormal, an infinity or a normal double
(Ratpoints.Double.fields_assemble) and, in the range of the finite doubles, the value ±M 2 ^ q
(Ratpoints.Double.toRat_assemble); the double Ratpoints.Double.ofDyadic nearest to ±m 2 ^ e,
which ends with it, is exact when 0 < m < 2 ^ 53, e ≥ -1074 and m 2 ^ e < 2 ^ 1024
(Ratpoints.Double.ofDyadic_exact, where the last hypothesis reads Nat.log2 m + e ≤ 1023); hence
(double)n is exact for |n| ≤ 2 ^ 53 (Ratpoints.Double.ofInt64_exact), ldexp and frexp are
exact in the normal range (Ratpoints.Double.ldexp_exact,
Ratpoints.Double.toRat_frexp_mul_zpow_eq_and_bounds), and the conversions to long and
unsigned long truncate (Ratpoints.Double.toInt_toInt64, Ratpoints.Double.toNat_toUInt64).
Main definitions #
Ratpoints.Double.maxOrderValue,Ratpoints.Double.magnitudeUnits,Ratpoints.Double.orderValueUnits,Ratpoints.Double.valueOfOrderValue: the order value of+∞, and the value of the doubles of an order value.
Main statements #
Ratpoints.Double.doubleValue_eq_valueOfOrderValue,Ratpoints.Double.strictMonoOn_valueOfOrderValue: the value of a double that is not a NaN is that of its order value, strictly increasing in it.Ratpoints.Double.lt_eq_true_iff,Ratpoints.Double.le_eq_true_iff,Ratpoints.Double.beq_eq_true_iff: the comparisons of the C language off NaN.Ratpoints.Double.doubleValue_bits,Ratpoints.Double.doubleValue_eq_toRat: the value of a double by its fields, and that of a finite double.Ratpoints.Double.fields_assemble,Ratpoints.Double.isFinite_assemble_iff,Ratpoints.Double.toRat_assemble: the bits of a significand and an exponent.Ratpoints.Double.ofDyadic_exact,Ratpoints.Double.ofInt64_exact: the exact rounding of a dyadic number and the conversion of along.Ratpoints.Double.ldexp_exact,Ratpoints.Double.toRat_frexp_mul_zpow_eq_and_bounds,Ratpoints.Double.toInt_toInt64,Ratpoints.Double.toNat_toUInt64: the functions of the C library and the conversions.Ratpoints.Double.orderValue_nextUp,Ratpoints.Double.nextUp_le_of_lt,Ratpoints.Double.nextDown_eq_neg_nextUp_neg,Ratpoints.Double.orderValue_nextDown,Ratpoints.Double.le_nextDown_of_lt:nextaftertowards±HUGE_VAL.
The exact value of a finite double #
The value that the specification gives the bits of a double (Ratpoints.doubleValue), by the
fields of the model: ±∞ for the exponent field 2047 and the exact value
Ratpoints.Double.toRat otherwise.
The order of the values #
The order value (Ratpoints.Double.orderValue) of +∞, 2047 · 2 ^ 52, the bits of +∞;
-maxOrderValue is that of -∞.
Equations
- Ratpoints.Double.maxOrderValue = 2047 * 2 ^ 52
Instances For
The value of the nonnegative finite double with the bits a, in units of the least subnormal
2 ^ (-1074): the fraction f for the exponent field 0, and (2 ^ 52 + f) 2 ^ (e - 1) for an
exponent field e ≥ 1.
Equations
Instances For
Ratpoints.Double.magnitudeUnits with the sign of the order value k, the value of the finite
doubles with the order value k in units of 2 ^ (-1074).
Equations
Instances For
The value of the doubles with the order value k (Ratpoints.Double.orderValue), for
|k| ≤ Ratpoints.Double.maxOrderValue: ⊥ at -maxOrderValue, ⊤ at maxOrderValue, and
Ratpoints.Double.orderValueUnits k times 2 ^ (-1074) between.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The magnitude and the operations on the sign bit #
Doubles from their fields #
The assembly of the bits #
The sign bit, the exponent field and the fraction of the double that
Ratpoints.Double.assemble makes from a significand M < 2 ^ 53 and the exponent q of its last
place: those of a subnormal or a zero for M < 2 ^ 52, of an infinity when the exponent field
q + 1075 would reach 2047, and of a normal double otherwise.
The value ±M 2 ^ q of the double that Ratpoints.Double.assemble makes from a significand
M < 2 ^ 53 and the exponent q of its last place in the range of the finite doubles: q = -1074
for a subnormal or a zero (M < 2 ^ 52), and -1074 ≤ q with the exponent field q + 1075 below
2047 for a normal double.
The neighbours #
The conversions #
The value ±|m| 2 ^ (e + k) of a double with the sign of x and the magnitude of
Ratpoints.Double.toDyadic x = (m, e) scaled by 2 ^ k is x 2 ^ k.