Commit f450734
committed
Fix off-by-one error in X87DoubleExtended::from_bits
The standard floating point formats use an implicit bit in the significand.
For example, for a 64-bit floating point value (a 'double'), the significand might be a 53-bit value, stored as 52 bits.
The most significant bit is implicitly assumed to be 1.
The X87 80-bit floating point format does not use an implicit bit. It stores a significand of 64 bits as 64 bits.
The Semantics::PRECISION constant defines the size of the significand including the implicit bit.
So for a 64-bit floating point value, Semantics::PRECISION would be 53 even though only 52 bits are used to store the significand.
The code for the standard floating point formats has to work around this,
by subtracting 1 from PRECISION to compute the correct number of bits.
The code in X87DoubleExtended::from_bits incorrectly also subtracted 1 from PRECISION,
even though no implicit bit is used in this format. Thus computing a size that is off-by-one from the actual size.1 parent f3ab6f0 commit f450734
2 files changed
+45
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3299 | 3299 | | |
3300 | 3300 | | |
3301 | 3301 | | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
| 3331 | + | |
| 3332 | + | |
| 3333 | + | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
0 commit comments