Double floats doesn't work correctly #3
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: zzkt/osc#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
encode-data
checks forfloat
(usingtypecase
), and encodes it usingencode-float32
. However, if a double float is passed toencode-data
, it will also match thefloat
clause and will be encoded as asingle-float
.Depending on the implementation, this may give the correct result, throw an error, or silently fail with the wrong result. (That's what happened to me)
A simple fix would be to change the
typecond
clause inencode-data
(andencode-typetags
) fromfloat
tosingle-float
. This could later be complemented by a check fordouble-float
, callingencode-float64
.Another possible simple fix would be to coerce the value to a single-float before passing it to
encode-float32
.float encoding for
single-float
anddouble-float
should work as expected now.2bad195