# Them Maximum value for float

• ### Question

• I'm trying to find out what is the maximum value that a float can accept, for that I have this small solution. However the program does not print anything, what am I doing wrong?
float f;
for (f = 3.0F; (f < float.MaxValue) && (f >= 0.0); f++)
{}
Console.WriteLine("Them Maximum value for float is (+)(-): {0}", f);

What I would like to know is the maximum value a numerical value type can hold.

One more question, the default language in this fórum is Spanish, so the words I type here are classified as miss spelled by the spell-checker. How can I change the dafault language to English?

Look at these words

Corazón, Camaleón, anécdota, cañón, this language is driving me craizy!

TIA

Wednesday, May 1, 2013 10:57 AM

• Your for statement will loop forever.

When f reaches some threshold the increment of 1 will be too small to increment the sum due to the restricted precision.

float.MaxValue is already the max value you are looking for.

• Proposed as answer by Wednesday, May 1, 2013 2:10 PM
• Marked as answer by Thursday, May 30, 2013 10:18 AM
Wednesday, May 1, 2013 11:11 AM
• It is easier to look in the official C# documentation for this.

http://msdn.microsoft.com/en-us/library/b1e65aza(v=vs.110).aspx

Success
Cor

• Marked as answer by Thursday, May 30, 2013 10:18 AM
Wednesday, May 1, 2013 11:15 AM
• The maximum value that float can accept is float.MaxValue!  I'm not sure why you think that looping will get you a different maximum value!

`Console.WriteLine("Them Maximum value for float is (+)(-): {0}", float.MaxValue);`

• Marked as answer by Thursday, May 30, 2013 10:18 AM
Wednesday, May 1, 2013 10:12 PM

### All replies

• Your for statement will loop forever.

When f reaches some threshold the increment of 1 will be too small to increment the sum due to the restricted precision.

float.MaxValue is already the max value you are looking for.

• Proposed as answer by Wednesday, May 1, 2013 2:10 PM
• Marked as answer by Thursday, May 30, 2013 10:18 AM
Wednesday, May 1, 2013 11:11 AM
• It is easier to look in the official C# documentation for this.

http://msdn.microsoft.com/en-us/library/b1e65aza(v=vs.110).aspx

Success
Cor

• Marked as answer by Thursday, May 30, 2013 10:18 AM
Wednesday, May 1, 2013 11:15 AM
• The maximum value that float can accept is float.MaxValue!  I'm not sure why you think that looping will get you a different maximum value!

`Console.WriteLine("Them Maximum value for float is (+)(-): {0}", float.MaxValue);`

• Marked as answer by Thursday, May 30, 2013 10:18 AM
Wednesday, May 1, 2013 10:12 PM