NO

Author Topic: some math functions are wrong  (Read 3571 times)

jullien

  • Guest
some math functions are wrong
« on: February 10, 2015, 06:55:12 AM »
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

  • Guest
Re: some math functions are wrong
« Reply #1 on: February 10, 2015, 06:56:51 AM »
Oooops, I forgot to say it has been tested with Feb RC7 version of course.

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: some math functions are wrong
« Reply #2 on: February 11, 2015, 02:27:30 AM »
Oooops, I forgot to say it has been tested with Feb RC7 version of course.
Confirmed on Windows 8.1/64...

Ralf

jullien

  • Guest
Re: some math functions are wrong
« Reply #3 on: March 10, 2015, 06:03:16 PM »
All fixed in RC8