Python float和numpy float32之间的区别 [英] Difference between Python float and numpy float32

查看:1259
本文介绍了Python float和numpy float32之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

内置的floatnumpy.float32有什么区别?

示例

a = 58682.7578125
print type(a)
print a
print type(numpy.float32(a))
print numpy.float32(a)

输出:

<type 'float'>
58682.7578125
<type 'numpy.float32'>
58682.8

我发现此处 numpy.float32是:

float32单精度浮点:符号位,8位指数,23位 尾数

float32 Single precision float: sign bit, 8 bits exponent, 23 bits mantissa

找不到内置的float格式是什么.

didn't find what the built in float format is.

推荐答案

Python的标准float类型是C double:

Python's standard float type is a C double: http://docs.python.org/2/library/stdtypes.html#typesnumeric

NumPy的标准numpy.float相同,并且也与numpy.float64相同.

NumPy's standard numpy.float is the same, and is also the same as numpy.float64.

这篇关于Python float和numpy float32之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆