在python中 float是什么意思?

来源:百度知道 编辑:UC知道 时间:2024/05/20 22:06:36
我就想知道什么是float

浮点型(Float)

  Python的浮点数就是数学中的小数,类似C语言中的double。

  在运算中,整数与浮点数运算的结果是浮点数.

  浮点数也就是小数,之所以称为浮点数,是因为按照科学记数法表示时,一个浮点数的小数点位置是可变的,比如,1.23x109和12.3x108是相等的。浮点数可以用数学写法,如1.23,3.14,-9.01,等等。但是对于很大或很小的浮点数,就必须用科学计数法表示,把10用e替代,1.23x109就是1.23e9,或者12.3e8,0.000012可以写成1.2e-5,等等。

  整数和浮点数在计算机内部存储的方式是不同的,整数运算永远是精确的而浮点数运算则可能会有四舍五入的误差。

float型数据,浮点型

详细介绍看这里
http://docs.python.org/tutorial/floatingpoint.html

就像int类型...

浮点类型变量
也就是小数的意思

float 就是浮点数,看python的manual
float( [x])

Convert a string or a number to floating point. If the argument is a string, it must contain a possibly signed decimal or floating point number, possibly embedded in whitespace. Otherwise, the argument may be a plain or long integer or a floating point number, and a floating point number with the same value (within Python's floa