GNU GCC mathematical function accuracy requirement?

I tried in vain for several days to find the accuracy of the mathematical functions (in math.h) of the GNU GCC compiler. The C99 standard states that the requirement for the accuracy of mathematical functions in math.h is determined by the implementation. I could not find mention of this in the GNU GCC compiler manuals. Does anyone have an answer to this?

+6
source share
3 answers

The math.h functions are part of the GNU C library, not the GCC compiler. Their accuracy is documented here as part of the GNU C Library Guide .

+8
source

The only thing that can be assumed is that the “-” characters in the glibc precision diagram are:

http://www.gnu.org/software/libc/manual/html_node/Errors-in-Math-Functions.html#Errors-in-Math-Functions

means “not verified”, given the absence of official documentation suggesting otherwise.

+1
source

Errors are indeed listed here , but IMHO the assumption that “-” means “correctly rounded” (ie 1/2 ulp) is almost certainly refuted by the expression at the top of the page

[T] The GNU C library is not aimed at correct rounded results for a function in the math library ... Instead, the goals for accuracy of a function without fully defined results are as follows: some functions have errors, which means that they do not meet these goals in all cases. In the future, the GNU C library may provide some other correct rounding of functions under names, such as crsin, proposed for the extension of ISO C.

After studying the source code, I found that the ulp test results (for x86-64) seemed to be. It seems that for the default rounding mode (from rounded to nearest, the bindings go to even), they explicitly check for double when ulp long double (80 bit IEEE) is worse than float . An implicit assumption seems to be that double cannot be worse than long double . For directional rounding modes, they seem to always check both float and double explicitly.

However, there is a strange thing.

  • There are no test results for exp .
  • For cos and tan they only check real / complex long double .
0
source

Source: https://habr.com/ru/post/908070/


All Articles