News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

some math functions are wrong

Started by jullien, February 10, 2015, 06:55:12 AM

Previous topic - Next topic

jullien

For example exp and sin:

#if 0
f:\PellesC-64\bin\cc -c -Ze -Zx -Gz -W0 -Go -Tamd64-coff main.c
f:\PellesC-64\bin\polink  /out:main.exe main.obj
#endif

#include <stdio.h>
#include <math.h>

int
main()
{
   printf("sin(3.14159 / 4): expected: 0.707106, got %f\n",
          sin(3.14159 / 4));
   printf("exp(1):           expected: 2.718282, got %f\n", exp(1));
}

But log, pow, cos, asin, acos, sinh, cosh, tanh, atan are wrong as well.

Also, strtod does not detect "1e400" as float overflow. I admit that ISO C does not require to detect this (contrary to underflow as with "1e-400") but pelles C 32bit version correctly detect it as does Visual C++ and gcc on all processor I know.

jullien

Oooops, I forgot to say it has been tested with Feb RC7 version of course.

Bitbeisser

Quote from: jullien on February 10, 2015, 06:56:51 AM
Oooops, I forgot to say it has been tested with Feb RC7 version of course.
Confirmed on Windows 8.1/64...

Ralf

jullien