left-curve / grug

Grug
https://leftcurve.software/grug
77 stars 9 forks source link

Math - square root methods #23

Closed larry0x closed 1 month ago

larry0x commented 4 months ago

We need to figure out whether the square root method we implement for Uint and Decimal etc. are rounded down or rounded to nearest, and add a comment to specify this (or maybe even rename the function to make it clear). This behavior can greatly impact DeFi protocols.

dzmitry-lahoda commented 2 months ago

Good, so imho DeFi never needs Decimal. Any kind of Decimal is misleading leaking abstraction.

larry0x commented 1 month ago

Answer: it's rounded towards zero (floored).