From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a30e9cc47b5029fe X-Google-Attributes: gid103376,public From: Gautier Subject: Re: ratioanl number type Date: 1999/12/03 Message-ID: <38478F43.1690EFFA@maths.unine.ch>#1/1 X-Deja-AN: 556140507 Content-Transfer-Encoding: 7bit References: <38473D8A.9BB68676@gte.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-12-03T00:00:00+00:00 List-Id: > Are there any Ada95 examples in books or on the web that implement the > exact rational number data type with overloading of all appropriate > arithmetic operations and conversion to and from other number types, all > in Ada95 without anything relating to the platform it will run on? It > goes without saying that it is too difficult to predict the number of > digits that the numerator and denominator need to have, so, available > memory should be the only limit to their size. A thing to do is to combine a generic code to obtain the fraction field of an (euclidean) ring, with multi-precision integers, so you can choose the two component independently. All ingredients are there http://lglwww.epfl.ch/Team/MW/mw_components.html You can also take my generic code (frac) in mathpaqs.zip http://members.xoom.com/gdemont/gsoft.htm and use one of the multi-precision packs from there http://members.xoom.com/gnatlist/ NB: no bug-free warranty in any I think ... ;-) HTH -- Gautier