This was reduced from a ghc test. The results of the program differ
between OpenBSD 7.0-current-amd64 and a couple of other systems:

% cat tanf.c
#include <math.h>
#include <stdio.h>

int main(int a, char**b) {
        float x = 1e18;
        printf("tanf(%f)=%f\n", x, tanf(x));
        float y = 1e19;
        printf("tanf(%f)=%f\n", y, tanf(y));
}

% uname -sr; cc tanf.c -o tanf -lm && ./tanf
FreeBSD 13.0-STABLE
tanf(999999984306749440.000000)=-0.222015
tanf(9999999980506447872.000000)=0.708482

% uname -sr; cc tanf.c -o tanf -lm; ./tanf
Linux 5.11.0-38-generic
tanf(999999984306749440.000000)=-0.222015
tanf(9999999980506447872.000000)=0.708482

% uname -sr; cc tanf.c -o tanf -lm && ./tanf
OpenBSD 7.0
tanf(999999984306749440.000000)=-0.220665
tanf(9999999980506447872.000000)=-nan

Notice also the precision loss starting at 1e18.

This behavior has likely been broken for a long time as I remember the
original ghc test to fail last year too.

Thanks
Greg

Reply via email to