Comments (6)
I think at this point we're committed to double precision floating point.
from jsonnet.
I got stuck with the limitation of double
representation of numbers. Could you reconsider support of arbitrary precision for numbers?
from jsonnet.
@dynaxis Can you tell us more about your use case?
We don't expect to change it (that's why it was closed), but it's not completely out of question.
from jsonnet.
I'm using jsonnet to write JSON schemas. There, I need to write int range constraints comparable to int64
. But I can't even write the type's min and max values as literal numbers since it requires more than 53 bits.
from jsonnet.
Thanks. This seems like a very reasonable use case to me.
In the short-term it is possible to implement a workaround: a custom manifestJSON
which serializes your custom objects as long numbers (internally you could then represent them as strings or something). LMK if you want to go this way and need help with that.
Please note that the JSON specification allows the implementations to set limits on the precision, and recommends to avoid requiring more precision. A lot of JSON parsers have limitations there (Javascript, QT, Go with default settings...). So if you have control of the schema, perhaps it's better to avoid the need for large numbers there (e.g. by using a larger unit).
This specification allows implementations to set limits on the range
and precision of numbers accepted. Since software that implements
IEEE 754-2008 binary64 (double precision) numbers [IEEE754] is
generally available and widely used, good interoperability can be
achieved by implementations that expect no more precision or range
than these provide, in the sense that implementations will
approximate JSON numbers within the expected precision. A JSON
number such as 1E400 or 3.141592653589793238462643383279 may indicate
potential interoperability problems, since it suggests that the
software that created it expects receiving software to have greater
capabilities for numeric magnitude and precision than is widely
available.
Source: https://tools.ietf.org/html/rfc7159#section-6
from jsonnet.
Thanks for the clarification. I'll think more about how I'll proceed taking your suggestion into acount.
from jsonnet.
Related Issues (20)
- std.{any,all} fails with gibberish log when arr contains non boolean elements
- Jsonnet.org - make headers links
- Specification missing rule for empty object
- Reflection of function arguments
- CMake: Non-existent dependency warning when attempting to disable BUILD_JSONNET option HOT 2
- std.parseYaml fails on non-standard yaml feature, supported in other implementations HOT 1
- adjacent object literals vs adjacent variables HOT 2
- Different behavior of hidden status inheritance between Jsonnet and Go-Jsonnet HOT 5
- stack-overflow exists in the function parse in parser.cpp
- stack-overflow exists in the function maybeParseGreedy in parser.cpp HOT 1
- add atan2 to std HOT 1
- Migrate Jsonnet from Travis CI to GitHub Actions HOT 4
- Unable to install jsonnet in Google Colab notebook: failed building wheel
- OSS-Fuzz issue 65944 HOT 2
- OSS-Fuzz issue 65950 HOT 4
- std.manifestIni should support repeated section names
- Can't parse object HOT 3
- Behavior of `std` overriding and desugaring. HOT 1
- std.parseYaml wraps result in an array when string values contain --- HOT 3
- Crash (assert/check fail) in RapidYAML if the input is a YAML stream
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonnet.