What defines floating point precision in python?

后端 未结 2 566
迷失自我
迷失自我 2021-01-06 03:29

I learnt of the \"exactly equal to\" operator in Erlang, which compares not only values, but also data types of numbers, and I was curious about how things work in Python an

2条回答
  •  不要未来只要你来
    2021-01-06 03:49

    It's a peril of using floating-point numbers.

    If you need precision at this deep a level, use the Decimal type.

    More here: http://docs.python.org/library/decimal.html

提交回复
热议问题