Giter Site home page Giter Site logo

even if you give an initial value to a float variable, json parsing gives you an initial value. Without the initial value, the result is a little bit like 4.6085e+33. about cjsonobject HOT 9 CLOSED

bwar avatar bwar commented on September 25, 2024
even if you give an initial value to a float variable, json parsing gives you an initial value. Without the initial value, the result is a little bit like 4.6085e+33.

from cjsonobject.

Comments (9)

kematy avatar kematy commented on September 25, 2024

This is not the case with integers.

from cjsonobject.

kematy avatar kematy commented on September 25, 2024

In my operating system (win10), when I execute the EXE I generate, as long as the integer is incremented by a small enough number, it can be parsed by cjson。

from cjsonobject.

kematy avatar kematy commented on September 25, 2024

I suspect this is a matter of the compiler handling floating-point precision

from cjsonobject.

kematy avatar kematy commented on September 25, 2024

The compiler I use is mingw32 7.4.0。

from cjsonobject.

Bwar avatar Bwar commented on September 25, 2024

from cjsonobject.

kematy avatar kematy commented on September 25, 2024

Waiting for your good news。祝你旅途愉快!

from cjsonobject.

kematy avatar kematy commented on September 25, 2024

另外,这个cjsonobject 怎么识别null和true、false,这也是经常要用到的。好像没有这样的实例函数,只有一个IsEmpty()?

from cjsonobject.

Bwar avatar Bwar commented on September 25, 2024

问题不在.Get(0,fvalue),在cJSON.c里的print_double(),在你的例子中做了json赋值,赋值时ToString()方法会调用print_double(),而print_double()将.0截掉了,值变成了整数。
另外,你提到的null,我也加入了对null的支持,不过建议能不用null就尽量别用null,null虽然是json属于json标准,但用在C++这种强类型语言里不是太合适,明确一个json value是string、int、float或{}又或[]会更好。

from cjsonobject.

kematy avatar kematy commented on September 25, 2024

非常感谢,试过了,已经比较完善了,感谢你的辛劳和付出。

from cjsonobject.

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.