Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

c - Is there a Microsoft-specific (for Microsoft compiler) data type for floating point numbers

Is there any specific data type for Microsoft's compiler for representing floating data points. I seem to find only float, double and long double

question from:https://stackoverflow.com/questions/65862622/is-there-a-microsoft-specific-for-microsoft-compiler-data-type-for-floating-po

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

1 Answer

0 votes
by (71.8m points)

No. At time of writing Visual C++ v16 a.k.a Visual C++ 2019, does not support any floating point data types other than those defined in the C and C++ standards. Moreover unlike GCC on Intel x86/x64 targets, double and long double have teh same 64-bit representation.

This is documented at https://docs.microsoft.com/en-us/cpp/cpp/fundamental-types-cpp?view=msvc-160

The Intel x86/x64 FPU supports an 80 bit data type in hardware, but it is not directly supported by a data type.

GCC on the other has a number of extended types https://gcc.gnu.org/onlinedocs/gcc/Floating-Types.html including a __float80 to match the hardware and a __float128. long double is not the same as double on GCC.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...