larcenists / larceny

Larceny Scheme implementation
Other
202 stars 32 forks source link

bytevector-ieee-double-native-set! throws an error when the value is exact integer #823

Open ktakashi opened 6 years ago

ktakashi commented 6 years ago

This piece of code throws an error.

(define bv (make-bytevector 8))
(bytevector-ieee-single-native-set! v 0 1)

whilst this is okay.

(define bv (make-bytevector 8))
(bytevector-ieee-single-native-set! v 0 1.0)

The simplest fix, I think, could be adding (define x (inexact x)) (or adding let) in the definition of bytevector-ieee-double-native-set!.