float()

阅读(2106) 标签: 双精度, 浮点数,

描述:

将字符串或数字转换成64位的双精度浮点数。

语法:

float(stringExp)

float(numberExp)

备注:

参数stringExp必须是小于或等于64位数字组成的字符串。对于值超过64位,float(stringExp)的结果将不精确。

参数numberExp必须小于或等于64位的数值。对于值超过64位,float(numberExp)的结果将不精确。

参数:

stringExp

需要转换的双精度浮点数字符串。

numberExp

需要转换的双精度浮点数。

返回值:

64位的双精度浮点数

示例:

float("1234567")

1234567.0

float(1234567)

1234567.0

相关概念:

decimal()

int()

long()

number()

string()