468,765 Members | 949 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

Is there a bigger data type in c than the double one?

Is there a bigger, mathematical, data type in C than the double (64 bit) one
or the old long double (80 bit)?
I'd like to add precision to my mathematical application, but I can't figure
out how.
Thanks alot.
Nov 14 '05 #1
33 7178
>Is there a bigger, mathematical, data type in C than the double (64 bit) one
or the old long double (80 bit)?
C doubles are not guaranteed to be 64 bits.
long double is not guaranteed to be 80 bits, and why is it the *OLD*
long double?

Do you have floating-point hardware that uses more than 80 bits
to represent a number?
I'd like to add precision to my mathematical application, but I can't figure
out how.


An int could conceivably be 128 bits, although if your machine has
128-bit operations, the 128-bit integer type is more likely long long.

Gordon L. Burditt
Nov 14 '05 #2
"Gordon Burditt" <go***********@burditt.org> ha scritto nel messaggio
news:co********@library1.airnews.net...
Is there a bigger, mathematical, data type in C than the double (64 bit) oneor the old long double (80 bit)?


C doubles are not guaranteed to be 64 bits.
long double is not guaranteed to be 80 bits, and why is it the *OLD*
long double?

Do you have floating-point hardware that uses more than 80 bits
to represent a number?
I'd like to add precision to my mathematical application, but I can't figureout how.


An int could conceivably be 128 bits, although if your machine has
128-bit operations, the 128-bit integer type is more likely long long.

Gordon L. Burditt


My machine is a p4 pc using Windowsme;
I would like to add decimals to my results example instead of
17 decimals 30 or 40.
Nov 14 '05 #3
Daniel Fadlun wrote:
"Gordon Burditt" <go***********@burditt.org> ha scritto nel messaggio
news:co********@library1.airnews.net...
Is there a bigger, mathematical, data type in C than the double (64 bit)
one
or the old long double (80 bit)?


C doubles are not guaranteed to be 64 bits.
long double is not guaranteed to be 80 bits, and why is it the *OLD*
long double?

Do you have floating-point hardware that uses more than 80 bits
to represent a number?

I'd like to add precision to my mathematical application, but I can't
figure
out how.


An int could conceivably be 128 bits, although if your machine has
128-bit operations, the 128-bit integer type is more likely long long.

Gordon L. Burditt

My machine is a p4 pc using Windowsme;
I would like to add decimals to my results example instead of
17 decimals 30 or 40.


That's 100-133 significand bits. H-format numbers on
the VAX could approach the lower end (I don't recall just
how many of its 128 bits were exponent), but I'm not aware
of any C compiler that made use of H-format.

The big question, though, is why do you want so many
digits? What meaning could you assign to a plus-or-minus
one fluctuation in the fortieth decimal place? If you're
trying to calculate the radius of the Universe in Angstrom
units, forty places are far more than you need.

--
Er*********@sun.com

Nov 14 '05 #4
Eric Sosman wrote:
Daniel Fadlun wrote:
"Gordon Burditt" <go***********@burditt.org> ha scritto nel messaggio
news:co********@library1.airnews.net...

Is there a bigger, mathematical, data type in C than the double (64 bit)


one

or the old long double (80 bit)?

C doubles are not guaranteed to be 64 bits.
long double is not guaranteed to be 80 bits, and why is it the *OLD*
long double?

Do you have floating-point hardware that uses more than 80 bits
to represent a number?

I'd like to add precision to my mathematical application, but I can't


figure

out how.

An int could conceivably be 128 bits, although if your machine has
128-bit operations, the 128-bit integer type is more likely long long.

Gordon L. Burditt

My machine is a p4 pc using Windowsme;
I would like to add decimals to my results example instead of
17 decimals 30 or 40.

That's 100-133 significand bits. H-format numbers on
the VAX could approach the lower end (I don't recall just
how many of its 128 bits were exponent), but I'm not aware
of any C compiler that made use of H-format.

The big question, though, is why do you want so many
digits? What meaning could you assign to a plus-or-minus
one fluctuation in the fortieth decimal place? If you're
trying to calculate the radius of the Universe in Angstrom
units, forty places are far more than you need.


I'll be sorry I did this but..

angstrom
n : a metric unit of length equal to one ten billionth of a
meter (or 0.0001 micron); used to specify wavelengths of
electromagnetic radiation [syn: angstrom unit, A]

...and so 1 meter is 10,000,000,000 angstroms.

The speed of Light is 300 million meters per second. In angstroms we
have 1e10 * 3e8. That would bring us to 3e18 or

3,000,000,000,000,000,000

angstroms per second Light speed. That's only 19 digits but it's
only one second. I'm not sure the 'correct' seconds per year but 60
* 60 * 24 * 365.25 yields 31,557,600 seconds. One Light Year would
be about 9.46728e25 angstroms. Let's say 1e26 angstroms.

Ah now, what is the radius of the Universe? Even if we thought it
could be 10 billion Light Years that would be 1e10 and would be only
1e36 angstroms. Eric is right. 40 digits will be enough.

How many digits can a 128-bit int represent? 40?

I'm right after all. I'm sorry I did this. ;-)

--
Joe Wright mailto:jo********@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 14 '05 #5
"Daniel Fadlun" <mu**********@fastwebnet.it> wrote in message news:<pF*****************@tornado.fastwebnet.it>.. .
"Gordon Burditt" <go***********@burditt.org> ha scritto nel messaggio
news:co********@library1.airnews.net...
Is there a bigger, mathematical, data type in C than the double (64 bit) oneor the old long double (80 bit)?


C doubles are not guaranteed to be 64 bits.
long double is not guaranteed to be 80 bits, and why is it the *OLD*
long double?

Do you have floating-point hardware that uses more than 80 bits
to represent a number?
I'd like to add precision to my mathematical application, but I can't figureout how.


An int could conceivably be 128 bits, although if your machine has
128-bit operations, the 128-bit integer type is more likely long long.

Gordon L. Burditt


My machine is a p4 pc using Windowsme;
I would like to add decimals to my results example instead of
17 decimals 30 or 40.


Do you know how to implement big big number addition/subtraction etc
using arrays/linked lists(yes, you do the operations by hand).You can
try the
same for figures following the decimal point.So conceptually you will
be adding elements of two arrays.You just keep an index as to where to
put the decimal point while printing.

If you are through with this, or this is way too inefficent, think how
you can
use the array element to hold more than one integer (as in 1 of 3.21).

HTH
Suman.
Nov 14 '05 #6
Daniel Fadlun wrote:
Is there a bigger, mathematical, data type in C than the double (64 bit) one
or the old long double (80 bit)?
I'd like to add precision to my mathematical application, but I can't figure
out how.
Thanks alot.

With lcc-win32 you can use the qfloat data type with 350 bits and
approx 100 digits precision.

You use just as the other data types:

qfloat m = 23.3;

qfloat p = exp(m,6.0);

etc

lcc-win32:
http://www.cs.virginia.edu/~lcc-win32
Nov 14 '05 #7
Neo

"Joe Wright" <jo********@comcast.net> wrote in message
news:Pp********************@comcast.com...
Eric Sosman wrote:
Daniel Fadlun wrote:
"Gordon Burditt" <go***********@burditt.org> ha scritto nel messaggio
news:co********@library1.airnews.net...
>Is there a bigger, mathematical, data type in C than the double (64
>bit)

one
>or the old long double (80 bit)?

C doubles are not guaranteed to be 64 bits.
long double is not guaranteed to be 80 bits, and why is it the *OLD*
long double?

Do you have floating-point hardware that uses more than 80 bits
to represent a number?

>I'd like to add precision to my mathematical application, but I can't

figure
>out how.

An int could conceivably be 128 bits, although if your machine has
128-bit operations, the 128-bit integer type is more likely long long.

Gordon L. Burditt
My machine is a p4 pc using Windowsme;
I would like to add decimals to my results example instead of
17 decimals 30 or 40.

That's 100-133 significand bits. H-format numbers on
the VAX could approach the lower end (I don't recall just
how many of its 128 bits were exponent), but I'm not aware
of any C compiler that made use of H-format.

The big question, though, is why do you want so many
digits? What meaning could you assign to a plus-or-minus
one fluctuation in the fortieth decimal place? If you're
trying to calculate the radius of the Universe in Angstrom
units, forty places are far more than you need.


I'll be sorry I did this but..

angstrom
n : a metric unit of length equal to one ten billionth of a
meter (or 0.0001 micron); used to specify wavelengths of
electromagnetic radiation [syn: angstrom unit, A]

..and so 1 meter is 10,000,000,000 angstroms.

The speed of Light is 300 million meters per second. In angstroms we have
1e10 * 3e8. That would bring us to 3e18 or

3,000,000,000,000,000,000

angstroms per second Light speed. That's only 19 digits but it's only one
second. I'm not sure the 'correct' seconds per year but 60 * 60 * 24 *
365.25 yields 31,557,600 seconds. One Light Year would be about 9.46728e25
angstroms. Let's say 1e26 angstroms.

Ah now, what is the radius of the Universe? Even if we thought it could be
10 billion Light Years that would be 1e10 and would be only 1e36
angstroms. Eric is right. 40 digits will be enough.

How many digits can a 128-bit int represent? 40?

I'm right after all. I'm sorry I did this. ;-)

--
Joe Wright mailto:jo********@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---


gud wrk n nice explanation.
-Neo
Nov 14 '05 #8
On Tue, 23 Nov 2004 17:58:02 -0500, Eric Sosman <er*********@sun.com>
wrote in comp.lang.c:
Daniel Fadlun wrote:
"Gordon Burditt" <go***********@burditt.org> ha scritto nel messaggio
news:co********@library1.airnews.net...
Is there a bigger, mathematical, data type in C than the double (64 bit)


one
or the old long double (80 bit)?

C doubles are not guaranteed to be 64 bits.
long double is not guaranteed to be 80 bits, and why is it the *OLD*
long double?

Do you have floating-point hardware that uses more than 80 bits
to represent a number?
I'd like to add precision to my mathematical application, but I can't


figure
out how.

An int could conceivably be 128 bits, although if your machine has
128-bit operations, the 128-bit integer type is more likely long long.

Gordon L. Burditt

My machine is a p4 pc using Windowsme;
I would like to add decimals to my results example instead of
17 decimals 30 or 40.


That's 100-133 significand bits. H-format numbers on
the VAX could approach the lower end (I don't recall just
how many of its 128 bits were exponent), but I'm not aware
of any C compiler that made use of H-format.

The big question, though, is why do you want so many
digits? What meaning could you assign to a plus-or-minus
one fluctuation in the fortieth decimal place? If you're
trying to calculate the radius of the Universe in Angstrom
units, forty places are far more than you need.


Often the need for high precision is not for either the input data or
output results, but to minimize the inevitable rounding (and other)
errors in complex calculations.

But even for that purpose, 30 to 40 decimal places seems excessive.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #9

"Joe Wright" <jo********@comcast.net> wrote in message
news:Pp********************@comcast.com...
How many digits can a 128-bit int represent? 40?


unsigned: floor(log10(2^n)) + 1
signed: floor(log10(2^(n-1))) + 1

Assuming 2's complement is used. Which by the way poses the queston wether
or not 2's complement is mandated/required by the standard or merely by many
CPU's (i assume it's the latter, but the question is a real one *and*
topical)

Nov 14 '05 #10
In <5q********************************@4ax.com> Jack Klein <ja*******@spamcop.net> writes:
Often the need for high precision is not for either the input data or
output results, but to minimize the inevitable rounding (and other)
errors in complex calculations.


And when this is the case, it is quite often due to an inappropriate
choice of the algorithm. If hardware support for 128 floats has never
been popular, it is because there is precious little *real* demand for
this kind of precision.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union
Nov 14 '05 #11
In article <41**********************@news.wanadoo.fr>, ja***@jacob.remcomp.fr
says...
Daniel Fadlun wrote:
Is there a bigger, mathematical, data type in C than the double (64 bit) one
or the old long double (80 bit)?
I'd like to add precision to my mathematical application, but I can't figure
out how.
Thanks alot.

With lcc-win32 you can use the qfloat data type with 350 bits and
approx 100 digits precision.

You use just as the other data types:

qfloat m = 23.3;

qfloat p = exp(m,6.0);

etc

lcc-win32:
http://www.cs.virginia.edu/~lcc-win32


Please stop posting unportable "my compiler only" solutions to problems in
c.l.c.

Nov 14 '05 #12
In article <41***********************@dreader16.news.xs4all.n l>,
dandelion <da*******@meadow.net> wrote:

"Joe Wright" <jo********@comcast.net> wrote in message
news:Pp********************@comcast.com...
How many digits can a 128-bit int represent? 40?
unsigned: floor(log10(2^n)) + 1
signed: floor(log10(2^(n-1))) + 1

Assuming 2's complement is used.


....or any other sensible way of encoding values in binary form without
using some bits for parity checking or error correcting. Some sensible
forms will have both positive and negative representations for zero,
but otherwise they'll use all 2^n possible bit patterns to represent
different values.
Ten bits is slightly more than three digits (2^10=1024), so without
calculating any logarithms 38-39 digits is a reasonable guess for
128-bit binary.
Which by the way poses the queston wether
or not 2's complement is mandated/required by the standard or merely by many
CPU's (i assume it's the latter, but the question is a real one *and*
topical)


Not required by the standard.

I believe C99 requires one of binary 2s-complement, binary 1s-complement,
or binary sign-magnitude for signed integer types. I'm not sure what
C90 has to say on the subject.
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
I've got [a 2-port hub]. It's so tiny that you can't see where the two
patch leads plug into it, & it's line-powered...
--Lionel in the scary devil monastery
Nov 14 '05 #13
dandelion wrote:
"Joe Wright" <jo********@comcast.net> wrote in message
news:Pp********************@comcast.com...

How many digits can a 128-bit int represent? 40?

unsigned: floor(log10(2^n)) + 1
signed: floor(log10(2^(n-1))) + 1

Assuming 2's complement is used. Which by the way poses the queston wether
or not 2's complement is mandated/required by the standard or merely by many
CPU's (i assume it's the latter, but the question is a real one *and*
topical)


The Standard permits two's complement, ones' complement,
and signed magnitude representations for negative integers.
Oddly, it *requires* two's complement for exact-width integer
types, if the implementation provides them.

--
Er*********@sun.com

Nov 14 '05 #14
In <41**********************@news.wanadoo.fr> jacob navia <ja***@jacob.remcomp.fr> writes:
Daniel Fadlun wrote:
Is there a bigger, mathematical, data type in C than the double (64 bit) one ^^^^ or the old long double (80 bit)?
I'd like to add precision to my mathematical application, but I can't figure
out how.
Thanks alot.

With lcc-win32 you can use the qfloat data type with 350 bits and
approx 100 digits precision.


What part of "in C" was too difficult for you to understand?

lcc-win32 is not a C compiler and qfloat is not a C feature.

Your advice is about as topical as "get a VAX/VMS box, rewrite your
code in FORTRAN and use the REAL*16 data type".

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union
Nov 14 '05 #15
On 24 Nov 2004 17:18:11 GMT, Da*****@cern.ch (Dan Pop) wrote:
In <41**********************@news.wanadoo.fr> jacob navia <ja***@jacob.remcomp.fr> writes: ....
With lcc-win32 you can use the qfloat data type with 350 bits and
approx 100 digits precision.


lcc-win32 is not a C compiler and qfloat is not a C feature.


Qfloat seems a 'vendor-specific' feature that seems a reasonable thing
to point out, especially as lcc-win32 is free.

Perhaps the OP's compiler has a similar extension. If portability is
not an issue, then go for it.

Otherwise there are BIGNUM-type libraries for arbitrary precision
arithmetic.

The answer to the OP's original question seems to be: No, nothing
beyond double/long double built-in to C. And the advice seems to be:
You don't need that much precision, which I would dispute..

Your advice is about as topical as "get a VAX/VMS box, rewrite your
code in FORTRAN and use the REAL*16 data type".


That's a good idea. Why not float*16 (or C equivalent syntax) in C?
Bart C.
Nov 14 '05 #16
Bart wrote:
On 24 Nov 2004 17:18:11 GMT, Da*****@cern.ch (Dan Pop) wrote:

In <41**********************@news.wanadoo.fr> jacob navia <ja***@jacob.remcomp.fr> writes:


...
With lcc-win32 you can use the qfloat data type with 350 bits and
approx 100 digits precision.


lcc-win32 is not a C compiler and qfloat is not a C feature.

Qfloat seems a 'vendor-specific' feature that seems a reasonable thing
to point out, especially as lcc-win32 is free.

Perhaps the OP's compiler has a similar extension. If portability is
not an issue, then go for it.

Otherwise there are BIGNUM-type libraries for arbitrary precision
arithmetic.

The answer to the OP's original question seems to be: No, nothing
beyond double/long double built-in to C. And the advice seems to be:
You don't need that much precision, which I would dispute..

Your advice is about as topical as "get a VAX/VMS box, rewrite your
code in FORTRAN and use the REAL*16 data type".

That's a good idea. Why not float*16 (or C equivalent syntax) in C?
Bart C.


An example where the extra precision is needed is... printf
To *implement* printf without greater precision than long double
means that round-off errors will creep in when processing the
"%lld" directive.

Most quality implementation of printf include a higher precision
module, see for instance the implementation of gcc.

lcc-win32 uses the qfloat package internally when reading and writing
floating point. The extra time that this uses is justified by
the greater accuracy of the printouts.

Nov 14 '05 #17
On Tue, 23 Nov 2004 22:51:17 +0100, "Daniel Fadlun"
<mu**********@fastwebnet.it> wrote:
Is there a bigger, mathematical, data type in C than the double (64 bit) one
or the old long double (80 bit)?
I'd like to add precision to my mathematical application, but I can't figure
out how.


yes GMP.

Introduction to GNU MP

GNU MP is a portable library written in C for arbitrary precision
arithmetic on integers, rational numbers, and floating-point numbers.
It aims to provide the fastest possible arithmetic for all
applications that need higher precision than is directly supported by
the basic C types.

ftp.gnu.org/gnu/gmp
Nov 14 '05 #18
jacob navia wrote:

[snip: Discussion about the topicality of qfloat in lcc-win32 and
the usefulness for the OP]
An example where the extra precision is needed is... printf
To *implement* printf without greater precision than long double
means that round-off errors will creep in when processing the
"%lld" directive.

Most quality implementation of printf include a higher precision
module, see for instance the implementation of gcc.

lcc-win32 uses the qfloat package internally when reading and writing
floating point. The extra time that this uses is justified by
the greater accuracy of the printouts.


You got me there -- what do you need long doubles for when you
want to print a signed long long int? I would have gone for an
efficient "itoa" variant but am aware that compiler builders
want the thing to be fast, and not necessarily conforming...

If there is a nice trick I would be very interested :-)

Apart from that: How bad can the rounding error be when only
working with long doubles? As every binary fraction has a
finite decimal fraction representation, it should be
theoretically possible to print out with a certain
rounding behaviour and no deviation (maybe I am too naive
with respect to the cost).
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 14 '05 #19
Michael Mair wrote:
jacob navia wrote:
You got me there -- what do you need long doubles for when you
want to print a signed long long int?
Jeeeeez.... Sorry about that. It should have been "%Ld" of course!!!
Excuse me.

Apart from that: How bad can the rounding error be when only
working with long doubles? As every binary fraction has a
finite decimal fraction representation, it should be
theoretically possible to print out with a certain
rounding behaviour and no deviation (maybe I am too naive
with respect to the cost).


The complications arise with sub-normal numbers, i.e. numbers
just below the normalization threshold, typically the results
of underflow. Gcc (and lcc-win32) can print those numbers with
great precision because of the extended precision module, where
the underflow is eliminated.

Other problems arise when trying to print the infamous *last*
digit accurately, because it must be rounded, and not truncated
as it would be staying with the given precision.

Nov 14 '05 #20
sa*****@hetnet.nl wrote:
On Tue, 23 Nov 2004 22:51:17 +0100, "Daniel Fadlun"
<mu**********@fastwebnet.it> wrote:

Is there a bigger, mathematical, data type in C than the double (64 bit) one
or the old long double (80 bit)?
I'd like to add precision to my mathematical application, but I can't figure
out how.

yes GMP.

Introduction to GNU MP

GNU MP is a portable library written in C for arbitrary precision
arithmetic on integers, rational numbers, and floating-point numbers.
It aims to provide the fastest possible arithmetic for all
applications that need higher precision than is directly supported by
the basic C types.

ftp.gnu.org/gnu/gmp

Nice package. It is approx twice as fast as lcc-win32.
It doesn't really run under windows though, and even if I have heard of
unsupported ports, nothing really official exist for windows, as far as
I know.

Please correct me if I am wrong.

It is twice as fast because it uses a variable precision number system,
reducing the number of calculations to be done for small numbers.
Besides it has a lot of assembly in it, maybe one of the reasons there
isn't a windows version (besides the cygwin emulator)

C library support is not provided with the package, i.e. all the
functions of the C library aren't supported even if it has the most
important ones (sqrt, etc).

All in all, the best thing around.

Nov 14 '05 #21
jacob navia wrote:
With lcc-win32 you can use the qfloat data type with 350 bits and
approx 100 digits precision.

You use just as the other data types:

qfloat m = 23.3;

qfloat p = exp(m,6.0);
Sorry that should have been
qfloat p = pow(m,6.0);

etc

lcc-win32:
http://www.cs.virginia.edu/~lcc-win32

Nov 14 '05 #22

In article <co**********@rumours.uwaterloo.ca>, dj******@csclub.uwaterloo.ca (Dave Vandervies) writes:
In article <41***********************@dreader16.news.xs4all.n l>,
dandelion <da*******@meadow.net> wrote:

Which by the way poses the queston wether
or not 2's complement is mandated/required by the standard or merely by many
CPU's (i assume it's the latter, but the question is a real one *and*
topical)


Not required by the standard.

I believe C99 requires one of binary 2s-complement, binary 1s-complement,
or binary sign-magnitude for signed integer types. I'm not sure what
C90 has to say on the subject.


I asked about that a few years back, and the consensus was that the
requirements in C90 - a "pure binary" number system and so forth - in
effect eliminated any other possibilities than the three you mention
above. BCD, for example, is out, because of the "pure binary"
requirement.

--
Michael Wojcik mi************@microfocus.com

The way things were, were the way things were, and they stayed that way
because they had always been that way. -- Jon Osborne
Nov 14 '05 #23
jacob navia wrote:
Michael Mair wrote:
jacob navia wrote:

You got me there -- what do you need long doubles for when you
want to print a signed long long int?
Jeeeeez.... Sorry about that. It should have been "%Ld" of course!!!
Excuse me.


You probably mean "%L[eEfFgG]".
Apart from that: How bad can the rounding error be when only
working with long doubles? As every binary fraction has a
finite decimal fraction representation, it should be
theoretically possible to print out with a certain
rounding behaviour and no deviation (maybe I am too naive
with respect to the cost).


The complications arise with sub-normal numbers, i.e. numbers
just below the normalization threshold, typically the results
of underflow. Gcc (and lcc-win32) can print those numbers with
great precision because of the extended precision module, where
the underflow is eliminated.


I see.
Other problems arise when trying to print the infamous *last*
digit accurately, because it must be rounded, and not truncated
as it would be staying with the given precision.


Okay, nobody wants to run through all the decimal digits to sum
it up finding out where you actually are...
Thank you for the explanations :-)

-Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 14 '05 #24

"Eric Sosman" <er*********@sun.com> wrote in message
news:co**********@news1brm.Central.Sun.COM...
Daniel Fadlun wrote:
"Gordon Burditt" <go***********@burditt.org> ha scritto nel messaggio
news:co********@library1.airnews.net...
Is there a bigger, mathematical, data type in C than the double (64
bit)
one
or the old long double (80 bit)?

C doubles are not guaranteed to be 64 bits.
long double is not guaranteed to be 80 bits, and why is it the *OLD*
long double?

Do you have floating-point hardware that uses more than 80 bits
to represent a number?
I'd like to add precision to my mathematical application, but I can't


figure
out how.

An int could conceivably be 128 bits, although if your machine has
128-bit operations, the 128-bit integer type is more likely long long.

Gordon L. Burditt

My machine is a p4 pc using Windowsme;
I would like to add decimals to my results example instead of
17 decimals 30 or 40.


That's 100-133 significand bits. H-format numbers on
the VAX could approach the lower end (I don't recall just
how many of its 128 bits were exponent), but I'm not aware
of any C compiler that made use of H-format.

The big question, though, is why do you want so many
digits? What meaning could you assign to a plus-or-minus
one fluctuation in the fortieth decimal place? If you're
trying to calculate the radius of the Universe in Angstrom
units, forty places are far more than you need.


Since the universe is a simple place, one might like to see the order of the
largest sporadic simple group, which is a good deal larger than 40 places.
I claim that it's the largest meaningful integer. MPJ
Nov 14 '05 #25
On Wed, 24 Nov 2004 22:21:08 +0100
jacob navia <ja***@jacob.remcomp.fr> wrote:
sa*****@hetnet.nl wrote:
On Tue, 23 Nov 2004 22:51:17 +0100, "Daniel Fadlun"
<mu**********@fastwebnet.it> wrote:
Is there a bigger, mathematical, data type in C than the double (64bit) one>or the old long double (80 bit)?
I'd like to add precision to my mathematical application, but I

can't figure>out how.
yes GMP.

Introduction to GNU MP

GNU MP is a portable library written in C for arbitrary precision
arithmetic on integers, rational numbers, and floating-point
numbers. It aims to provide the fastest possible arithmetic for all
applications that need higher precision than is directly supported
by the basic C types.

ftp.gnu.org/gnu/gmp

Nice package. It is approx twice as fast as lcc-win32.
It doesn't really run under windows though, and even if I have heard
of unsupported ports, nothing really official exist for windows, as
far as I know.

Please correct me if I am wrong.


You are wrong. The standard documentation for GMP includes instructions
on building with either mingw (which is native Windows) and Microsoft C
(about which I will let you guess).
It is twice as fast because it uses a variable precision number
system, reducing the number of calculations to be done for small
numbers. Besides it has a lot of assembly in it, maybe one of the
reasons there isn't a windows version (besides the cygwin emulator)
Well, the processor is the same whether you are using Linux on x86 or
Windows on x86, so what makes you think using assembler would be a
problem?
C library support is not provided with the package, i.e. all the
functions of the C library aren't supported even if it has the most
important ones (sqrt, etc).

All in all, the best thing around.


So stop recommending your completely non-standard and non-portable
extensions around here.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 14 '05 #26
Flash Gordon wrote:
On Wed, 24 Nov 2004 22:21:08 +0100
jacob navia <ja***@jacob.remcomp.fr> wrote:

sa*****@hetnet.nl wrote:

On Tue, 23 Nov 2004 22:51:17 +0100, "Daniel Fadlun"
<mu**********@fastwebnet.it> wrote:
Is there a bigger, mathematical, data type in C than the double (64

bit) one>or the old long double (80 bit)?

I'd like to add precision to my mathematical application, but I

can't figure>out how.
yes GMP.

Introduction to GNU MP

GNU MP is a portable library written in C for arbitrary precision
arithmetic on integers, rational numbers, and floating-point
numbers. It aims to provide the fastest possible arithmetic for all
applications that need higher precision than is directly supported
by the basic C types.

ftp.gnu.org/gnu/gmp

Nice package. It is approx twice as fast as lcc-win32.
It doesn't really run under windows though, and even if I have heard
of unsupported ports, nothing really official exist for windows, as
far as I know.

Please correct me if I am wrong.

You are wrong. The standard documentation for GMP includes instructions
on building with either mingw (which is native Windows) and Microsoft C
(about which I will let you guess).


I have downloaded the package from the official GNU site and there
is NO mention of windows in it, nor any Microsoft C workspace or
project. As such, the package will not even configure under
windows since it supposes the existence of /bin/sh.

Please, cygwin is not native windows, since needs a copyrighted
library callled cygwin.dll to run. This is quite expensive
if you do not want your code GPLed, license for it runs at
18.000 US$ last time I heard, to pay to RedHat Corp.
It is twice as fast because it uses a variable precision number
system, reducing the number of calculations to be done for small
numbers. Besides it has a lot of assembly in it, maybe one of the
reasons there isn't a windows version (besides the cygwin emulator)

Well, the processor is the same whether you are using Linux on x86 or
Windows on x86, so what makes you think using assembler would be a
problem?


The assembler syntax is not the same, even if the opcodes are the
same.
C library support is not provided with the package, i.e. all the
functions of the C library aren't supported even if it has the most
important ones (sqrt, etc).

All in all, the best thing around.

So stop recommending your completely non-standard and non-portable
extensions around here.


Yes, I will. I know I am an (expletive deleted) as your friend Mr Pop
said, and you are the best GNU fan I have ever met. You should be
promoted to a higher position after your diatribes.

The problem with me is that I am NOT GPL, so I could be a competitor
for the GNU business plan. Therefore, insulting me, crying "GO AWAY"
and telling that my work is "NOT C" , "NON PORTABLE", etc is useful for
GNU.

This is how GNU sees "competition". Interesting, Microsoft people are
more restrained. They just tell that "free software is bad" or
"lcc-win32 is a buggy package" but I have never been insulted from
them, nor do they rise Hell when I post in their discussions groups.

Another monopoly, different habits.

jacob
Nov 14 '05 #27
mw*****@newsguy.com (Michael Wojcik) wrote:
In article <co**********@rumours.uwaterloo.ca>, dj******@csclub.uwaterloo.ca (Dave Vandervies) writes:
In article <41***********************@dreader16.news.xs4all.n l>,
dandelion <da*******@meadow.net> wrote:

Which by the way poses the queston wether
or not 2's complement is mandated/required by the standard or merely by many
CPU's (i assume it's the latter, but the question is a real one *and*
topical)


Not required by the standard.

I believe C99 requires one of binary 2s-complement, binary 1s-complement,
or binary sign-magnitude for signed integer types. I'm not sure what
C90 has to say on the subject.


I asked about that a few years back, and the consensus was that the
requirements in C90 - a "pure binary" number system and so forth - in
effect eliminated any other possibilities than the three you mention
above.


Not entirely. There is at least one other possibility, which could
provisionally be called sign-magnitude-minus-one, and which is to s-m as
2's complement is to 1's c. -1 would be 10..00, -2 10..01, -3 10...10,
etc. I've never seen anything which actually uses this, and of course
it's highly unlikely that such a system even exists or ever will, but
AFAICT the wording in C89 doesn't forbid it.

Richard
Nov 14 '05 #28
In article <41**********************@news.wanadoo.fr> jacob navia <ja***@jacob.remcomp.fr> writes:
Flash Gordon wrote:
On Wed, 24 Nov 2004 22:21:08 +0100
jacob navia <ja***@jacob.remcomp.fr> wrote: ....
Nice package. It is approx twice as fast as lcc-win32.
It doesn't really run under windows though, and even if I have heard
of unsupported ports, nothing really official exist for windows, as
far as I know.

Please correct me if I am wrong.


You are wrong. The standard documentation for GMP includes instructions
on building with either mingw (which is native Windows) and Microsoft C
(about which I will let you guess).


I have downloaded the package from the official GNU site and there
is NO mention of windows in it, nor any Microsoft C workspace or
project. As such, the package will not even configure under
windows since it supposes the existence of /bin/sh.


Look in the file gmp.info-1. But maybe
<http://www.cs.nyu.edu/exact/core/gmp/> helps?
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Nov 14 '05 #29
In <41***********************@news.wanadoo.fr> jacob navia <ja***@jacob.remcomp.fr> writes:
Most quality implementation of printf include a higher precision
module, see for instance the implementation of gcc.


gcc, being a mere compiler, doesn't come with a printf implementation.

If you're unable to understand something as simple as that, how can you
expect anyone to take your opinions seriously? You just can't miss *any*
opportunity to make a fool of yourself.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union
Nov 14 '05 #30
In article <41**********************@news.wanadoo.fr>,
jacob navia <ja***@jacob.remcomp.fr> wrote:
Flash Gordon wrote:
So stop recommending your completely non-standard and non-portable
extensions around here.


The problem with me is that I am NOT GPL, so I could be a competitor
for the GNU business plan. Therefore, insulting me, crying "GO AWAY"
and telling that my work is "NOT C" , "NON PORTABLE", etc is useful for
GNU.


Yep, we just love GNUC and the GCC extensions around here. They're the
best thing since Bill Gates first invented the language.

Microsoft's extensions aren't actually all that bad either. It's just
you, with your particular not-quite-C compiler, that we have an irrational
desire to persecute.
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
If the user can hack the kernel, they can change the file permissions for the
executable. Of course they my *prefer* to hack the kernel, because that has
more Macho Kernel Hacker Points. --Chris Dollin in comp.lang.c
Nov 14 '05 #31
In <41**********************@news.wanadoo.fr> jacob navia <ja***@jacob.remcomp.fr> writes:
Flash Gordon wrote:
On Wed, 24 Nov 2004 22:21:08 +0100
jacob navia <ja***@jacob.remcomp.fr> wrote:

sa*****@hetnet.nl wrote:
On Tue, 23 Nov 2004 22:51:17 +0100, "Daniel Fadlun"
<mu**********@fastwebnet.it> wrote:
>Is there a bigger, mathematical, data type in C than the double (64

bit) one>or the old long double (80 bit)?

>I'd like to add precision to my mathematical application, but I

can't figure>out how.
yes GMP.

Introduction to GNU MP

GNU MP is a portable library written in C for arbitrary precision
arithmetic on integers, rational numbers, and floating-point
numbers. It aims to provide the fastest possible arithmetic for all
applications that need higher precision than is directly supported
by the basic C types.

ftp.gnu.org/gnu/gmp
Nice package. It is approx twice as fast as lcc-win32.
It doesn't really run under windows though, and even if I have heard
of unsupported ports, nothing really official exist for windows, as
far as I know.

Please correct me if I am wrong.

You are wrong. The standard documentation for GMP includes instructions
on building with either mingw (which is native Windows) and Microsoft C ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (about which I will let you guess).


I have downloaded the package from the official GNU site and there
is NO mention of windows in it, nor any Microsoft C workspace or
project. As such, the package will not even configure under
windows since it supposes the existence of /bin/sh.


One doesn't have to be a genius in order to type "gnu mp windows" into
the Google search engine. The third hit is "GMP Install Instruction
for Windows Platform".
Please, cygwin is not native windows, since needs a copyrighted ^^^^^^library callled cygwin.dll to run. This is quite expensive
if you do not want your code GPLed, license for it runs at
18.000 US$ last time I heard, to pay to RedHat Corp.


Please, learn to read! He was talking about mingw, not about cygwin.
Are you so stupid that you cannot tell the difference?

Anyway, here is the first part of the Google hit mentioned above (URL:
http://www.cs.nyu.edu/exact/core/gmp/)

Currently Core Library (from v1.4) uses GNU Multiple Precision
Arithmetic Library (GMP) as its low level big number package. GMP
is a free library for arbitrary precision arithmetic, operating on
signed integers, rational numbers, and floating point numbers. As
GMP was originally designed to work under Unix platform, there is few
information about how to compile and install under Windows platform. I
wrote this page to help you simplify installation.

While there are many C/C++ compilers available under Windows Platform,
I will only focus on the following 4 compilers/environments: Cygwin
GCC, MinGW GCC, Visual C++ 6.0 and .Net which are freely available
or widely used. If you have experiences on other compilers, please
let me know.

Is Visual C++ 6.0 native Windows enough for you, or only lcc-win32 (which
is blissfully ignored by the author of that port) qualifies as such?

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union
Nov 14 '05 #32
"dandelion" <da*******@meadow.net> wrote:

Which by the way poses the queston wether or not 2's
complement is mandated/required by the standard or merely
by many CPU's (i assume it's the latter, but the question
is a real one *and* topical)


Unfortunately not, otherwise the volume of this newsgroup
would be half what it is.
Nov 14 '05 #33

"Dan Pop" <Da*****@cern.ch> wrote in message
news:co**********@sunnews.cern.ch...
In <41**********************@news.wanadoo.fr> jacob navia <ja***@jacob.remcomp.fr> writes:
Flash Gordon wrote:
On Wed, 24 Nov 2004 22:21:08 +0100
jacob navia <ja***@jacob.remcomp.fr> wrote:
sa*****@hetnet.nl wrote:
>On Tue, 23 Nov 2004 22:51:17 +0100, "Daniel Fadlun"
><mu**********@fastwebnet.it> wrote:
>
>
>>Is there a bigger, mathematical, data type in C than the double (64
>
>bit) one>or the old long double (80 bit)?
>
>>I'd like to add precision to my mathematical application, but I
>
>can't figure>out how.
>
>
>yes GMP.
>
>Introduction to GNU MP
>
>GNU MP is a portable library written in C for arbitrary precision
>arithmetic on integers, rational numbers, and floating-point
>numbers. It aims to provide the fastest possible arithmetic for all
>applications that need higher precision than is directly supported
>by the basic C types.
>
>ftp.gnu.org/gnu/gmp
>

Nice package. It is approx twice as fast as lcc-win32.
It doesn't really run under windows though, and even if I have heard
of unsupported ports, nothing really official exist for windows, as
far as I know.

Please correct me if I am wrong.
You are wrong. The standard documentation for GMP includes instructions
on building with either mingw (which is native Windows) and Microsoft C ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (about which I will let you guess).


I have downloaded the package from the official GNU site and there
is NO mention of windows in it, nor any Microsoft C workspace or
project. As such, the package will not even configure under
windows since it supposes the existence of /bin/sh.


One doesn't have to be a genius in order to type "gnu mp windows" into
the Google search engine. The third hit is "GMP Install Instruction
for Windows Platform".
Please, cygwin is not native windows, since needs a copyrighted

^^^^^^
library callled cygwin.dll to run. This is quite expensive
if you do not want your code GPLed, license for it runs at
18.000 US$ last time I heard, to pay to RedHat Corp.


Please, learn to read! He was talking about mingw, not about cygwin.
Are you so stupid that you cannot tell the difference?

Anyway, here is the first part of the Google hit mentioned above (URL:
http://www.cs.nyu.edu/exact/core/gmp/)

Currently Core Library (from v1.4) uses GNU Multiple Precision
Arithmetic Library (GMP) as its low level big number package. GMP
is a free library for arbitrary precision arithmetic, operating on
signed integers, rational numbers, and floating point numbers. As
GMP was originally designed to work under Unix platform, there is few
information about how to compile and install under Windows platform. I
wrote this page to help you simplify installation.

While there are many C/C++ compilers available under Windows Platform,
I will only focus on the following 4 compilers/environments: Cygwin
GCC, MinGW GCC, Visual C++ 6.0 and .Net which are freely available
or widely used. If you have experiences on other compilers, please
let me know.

Is Visual C++ 6.0 native Windows enough for you, or only lcc-win32 (which
is blissfully ignored by the author of that port) qualifies as such?


In my usual state of semi-understanding (Cygwin C++6 sounds like a Harry
Potter spell to me), I'd like to ask the following:

Is GMP ANSI/ISO conforming?

The literature is really thin on arbitrary precision stuff. Borwein and
Borwein is the best reference I've read. MPJ
Nov 14 '05 #34

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Lorenzo Villari | last post: by
4 posts views Thread by Dan | last post: by
6 posts views Thread by LordHog | last post: by
4 posts views Thread by Peter | last post: by
31 posts views Thread by aarklon | last post: by
11 posts views Thread by sofeng | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.