Live data from Hacker News

Python rounds float values by converting them to string and then back

github.com

1–10 of 152 posts

Re: Python rounds float values by converting them to string and then back

#8
post #5

Maybe I'm missing something but what's wrong with rounding floats this way?

The two concerns I have are performance and correctness. I don’t know enough about the implementation of round(3) to know... perhaps someone else does?

Re: Python rounds float values by converting them to string and then back

#10
post #5

Maybe I'm missing something but what's wrong with rounding floats this way?

I don't know that it is "wrong", just unexpected. I suspect most people expect all math functions to be purely implemented in numerical terms, so finding string manipulation is surprising/interesting.
Post reply on HN