Eric M. Monsler wrote:
> 
> Inspecting errno when?
 >

tmp_float = (float)strtod("6.0e-44",NULL);

/* inspect errno and tmp_float here - see strtod(3) */

if(errno == ERANGE) {
     g_print("bad argument to strtod()\n");
     exit(1);
} else if(tmp_float == FLT_MIN || tmp_float == FLT_MAX) {
     g_print("float out of range\n");
     exit(1);
}

g_string_sprintf(pGStr,"%6.2f\n",tmp_float);

Even better would be to skip the cast, make tmp_float
into tmp_double, and just check errno. This is because
FLT_MIN and FLT_MAX may not be portable beyond machines
with gcc on them.

Chris

-- 
[EMAIL PROTECTED] (work)
[EMAIL PROTECTED] (home)

_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to