Skip to content

exp, exp2 functions are not working as expected #66

Closed Answered by PaulRBerg
felix0888 asked this question in Q&A
Discussion options

You must be logged in to vote

Any misunderstanding on my side?

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 to 1, in normal numbers that's actually 0.000000000000000001. The result you got is correct: taking e to the power of 0.000000000000000001 gives you ~1.

Please refer to the README, this is explained thoroughly there.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@felix0888
Comment options

@PaulRBerg
Comment options

Answer selected by felix0888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants