Thread overview
Warning 24: number is not representable
Aug 26, 2003
Steve Hall
Aug 27, 2003
Ilya Minkov
Aug 27, 2003
Walter
August 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


August 27, 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

August 27, 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
>
>