From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/gcc~13/hex-floats.html | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 devdocs/gcc~13/hex-floats.html (limited to 'devdocs/gcc~13/hex-floats.html') diff --git a/devdocs/gcc~13/hex-floats.html b/devdocs/gcc~13/hex-floats.html new file mode 100644 index 00000000..1e023a00 --- /dev/null +++ b/devdocs/gcc~13/hex-floats.html @@ -0,0 +1,6 @@ +

6.15 Hex Floats

ISO C99 and ISO C++17 support floating-point numbers written not only in the usual decimal notation, such as 1.55e1, but also numbers such as 0x1.fp3 written in hexadecimal format. As a GNU extension, GCC supports this in C90 mode (except in some cases when strictly conforming) and in C++98, C++11 and C++14 modes. In that format the ‘0x’ hex introducer and the ‘p’ or ‘P’ exponent field are mandatory. The exponent is a decimal number that indicates the power of 2 by which the significant part is multiplied. Thus ‘0x1.f’ is 1 15/16, ‘p3’ multiplies it by 8, and the value of 0x1.fp3 is the same as 1.55e1.

Unlike for floating-point numbers in the decimal notation the exponent is always required in the hexadecimal notation. Otherwise the compiler would not be able to resolve the ambiguity of, e.g., 0x1.f. This could mean 1.0f or 1.9375 since ‘f’ is also the extension for floating-point constants of type float.

+

+ © Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
+ https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Hex-Floats.html +

+
-- cgit v1.2.3