Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #25236

Re: OxCp syntax ?

From Nobody <nobody@nowhere.com>
Subject Re: OxCp syntax ?
Date 2012-08-28 14:17 +0100
Message-Id <pan.2012.08.28.13.18.11.113000@nowhere.com>
Newsgroups comp.lang.c
References <k1ia14$kjn$1@ccpntc8.in2p3.fr>
Organization Zen Internet

Show all headers | View raw


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.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

OxCp syntax ? Guillaume Dargaud <use_the_contact_form@www.gdargaud.net> - 2012-08-28 13:28 +0200
  Re: OxCp syntax ? Les Cargill <lcargill99@comcast.com> - 2012-08-28 07:30 -0500
    Re: OxCp syntax ? Les Cargill <lcargill99@comcast.com> - 2012-08-28 07:41 -0500
  Re: OxCp syntax ? James Kuyper <jameskuyper@verizon.net> - 2012-08-28 09:00 -0400
    Re: OxCp syntax ? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-28 09:10 -0400
      Re: OxCp syntax ? James Kuyper <jameskuyper@verizon.net> - 2012-08-28 09:58 -0400
  Re: OxCp syntax ? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-28 09:02 -0400
    Re: OxCp syntax ? Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2012-08-29 19:16 +0200
  Re: OxCp syntax ? Nobody <nobody@nowhere.com> - 2012-08-28 14:17 +0100
  Re: OxCp syntax ? Guillaume Dargaud <use_the_contact_form@www.gdargaud.net> - 2012-08-29 17:50 +0200

csiph-web