|
10 | 10 |
|
11 | 11 | //! Bit fiddling on positive IEEE 754 floats. Negative numbers aren't and needn't be handled.
|
12 | 12 | //! Normal floating point numbers have a canonical representation as (frac, exp) such that the
|
13 |
| -//! value is 2^exp * (1 + sum(frac[N-i] / 2^i)) where N is the number of bits. Subnormals are |
14 |
| -//! slightly different and weird, but the same principle applies. |
| 13 | +//! value is 2<sup>exp</sup> * (1 + sum(frac[N-i] / 2<sup>i</sup>)) where N is the number of bits. |
| 14 | +//! Subnormals are slightly different and weird, but the same principle applies. |
15 | 15 | //!
|
16 |
| -//! Here, however, we represent them as (sig, k) with f positive, such that the value is f * 2^e. |
17 |
| -//! Besides making the "hidden bit" explicit, this changes the exponent by the so-called |
18 |
| -//! mantissa shift. |
| 16 | +//! Here, however, we represent them as (sig, k) with f positive, such that the value is f * |
| 17 | +//! 2<sup>e</sup>. Besides making the "hidden bit" explicit, this changes the exponent by the |
| 18 | +//! so-called mantissa shift. |
19 | 19 | //!
|
20 | 20 | //! Put another way, normally floats are written as (1) but here they are written as (2):
|
21 | 21 | //!
|
@@ -94,7 +94,8 @@ pub trait RawFloat : Float + Copy + Debug + LowerExp
|
94 | 94 | /// represented, the other code in this module makes sure to never let that happen.
|
95 | 95 | fn from_int(x: u64) -> Self;
|
96 | 96 |
|
97 |
| - /// Get the value 10^e from a pre-computed table. Panics for e >= ceil_log5_of_max_sig(). |
| 97 | + /// Get the value 10<sup>e</sup> from a pre-computed table. Panics for e >= |
| 98 | + /// ceil_log5_of_max_sig(). |
98 | 99 | fn short_fast_pow10(e: usize) -> Self;
|
99 | 100 |
|
100 | 101 | // FIXME Everything that follows should be associated constants, but taking the value of an
|
|
0 commit comments