Raymond Toy pushed to branch issue-274-make-float-of-huge-numbers at cmucl / cmucl
Commits:
-
ab7f4ce8
by Raymond Toy at 2024-03-10T12:52:20-07:00
1 changed file:
Changes:
... | ... | @@ -1845,12 +1845,22 @@ the end of the stream." |
1845 | 1845 | (multiple-value-bind (log2-low log2-high)
|
1846 | 1846 | (ecase float-format
|
1847 | 1847 | ((short-float single-float)
|
1848 | - ;; Single-float exponents range is -149 to 127
|
|
1849 | - (values (* 2 -149) (* 2 127)))
|
|
1848 | + ;; Single-float exponents range is -149 to 127, but we
|
|
1849 | + ;; don't need to be super-accurate since we're
|
|
1850 | + ;; multiplying the values by 2.
|
|
1851 | + (values (* 2 (- vm:single-float-normal-exponent-min
|
|
1852 | + vm:single-float-bias
|
|
1853 | + vm:single-float-digits))
|
|
1854 | + (* 2 (- vm:single-float-normal-exponent-max
|
|
1855 | + vm:single-float-bias))))
|
|
1850 | 1856 | ((double-float long-float
|
1851 | 1857 | #+double-double kernel:double-double-float)
|
1852 | - ;; Double-float exponent range is -1074 to -1023
|
|
1853 | - (values (* 2 -1074) (* 2 1023))))
|
|
1858 | + (values (* 2 (- vm:double-float-normal-exponent-min
|
|
1859 | + vm:double-float-bias
|
|
1860 | + vm:double-float-digits))
|
|
1861 | + (* 2 (- vm:double-float-normal-exponent-max
|
|
1862 | + vm:double-float-bias)))))
|
|
1863 | + ;; Double-float exponent range is -1074 to -1023
|
|
1854 | 1864 | (unless (< log2-low log2-num log2-high)
|
1855 | 1865 | ;; The number is definitely too large or too small to fit.
|
1856 | 1866 | ;; Signal an error.
|