Skip to content

update go-cty to v1.10.0#29864

Merged
jbardin merged 1 commit intomainfrom
jbardin/update-cty
Nov 3, 2021
Merged

update go-cty to v1.10.0#29864
jbardin merged 1 commit intomainfrom
jbardin/update-cty

Conversation

@jbardin
Copy link
Copy Markdown
Member

@jbardin jbardin commented Nov 2, 2021

cty: The documented definition and comparison logic of cty.Number is now
refined to acknowledge that its true range is limited only to values
that have both a binary floating point and decimal representation,
because cty values are primarily designed to traverse JSON serialization
where numbers are always defined as decimal strings.

In particular, that means that two cty.Number values now always compare
as equal if their representation in JSON (under cty's own JSON encoder)
would be equal, even though the decimal approximation we use for that
conversion is slightly lossy. This pragmatic compromise avoids confusing
situations where a round-trip through JSON serialization (or other
serializations that use the same number format) may produce a value that
doesn't compare equal to the original.

This new definition of equals should not cause any significant behavior
change for any integer in our in-memory storage range, but may cause
some fractional values to compare equal where they didn't before if they
differ only by a small fraction.

Fixes #29861

cty: The documented definition and comparison logic of cty.Number is now
refined to acknowledge that its true range is limited only to values
that have both a binary floating point and decimal representation,
because cty values are primarily designed to traverse JSON serialization
where numbers are always defined as decimal strings.

In particular, that means that two cty.Number values now always compare
as equal if their representation in JSON (under cty's own JSON encoder)
would be equal, even though the decimal approximation we use for that
conversion is slightly lossy. This pragmatic compromise avoids confusing
situations where a round-trip through JSON serialization (or other
serializations that use the same number format) may produce a value that
doesn't compare equal to the original.

This new definition of equals should not cause any significant behavior
change for any integer in our in-memory storage range, but may cause
some fractional values to compare equal where they didn't before if they
differ only by a small fraction.
@jbardin jbardin added 1.0-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged 1.1-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged labels Nov 2, 2021
@jbardin jbardin requested a review from a team November 2, 2021 21:33
@jbardin jbardin self-assigned this Nov 2, 2021
@jbardin jbardin merged commit 5e943ec into main Nov 3, 2021
@jbardin jbardin deleted the jbardin/update-cty branch November 3, 2021 12:57
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 4, 2021

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

1.0-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged 1.1-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terraform plan/apply fails when setting a float field to a float value

2 participants