Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Multiple precise: how to make 16bytes double ???

Reply
Thread Tools

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

 
 
Auronc
Guest
Posts: n/a
 
      08-26-2004
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.
 
Reply With Quote
 
 
 
 
Richard Pennington
Guest
Posts: n/a
 
      08-26-2004
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

 
Reply With Quote
 
 
 
 
Ron Natalie
Guest
Posts: n/a
 
      08-26-2004

"Auronc" <> wrote in message news: om...
> 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"

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
from List <double> to double[] Web learner ASP .Net 3 04-26-2006 05:26 PM
Should I be concerned about buying DVD18s (Double-sided, double-layered) The Man With No Name DVD Video 3 02-04-2006 01:45 AM
cannot convert parameter from 'double (double)' to 'double (__cdecl *)(double)' error Sydex C++ 12 02-17-2005 06:30 PM
Double double display display problem problem Tom Accuosti Firefox 3 09-27-2004 10:02 PM



Advertisments