-
Notifications
You must be signed in to change notification settings - Fork 53
Closed
Milestone
Description
AppendDouble checks that the value is in the range [FLT_MIN, FLT_MAX] before appending. However, that's not actually the right check: FLT_MIN isn't the "minimum float value" (that doesn't make sense; floats contain infinity), but rather the smallest positive float. Hence, 0 and any negative float will get wrongly rejected.
IMO, it might make sense to just accept any double and cast it to float without thinking. Otherwise, maybe the right check is (double)((float) v) == v or something ("is this double exactly representable as a float", perhaps there's an idiom for this though I can't get the right search query to figure this out), though this will not work for NaN.
Metadata
Metadata
Assignees
Labels
No labels