c++ - Warning 24: number is not representable
- "Steve Hall" <sthall lorrexinc.com> Aug 26 2003
- Ilya Minkov <midiclub 8ung.at> Aug 26 2003
- "Walter" <walter digitalmars.com> Aug 26 2003
#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









Ilya Minkov <midiclub 8ung.at> 