Date: Sun, 14 Feb 2021 13:59:58 -0800 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: freebsd-current@freebsd.org Subject: HEADSUP: math is broken with clang and optimization Message-ID: <20210214215958.GA80810@troutmask.apl.washington.edu>
next in thread | raw e-mail | index | archive | help
Just a headsup for anyone doing numerical work with FreeBSD-current. clang with optimization of -O1 or higher produces wrong results. Testing 1 million complex values of ccoshf and limiting |z| < 20, shows % cc -o testf -O2 -pipe -static -Wall -fno-builtin \ -I/usr/home/kargl/include -I/usr/local/include -I../mp \ -I../libm/msun/src testf.c -L/usr/home/kargl/lib \ -L/usr/local/lib -L../mp -L../libm/msun -lmpsk -lmpfr -lgmp -lm % ./testf -u -n 1 -X 10 Max ULP Re: 136633.320045 Max ULP Im: 1890038.672637 % cc -o testf -O0 -pipe -static -Wall -fno-builtin \ -I/usr/home/kargl/include -I/usr/local/include -I../mp \ -I../libm/msun/src testf.c -L/usr/home/kargl/lib \ -L/usr/local/lib -L../mp -L../libm/msun -lmpsk -lmpfr -lgmp -lm % ./testf -u -n 1 -X 10 Max ULP Re: 2.785010 Max ULP Im: 2.926068 One of these is more correct than the other. -- Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210214215958.GA80810>