Giter Site home page Giter Site logo

Comments (3)

gregmarr avatar gregmarr commented on May 25, 2024 1

JSON itself doesn't really have a concept of signedness, or even integer vs floating point, it is just numbers.

This library separates numbers into three categories, signed, unsigned, or floating point. This is because it has to store values in concrete data types that have defined ranges. Using three representations with partially overlapping ranges, it can store a larger range of values than if it only used one storage type. It can support the full range of integers from minimum signed value to maximum unsigned value, which is 50% more than the range of either signed or unsigned alone, and also the full range of floating point values supported by double.

This allows it to parse a number and determine if it should store it as an unsigned integer value between 0 and unsigned max, or as signed integer value between signed min and 0, or as a floating point value. It can then write that value back out again as the same number (within the limits of floating point number representations).

from json.

gregmarr avatar gregmarr commented on May 25, 2024

Is there actually an issue here, or just a difference that you've noticed? Constructing from a known type uses the signedness of that type. Parsing a number from text is unsigned unless it has a sign. What change are you asking for?

from json.

andkerr avatar andkerr commented on May 25, 2024

Interesting, I didn't know that's the expected behaviour when numbers are parsed from text. I think my own ignorance on the subject is the issue here then. If the difference is simply due to C++ and JSON having different concepts of signedness I'm not sure anything should change.

I'll close this issue, thank you for the quick reply to clarify this.

from json.

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.