hi @all,
I’d like to get ( need ) correct! integer powers of 10 with fp80 precision, e.g. ‘powl( 10, i )’, ‘pow10l( i )’, ‘10^i’ or ‘10**i’ with ‘i’ being an integer between -4951 and 4932. AFAIS nearly all compilers are ‘weak’ and fail for some to plenty values to produce IEEE 754 compliant ‘nearest’.
By chance I stumbled over exactly 1 exception, Intel icpx or dpcpp calculate good values when I use ‘exp10l( i )’ in the code. They call clang++ with a huge bunch of options from which ‘-cc1’ and ‘-x c++’ look relevant to me. ‘-cc1’ seems somewhat ‘special’ / sophisticated, that’s why I ask for help.
- Can I achieve the ‘good’ computation for 'exp10l( i ) that is done with ‘-cc1’ in other modes? how?
- Can I compile a library with ‘-cc1’ that provides functions declared with ‘external C’ that I can use from ‘pure C’ programs? how?
- Can someone explain the difference that clang++ makes with or without ‘cc1’, and show how / where I can find the respective code that is used for ‘exp10l’?
long story:
for a project compiled with gcc i need good powers of ten for rounding. Since powl( 10, i ) and pow10l( i ) produce some errors ( rounding error in the last bit, different results from ‘1Ei’), I searched around and by chance found Intel icpx which gives better results. It uses clang++ with - among many others - the options ‘-cc1’ and ‘-x c++’.
Despite diligent searching, I have not yet been able to achieve the quality of these results in other compilers, nor have I been able to create a library with clang++ that I can call from other programs (‘external C’). (Library in principle is possible, but not together with ‘cc1’).
I have now read in llvm/llvm-project/llvm/lib/Analysis/TargetLibraryInfo.cpp:
case Triple::Linux:
// exp10, exp10f, exp10l is available on Linux (GLIBC) but are extremely
// buggy prior to glibc version 2.18. Until this version is widely deployed
// or we have a reasonable detection strategy, we cannot use exp10 reliably
// on Linux.
but don’t know how far this is still valid (in some files I could find with ‘nm’ that clang with ‘-cc1’ simply calls ‘exp10l’ - good results, while other compilers use ‘exp10l@GLIC_2.2.5’ - bad results).
Since I just want to use this without writing a thesis about compiler options or insufficient implementations or the secrets of ‘cc1’ three questions:
- Can I achieve the ‘good’ computation for 'exp10l( i ) that is done with ‘cc1’ in other modes? how?
- Can I compile a library with ‘cc1’ that provides functions declared with ‘external C’ that I can use from ‘pure C’ programs? how?
- Can someone explain the difference that clang++ makes with or without ‘cc1’, and show how / where I can find the code that is used for ‘exp10l’ vs. ‘exp10l@GLIBC_2.2.5’?
Best Regards, TIA for any help,
b.