Does Intel C++ support 16 bytes floats on IA-32?

Does Intel C++ support 16 bytes floats on IA-32?

In Fortran, 16 bytes float has been supported on IA-32. In VC++, double and long doubleare 8 bytes floats only. Does Intel C++ support 16 bytes floats on IA-32?

13 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Dear Weichao,

We support some functionality in our 8.0 compiler.Theswitch to turn on this support is-Qoption,cpp,--extended_float_types with type _Quad. We do not provide I/O support for these types (I/O support is dependent on the library, gcc or MS dependent).

Hope this helps,

Max

Dear mjdomeik,

Thanks for your answer. After I added the option, I gotsizeof(double)=8 bytes. why?

Sorry!! I forgot to change the type "double" to "_Quad".

Is there any possible to write _Quad data to a binay file?

Dear Weichao,

I have not tried, but you should be able to write the data to disk using low level writes (not fwrite). Have you tried?

Max

No problem! Here is my example to read and write.

#include
int main()
{
typedef _Quad real;
real a;
double b;
a=0.1234567890123456789012345;
b=a;
for(int i=0;i<100;++i)
{
a/=7.2;
b/=7.2;
}

FILE* file=fopen("test.bin","w+b");
fwrite((char*) &a,sizeof(real),1,file);
printf("SIZE OF DOUBLE = %i
",sizeof(real));
rewind(file);
fread((char*) &a,sizeof(real),1,file);
for(int i=0;i<100;++i)
{
a*=7.2;
b*=7.2;
}
printf("% 30.25f
",(double)a);
printf("% 30.25f
",b);
return 0;
}

Dear Weichao,

I ran your sample and it looks good to me. Glad I could help. Let me know if you have any more questions and I'll see what I can do.

Best regards,

Max

You said that the _Quad type is available on windows operating systems.

But is this type available with the intel c++ 8.0 on linux ?
If yes, which is the appropriated command line to have this type ?

Mickael,

Dear Mickael,

I performed my test of weichao's code on a linux system. The same command specified above should do the trick. Have you tried? Did it work for you?

Thanks,

Max

We use the _Quad type.

You do not provide standard mathematical functions like sin, cos for this type : no header and no library.

Do you plan to provide it ? These functions are available in the intel fortran compiler ( type real(16) ).

Do you will provide function like strtod or printf for the type _Quad ?

These functions are very usefull when we use 16 bytes floats.

Mickael,

Intel C does relatively little augmentation of glibc, in order to be able to share libraries with gcc code. So this is one aspect of _Quad data type not being supported in the C compiler.
I don't know the answer, but full support may not happen unless gcc and glibc acquire this feature.
You might consider making a wrapper function which invokes the Fortran math function. If you made it real*16 rather than real(16) it might even work with a few C-Fortran combinations from other vendors as well. These functions are slow enough that you shouldn't notice the additional overhead of the wrapper call.

Thanks,

Where can I find documentation about _Quad type ?

if no documentation, how do I declare literal constants _Quad in C ?
e.g. for long double : 0.5E0L

Mickael,

Leave a Comment

Please sign in to add a comment. Not a member? Join today