float f = (float)5 / (float)2;
int64_t res = f * 1E10;
trace_float(SBUF("Division - "), float_set(-10, res));
Took the pure c float division first.
Then multiplied the result with 10^10.
Then gave that (result * 10^10) as the mantissa and -10 as exponent to the float_set
Environment
Ubuntu 18.04
rippled version 1.6.0-hooks
hooks-chaining branch
Issue Description
When the float_divide or float_multiply is used in calculations, the resulting value is invalid.
Steps to Reproduce
In the hooks contract I used:
Expected Result
Actual Result
Division - Float 1199999999999999*10^(-14) Multiplication - Float 1199999999720603*10^(-14)
Workaround
We used this as a workaround.
Took the pure c float division first. Then multiplied the result with 10^10. Then gave that (result * 10^10) as the mantissa and -10 as exponent to the float_set
Environment
Ubuntu 18.04 rippled version 1.6.0-hooks hooks-chaining branch