Float

Cai Gengyang gengyangcai at gmail.com
Sat Jul 30 07:44:42 EDT 2016


You mentioned that : A floating point number[2] is number that is not an integer (and not a 
complex number)

Hence ,

10 is not a floating point number because it is an integer
25 is not a floating point number because it is an integer 
7 + 3i is not a floating number because it is a complex number 
8 + 5i is not a floating number because it is a complex number.

Is 3.0 a floating number ? It is a rational number, not an integer right ?









On Saturday, July 30, 2016 at 6:34:25 PM UTC+8, Steven D'Aprano wrote:
> On Sat, 30 Jul 2016 08:21 pm, Cai Gengyang wrote:
> 
> > Cool ... can you give a concrete example ?
> 
> A concrete example of a float?
> 
> I already gave two:
> 
> 
> >> 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
> 
> 
> Here are some more:
> 
> 0.5  # one half
> 0.25  # one quarter
> 7.5  # seven and a quarter
> 0.001  # one thousandth
> 
> 12345.6789
> # twelve thousand, three hundred and forty-five, point six seven eight nine
> 
> -1.75  # minus one point seven five
> 0.0  # zero
> 3.0  # three
> 
> 1.23e45  # one point two three times ten to the power of forty-five
> 
> 
> 
> 
> -- 
> 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