1
0
mirror of synced 2026-05-05 07:34:31 +00:00
Files
Interlisp.medley/internal/test/LANGUAGE/AUTO/FP-PRINT-REGRESSION.TEST

29 lines
1.1 KiB
Plaintext

;;; Regression test for floating-point printing
;;; Basically checks accuracy of normal numbers
;;; and whether extreme numbers print at all
;;; (denormalized numbers can't have read-print consistency)
(do-test "fp-accuracy"
(and (string= (write-to-string 1.2345678) "1.2345678")
(string= (write-to-string -1.2345678) "-1.2345678")
(string= (write-to-string 6.02e23) "6.02E+23")
(string= (write-to-string 654.32) "654.32")
))
(do-test "fp-extremity"
(and (ignore-errors (write-to-string il:max.float))
(ignore-errors (write-to-string il:min.float))
(ignore-errors (write-to-string 3e-40)) ; denormalized #
(ignore-errors (write-to-string -5e-45))
))
;;; AR 7427 test: IL:FLTSTR was losing when it had to round a number to zero
;;; decimal places.
(do-test "fp-round-to-integer"
(and (string= (format nil "~4,0F" 31.4159) " 31.")
(string= (format nil "~4,0F" 31.6159) " 32.")
))
;;AR 7616 test: 1e7 was printing as 1.E+7 and should print as 1.0E+7
(do-test "fp-print-at-least-one-decimal-place"
(string= (write-to-string (read-from-string "1e7")) "1.0E+7"))