Git Product home page Git Product logo

Comments (6)

sparkprime avatar sparkprime commented on July 28, 2024

I think at this point we're committed to double precision floating point.

from jsonnet.

dynaxis avatar dynaxis commented on July 28, 2024

I got stuck with the limitation of double representation of numbers. Could you reconsider support of arbitrary precision for numbers?

from jsonnet.

sbarzowski avatar sbarzowski commented on July 28, 2024

@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.

dynaxis avatar dynaxis commented on July 28, 2024

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.

sbarzowski avatar sbarzowski commented on July 28, 2024

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.

dynaxis avatar dynaxis commented on July 28, 2024

Thanks for the clarification. I'll think more about how I'll proceed taking your suggestion into acount.

from jsonnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.