floating-point-conversion

Why does str(float) return more digits in Python 3 than Python 2?

Why does str(float) return more digits in Python 3 than Python 2? Question: In Python 2.7, repr of a float returns the nearest decimal number up to 17 digits long; this is precise enough to uniquely identify each possible IEEE floating point value. str of a float worked similarly, except that it limited the result …

Total answers: 1

Convert a list of float to string in Python

Convert a list of float to string in Python Question: I have a list of floats in Python and when I convert it into a string, I get the following [1883.95, 1878.3299999999999, 1869.4300000000001, 1863.4000000000001] These floats have 2 digits after the decimal point when I created them (I believe so), Then I used str(mylist) How …

Total answers: 6