-
Trying the exp, exp2 functions, I noticed that those functions are not working the way I expected. Actually, I was expecting uint x = 1; // test input
return x.exp();
Similar result when trying |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yup. This is a fixed-point math library, which means that numbers are assumed to have 18 decimals. Always. In your case, when you set Please refer to the README, this is explained thoroughly there. |
Beta Was this translation helpful? Give feedback.
Yup. This is a fixed-point math library, which means that numbers are assumed to have 18 decimals. Always.
In your case, when you set
x
to1
, in normal numbers that's actually0.000000000000000001
. The result you got is correct: takinge
to the power of0.000000000000000001
gives you ~1.Please refer to the README, this is explained thoroughly there.