c++ - Warning 24: number is not representable
-
Steve Hall
(9/9)
Aug 26 2003
#include
- Ilya Minkov (5/6) Aug 26 2003 Because printf (as any varargs function) expects doubles, which have a
- Walter (3/12) Aug 26 2003 Try putting an 'L' suffix on the number.
#include <stdio.h> #include <math.h> int main(){ long double a = powl(2, 2000); printf("%Lg = 2^2000 = %Lg\n", (long double) (1.14813e+602), a); return 0; } Why printf doesn't accept directly the value 1.14813e+602? Steve
Aug 26 2003
Steve Hall wrote:Why printf doesn't accept directly the value 1.14813e+602?Because printf (as any varargs function) expects doubles, which have a maximum decimal exponent of roughly 308, yours is twice as big. See \dm\include\float.h for further limits and details. -eye
Aug 26 2003
Try putting an 'L' suffix on the number. "Steve Hall" <sthall lorrexinc.com> wrote in message news:bigqng$eo0$1 digitaldaemon.com...#include <stdio.h> #include <math.h> int main(){ long double a = powl(2, 2000); printf("%Lg = 2^2000 = %Lg\n", (long double) (1.14813e+602), a); return 0; } Why printf doesn't accept directly the value 1.14813e+602? Steve
Aug 26 2003