Created
January 6, 2022 15:21
-
-
Save ant358/2247e440f83eabea9dcf41bf4e2c9b10 to your computer and use it in GitHub Desktop.
Truncate numbers (force them to round down)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def truncate(f, n=2): | |
return math.trunc(f * 10 ** n) / 10 ** n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment