Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cty: Define our number range more precisely
Our documentation and implementation were previously pretty loose about what _exactly_ the intended range of cty.Number is. Although internally we store it as a *big.Float, most practical uses involve decimal string representations of numbers, such as JSON serialization. We'll now be fully explicit that we only expect to preserve precision for the subset of numbers that are within the range of _both_ our in-memory representation and of decimal string approximations of those values. This was a practical constraint for many cases before anyway, but is now a real documented constraint. Along with this, the definition of "Equals" for numbers now honors the definition by treating two numbers as equal only if they would have an equal JSON serialization. cty can in principle be serialized in other formats, including msgpack built-in, but JSON is the canonical serialization in recognition of the fact that cty is typically used to represent values destined for JSON-based network APIs.
- Loading branch information
1 parent
e5d3f15
commit f0fc9bc
Showing
4 changed files
with
119 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters