Python中的最大浮点数是多少? [英] What is the maximum float in Python?

查看:2714
本文介绍了Python中的最大浮点数是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为通过调用 sys.maxint 可以获得python中的最大整数。

I think the maximum integer in python is available by calling sys.maxint.

最大值是多少Python中的 float long

What is the maximum float or long in Python?

推荐答案

对于 float 看看 sys.float_info

>>> import sys
>>> sys.float_info
sys.floatinfo(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2
250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsil
on=2.2204460492503131e-16, radix=2, rounds=1)

具体来说, sys.float_info.max

>>> sys.float_info.max
1.7976931348623157e+308

如果这还不够大,总会有正无限

If that's not big enough, there's always positive infinity:

>>> infinity = float("inf")
>>> infinity
inf
>>> infinity / 10000
inf

long 类型具有无限精度,所以我认为你只受限于记忆。

The long type has unlimited precision, so I think you're only limited by available memory.

这篇关于Python中的最大浮点数是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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