Use unambiguous float duration values #611
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Same rationale as #516 and #527: for example, when representing
35.621
as float64,35.62100000000000221689333557151257991790771484375
and35.621
are the same number (kind of how42
and(int)42.1
are the "same number" too), first being explicit and accurate, second one is what will get you to the first one when rounding, assuming 64 bits. (and for 32 bits,35.621
would be represented as35.620998382568359375
). I.e. can't reliably expect35.621.ToString()
to be35.621
and not35.62100000000000221689333557151257991790771484375
on all implementations, and should implementation give us"35.62100000000000221689333557151257991790771484375"
, it won't be incorrect, but cadl-ranch would fail.If we use
35.625
, it is not ambiguous:35.625
can be exactly represented as IEEE754 floating point, there is no room for misinterpretations, there is exactly one string representation for it, not two.So, in this PR, we're updating
35.621
to35.625
, and46.781
to46.75
for the same reason.