Exchange quadruple precision entities with C++

Exchange quadruple precision entities with C++

Pavel Holoborodko的头像

There is REAL*16 type for quadruple precision entities in Fortran. Is there similar type in Intel C++?

My ultimate goal is to use Fortran library relying on REAL*16 from C++ application. This means that I need equivalent quadruple precision type in both languages. Is there any?

Is it _Quad? If yes, is there any documentation about it? 

As a workaround, can I safely assume that REAL*16 can be represented in C++ by just two values of int64_t?

So that I can pass arguments to Fortran functions using something like struct{ int64_t a, int64_t b}

I would appreciate any help on this.

Multiprecision Computing Toolbox for MATLAB
6 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
Steve Lionel (Intel)的头像

As far as I know, Intel C++ does not currently support the 128-bit floating type of Intel Fortran. If you simply want to pass it around, you can use any 16-byte container as long as you don't ask for it to be passed by value. (If you do, you'll run into problems on x64.)

Steve
Pavel Holoborodko的头像

Thank you Steve for your reply!

One more related question. What is the internal format of REAL*16?
Does it follow (or is it compatible with) IEEE 754-2008 standard (binary128)?
15 bits exponent, 113 mantissa and other properties?

Knowing REAL*16 format I can create corresponding type in C++.

Thank you in advance

Multiprecision Computing Toolbox for MATLAB
Steve Lionel (Intel)的头像

I've been informed that Intel C++ 13.0, as well as gcc 4.7, support the __float128 type and this is the same as Intel Fortran's REAL(16). It is the same as the IEEE 754-2008 128-bit floating type. Note that ISO_C_BINDING does not contain a definition for this type.

Steve
Pavel Holoborodko的头像

Thank you for reply.

I use Intel(R) C++ Compiler XE 13.0 on Windows with MSVC 2010.
It doesn't support __float128 type: "error : identifier "__float128" is undefined" .

I guess it is supported only in Linux version of compiler? Or do I need some special tricks to enable it on Windows version of C++ (since Fortran already has it as REAL*16)?

Multiprecision Computing Toolbox for MATLAB
Steve Lionel (Intel)的头像

Sorry, it seems that its indeed Linux-only.

Steve

登陆并发表评论。