Is float128 possible with Xcode?

I am trying to write a command line tool app which will be able to use 128 bit float type calculation. The only hint how to increase precision from available 80 bits to desired 128 bits I found in the net is using boost library. I found and installed boost library via mac port install tool, and compiled the following sample code:


#include <boost/multiprecision/float128.hpp>
#include <boost/math/special_functions/gamma.hpp>
#include <iostream>
int main()
{
    using namespace boost::multiprecision;

    // Operations at 128-bit precision and full numeric_limits support:
    float128 b = 2;
    // There are 113-bits of precision:
    std::cout << std::numeric_limits<float128>::digits << std::endl;
    // Or 34 decimal places:
    std::cout << std::numeric_limits<float128>::digits10 << std::endl;
    // We can use any C++ std lib function, lets print all the digits as well:
    std::cout << std::setprecision(std::numeric_limits<float128>::max_digits10)
    << log(b) << std::endl;
    // We can also use any function from Boost.Math:
    std::cout << boost::math::tgamma(b) << std::endl;
    // And since we have an extended exponent range we can generate some really large
    // numbers here (4.02387260077093773543702433923004111e+2564):
    std::cout << boost::math::tgamma(float128(1000)) << std::endl;
    //
    // We can declare constants using GCC or Intel's native types, and the Q suffix,
    // these can be declared constexpr if required:
    constexpr float128 pi = 3.1415926535897932384626433832795028841971693993751058Q;

    return 0;
}


I got a buid error:

/opt/local/include/boost/multiprecision/float128.hpp:39:10: 'quadmath.h' file not found


The problem is caused by the following lines:

#if defined(BOOST_MP_USE_FLOAT128)

extern "C" {
#include <quadmath.h>
}


Is quadmath library & headers available under the xcode 7?

How can I get it?

Replies

Did you ever find out the solution? I'm figuring the solution might require using the gnu compilers.

You probably added the apropriate lib and include folders to the corresponding aths under Build Settings -> Search Paths. Now you need to make the folders you added recursive, so Xcode searches all the folders within the folders. Do this by double-clicking the cell and selecting the recursive dropdown folder, or by simply adding "/**" to the end of the directory names.

When I did this that error went away, but I got more errors. I still don't know how to address those.