Openlibm: Difference between revisions
No edit summary |
No edit summary |
||
Line 101: | Line 101: | ||
./bug#62212 | ./bug#62212 | ||
*;Ubuntu 22.04 (with GCC compiler and Libstdc++): | *;Ubuntu 22.04 (with GCC compiler and Libstdc++): | ||
linux-vdso.so.1 (0x00007ffed5d98000) | |||
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd1778b4000) | |||
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd17768c000) | |||
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd1775a5000) | |||
/lib64/ld-linux-x86-64.so.2 (0x00007fd177af2000) | |||
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd177585000) | |||
db_large_integer: 1.84467e+19 | |||
ui64_large_integer: 0 | |||
*;macOS (with llvm/Clang and Libc++): | *;macOS (with llvm/Clang and Libc++): | ||
/usr/local/opt/openlibm/lib/libopenlibm.4.dylib (compatibility version 0.0.0, current version 0.0.0) | |||
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0) | |||
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0) | |||
db_large_integer: 1.84467e+19 | |||
ui64_large_integer: 0 | |||
===Testing of bug {{bug|62332}}=== | ===Testing of bug {{bug|62332}}=== | ||
Line 141: | Line 156: | ||
*;Ubuntu 22.04 (with GCC compiler and Libstdc++): | *;Ubuntu 22.04 (with GCC compiler and Libstdc++): | ||
linux-vdso.so.1 (0x00007ffef447c000) | |||
libopenlibm.so.3 => /lib/x86_64-linux-gnu/libopenlibm.so.3 (0x00007efff64c3000) | |||
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007efff6297000) | |||
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efff606f000) | |||
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efff5f88000) | |||
/lib64/ld-linux-x86-64.so.2 (0x00007efff6505000) | |||
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007efff5f68000) | |||
0.707107+0.001i-->0.785399+-0.00141421i | |||
0.707107+1e-06i-->0.785398+-1.41421e-06i | |||
0.707107+1e-09i-->0.785398+-1.41421e-09i | |||
0.707107+1e-12i-->0.785398+-1.4142e-12i | |||
0.707107+1e-15i-->0.785398+-1.44329e-15i | |||
0.707107+1e-18i-->0.785398+0i | |||
0.707107+1e-21i-->0.785398+0i | |||
0.707107+1e-24i-->0.785398+0i | |||
0.707107+1e-27i-->0.785398+0i | |||
0.707107+1e-30i-->0.785398+0i | |||
0.707107+1e-33i-->0.785398+0i | |||
0.707107+1e-36i-->0.785398+0i | |||
0.707107+1e-39i-->0.785398+0i | |||
0.707107+1e-42i-->0.785398+0i | |||
0.707107+1e-45i-->0.785398+0i | |||
0.707107+1e-48i-->0.785398+0i | |||
0.707107+1e-51i-->0.785398+0i | |||
0.707107+1e-54i-->0.785398+0i | |||
0.707107+1e-57i-->0.785398+0i | |||
0.707107+1e-60i-->0.785398+0i | |||
*;macOS (with llvm/Clang and Libc++): | *;macOS (with llvm/Clang and Libc++): | ||
/usr/local/opt/openlibm/lib/libopenlibm.4.dylib (compatibility version 0.0.0, current version 0.0.0) | |||
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0) | |||
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0) | |||
0.707107+0.001i-->0.785399+-0.00141421i | |||
0.707107+1e-06i-->0.785398+-1.41421e-06i | |||
0.707107+1e-09i-->0.785398+-1.41421e-09i | |||
0.707107+1e-12i-->0.785398+-1.4142e-12i | |||
0.707107+1e-15i-->0.785398+-1.33227e-15i | |||
0.707107+1e-18i-->0.785398+-0i | |||
0.707107+1e-21i-->0.785398+-0i | |||
0.707107+1e-24i-->0.785398+-0i | |||
0.707107+1e-27i-->0.785398+-0i | |||
0.707107+1e-30i-->0.785398+-0i | |||
0.707107+1e-33i-->0.785398+-0i | |||
0.707107+1e-36i-->0.785398+-0i | |||
0.707107+1e-39i-->0.785398+-0i | |||
0.707107+1e-42i-->0.785398+-0i | |||
0.707107+1e-45i-->0.785398+-0i | |||
0.707107+1e-48i-->0.785398+-0i | |||
0.707107+1e-51i-->0.785398+-0i | |||
0.707107+1e-54i-->0.785398+-0i | |||
0.707107+1e-57i-->0.785398+-0i | |||
0.707107+1e-60i-->0.785398+-0i | |||
Revision as of 07:05, 28 July 2022
A list of open issues that are related to the differences in math libraries among different systems:
Bug number | Description |
---|---|
bug #57071 | Fix math.h and function names that block 64-bit double |
bug #55538 | logspace BIST tests fail when Octave built with LLVM libc++ |
bug #62212 | Wrong unsigned integer overflow with clang |
bug #49984 | fabs missing from libm implementation. |
bug #61812 | Math constants (e.g. M_PI) are not part of C/C++ standard |
bug #49091 | MinGW std::acosh less accurate than Linux versions |
bug #60784 | Inconsistent behavior for boolean matrix types with matrix functions |
bug #45481 | rem and fmod may give very wrong results for large arguments |
bug #61715 | Inconsistent NaN results for exponential function (0+0i)^0 with libc++ and libstdc++ |
bug #45746 | Incorrect results of trigonometric functions gsl_sf_sin and gsl_sf_cos |
bug #62332 | [MinGW] acos(z), asin(z) and atan(z) , ( z = x + yi ) return wrong result for imaginary part lower than 1e-12 |
Report on OpenLibm
The very idea of Linking openLibm with GNU octave was to bring consistency of maths library functions across different compilers and systems, thus achieving a good Libm implementation and countering the above bugs. The project openLibm was part of GSoC 2022, where some of the above bugs' c++ snippets were tested against openLibm to achieve the desired result. Unfortunately, the openLibm failed to provide the expected results.OpenLibm has its own limitation such as not being fully built and well-maintained Libm and hence the result.
Tests of Bugs against OpenLibm
The three Bugs (bug #55538 ,bug #62212, bug #62332 ) were tested against openLibm on systems Ubuntu 20.04, Ubuntu 22.04 and macOS through the github action (code can be found at BugTesting Repository ).
Testing of bug #55538
- CODE SOURCE
- C++ PROGRAM
- Output Expected
((-inf,inf), (inf,-nan), (-inf,inf), (inf,-nan) )
- Commands
On Ubuntu g++ -std=c++17 bug#55538.cc -o bug#55538 -lopenlibm //compiling ldd bug#55538 //to show shared libraries ./bug#55538 //output of program on macOS clang++ -stdlib=libc++ bug#55538.cc -o bug#55538 -lopenlibm otool -L bug#55538 // to show shared libraries ./bug#55538 //output of program
- Ubuntu 22.04 (with GCC compiler and Libstdc++)
linux-vdso.so.1 (0x00007ffe1cd2b000) libopenlibm.so.3 => /lib/x86_64-linux-gnu/libopenlibm.so.3 (0x00007fa21846e000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fa218242000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa218222000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6(0x00007fa217ffa000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6(0x00007fa217f13000) /lib64/ld-linux-x86-64.so.2 (0x00007fa2184b0000) (-inf,inf), (-nan,-nan), (-inf,inf), (inf,-nan)
- macOS (with llvm/Clang and Libc++)
/usr/local/opt/openlibm/lib/libopenlibm.4.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0) (inf,nan), (inf,nan), (-inf,inf), (inf,nan)
Testing of bug #62212
- CODE SOURCE
- C++ PROGRAM
- Output Expected
db_large_integer: 1.84467e+19 ui64_large_integer: 18446744073709551615
- Commands
On Ubuntu g++ -std=c++2a bug#62212.cc -o bug#62212 -lopenlibm ldd bug#62212 ./bug#62212 on macOS clang++ -stdlib=libc++ bug#62212.cc -o bug#62212 -lopenlibm otool -L bug#62212 ./bug#62212
- Ubuntu 22.04 (with GCC compiler and Libstdc++)
linux-vdso.so.1 (0x00007ffed5d98000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd1778b4000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd17768c000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd1775a5000) /lib64/ld-linux-x86-64.so.2 (0x00007fd177af2000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd177585000) db_large_integer: 1.84467e+19 ui64_large_integer: 0
- macOS (with llvm/Clang and Libc++)
/usr/local/opt/openlibm/lib/libopenlibm.4.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0) db_large_integer: 1.84467e+19 ui64_large_integer: 0
Testing of bug #62332
- CODE SOURCE
- C++ PROGRAM
- Output Expected
7.071068e-01+1.000000e-03i -> 7.853992e-01-1.414212e-03i 7.071068e-01+1.000000e-06i -> 7.853982e-01-1.414214e-06i 7.071068e-01+1.000000e-09i -> 7.853982e-01-1.414214e-09i 7.071068e-01+1.000000e-12i -> 7.853982e-01-1.414214e-12i 7.071068e-01+1.000000e-15i -> 7.853982e-01-1.414214e-15i 7.071068e-01+1.000000e-18i -> 7.853982e-01-1.414214e-18i 7.071068e-01+1.000000e-21i -> 7.853982e-01-1.414214e-21i 7.071068e-01+1.000000e-24i -> 7.853982e-01-1.414214e-24i 7.071068e-01+1.000000e-27i -> 7.853982e-01-1.414214e-27i 7.071068e-01+1.000000e-30i -> 7.853982e-01-1.414214e-30i 7.071068e-01+1.000000e-33i -> 7.853982e-01-1.414214e-33i 7.071068e-01+1.000000e-36i -> 7.853982e-01-1.414214e-36i 7.071068e-01+1.000000e-39i -> 7.853982e-01-1.414214e-39i 7.071068e-01+1.000000e-42i -> 7.853982e-01-1.414214e-42i 7.071068e-01+1.000000e-45i -> 7.853982e-01-1.414214e-45i 7.071068e-01+1.000000e-48i -> 7.853982e-01-1.414214e-48i 7.071068e-01+1.000000e-51i -> 7.853982e-01-1.414214e-51i 7.071068e-01+1.000000e-54i -> 7.853982e-01-1.414214e-54i 7.071068e-01+1.000000e-57i -> 7.853982e-01-1.414214e-57i 7.071068e-01+1.000000e-60i -> 7.853982e-01-1.414214e-60i
- Commands
On Ubuntu g++ -std=c++17 bug#62332.cc -o bug#62332 -lopenlibm ldd bug#62332 ./bug#62332 on macOS clang++ -stdlib=libc++ bug#62332.cc -lopenlibm -o bug#62332 otool -L bug#62332 ./bug#62332
- Ubuntu 22.04 (with GCC compiler and Libstdc++)
linux-vdso.so.1 (0x00007ffef447c000) libopenlibm.so.3 => /lib/x86_64-linux-gnu/libopenlibm.so.3 (0x00007efff64c3000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007efff6297000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efff606f000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efff5f88000) /lib64/ld-linux-x86-64.so.2 (0x00007efff6505000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007efff5f68000) 0.707107+0.001i-->0.785399+-0.00141421i 0.707107+1e-06i-->0.785398+-1.41421e-06i 0.707107+1e-09i-->0.785398+-1.41421e-09i 0.707107+1e-12i-->0.785398+-1.4142e-12i 0.707107+1e-15i-->0.785398+-1.44329e-15i 0.707107+1e-18i-->0.785398+0i 0.707107+1e-21i-->0.785398+0i 0.707107+1e-24i-->0.785398+0i 0.707107+1e-27i-->0.785398+0i 0.707107+1e-30i-->0.785398+0i 0.707107+1e-33i-->0.785398+0i 0.707107+1e-36i-->0.785398+0i 0.707107+1e-39i-->0.785398+0i 0.707107+1e-42i-->0.785398+0i 0.707107+1e-45i-->0.785398+0i 0.707107+1e-48i-->0.785398+0i 0.707107+1e-51i-->0.785398+0i 0.707107+1e-54i-->0.785398+0i 0.707107+1e-57i-->0.785398+0i 0.707107+1e-60i-->0.785398+0i
- macOS (with llvm/Clang and Libc++)
/usr/local/opt/openlibm/lib/libopenlibm.4.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0) 0.707107+0.001i-->0.785399+-0.00141421i 0.707107+1e-06i-->0.785398+-1.41421e-06i 0.707107+1e-09i-->0.785398+-1.41421e-09i 0.707107+1e-12i-->0.785398+-1.4142e-12i 0.707107+1e-15i-->0.785398+-1.33227e-15i 0.707107+1e-18i-->0.785398+-0i 0.707107+1e-21i-->0.785398+-0i 0.707107+1e-24i-->0.785398+-0i 0.707107+1e-27i-->0.785398+-0i 0.707107+1e-30i-->0.785398+-0i 0.707107+1e-33i-->0.785398+-0i 0.707107+1e-36i-->0.785398+-0i 0.707107+1e-39i-->0.785398+-0i 0.707107+1e-42i-->0.785398+-0i 0.707107+1e-45i-->0.785398+-0i 0.707107+1e-48i-->0.785398+-0i 0.707107+1e-51i-->0.785398+-0i 0.707107+1e-54i-->0.785398+-0i 0.707107+1e-57i-->0.785398+-0i 0.707107+1e-60i-->0.785398+-0i