I've never used Python, but if there's an issue here it's probably because the value has to traverse through being a string and any opinions in the to/from string conversions could cause unexpected mutations to floats?
For anyone who's able to, I'd love to hear how my awful method compares with other real methods. (i.e. not accounting for some mathematical nuance, performance, etc)