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

A

Auronc

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.
 
R

Richard Pennington

Auronc said:
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
 
R

Ron Natalie

Auronc said:
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"
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top