Multiple precise: how to make 16bytes double ???

Discussion in 'C++' started by Auronc, Aug 26, 2004.

  1. Auronc

    Auronc Guest

    In VC, the data type "double" has 8-bytes length.
    For calculating precisely,I have to make more long floating-point,like
    16bytes or more.
    Somebody could give me a hint or maybe some free source code could be
    downloaded. Thanks for your help.
     
    Auronc, Aug 26, 2004
    #1
    1. Advertising

  2. Auronc wrote:
    > In VC, the data type "double" has 8-bytes length.
    > For calculating precisely,I have to make more long floating-point,like
    > 16bytes or more.
    > Somebody could give me a hint or maybe some free source code could be
    > downloaded. Thanks for your help.


    Here is something I've been using:

    ftp://pennware.com/pub/number

    It has several flaws:

    1. It is one of the first C++ classes that I wrote. I need to go back
    and clean it up. ;-)

    2. It was written to support by compiler development and has endian
    support in it. I'll probably change the endian support to allow
    retrieving numbers in a given endianness at some point. Although I uses
    the endianess to simplify number <-> integer conversions now.

    3. It uses "long long" and is probably only usable with gnu-c++. (Ding!
    Ding! Ding! off topic for this group!)

    4. Eventually I'm going to enhance it to support fixed formats and
    restricted size formats to support the machines I'll be targeting with
    the compiler.

    5. You may not want to use it for computationally intensive
    applications. I haven't benchmarked it, but I'd guess it isn't a speed
    demon.

    6. There is a basic assumption in the code that sizeof(long long) is
    twice the size of sizeof(long). I use this for multi-precision multiply.

    7. It also assumes a byte is 8 bits.

    8. Given all of the above: This code is NOT STANDARD C++ and is NOT
    NECESSARILY PORTABLE.

    What it can do:

    1. It implements a floating point number format with a long sized
    exponent and N longs in the mantissa. The current source has N a
    compiler time option with N being 3 for a 96 bit mantissa.

    2. Add, subtract, multiply, divide, compare, etc.

    3. It works, mostly. ;-)

    4. It is provided as-is, with no guarantees.

    -Rich

    --
    Richard Pennington
    Email:
    http://www.pennware.com ftp://ftp.pennware.com
     
    Richard Pennington, Aug 26, 2004
    #2
    1. Advertising

  3. Auronc

    Ron Natalie Guest

    "Auronc" <> wrote in message news:...
    > In VC, the data type "double" has 8-bytes length.
    > For calculating precisely,I have to make more long floating-point,like
    > 16bytes or more.
    > Somebody could give me a hint or maybe some free source code could be
    > downloaded. Thanks for your help.


    google for "arbitrary precision math"
     
    Ron Natalie, Aug 26, 2004
    #3
    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. Joseph
    Replies:
    2
    Views:
    943
    Ben Twijnstra
    May 8, 2005
  2. Moritz Beller
    Replies:
    2
    Views:
    530
    Chris Theis
    Sep 19, 2004
  3. Sydex
    Replies:
    12
    Views:
    6,602
    Victor Bazarov
    Feb 17, 2005
  4. DAVID SCHULMAN

    When (32-bit) double precision isn't precise enough

    DAVID SCHULMAN, Sep 10, 2003, in forum: C Programming
    Replies:
    5
    Views:
    649
    John L
    Sep 12, 2003
  5. Andy
    Replies:
    11
    Views:
    693
    Keith Thompson
    Jun 1, 2010
Loading...

Share This Page