Quadruple Precision in C++ (GCC)

前端 未结 2 1457
名媛妹妹
名媛妹妹 2020-12-05 15:33

Just recently, the GCC 4.6.0 came out along with libquadmath. Unfortunately, GNU has supported Fortran, but not C or C++ (all that is included is a .so). I have not found

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-05 16:20

    Apparently, this seems to have been an installation error on my part.

    While the core C/C++ portion of the GCC includes libquadmath.so, the Fortran version supplies libquadmath.a and quadmath.h, which can be included to access the functions.

    #include 
    #include 
    int main()
    {
      char* y = new char[1000];
      quadmath_snprintf(y, 1000, "%Qf", 1.0q);
      std::cout << y << std::endl;
      return 0;
    }
    

提交回复
热议问题