Problem
The Trigonometry Function sin() does not return the correct value in OpenServer 5.0.7 when using SCO OpenServer Development System v5.2.0.Aa or gcc
For example, compile and run the following program :
# more test.c
#include <stdio.h>
#include <math.h>void main() { printf( "Sin(123.123) = %f\n\n", sin(123.123)); }
# cc -V
SCO UNIX Development System Release 5.2.0A 22Jul03
Usage: cc [ options ] files ...
# cc test.c -lm
# ./a.out
Sin(123.123) = 0.565374This in incorrect, the correct result should be -0.565374
This problem has also been seen to occur with the OpenServer gcc compiler, and appears to be caused by a problem with the libm library.
Solution
This problem has been reported to SCO Engineering and may be addressed in a future release.
A workaround exists in that this problem does not occur when using the "cc" compiler and associated libraries included in the "UnixWare and OpenServer Development Kit". A license is required to use this development kit, but if possible this compiler could be used to avoid this problem.