Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Re: OxCp syntax ? (http://www.velocityreviews.com/forums/t951489-re-oxcp-syntax.html)

Nobody 08-28-2012 01:17 PM

Re: OxCp syntax ?
 
On Tue, 28 Aug 2012 13:28:35 +0200, Guillaume Dargaud wrote:

> I just ran across this syntax:
> #define NAN 0xCp125f
> Can somebody explain ? A quick googling turned out nothing.


It's a hexadecimal floating-point constant (see 6.4.4.2).

"0x" is the hexadecimal prefix.
"C" is the value of the significand (mantissa) in hex, i.e. 12 decimal.
"p" is the binary exponent indicator (binary version of "e").
"125" is the binary exponent in decimal.
"f" is the "float" (single-precision) suffix.

So: 0xCp125f is 12*2^125 ~= 5.104e+38.



All times are GMT. The time now is 03:59 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.