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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,74fbf0c5ce05c298 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1993-03-23 18:23:29 PST Newsgroups: comp.lang.ada Path: sparky!uunet!pmafire!news.dell.com!natinst.com!cs.utexas.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!agate!linus!linus.mitre.org!linus!mbunix!eachus From: eachus@dr_no.mitre.org (Robert I. Eachus) Subject: Re: Ada Decimal Arithmetic & Representations (ADAR) V1.0 available In-Reply-To: kst@telesoft.com's message of Mon, 22 Mar 1993 22:33:36 GMT Message-ID: Sender: news@linus.mitre.org (News Service) Nntp-Posting-Host: dr-no.mitre.org Organization: The Mitre Corp., Bedford, MA. References: <1993Mar19.161646.26563@sei.cmu.edu> <1993Mar21.231233.2934@seas.gwu.edu> <1993Mar22.095301.806@enpc.fr> <1993Mar22.223336.23771@telesoft.com> Date: Wed, 24 Mar 1993 01:33:27 GMT Date: 1993-03-24T01:33:27+00:00 List-Id: Summary: The ADAR packages are a portable langauge extension in an area where Ada just isn't very portable. We came up with a LOT of magic to make this code possible, since when we started it was expected that any Ada 83 decimal extension would require support by compiler vendors. The ADAR packages as produced have portable, but in some cases slow, bodies which can be customized to a particular compiler to get a very efficent facility. But don't expect to do such customization without knowing the compiler internals and the hardware arithmetic model a lot better than you would like to. In article <1993Mar22.223336.23771@telesoft.com> kst@telesoft.com (Keith Thompson @pulsar) writes: > Ahem. Actually, it's a shortcoming of the package that it depends > on Long_Integer.... > If you want the longest possible integer type (whatever its name > happens to be in Standard), use something like this: > type Longest_Integer is range System.Min_Int .. System.Max_Int; FLAME ON!!!! This sort of abstract pontificating has its place, but in this case you do a significant disservice in posting something like this without looking at the actual packages. First, most of the use of system dependant types occurs either in a configuration package or in examples. Second, every such case is commented with WHY the decision to declare things that way was made. Third, there are cases where declarations like Longest_Integer above will simply not work, because you must use Standard.Integer. Two examples are the rules in 3.6.1(2) and the exponentiation operators defined in 4.5.6(4). Forth, well you get the picture... FLAME OFF. We went to a lot of work to push Ada to the edges of the Reference Manual definition in the ADAR packages. Unfortunately you can only carry portability so far. In general, the (package) specifications are perfectly portable. However, it is simply not possible to write, for example, an efficient portable double precision multiply that will work on 24-bit and 32-bit hardware. Plan to change a couple of constants. (And don't flame me about the fact that you need static values in some places that can't be calculated from static attributes. Where they can, we did, but for example, find the largest power of ten smaller than Integer'LAST in static Ada...) We tried to produce software which could be easily ported without modifying compilers. But to expect the kind of magic which has to go on in the bodies of these packages to port with zero effort, give me a BREAK. As a "simple" example, one of the implementations uses floating point to provide a type with exact fixed-point semantics. It works, it's neat, but the number of digits for which you get exact decimal arithmetic will be a complex function of the hardware floating point model. (It's usually 15 or 16.) The code as written will get the bounds right on most hardware I know of, but it does take some attention to make sure. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...