www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Warning 24: number is not representable

↑ ↓ ← "Steve Hall" <sthall lorrexinc.com> writes:
#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> writes:
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
→ "Walter" <walter digitalmars.com> writes:
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