long double range

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lssainath
    New Member
    • Dec 2008
    • 1

    long double range

    can somebody explain how the "long double" is stored in memory. what is the decimal range it can store? I would like to know abt the 128 bit long double not the extended 80 bit double.
    Thanks in advance
  • vmpstr
    New Member
    • Nov 2008
    • 63

    #2
    Googling long double gets me to this article:
    Long double - Wikipedia, the free encyclopedia

    Reading about it, and narrowing it down to 128 bit long double, makes me click a link in that article to the following article:

    Quadruple precision - Wikipedia, the free encyclopedia

    That one describes how it is stored, it's ranges, and some examples. Finishing with the first article, I get the impression that long double is very much system dependent.

    hope this helps.

    Comment

    • YarrOfDoom
      Recognized Expert Top Contributor
      • Aug 2007
      • 1243

      #3
      I can't tell you for 128bit long doubles, because my compiler has 80bit long doubles, but you should be able to check for yourself.
      Just include <cfloat>, and then you'll have access to LDBL_MIN and LDBL_MAX (minimum and maximum value you can store in a long double). Additionally, you also have access to LDBL_MIN_10_EXP and LDBL_MAX_10_EXP , the minimum and maximum values for the exponent.
      Finally, there's also LDBL_MANT_DIG, which is how many bits are used to store the significant.

      @vmpstr: I believe they are compiler dependent

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        long double is platform and compiler dependent. That is you are unlikely to find them on a platform what has no hardware support for larger precision floating point and even if there is hardware support for them you don't always get them for every compiler.

        MSVC is a good example I believe it does not support and precision beyond double even on the Intel platforms that I believe support 80 bit floating point operations and this precision can be used through gcc.

        Note that the type long double is always valid but that on platforms without support for higher precision floating point operations it will default to the same precision as a double.

        Comment

        Working...