Changeset 26346 in project


Ignore:
Timestamp:
04/02/12 22:06:36 (9 years ago)
Author:
sjamaan
Message:

numbers: Of course, for negative exponents the same can happen...

Location:
release/4/numbers/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/numbers/trunk/numbers.scm

    r26345 r26346  
    17151715    (and e (if (not value)
    17161716               0
    1717                (if (> e +maximum-allowed-exponent+)
    1718                    (and (eq? exactness 'i) +inf.0)
    1719                    (%* value (expt 10 e))))))
     1717               (cond
     1718                 ((> e +maximum-allowed-exponent+)
     1719                  (and (eq? exactness 'i) +inf.0))
     1720                 ((< e (- +maximum-allowed-exponent+))
     1721                  (and (eq? exactness 'i) +0.0))
     1722                 (else (%* value (expt 10 e)))))))
    17201723  (let* ((len (##sys#size str))
    17211724         (r..9 (integer->char (fx+ (char->integer #\0) radix)))
  • release/4/numbers/trunk/tests/numbers-test.scm

    r26344 r26346  
    761761        (e2 (string->number "#e1.0e1000000"))
    762762        (t2 (current-seconds)))
    763    (test-assert "read time for inexacts isn't insanely high" (< (- t2 t1) 2))
    764    (test "numbers read back are equal" i1 i2)
     763   (test-assert "read time for inexacts with large positive exp isn't insanely high" (< (- t2 t1) 2))
     764   (test "inexact read back are equal" i1 i2)
     765   (test "inexact are inf" i1 +inf.0)
     766   (test "exact are equal" e1 e2)
     767   (test "exact are false" e1 #f))
     768 (let* ((t1 (current-seconds))
     769        (i1 (string->number "1e-1000000"))
     770        (i2 (string->number "1.0e-1000000"))
     771        (e1 (string->number "#e1e-1000000"))
     772        (e2 (string->number "#e1.0e-1000000"))
     773        (t2 (current-seconds)))
     774   (test-assert "read time for inexacts with large negative exp isn't insanely high" (< (- t2 t1) 2))
     775   (test "inexact read back are equal" i1 i2)
     776   (test "inexact are 0" i1 +0.0)
    765777   (test "exact are equal" e1 e2)
    766778   (test "exact are false" e1 #f))
Note: See TracChangeset for help on using the changeset viewer.