maximum value for type float in c#

前端 未结 8 1617
你的背包
你的背包 2021-02-12 14:27

when i do this:

float x = float.MaxValue;

I have the result: 3.40282347E+38

What is E+38? how can I represent the maximum number withou

8条回答
  •  -上瘾入骨i
    2021-02-12 15:30

    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("#")
    

    This will result in:

    340282300000000000000000000000000000000
    

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

提交回复
热议问题