Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use unambiguous float duration values #611

Merged
merged 2 commits into from
Jun 28, 2024
Merged

Conversation

antkmsft
Copy link
Member

@antkmsft antkmsft commented Jun 27, 2024

Same rationale as #516 and #527: for example, when representing 35.621 as float64, 35.62100000000000221689333557151257991790771484375 and 35.621 are the same number (kind of how 42 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 as 35.620998382568359375). I.e. can't reliably expect 35.621.ToString() to be 35.621 and not 35.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 to 35.625, and 46.781 to 46.75 for the same reason.

Copy link

changeset-bot bot commented Jun 27, 2024

🦋 Changeset detected

Latest commit: 086b650

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@azure-tools/cadl-ranch-specs Patch
@azure-tools/cadl-ranch Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@antkmsft antkmsft merged commit d82838f into Azure:main Jun 28, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants