In case of Itanium where floating-point registers are 82-bit wide then long double would highly likely have the same width, with some padding for proper alignment to 128-bit Old NVIDIA CUDA cores didn't have hardware support for double, so many people used float-float for the bigger precision. That's also the reason PowerPC uses double-double for long double by default, because you can utilize the hardware double unit which makes operations much faster. Some later platforms like Motorola 6888x and Intel i960 also support that type, so it makes sense for compilers to use it for long double instead of resorting to the much slower software emulation Why defaulting to an 80-bit representation on some cases?īecause x87 supports the 80-bit IEEE-754 extended precision format. Only since C++11 you can check if the platform uses IEEE-754 with std::numeric_limits::is_iec559 Is it safe to assume floating point is represented using IEEE754 floats in C?.Does the C++ standard specify anything on the representation of floating point numbers?.C++ doesn't even require the use of IEEE-754 for floating-point types. Is long double in C++ an implementation of IEEE's binary128? It seems like indeed long double may not be an implementation of IEEE's binary128, but why not make this the case? Why defaulting to an 80-bit representation on some cases? On OS X, long double is 80-bit extended precision. The Intel C++ Compiler for x86, on the other hand, enables extended-precision mode by default. With gcc on Linux, 80-bit extended precision is the default on several BSD operating systems (FreeBSD and OpenBSD), double-precision mode is the default, and long double operations are effectively reduced to double precision. As of gcc 4.3, a quadruple precision is also supported on x86, but as the nonstandard type _float128 rather than long double. on PowerPC) or 128-bit quadruple precision (e.g. On some other architectures, long double can be double-double (e.g. With the GNU C Compiler, long double is 80-bit extended precision on x86 processors regardless of the physical storage used for the type (which can be either 96 or 128 bits). However, as with C++'s other floating-point types, it may not necessarily map to an IEEE format. In C++, long double refers to a floating-point data type that is often more precise than double-precision.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |