Re: OxCp syntax ?

Discussion in 'C Programming' started by Nobody, Aug 28, 2012.

  1. Nobody

    Nobody Guest

    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.
    Nobody, Aug 28, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gabriele renzi
    Replies:
    2
    Views:
    192
    gabriele renzi
    Dec 31, 2005
  2. Ken Bloom
    Replies:
    3
    Views:
    192
  3. Les Cargill

    Re: OxCp syntax ?

    Les Cargill, Aug 28, 2012, in forum: C Programming
    Replies:
    1
    Views:
    310
    Les Cargill
    Aug 28, 2012
  4. James Kuyper

    Re: OxCp syntax ?

    James Kuyper, Aug 28, 2012, in forum: C Programming
    Replies:
    2
    Views:
    318
    James Kuyper
    Aug 28, 2012
  5. Vincenzo Mercuri

    Re: OxCp syntax ?

    Vincenzo Mercuri, Aug 29, 2012, in forum: C Programming
    Replies:
    0
    Views:
    328
    Vincenzo Mercuri
    Aug 29, 2012
Loading...

Share This Page