- Feb 04, 2008
-
-
rtoy authored
save-and-reload-tos to save and reload the top-of-stack value. This fixes several compiler warnings.
-
- Feb 01, 2008
-
-
rtoy authored
used instead of %sin and friends. Simple tests showed that they gave bad answers (values > 1 or exceptions) for numbers greater than 2^63 (2^62 for tan).
-
rtoy authored
less than 10^(-d) (approximately). Previously, we'd print out m leading digits if the number were 10^(-m) even if d < m. Additional tests: (assert (string= (format nil "~,3F" 0.000001) "0.000"))
-
- Jan 31, 2008
-
-
rtoy authored
-
rtoy authored
whatever dd says. This allows ~G to match what Fortran does, and also defers to ~F to let it decide what to do. The following tests now fail: (assert (string= (format nil "~9,5G" pi) "3.142 ")) (assert (string= (format nil "~12,,,,'%g" 1.2345678d1) "12.34568 ")) The former should be (assert (string= (format nil "~9,5G" pi) "3.1416 ")) and the latter should be removed or changed to (assert (string= (format nil "~12,,,,'%g" 1.2345678d1) "%%%%%%%%%%%%"))
-
rtoy authored
-
- Jan 30, 2008
-
-
rtoy authored
-
rtoy authored
-
rtoy authored
change. No cross-compile needed.
-
rtoy authored
appear to affect any output, but let's be safe when calling format-fixed-aux.
-
rtoy authored
instead, as suggested by Carl.
-
rtoy authored
-
rtoy authored
optimization setting. Needed to compile e_rem_pio2.c and k_rem_pio2.c with -O1. There are aliasing issues with that code.
-
- Jan 29, 2008
-
-
rtoy authored
format-general-aux.
-
rtoy authored
print "+.001e+06" o Major changes for ~g. See the comments in format-general-aux for more details. - ~g will choose ~e more often now, especially for large numbers. - ~g when using ~F as the output format won't overflow if the number has lots of significant digits. - Excessive number of digits has been suppressed. - The original d value is used for ~g, instead of the computed value. Here is the test suite used. All tests passed. (assert (string= (format nil "~9,3,2,0,'%G" 0.0314159) "0.314e-01")) (assert (string= (format nil "~9,3,2,-2,'%@e" 3.14159) "+.003e+03")) (assert (string= (format nil "~6,2,1,'*F" 3.14159) " 31.42")) (assert (string= (format nil "~9,0,6f" 3.14159) " 3141590.")) ;; Make sure a significant digit is printed with the bad choice of ;; scale factor. Width is exceeded. (assert (string= (format nil "~9,4,,-7E" pi) ".00000003d+8")) (assert (string= (format nil "~9,4,,-5E" pi) ".000003d+6")) (assert (string= (format nil "~5,4,,7E" pi) "3141600.d-6")) (assert (string= (format nil "~11,4,,3E" pi) " 314.16d-2")) (assert (string= (format nil "~11,4,,5E" pi) " 31416.d-4")) (assert (string= (format nil "~11,4,,0E" pi) " 0.3142d+1")) (assert (string= (format nil "~9,,,-1E" pi) ".03142d+2")) (assert (string= (format nil "~,,,-2E" pi) "0.003141592653589793d+3")) (assert (string= (format nil "~,,,2E" pi) "31.41592653589793d-1")) (assert (string= (format nil "~E" pi) "3.141592653589793d+0")) (assert (string= (format nil "~9,5,,-1E" pi) ".03142d+2")) (assert (string= (format nil "~11,5,,-1E" pi) " 0.03142d+2")) (assert (string= (format nil "~G" pi) "3.141592653589793 ")) ;; This test exceeds the specified width, unnecessarily. ;;(assert (string= (format nil "~9,5G" pi) "3.1416 ")) (assert (string= (format nil "~9,5G" pi) "3.142 ")) (assert (string= (format nil "|~13,6,2,7E|" pi) "| 3141593.d-06|")) (assert (string= (format nil "~9,3,2,0,'%E" pi) "0.314d+01")) (assert (string= (format nil "~9,0,6f" pi) " 3141593.")) (assert (string= (format nil "~6,2,1,'*F" pi) " 31.42")) (assert (string= (format nil "~6,2,1,'*F" (* 100 pi)) "******")) (assert (string= (format nil "~9,3,2,-2,'%@E" pi) "+.003d+03")) (assert (string= (format nil "~10,3,2,-2,'%@E" pi) "+0.003d+03")) (assert (string= (format nil "~15,3,2,-2,'%,'=@E" pi) "=====+0.003d+03")) (assert (string= (format nil "~9,3,2,-2,'%E" pi) "0.003d+03")) (assert (string= (format nil "~8,3,2,-2,'%@E" pi) "%%%%%%%%")) (assert (string= (format nil "~g" 1e0) "1. ")) ;; This test is one interpration of the spec. We don't use this. ;;(assert (string= (format nil "~g" 1.2d40) "12000000000000000000000000000000000000000. ")) (assert (string= (format nil "~g" 1.2d40) "1.2d+40")) (assert (string= (format nil "~e" 0) "0.0e+0")) (assert (string= (format nil "~e" 0d0) "0.0d+0")) (assert (string= (format nil "~9,,4e" 0d0) "0.0d+0000")) (assert (string= (format nil "~E" 1.234567890123456789d4) "1.2345678901234567d+4")) (assert (string= (format nil "~20E" (expt 2d0 120)) "1.32922799578492d+36")) (assert (string= (format nil "~21,8E" (expt 2d0 120)) " 1.32922800d+36")) (assert (string= (format nil "~9,,,-2E" 1.2345689d3) ".00123d+6")) (assert (string= (format nil "~9,,,-2E" -1.2345689d3) "-.0012d+6")) (assert (string= (format nil "~9,,,-2E" 1.2345689d-3) ".00123d+0")) (assert (string= (format nil "~9,,,-2E" -1.2345689d-3) "-.0012d+0")) ;; Trac ticket #12: (assert (string= (format nil "~10,1,2,0,'*,,'DE" 1d-6) " 0.1D-05")) (assert (string= (format nil "~11f" 1.23456789123456789d-3) ".0012345679")) ;; Don't overflow (assert (string= (format nil "~12,,,,'%g" 1.2345678d1) "12.34568 ")) ;; From CLH 22.3.11 (defun test-f (x) (format nil "~6,2F|~6,2,1,'*F|~6,2,,'?F|~6F|~,2F|~F" x x x x x x)) (assert (string= (test-f 3.14159) " 3.14| 31.42| 3.14|3.1416|3.14|3.14159")) (assert (string= (test-f -3.14159) " -3.14|-31.42| -3.14|-3.142|-3.14|-3.14159" )) (assert (string= (test-f 100.0) "100.00|******|100.00| 100.0|100.00|100.0")) (assert (string= (test-f 1234.0) "1234.00|******|??????|1234.0|1234.00|1234.0")) (assert (string= (test-f 0.006) " 0.01| 0.06| 0.01| 0.006|0.01|0.006")) (defun test-e (x) (format nil "~9,2,1,,'*E|~10,3,2,2,'?,,'$E|~ ~9,3,2,-2,'%@E|~9,2E" x x x x)) (assert (string= (test-e 3.14159) " 3.14e+0| 31.42$-01|+.003e+03| 3.14e+0")) (assert (string= (test-e -3.14159) " -3.14e+0|-31.42$-01|-.003e+03| -3.14e+0")) (assert (string= (test-e 1100.0) " 1.10e+3| 11.00$+02|+.001e+06| 1.10e+3")) (assert (string= (test-e 1100.0d0) " 1.10d+3| 11.00$+02|+.001d+06| 1.10d+3")) (assert (string= (test-e 1.1e13) "*********| 11.00$+12|+.001e+16| 1.10e+13")) (assert (string= (test-e 1.1d120) "*********|??????????|%%%%%%%%%|1.10d+120")) (defun test-g (x) (format nil "~9,2,1,,'*G|~9,3,2,3,'?,,'$G|~9,3,2,0,'%G|~9,2G" x x x x)) (assert (string= (test-g 0.0314159) " 3.14e-2|314.2$-04|0.314e-01| 3.14e-2")) (assert (string= (test-g 0.314159) " 0.31 |0.314 |0.314 | 0.31 ")) (assert (string= (test-g 3.14159) " 3.1 | 3.14 | 3.14 | 3.1 ")) (assert (string= (test-g 31.4159) " 31. | 31.4 | 31.4 | 31. ")) (assert (string= (test-g 314.159) " 3.14e+2| 314. | 314. | 3.14e+2")) (assert (string= (test-g 3141.59) " 3.14e+3|314.2$+01|0.314e+04| 3.14e+3")) (assert (string= (test-g 3141.59d0) " 3.14d+3|314.2$+01|0.314d+04| 3.14d+3")) (assert (string= (test-g 3.14e12) "*********|314.0$+10|0.314e+13| 3.14e+12")) (assert (string= (test-g 3.14d120) "*********|?????????|%%%%%%%%%|3.14d+120")) (defun test-scale (k) (format nil "~&Scale factor ~2D: |~13,6,2,VE|" (- k 5) (- k 5) 3.14159)) (assert (string= (test-scale 0) "Scale factor -5: | 0.000003e+06|")) (assert (string= (test-scale 1) "Scale factor -4: | 0.000031e+05|")) (assert (string= (test-scale 2) "Scale factor -3: | 0.000314e+04|")) (assert (string= (test-scale 3) "Scale factor -2: | 0.003142e+03|")) (assert (string= (test-scale 4) "Scale factor -1: | 0.031416e+02|")) (assert (string= (test-scale 5) "Scale factor 0: | 0.314159e+01|")) (assert (string= (test-scale 6) "Scale factor 1: | 3.141590e+00|")) (assert (string= (test-scale 7) "Scale factor 2: | 31.41590e-01|")) (assert (string= (test-scale 8) "Scale factor 3: | 314.1590e-02|")) (assert (string= (test-scale 9) "Scale factor 4: | 3141.590e-03|")) (assert (string= (test-scale 10) "Scale factor 5: | 31415.90e-04|")) (assert (string= (test-scale 11) "Scale factor 6: | 314159.0e-05|")) (assert (string= (test-scale 12) "Scale factor 7: | 3141590.e-06|"))
-
- Jan 28, 2008
-
-
rtoy authored
double-double-float's.
-
rtoy authored
by Lynn Quam on cmucl-imp, 2008-01-28.
-
rtoy authored
array. The new function returns 2 new output values. code/irrat.lisp: o Rename the original %ieee754-rem-pi/2 to %%ieee754-rem-pi-2. o Define the new %ieee754-rem-pi/2 function. This returns the output as two output values instead of an array. o Use the new function. We should have wrapped the original with without-gcing, but we don't have to anymore. lisp/ppc-arch.c: lisp/x86-arch.c: o Implement the new C interface to __ieee754_rem_pio2 lisp/Config.linux_gencgc: o Use -ffloat-store when compiling e_rem_pio2.c and k_rem_pio2.c, just to be sure.
-
rtoy authored
Here is a test for this: (defun tst (x) (declare (type (unsigned-byte 32) x) (optimize (speed 3) (safety 0))) (* 3f0 (coerce x 'single-float))) (compile 'tst) (tst 33554434) The answer used to be 1.00663304e8, but the correct answer is 1.006633e8, as given on sparc.
-
- Jan 27, 2008
-
-
rtoy authored
to make sure the result is a properly rounded single-float number. This is done by storing the number to memory and reloading it.
-
- Jan 26, 2008
-
-
rtoy authored
"~9,,,-2E" 1.2345689d-3). This change also allows us to get rid of one other call to flonum-to-string, so printing should be faster now. Some additional tests: (assert (string= (format nil "~9,,,-2E" 1.2345689d3) ".00123d+6")) (assert (string= (format nil "~9,,,-2E" -1.2345689d3) "-.0012d+6")) (assert (string= (format nil "~9,,,-2E" 1.2345689d-3) ".00123d+0")) (assert (string= (format nil "~9,,,-2E" -1.2345689d-3) "-.0012d+0"))
-
- Jan 25, 2008
-
-
rtoy authored
o If FMIN is given, print out the digits, even if we're out of room. (This is so ~E will print at least 1 digit due to a bad choice in scale factor.) The following tests all pass. (assert (string= (format nil "~9,3,2,0,'%G" 0.0314159) "0.314e-01")) (assert (string= (format nil "~9,3,2,-2,'%@e" 3.14159) "+.003e+03")) (assert (string= (format nil "~6,2,1,'*F" 3.14159) " 31.42")) (assert (string= (format nil "~9,0,6f" 3.14159) " 3141590.")) (assert (string= (format nil "~9,4,,-7E" pi) ".00000003d+8")) (assert (string= (format nil "~9,4,,-5E" pi) ".000003d+6")) (assert (string= (format nil "~5,4,,7E" pi) "3141600.d-6")) (assert (string= (format nil "~11,4,,3E" pi) " 314.16d-2")) (assert (string= (format nil "~11,4,,5E" pi) " 31416.d-4")) (assert (string= (format nil "~11,4,,0E" pi) " 0.3142d+1")) (assert (string= (format nil "~9,,,-1E" pi) ".03142d+2")) (assert (string= (format nil "~,,,-2E" pi) "0.003141592653589793d+3")) (assert (string= (format nil "~,,,2E" pi) "31.41592653589793d-1")) (assert (string= (format nil "~E" pi) "3.141592653589793d+0")) (assert (string= (format nil "~9,5,,-1E" pi) ".03142d+2")) (assert (string= (format nil "~11,5,,-1E" pi) " 0.03142d+2")) (assert (string= (format nil "~G" pi) "3.141592653589793 ")) (assert (string= (format nil "~9,5G" pi) "3.1416 ")) (assert (string= (format nil "|~13,6,2,7E|" pi) "| 3141593.d-06|")) (assert (string= (format nil "~9,3,2,0,'%E" pi) "0.314d+01")) (assert (string= (format nil "~9,0,6f" pi) " 3141593.")) (assert (string= (format nil "~6,2,1,'*F" pi) " 31.42")) (assert (string= (format nil "~6,2,1,'*F" (* 100 pi)) "******")) (assert (string= (format nil "~9,3,2,-2,'%@E" pi) "+.003d+03")) (assert (string= (format nil "~10,3,2,-2,'%@E" pi) "+0.003d+03")) (assert (string= (format nil "~15,3,2,-2,'%,'=@E" pi) "=====+0.003d+03")) (assert (string= (format nil "~9,3,2,-2,'%E" pi) "0.003d+03")) (assert (string= (format nil "~8,3,2,-2,'%@E" pi) "%%%%%%%%")) (assert (string= (format nil "~g" 1e0) "1. ")) ;(assert (string= (format nil "~g" 1.2d40) "12000000000000000000000000000000000000000. ")) (assert (string= (format nil "~e" 0) "0.0e+0")) (assert (string= (format nil "~e" 0d0) "0.0d+0")) (assert (string= (format nil "~9,,4e" 0d0) "0.0d+0000")) (assert (string= (format nil "~E" 1.234567890123456789d4) "1.2345678901234567d+4")) (assert (string= (format nil "~20E" (expt 2d0 120)) "1.32922799578492d+36")) (assert (string= (format nil "~21,8E" (expt 2d0 120)) " 1.32922800d+36")) (assert (string= (format nil "~11f" 1.23456789123456789d-3) ".0012345679")) ;; From CLH 22.3.11 (defun test-f (x) (format nil "~6,2F|~6,2,1,'*F|~6,2,,'?F|~6F|~,2F|~F" x x x x x x)) (assert (string= (test-f 3.14159) " 3.14| 31.42| 3.14|3.1416|3.14|3.14159")) (assert (string= (test-f -3.14159) " -3.14|-31.42| -3.14|-3.142|-3.14|-3.14159" )) (assert (string= (test-f 100.0) "100.00|******|100.00| 100.0|100.00|100.0")) (assert (string= (test-f 1234.0) "1234.00|******|??????|1234.0|1234.00|1234.0")) (assert (string= (test-f 0.006) " 0.01| 0.06| 0.01| 0.006|0.01|0.006")) (defun test-e (x) (format nil "~9,2,1,,'*E|~10,3,2,2,'?,,'$E|~ ~9,3,2,-2,'%@E|~9,2E" x x x x)) (assert (string= (test-e 3.14159) " 3.14e+0| 31.42$-01|+.003e+03| 3.14e+0")) (assert (string= (test-e -3.14159) " -3.14e+0|-31.42$-01|-.003e+03| -3.14e+0")) (assert (string= (test-e 1100.0) " 1.10e+3| 11.00$+02|+.001e+06| 1.10e+3")) (assert (string= (test-e 1100.0d0) " 1.10d+3| 11.00$+02|+.001d+06| 1.10d+3")) (assert (string= (test-e 1.1e13) "*********| 11.00$+12|+.001e+16| 1.10e+13")) (assert (string= (test-e 1.1d120) "*********|??????????|%%%%%%%%%|1.10d+120")) (defun test-scale (k) (format nil "~&Scale factor ~2D: |~13,6,2,VE|" (- k 5) (- k 5) 3.14159)) (assert (string= (test-scale 0) "Scale factor -5: | 0.000003e+06|")) (assert (string= (test-scale 1) "Scale factor -4: | 0.000031e+05|")) (assert (string= (test-scale 2) "Scale factor -3: | 0.000314e+04|")) (assert (string= (test-scale 3) "Scale factor -2: | 0.003142e+03|")) (assert (string= (test-scale 4) "Scale factor -1: | 0.031416e+02|")) (assert (string= (test-scale 5) "Scale factor 0: | 0.314159e+01|")) (assert (string= (test-scale 6) "Scale factor 1: | 3.141590e+00|")) (assert (string= (test-scale 7) "Scale factor 2: | 31.41590e-01|")) (assert (string= (test-scale 8) "Scale factor 3: | 314.1590e-02|")) (assert (string= (test-scale 9) "Scale factor 4: | 3141.590e-03|")) (assert (string= (test-scale 10) "Scale factor 5: | 31415.90e-04|")) (assert (string= (test-scale 11) "Scale factor 6: | 314159.0e-05|")) (assert (string= (test-scale 12) "Scale factor 7: | 3141590.e-06|"))
-
- Jan 24, 2008
-
-
rtoy authored
printing 1.0d+36. It should have printed far more digits. The previous fixes weren't quite right. We can't just adjust the scale factor with the size of the number. The wrong number of digits gets printed. So FLONUM-TO-STRING takes an extra parameter to indicate the exponent (base 10) of the number. This is used to compensate for the output of FLONUM-TO-DIGITS so that we have the right number of digits. (FLONUM-TO-STRING was assuming FLONUM-TO-DIGITS was called with a scaled number, but we weren't.) print.lisp: o FLONUM-TO-STRING takes extra parameter for the exponent (base 10) of the number---basically what ACCURATE-SCALE-EXPONENT would return. o Add FIXUP-FLONUM-TO-DIGITS to compensate the exponent returned by FLONUM-TO-DIGITS by the exponent of the number. o Some rearrange of the code to get the right number of digits printed under this new scheme. format.lisp: o Keep the exponent of the number and the scaled exponent separate so FLONUM-TO-STRING knows the real exponent. o FORMAT-GENERAL-AUX uses ACCURATE-SCALE-EXPONENT now instead of LISP:SCALE-EXPONENT. With these changes, the following tests all pass: (assert (string= (format nil "~9,3,2,0,'%G" 0.0314159) "0.314e-01")) (assert (string= (format nil "~9,3,2,-2,'%@e" 3.14159) "+.003e+03")) (assert (string= (format nil "~6,2,1,'*F" 3.14159) " 31.42")) (assert (string= (format nil "~9,0,6f" 3.14159) " 3141590.")) (assert (string= (format nil "~9,4,,-7E" pi) ".00000003d+8")) (assert (string= (format nil "~9,4,,-5E" pi) ".000003d+6")) (assert (string= (format nil "~5,4,,7E" pi) "3141600.d-6")) (assert (string= (format nil "~11,4,,3E" pi) " 314.16d-2")) (assert (string= (format nil "~11,4,,5E" pi) " 31416.d-4")) (assert (string= (format nil "~11,4,,0E" pi) " 0.3142d+1")) (assert (string= (format nil "~9,,,-1E" pi) ".03142d+2")) (assert (string= (format nil "~,,,-2E" pi) "0.003141592653589793d+3")) (assert (string= (format nil "~,,,2E" pi) "31.41592653589793d-1")) (assert (string= (format nil "~E" pi) "3.141592653589793d+0")) (assert (string= (format nil "~9,5,,-1E" pi) ".03142d+2")) (assert (string= (format nil "~11,5,,-1E" pi) " 0.03142d+2")) (assert (string= (format nil "~G" pi) "3.141592653589793 ")) (assert (string= (format nil "~9,5G" pi) "3.1416 ")) (assert (string= (format nil "|~13,6,2,7E|" pi) "| 3141593.d-06|")) (assert (string= (format nil "~9,3,2,0,'%E" pi) "0.314d+01")) (assert (string= (format nil "~9,0,6f" pi) " 3141593.")) (assert (string= (format nil "~6,2,1,'*F" pi) " 31.42")) (assert (string= (format nil "~6,2,1,'*F" (* 100 pi)) "******")) (assert (string= (format nil "~9,3,2,-2,'%@E" pi) "+.003d+03")) (assert (string= (format nil "~10,3,2,-2,'%@E" pi) "+0.003d+03")) (assert (string= (format nil "~15,3,2,-2,'%,'=@E" pi) "=====+0.003d+03")) (assert (string= (format nil "~9,3,2,-2,'%E" pi) "0.003d+03")) (assert (string= (format nil "~8,3,2,-2,'%@E" pi) "%%%%%%%%")) (assert (string= (format nil "~g" 1e0) "1. ")) (assert (string= (format nil "~g" 1.2d40) "12000000000000000000000000000000000000000. ")) (assert (string= (format nil "~e" 0) "0.0e+0")) (assert (string= (format nil "~e" 0d0) "0.0d+0")) (assert (string= (format nil "~9,,4e" 0d0) "0.0d+0000")) (assert (string= (format nil "~E" 1.234567890123456789d4) "1.2345678901234567d+4")) (assert (string= (format nil "~20E" (expt 2d0 120)) "1.32922799578492d+36")) (assert (string= (format nil "~21,8E" (expt 2d0 120)) " 1.32922800d+36")) (let (x) (dotimes (k 13 x) (setq x (cons (format nil "~%Scale factor ~2D: |~13,6,2,VE|" (- k 5) (- k 5) 3.14159) x))))
-
- Jan 22, 2008
-
-
rtoy authored
-
rtoy authored
o Make verbatim in a smaller font to get rid of overfull box.
-
rtoy authored
o Fix link.
-
rtoy authored
other uses.
-
rtoy authored
-
rtoy authored
test of 'EQ or 'EQL.
-
rtoy authored
about extended floats. o Add reference in float section to extended floats section. o Make extended floats its own section separate from floats.
-
rtoy authored
-
rtoy authored
-
- Jan 18, 2008
-
-
rtoy authored
o Remove the part about precision control since this no longer exists.
-
rtoy authored
-
rtoy authored
o Change MAX-BITS to #xffffffff. This fixes (works around) the issue reported by Walter Pelissero, reported on cmucl-help, 2008-01-09. We will still have problems for sufficiently long strings. boot-2007-12-1.lisp: o Boot file to use for the above change.
-
rtoy authored
Config.linux_gencgc. This only appears to be an issue on Linux. FreeBSD and Darwin are ok. And it depends on the compiler. gcc 4.2.1 produces bad results, but gcc 3.4.6 is ok. Could be an aliasing issue. So use -O1 everywhere. -ffloat-store doesn't appear to matter so remove that too.
-
rtoy authored
platforms that need them. This is to make sure double-float precision is used throughout instead of extended precision, which will cause bad answers. Linux also appears to need -O1 instead of -O2, so use -O1 everywhere. (Should this be changed?)
-
- Jan 17, 2008
-
-
rtoy authored
sigcontext. This is a workaround for an issue on x86/darwin where loading of the control word enabling the invalid operation exception would cause that exception because the status word had that exception. Not sure why this is needed or why the invalid operation exception was set. It was happening in a call run-program while concatenating the files for the hemlock library.
-
- Jan 09, 2008
-
-
rtoy authored
some warnings.
-
- Jan 03, 2008
-
-
rtoy authored
-