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
As mentioned in bitshares/bitshares-ui#3545 (comment), the function to_long() in SerializerValidation.js may return unexpected result if the input is a float with decimals (E.G. 12.999999999999998). Code:
For a little extra context, it looks like Long (from the bytebuffer library), will correctly handle the first five digits after the decimal point, whereafter it seems to just append digits.
> var Long = require("bytebuffer").Long;
undefined
> Long.fromString("12.12345")
Long { low: 12, high: 0, unsigned: false }
> Long.fromString("12.123456")
Long { low: 126, high: 0, unsigned: false }
> Long.fromString("12.1234567")
Long { low: 1267, high: 0, unsigned: false }
>
As mentioned in bitshares/bitshares-ui#3545 (comment), the function
to_long()
inSerializerValidation.js
may return unexpected result if the input is afloat
with decimals (E.G.12.999999999999998
). Code:bitsharesjs/lib/serializer/src/SerializerValidation.js
Lines 103 to 116 in c962b80
To fix this, IMHO, as a library, we shouldn't change user input, but we should require the input to be valid.
The text was updated successfully, but these errors were encountered: