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

J

jacob navia

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

jacob navia

jacob said:
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);
 
M

Michael Wojcik

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

Michael Mair

jacob said:
Jeeeeez.... Sorry about that. It should have been "%Ld" of course!!!
Excuse me.

You probably mean "%L[eEfFgG]".
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
 
M

Merrill & Michele

Eric Sosman said:
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
 
F

Flash Gordon

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

jacob navia

Flash said:
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.
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.
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
 
R

Richard Bos

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
 
D

Dik T. Winter

>
> 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?
 
D

Dan Pop

In said:
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
 
D

Dan Pop

In said:
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
 
D

Dave Vandervies

Flash Gordon wrote:

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
 
O

Old Wolf

dandelion said:
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.
 
M

Merrill & Michele

Dan Pop said:
In <[email protected]> jacob navia

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, 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
 

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
474,155
Messages
2,570,871
Members
47,401
Latest member
CliffGrime

Latest Threads

Top