If I have a float like 32.879
, and I want to end up with just 0.879
, I can think of a few ways to do it, like:
- Convert to string, strip off everything before the
.
, convert back to float; OR 32.879 - int(32.879)
Both of those feel like hacks. Is there no pure math operation that can do this?
Sort of like using abs()
instead of if x < 0: x = x*-1
I'm dealing with Python, but if anyone can tell me the math name for this operation, I can probably google the Python way to do it.