I have been trying to work with Intel's Quad-precision floats. I have the following code, and it is returning unexpected results.
#include <stdio.h>
#include <math.h>
int print(const char *label, _Quad r) {
  int prec = 20;
  int width = 46;
  char buf[128];
  int n = quadmath_snprintf(buf, sizeof buf, "%+-#*.36Qe", width, r);
  printf ("%s: %s\n", label, buf);
  return 0;
}
int main () {
  _Quad x = 3.14159265358979323846264338327950288q;
  print("value", x);
  print("log", logq(x));
  print("log10", log10q(x));
  print("cos", cosq(x));
  print("sin", sinq(x));
  print("sqrt", sqrtq(x));
}
This program returns the following results:
value: +3.141592653589793238462643383279502797e+00   
log: +7.644623500000000000000000000000000000e+07   
log10: -6.174980530000000000000000000000000000e+08   
cos: +0.000000000000000000000000000000000000e+00   
sin: +0.000000000000000000000000000000000000e+00   
sqrt: -1.994699018000000000000000000000000000e+09   
It looks like the quad-precision literal is being interpreted correctly. However, the functions logq, log10q, cosq, sinq and sqrtq are returning incorrect results.
The only directions I've found regarding Intel's _Quad type is here.
I am compiling this code on MacOS with:
icc -fPIC -wd1572 -Qoption,cpp,--extended_float_type -Wconversion -lquadmath -L/usr/local/Cellar/gcc/10.2.0/lib/gcc/10 test.c
Am I using the quad-precision math functions correctly?
Also, I have tried to use the function pattern as described in this post.
Quadruple precision analogs of libm functions have '__' prefix (double underscore) and 'q' suffix."
However, this results in NaN returned for all functions.