comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: ratioanl number type
Date: 1999/12/11
Date: 1999-12-11T00:00:00+00:00	[thread overview]
Message-ID: <82tnk0$n56$1@nnrp1.deja.com> (raw)
In-Reply-To: 385252FF.BB4C7A5@gte.net

In article <385252FF.BB4C7A5@gte.net>,
  cnelson9@gte.net wrote:
>
>
> Dmitriy Anisimkov wrote:
>
> > "Clifford J. Nelson" wrote:
> >
> > > Are there any Ada95 examples in books or on the web that
implement the
> > > exact rational number data type,
> >
> > .......
> >
> > > available
> > > memory should be the only limit to their size.
> >
> > Try  http://www.chat.ru/~vagul/Unlimit7.zip
>
> A timing test of GNAT Ada95 CodeBuilder 1.1 exact rational
numbers with
> unlimited size integers using
http://www.chat.ru/~vagul/Unlimit7.zip
> compared to Mathematica 3.01.
>
> Ada95 took 4861.733319000 seconds. Mma took 15.2667 seconds.


That's not too surprising. It is very easy to write inefficient
exact rational handling, and a naive approach is indeed likely
to be far slower than the carefully crafted routines inside
Mma, where these operations are of course central to the
mission, so a lot of effort has gone into doing things right.

Another reminder that choosing the proper algorithms and data
structures is usually FAR more important from an efficiency
point of view than choice of language!

Actually in the case of multiple precision, high level languages
are often at a disadvantage compared to machine language for two
reasons:

1. They do not give easy access to the carry flag, and
operations like add-carry.

2. They do not give easy access to the multiply and divide
operations that mix single and double length results.

It wouldn't surprise me if Mma used some assembly language
insertions at this point, or at the very least, very low level
code designed to interface to the machine very carefully.


Sent via Deja.com http://www.deja.com/
Before you buy.




  reply	other threads:[~1999-12-11  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-03  0:00 ratioanl number type Clifford J. Nelson
1999-12-03  0:00 ` Tucker Taft
1999-12-03  0:00 ` Gautier
1999-12-03  0:00 ` Dmitriy Anisimkov
1999-12-11  0:00   ` Clifford J. Nelson
1999-12-11  0:00     ` Robert Dewar [this message]
     [not found]     ` <01bf43ea$646d5bc0$022a6282@dieppe>
1999-12-11  0:00       ` Clifford J. Nelson
     [not found]         ` <01bf43f3$3aadb600$022a6282@dieppe>
1999-12-11  0:00           ` Vladimir Olensky
1999-12-12  0:00             ` Robert Dewar
1999-12-12  0:00               ` Vladimir Olensky
1999-12-12  0:00                 ` MMX (was Re: ratioanl number type) Vladimir Olensky
1999-12-14  0:00                 ` ratioanl number type Robert Dewar
1999-12-17  0:00                 ` Gisle S�lensminde
1999-12-19  0:00                   ` Robert Dewar
1999-12-12  0:00         ` Robert Dewar
1999-12-09  0:00 ` rational " Wes Groleau
  -- strict thread matches above, loose matches on Subject: below --
1999-12-15  0:00 ratioanl " Alexander E. Kopilovitch
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox