user60405: I have the following sketch:
void setup() {}

void loop() {
  float af = 4294967040.0;
  float bf = 4294967240.0;
  double ad = 4294967040.0;
  double bd = 4294967040.00001;
  Serial.println(af);
  Serial.println(bf);
  Serial.println(ad);
  Serial.println(bd);
}

The values of af, bf, ad and bd are way smaller than 3.402823466e38 which is the maximum for float values. The values can still be correctly operated with, but the result on the serial monitor however is ovf for bf and bd.
Why is that?

user4143: It's not the data type, it's the printing routine that sets that limit.  In Print.cpp:
227   if (isnan(number)) return print("nan");
228   if (isinf(number)) return print("inf");
229   if (number > 4294967040.0) return print ("ovf");  // constant determined empirically
230   if (number <-4294967040.0) return print ("ovf");  // constant determined empirically

Don't ask why...

60405: <p>I have the following sketch:</p>
<pre class="lang-cpp prettyprint-override"><code>void setup() {}

void loop() {
  float af = 4294967040.0;
  float bf = 4294967240.0;
  double ad = 4294967040.0;
  double bd = 4294967040.00001;
  Serial.println(af);
  Serial.println(bf);
  Serial.println(ad);
  Serial.println(bd);
}
</code></pre>
<p>The values of <code>af</code>, <code>bf</code>, <code>ad</code> and <code>bd</code> are way smaller than 3.402823466e38 which is the maximum for float values. The values can still be correctly operated with, but the result on the serial monitor however is <code>ovf</code> for <code>bf</code> and <code>bd</code>.</p>
<p>Why is that?</p>
 4143: <p>It's not the data type, it's the printing routine that sets that limit.  In <code>Print.cpp</code>:</p>
<pre class="lang-cpp prettyprint-override"><code>227   if (isnan(number)) return print(&quot;nan&quot;);
228   if (isinf(number)) return print(&quot;inf&quot;);
229   if (number &gt; 4294967040.0) return print (&quot;ovf&quot;);  // constant determined empirically
230   if (number &lt;-4294967040.0) return print (&quot;ovf&quot;);  // constant determined empirically
</code></pre>
<p>Don't ask why...</p>
