IEEE754 fp

Discussion in 'C Programming' started by Ravishankar S, Feb 14, 2008.

  1. Hello C-Experts,

    Is there any predefined constant in Std C which specifed that the
    implementation uses the IEEE754
    standard for floating point operation ?

    Regards,
    Ravishankar
     
    Ravishankar S, Feb 14, 2008
    #1
    1. Advertising

  2. Ravishankar S

    Ben Pfaff Guest

    "Ravishankar S" <> writes:

    > Is there any predefined constant in Std C which specifed that the
    > implementation uses the IEEE754
    > standard for floating point operation ?


    C99 has __STDC_IEC_559__:

    F.1 Introduction
    1 This annex specifies C language support for the IEC 60559
    floating-point standard. The IEC 60559 floating-point
    standard is specifically Binary floating-point arithmetic
    for microprocessor systems, second edition (IEC 60559:1989),
    previously designated IEC 559:1989 and as IEEE Standard for
    Binary Floating-Point Arithmetic (ANSI/IEEE 754-1985). IEEE
    Standard for Radix-Independent Floating-Point Arithmetic
    (ANSI/IEEE 854-1987) generalizes the binary standard to
    remove dependencies on radix and word length. IEC 60559
    generally refers to the floating-point standard, as in IEC
    60559 operation, IEC 60559 format, etc. An implementation
    that defines __STDC_IEC_559__ shall conform to the
    specifications in this annex. Where a binding between the C
    language and IEC 60559 is indicated, the IEC 60559-specified
    behavior is adopted by reference, unless stated otherwise.

    --
    "When in doubt, treat ``feature'' as a pejorative.
    (Think of a hundred-bladed Swiss army knife.)"
    --Kernighan and Plauger, _Software Tools_
     
    Ben Pfaff, Feb 14, 2008
    #2
    1. Advertising

  3. Ravishankar S wrote:
    > Hello C-Experts,
    >
    > Is there any predefined constant in Std C which specifed that the
    > implementation uses the IEEE754
    > standard for floating point operation ?


    Note that the ANSI/IEEE 754, ANSI/IEEE 854, and IEC 559 designations
    have been superseded by IEEE 60559.

    If the implementation defines __STDC_IEC_559__ (the old name is used in
    the macro) then the implementation shall conform to IEC 60559, in the
    way specified in the annex to the C standard.
     
    Martin Ambuhl, Feb 14, 2008
    #3
  4. Ravishankar S

    Army1987 Guest

    Ravishankar S wrote:

    > Hello C-Experts,
    >
    > Is there any predefined constant in Std C which specifed that the
    > implementation uses the IEEE754
    > standard for floating point operation ?

    __STDC_IEC_559__
    But note that there are many implementations which partially conform to
    the Annex F, and do not define __STDC_IEC_559__, even if, for example,
    floating point numbers are stored with the IEEE754 representation.


    --
    Army1987 (Replace "NOSPAM" with "email")
     
    Army1987, Feb 14, 2008
    #4
    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. Pavel
    Replies:
    13
    Views:
    933
    Richard Herring
    Mar 14, 2008
  2. Malcolm McLean

    Portable IEEE754 write routine

    Malcolm McLean, Feb 17, 2010, in forum: C Programming
    Replies:
    7
    Views:
    605
    Ben Pfaff
    Feb 19, 2010
Loading...

Share This Page