Technical article 125450

Trigonometry function sin() returns incorrect results on OpenServer 5.0.7

OpenServer 5.0.7

Written · Last revised

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.565374

This 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.

From the Xinuos technical article database, record 125450. Reproduced with permission. The original is at www.sco.com/ta/125450, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.