Python round() too slow, faster way to reduce precision?

Viewed 6537

I am doing the following:

TOLERANCE = 13
some_float = ...
round(some_float, TOLERANCE)

This is run many times, so performance is important. I have to round some_float due to floating point representation error. I don't actually need to "round" the number in that sense, just remove digits after 13 trailing digits.

Is there a faster way to do this?

2 Answers
Related