29.10.2014 Views

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Compiler</strong> Coding Practices<br />

5.65 Hexadecimal floating-point numbers in C99<br />

C99 supports floating-point numbers that can be written in hexadecimal <strong>for</strong>mat. For example:<br />

float hex_floats(void)<br />

{<br />

return 0x1.fp3; // 1 15/16 * 2^3<br />

}<br />

In hexadecimal <strong>for</strong>mat <strong>the</strong> exponent is a decimal number that indicates <strong>the</strong> power of two by<br />

which <strong>the</strong> significant part is multiplied. There<strong>for</strong>e 0x1.fp3 = 1.9375 * 8 = 1.55e1.<br />

C99 also adds %a and %A <strong>for</strong>mat <strong>for</strong> printf().<br />

5.65.1 See also<br />

Concepts<br />

• New language features of C99 on page 5-77.<br />

<strong>ARM</strong> DUI 0375C Copyright © 2007-2008, 2011 <strong>ARM</strong>. All rights reserved. 5-83<br />

ID061811<br />

Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!