Thread overview | |||||
---|---|---|---|---|---|
|
August 26, 2003 Warning 24: number is not representable | ||||
---|---|---|---|---|
| ||||
#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 Re: Warning 24: number is not representable | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steve Hall | 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 Re: Warning 24: number is not representable | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steve Hall | 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 > > |
Copyright © 1999-2021 by the D Language Foundation