James Bardin
authored
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.
Name | Last commit | Last update |
---|