2020-12-30 15:43:18 +00:00
|
|
|
#lang racket/base
|
|
|
|
;; Wrapper struct to mark a need for 32-bit IEEE floating-point
|
|
|
|
;; precision (de)serialization. In many circumstances, Racket lacks
|
|
|
|
;; 32-bit floating point support, and single-flonum? always yields #f.
|
|
|
|
|
2021-06-09 18:02:06 +00:00
|
|
|
(provide (struct-out float)
|
|
|
|
->float)
|
2020-12-30 15:43:18 +00:00
|
|
|
|
|
|
|
(struct float (value) #:transparent)
|
2021-06-09 18:02:06 +00:00
|
|
|
|
|
|
|
(define (->float v)
|
|
|
|
(if (float? v)
|
|
|
|
v
|
|
|
|
(float (exact->inexact v))))
|