on 2021 Nov 21 3:46 PM
Query example:
select 1 as TAG, null as PARENT, '0' as "key", 7.27 as "value" for json explicit
Result:
[["0",7.26999999999999881]]
As a result, value should be as in the original 7.27, the format of the field is numeric (12, 5)
[["0",7.27]]
I'll be grateful, cast, round, truncnum doesn't help
Request clarification before answering.
JSON numbers are either integer or double-precision floating point. Values like 7.27 cannot be expressed exactly as a floating point number. One option is to process these values as strings.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is that at the end of the day, 2.7 cannot be accurately stored in base2 as a real number (just like 1/3 can't be exactly converted to base10) - you will always being dealing with some sort of approximation. Floating point numbers are a computer thing not a mathematical thing!
I think decimal datatypes (when available) are stored as integer values and the appropriate offset then applied.
User | Count |
---|---|
33 | |
22 | |
17 | |
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.