Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
604 views
in Technique[技术] by (71.8m points)

c++ - Print __float128, without using quadmath_snprintf

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:

  1. __float128 is standard, correct?
  2. How to print it?
  3. Isn't quadmath.h standard?

These answers did not help:

  1. Use extern C
  2. Precision in C++
  3. Printing

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...