By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,433 Members | 1,827 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,433 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.
Jul 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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: ri**@pennware.com
http://www.pennware.com ftp://ftp.pennware.com

Jul 22 '05 #2

P: n/a

"Auronc" <au****@sinamail.com> wrote in message news:bf**************************@posting.google.c 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"

Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.