473,940 Members | 9,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Small High-precision Arithmetic Library

I'm looking for a very basic high-precision arithmetic library. I
need to be able to specify a fixed number of bits or decimal digits
(32 decimal digits should be all I need). The only arithmetic
functions I need are addition, subtraction, multiplication, division,
square-root, and comparison (i.e. less-than, greater-than, equal).
Preferably this should be in C++ but I could use C by putting
everything into a single class. I looked at a couple of packages but
they were massive in size, a huge overkill for my needs. I don't need
arbitrary precision, FFT-based multiplication, etc. I could write my
own package but this task seems like a common enough need that I would
be surprised if there aren't some freeware or shareware packages much
more suited to my needs. Any suggestions on an efficient small
package that handles a fixed number of digits?

If you want to respond by email, then use the following email address
(I use the volcanomail address only for reading and posting to
newsgroups and other public forums -- to avoid spammers.)

rhoads "at" cs "dot" rutgers "dot" edu

Jul 19 '07 #1
7 3818
GCRhoads wrote:
I'm looking for a very basic high-precision arithmetic library. I
need to be able to specify a fixed number of bits or decimal digits
(32 decimal digits should be all I need). The only arithmetic
functions I need are addition, subtraction, multiplication, division,
square-root, and comparison (i.e. less-than, greater-than, equal).
[..]
If you use a template library, your compiler will only create code
for the functions you use. Advice: try to avoid setting the limits
for yourself ahead of time, remember what happened to "640 Kbytes
should be enough for anybody"?

Take a look at CGAL, as part of it there is a numeric kernel that is
(AIUI) programmed as templates and contains part with arbitrary
precision floating points. It may be too much for your small task,
then look into OONumerics. Also, I searched for "arbitrary precision
floating point template" for you on Google and the first link that
comes up also looks promising.

Try not to cross-post to c.l.c++ AND c.l.c.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 19 '07 #2
GCRhoads wrote:
I'm looking for a very basic high-precision arithmetic library. I
need to be able to specify a fixed number of bits or decimal digits
(32 decimal digits should be all I need). The only arithmetic
functions I need are addition, subtraction, multiplication, division,
square-root, and comparison (i.e. less-than, greater-than, equal).
Preferably this should be in C++ but I could use C by putting
everything into a single class. I looked at a couple of packages but
they were massive in size, a huge overkill for my needs. I don't need
arbitrary precision, FFT-based multiplication, etc. I could write my
own package but this task seems like a common enough need that I would
be surprised if there aren't some freeware or shareware packages much
more suited to my needs. Any suggestions on an efficient small
package that handles a fixed number of digits?
Googling "high precision arithmetic library" should yield something
useful to you.

Off the top of my head, there is GMP.
--
clvrmnky <mailto:sp***** *@clevermonkey. org>

Direct replies will be blacklisted. Replace "spamtrap" with my name to
contact me directly.
Jul 19 '07 #3
GCRhoads <GC******@volca nomail.comwrite s:
I'm looking for a very basic high-precision arithmetic library. I
need to be able to specify a fixed number of bits or decimal digits
(32 decimal digits should be all I need). The only arithmetic
functions I need are addition, subtraction, multiplication, division,
square-root, and comparison (i.e. less-than, greater-than, equal).
Preferably this should be in C++ but I could use C by putting
everything into a single class. I looked at a couple of packages but
they were massive in size, a huge overkill for my needs. I don't need
arbitrary precision, FFT-based multiplication, etc. I could write my
own package but this task seems like a common enough need that I would
be surprised if there aren't some freeware or shareware packages much
more suited to my needs. Any suggestions on an efficient small
package that handles a fixed number of digits?

If you want to respond by email, then use the following email address
(I use the volcanomail address only for reading and posting to
newsgroups and other public forums -- to avoid spammers.)

rhoads "at" cs "dot" rutgers "dot" edu
Do you know about D. H. Bailey's work?

http://crd.lbl.gov/~dhbailey/

See, especially his ARBPREC package:

http://crd.lbl.gov/~dhbailey/mpdist/index.html

Chip
Jul 19 '07 #4
On Wed, 18 Jul 2007 19:46:15 -0700, in comp.lang.c , GCRhoads
<GC******@volca nomail.comwrote :
>I'm looking for a very basic high-precision arithmetic library.
This isn't either a C or C++ question - did you try googling? Or
asking in comp.programmin g?
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 19 '07 #5
Mark McIntyre <ma**********@s pamcop.netwrite s:
On Wed, 18 Jul 2007 19:46:15 -0700, in comp.lang.c , GCRhoads
<GC******@volca nomail.comwrote :
>>I'm looking for a very basic high-precision arithmetic library.

This isn't either a C or C++ question - did you try googling? Or
asking in comp.programmin g?
It could be either. He is clearly looking, one can assume, for a C or
C++ library to interface too.
Jul 20 '07 #6
On Jul 19, 11:26 am, Chip Coldwell <coldw...@gmail .invalidwrote:
GCRhoads <GCRho...@volca nomail.comwrite s:
I'm looking for a very basic high-precision arithmetic library. I
need to be able to specify a fixed number of bits or decimal digits
(32 decimal digits should be all I need). The only arithmetic
functions I need are addition, subtraction, multiplication, division,
square-root, and comparison (i.e. less-than, greater-than, equal).
Preferably this should be in C++ but I could use C by putting
everything into a single class. I looked at a couple of packages but
they were massive in size, a huge overkill for my needs. I don't need
arbitrary precision, FFT-based multiplication, etc. I could write my
own package but this task seems like a common enough need that I would
be surprised if there aren't some freeware or shareware packages much
more suited to my needs. Any suggestions on an efficient small
package that handles a fixed number of digits?
If you want to respond by email, then use the following email address
(I use the volcanomail address only for reading and posting to
newsgroups and other public forums -- to avoid spammers.)
rhoads "at" cs "dot" rutgers "dot" edu

Do you know about D. H. Bailey's work?

http://crd.lbl.gov/~dhbailey/

See, especially his ARBPREC package:

http://crd.lbl.gov/~dhbailey/mpdist/index.html
Right link, wrong package.
If he wants 32 digits, then QD is the package:
http://crd.lbl.gov/~dhbailey/mpdist/qd-2.2.5.tar.gz
For Windows users, try this implementation:
http://www.cs.berkeley.edu/~yozo/sof...2.4-windll.zip

ARPREC is for gazillion digit stuff. The QD package has double double
and quad double, which sounds like it is right in the O.P.'s
wheelhouse.

Jul 20 '07 #7
On Jul 19, 3:36 pm, Mark McIntyre <markmcint...@s pamcop.netwrote :
On Wed, 18 Jul 2007 19:46:15 -0700, in comp.lang.c , GCRhoads

<GCRho...@volca nomail.comwrote :
I'm looking for a very basic high-precision arithmetic library.

This isn't either a C or C++ question - did you try googling? Or
asking in comp.programmin g?
I agree that Google is the best bet.
SourceForge is always worth a look.
And if those do not pan out, then this sort of thing is suited to
news:sci.math.n um-analysis

Jul 20 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

48
3004
by: Bulba! | last post by:
I'll soon start development of a specialized small app and need to choose GUI for it. I have narrowed the choice to wxPython/PythonCard and QT/PyQT (buying commercial licenses is not a big problem, the company would pay for it). Which is better for this kind of application? I mean, looking from purely technological and long-term development aspects and ignoring licensing issues:
1
3013
by: David Franit | last post by:
Hello, I am looking at tuning NUM_POOLAGENTS for many v7.x and v8.x UDB instances. Aside from logging into each instance and running 'db2 list applications', or writing a script to do so, is there any way to determine the average number of connections to an instance? Also, without getting into detailed hardware information, we have many DB2 instances on a server whose bottleneck is usually RAM/paging space as opposed to CPU. I thought...
3
1543
by: Vjay77 | last post by:
As a result from who is I am getting this: > > NOTICE AND TERMS OF USE: You are not authorized to access or query our WHOIS database through the use of high-volume, automated, electronic processes. The Data in Network Solutions' WHOIS database is provided by Network Solutions for information purposes only, and to assist persons in obtaining information about or related to a domain name registration record. Network Solutions does not...
13
3142
by: Alan Silver | last post by:
Hello, MSDN (amongst other places) is full of helpful advice on ways to do data access, but they all seem geared to wards enterprise applications. Maybe I'm in a minority, but I don't have those sorts of clients. Mine are all small businesses whose sites will never reach those sorts of scales. I deal with businesses whose sites get maybe a few hundred visitors per day (some not even that much) and get no more than ten orders per day....
8
3252
by: Joe | last post by:
Hi trying to write some code to determine if user has large/small fonts set on PC thought this would work but it didn't Any suggestions??? Thanks Graphics g = Graphics.FromHwnd(this.Handle);
4
2055
by: =?Utf-8?B?VzFsZDBuZTc0?= | last post by:
When one architects a new project one of the first steps in the decision is to decide on the layers. (In my opinion anyway) One architecture that I have used before is to go solid OO and create objects, which normally are very small and only deals with the stuff pertaining to that object, then break it down into Business Process, Process Controllers and Data Access Objects for each "Object", each of which is created in it's very own .Net...
169
9297
by: JohnQ | last post by:
(The "C++ Grammer" thread in comp.lang.c++.moderated prompted this post). It would be more than a little bit nice if C++ was much "cleaner" (less complex) so that it wasn't a major world wide untaking to create a toolchain for it. Way back when, there used to be something called "Small C". I wonder if the creator(s) of that would want to embark on creating a nice little Small C++ compiler devoid of C++ language features that make...
6
2005
by: =?Utf-8?B?Q2hpV2hpdGVTb3g=?= | last post by:
hi all on our IIS6 we tried to update the asp version of a particular website from 1.1 to 2.0. Leaving other sites on the same server as ASP version 1.1 But when we go to the client and check our other sites from the same server, it's not able to do so or saying that famous msg, "Page cannot be displayed" any ideas or thoughts?
0
1686
by: mrchatgroup | last post by:
news from http://www.mrchat.net/myblog/myblog/small-accidents-mean-big-trouble-for-supercollider.html Small Accidents Mean Big Trouble for Supercollider Image Scientists expect startup glitches in the massive, complex machines they use to smash atoms.
0
10134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9963
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11110
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11293
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10659
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8218
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7389
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.