15 lines
387 B
Racket
15 lines
387 B
Racket
#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.
|
|
|
|
(provide (struct-out float)
|
|
->float)
|
|
|
|
(struct float (value) #:transparent)
|
|
|
|
(define (->float v)
|
|
(if (float? v)
|
|
v
|
|
(float (exact->inexact v))))
|