在C#中float类型的最大值 [英] maximum value for type float in c#

查看:3032
本文介绍了在C#中float类型的最大值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我这样做:

float x = float.MaxValue;



我的结果:3.40282347E + 38

I have the result: 3.40282347E+38

什么是E + 38? ?我怎么能代表没有这个符号的最大数量

What is E+38? how can I represent the maximum number without this symbol?

MSDN说范围:±1.5×10 ^ -45到±3.4×10 ^ 38,但是这并没有帮助我的。

msdn says RANGE: ±1.5 × 10^−45 to ±3.4 × 10^38, but that did not help me.

推荐答案

在E + 38的格式是默认的。如果你想看到整个数,指定这样一个不同的格式:

The "E+38" format is the default. If you'd like to see the whole number, specify a different format like this:

float.MaxValue.ToString("#")

这会导致:

340282300000000000000000000000000000000

下面是一些额外的格式:的 http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.aspx

Here are some additional formats: http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.aspx

这篇关于在C#中float类型的最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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