Float

Cai Gengyang gengyangcai at gmail.com
Sat Jul 30 06:21:34 EDT 2016


Cool ... can you give a concrete example ?

On Friday, July 29, 2016 at 10:27:08 PM UTC+8, Steven D'Aprano wrote:
> On Fri, 29 Jul 2016 07:44 pm, Cai Gengyang wrote:
> 
> > Can someone explain in layman's terms what "float" means ?
> 
> Floating point number:
> 
> https://en.wikipedia.org/wiki/Floating_point
> 
> As opposed to fixed point numbers:
> 
> https://en.wikipedia.org/wiki/Fixed-point_arithmetic
> 
> Python floats use 64 bits (approximately 18 decimal digits). Because the
> decimal point can "float" from place to place, they can represent very
> small numbers:
> 
> 1.2345678901234567e-100
> 
> and very big numbers:
> 
> 1.2345678901234567e100
> 
> using just 64 bits. If it were *fixed* decimal place, the range would be a
> lot smaller: for example, suppose the decimal place was fixed after three
> digits. The largest number would be 999.999999999999999 and the smallest
> would be 0.000000000000001.
> 
> 
> 
> 
> -- 
> Steven
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.




More information about the Python-list mailing list