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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e6545823a74c7c29 X-Google-Attributes: gid103376,public From: wemagor@sym1.cca.rockwell.com_nospam (Wayne Magor) Subject: Re: Fixed point design error in Ada95 Date: 1998/09/10 Message-ID: <6t9dlk$e0t1@onews.collins.rockwell.com>#1/1 X-Deja-AN: 389870269 Distribution: world Sender: wemagor@sym1.cca.rockwell.com (Wayne Magor) References: <6t6ihg$dkn1@onews.collins.rockwell.com> <6t93vn$g8l$1@nnrp1.dejanews.com> Organization: Rockwell Collins - Avionics Reply-To: No@Junk.Mail Newsgroups: comp.lang.ada Date: 1998-09-10T00:00:00+00:00 List-Id: dewarr@my-dejanews.com writes: >Actually this is to be honest less annoying than you might >think. Unless you are using fixed-point as "poor man's >floating-point" [a dubious proposition now that virtually >all processors do floating-point faster than fixed-point], >it makes little sense to do something like > > function "*" (x,y : dollars_cents) return dollars_cents; > >since, as in this case, there is an obvious conceptual >type error in this declaration. I'll certainly agree with you that there aren't a lot of uses for fixed-point operator overloading. We are running host-based simulations of avionics systems which run on a special avionics processor. That processor does not have floating point, but has something called fractional arithmetic. The fractional arithmetic does not work exactly the same way as Ada's fixed point. There is no overflow detection with this hardware, which is why the operator must be overloaded in order to properly simulate the way the software will operate in the target. The target compiler is an Ada83 compiler, but the host compiler is an Ada95 compiler. It is unfortunate that Ada95 is not 100% backward compatible in this area, even if it has little impact on the user community. A pragma to give Ada83 operation would be a good solution. Thanks, Wayne.