(j3.2006) Does C99 have an equivalent to HUGE?

Fred J. Tydeman tydeman
Mon Jun 29 14:59:23 EDT 2009


On Mon, 29 Jun 2009 11:26:23 -0700, Van Snyder wrote:

>I have a C code in which gcc 4.4.0 on a Mac notices
>
>e_float/efx/e_float_efx.h(57) : warning: integer constant is too large for 'long' type
>e_float/efx/e_float_efx.h(58) : warning: integer constant is too large for 'long' type
>
>The code in question is:
>      static const INT64 ef_max_exp10    = static_cast<INT64>(+89999999999999999);
>      static const INT64 ef_min_exp10    = static_cast<INT64>(-89999999999999999);
>
>In Fortran, I'd probably use HUGE to initialize these constants.
>
>Does C99 have an equivalent?

Yes.  In <limits.h>, there are:
 LLONG_MAX and LLONG_MIN

---
Fred J. Tydeman        Tydeman Consulting
tydeman at tybor.com      Testing, numerics, programming
+1 (775) 358-9748      Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.




More information about the J3 mailing list