Float
Ben Finney
ben+python at benfinney.id.au
Fri Jul 29 06:25:29 EDT 2016
Cai Gengyang <gengyangcai at gmail.com> writes:
> Can someone explain in layman's terms what "float" means ?
They are a compromise: in a known number of bits and with explict
very-fast hardware support, represent numbers at a large range of
scales. The compromise is that the values have limited precision for
representing those numbers.
<URL:https://en.wikipedia.org/wiki/Floating_point>
If you want exact representations of numbers, you don't want
floating-point numbers; you want Fraction or Decimal or integer etc.
If you just want to have fairly-good precision of fractional numbers, as
fast as your computer can compute them, then maybe the built-in
floating-point numbers are what you want.
There is no substitute for knowing the characteristics of floating-point
numbers, and using that information to decide when they are appropriate
and when they are not.
--
\ “Books and opinions, no matter from whom they came, if they are |
`\ in opposition to human rights, are nothing but dead letters.” |
_o__) —Ernestine Rose |
Ben Finney
More information about the Python-list
mailing list