Skip to content

Returning unanticipated results #154

Closed Answered by PaulRBerg
its-me-ilia asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @its-me-ilia, thank you for your question. I am sorry that you didn't find the current state of the docs satisfactory - there are a few examples offered in the README. Might you have missed them?

ud(15).mul(ud(2))

UD60x18 is a fixed-point type with 18 decimals, which means that the values you passed here are actually 0.000000000000000015 and 0.000000000000000002. These numbers are so small that when multiplied together, they yield a number with more than 18 zeroes after the dot, therefore PRBMath gives you the result 0.

Now, what you are perhaps interested in is the toUD60x18 conversion function, which would do the conversion from 15 to 15e18. Personally, I do not use that method becau…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@its-me-ilia
Comment options

@PaulRBerg
Comment options

@its-me-ilia
Comment options

@PaulRBerg
Comment options

Answer selected by its-me-ilia
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
Converted from issue

This discussion was converted from issue #154 on December 27, 2022 19:36.