| 
 
Archives
 
D Programming 
DD.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++ - powl bug
 
The following code produce wrong result:
#include <math.h>
#include <stdio.h>
int main()
{
 long double a = powl(-0.0397739, 310.954);
 long double b = -5.12198e11;
 printf("(%Lg)^(%Lg) = %Lg", a, b, powl(a, b));
 return 0;
}
The used compiler is Digital Mars Compiler v8.29n.
 Apr 21 2003
 
In article <b81iu3$2smm$1 digitaldaemon.com>, Steve Hall (sthall lorrexinc.com) says...  Apr 22 2003
 
I agree with you, but according to C99, the math and lcc-win32 v3.8 the
result of the following code should be: (nan)^(3.5) = nan.
#include <math.h>
#include <stdio.h>
int main()
{
 long double a = powl(-1, 0.5);
 long double b = 3.5;
 printf("(%Lg)^(%Lg) = %Lg", a, b, powl(a, b));
 return 0;
}
The result from dmc v8.29n is: (nan)^(3.5) = 3.36128e-4932.
The software that I develop depend on precision C99 floating-point
arithmetic.
"Larry Brasfield" <larry_brasfield snotmail.com> wrote in message
news:MPG.190ea07eab0c3d7e9896a4 news.digitalmars.com...
 Apr 22 2003
 
 |