You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
yyjson_get_real() returns zero (0) if you pass it a string containing an integer.
e.g. if you pass "99" it will return 0, I believe it should return 99.0.
Your environment
Debian 12
Debian clang version 16.0.6
It you look at C++ std::strtod() that's how it works: if you pass "99" it will return double 99.0.
thanks.
The text was updated successfully, but these errors were encountered:
pmuvb
changed the title
yyjson_get_real() returns zero (0) if you pass it an integer
yyjson_get_real() returns zero (0) if you pass it a string containing an integer
Dec 26, 2024
You can use yyjson_get_num() to convert any numeric type to a double.
In contrast, yyjson_get_real(), yyjson_get_sint(), and yyjson_get_uint() do not perform type conversion, they return 0 if the numeric type doesn't match.
The issues I have is the vendor sends me JSON containing a price, but if the price is a whole dollar (doesn't have cents) they send an integer, works now using yyjson_get_num().
Describe the bug
yyjson_get_real() returns zero (0) if you pass it a string containing an integer.
e.g. if you pass "99" it will return 0, I believe it should return 99.0.
Your environment
Debian 12
Debian clang version 16.0.6
It you look at C++ std::strtod() that's how it works: if you pass "99" it will return double 99.0.
thanks.
The text was updated successfully, but these errors were encountered: