maximum value for type float in c#

前端 未结 8 1630
你的背包
你的背包 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条回答
  •  爱一瞬间的悲伤
    2021-02-12 15:18

    That is Scientific Notation.

    5E+2 = 
    5 x 10 ^ 2 = 
    5 x 10 * 10 = 
    5 * 100 =
    500
    

    In other words, that's how many decimal places you move the decimal point to calculate the result. Take 5, move it over 2 places, end up with 500. In your example, you need to take your number, 3.40282347 and move the decimal place over 38 times!

提交回复
热议问题