In my question about Analysis of float/double precision in 32 decimal digits, one answer said to take a look at __float128
.
I used it and the compiler could find it, but I can not print it, since the complier can not find the header quadmath.h
.
So my questions are:
__float128
is standard, correct?- How to print it?
- Isn't
quadmath.h
standard?
These answers did not help:
The ref also did not help.
Note that I do not want to use any non standard library.
[EDIT]
It would be also useful, if that question had an answer, even if the answer was a negative one.
No, it's not standard - neither the type nor the header. That's why the type has a double underscore (reserved name). Apparently, quadmath.h provides a quadmath_snprintf
method. In C++ you would have used <<
, of course.
Work in GNU-Fortran! It allows to run the same program in different precision: single (32 bit), double (64 bit), extended (80 bit) and quad (128 bit). You don't have to do any changes in the program, you simply write 'real' for all floating points. The size of floating points is set by compiler options -freal-4-real-8, -freal-4-real-10 and -freal-4-real-16.
来源:https://stackoverflow.com/questions/23654693/print-float128-without-using-quadmath-snprintf