5.64 Hexadecimal floating-point numbers in C99

C99 supports floating-point numbers that can be written in hexadecimal format.

For example:

float hex_floats(void)
{
    return 0x1.fp3; // 1 15/16 * 2^3
}

In hexadecimal format the exponent is a decimal number that indicates the power of two by which the significant part is multiplied. Therefore 0x1.fp3 = 1.9375 * 8 = 1.55e1.

C99 also adds %a and %A format for printf().

Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.