racket/fasl: repair for +nan.f

The `racket/fasl` implementation wasn't updated with the change
to disable reading for lfoating-point literals.
This commit is contained in:
Matthew Flatt 2019-06-09 08:49:52 -06:00
parent 53da8f2bc8
commit c020bd4feb
2 changed files with 7 additions and 3 deletions

View File

@ -42,8 +42,12 @@
(for ([i (in-list immutables)])
(test i fasl->s-exp (s-exp->fasl i)))
(test 46f0 fasl->s-exp (s-exp->fasl 46f0))
(test (vector #t 46f0) fasl->s-exp (s-exp->fasl (vector #t 46f0)))
(when (single-flonum-available?)
(let ([n46f0 (real->single-flonum 46.0)])
(test n46f0 fasl->s-exp (s-exp->fasl n46f0))
(test (vector #t n46f0) fasl->s-exp (s-exp->fasl (vector #t n46f0))))
(let ([nan (real->single-flonum +nan.0)])
(test #t eqv? nan (fasl->s-exp (s-exp->fasl nan)))))
(test "4.5t0" format "~a" (fasl->s-exp (s-exp->fasl 4.5t0)))

View File

@ -202,7 +202,7 @@
o)]
[(single-flonum? v)
(write-byte fasl-single-flonum-type o)
(write-bytes (if (eqv? v +nan.f)
(write-bytes (if (eqv? v (real->single-flonum +nan.0))
;; use a canonical NaN (0 mantissa)
#"\0\0\300\177"
(real->floating-point-bytes v 4 #f))