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,184737148aef02ac X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Fixed point multiplication ambiguity Date: 1999/01/29 Message-ID: #1/1 X-Deja-AN: 438182449 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: <78r4qh$fcu$1@plug.news.pipex.net> Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1999-01-29T00:00:00+00:00 List-Id: Nick Roberts (Nick.Roberts@dial.pipex.com) wrote: : |... [ Integer(D*10.0 + 0.5) ] is effectively equivalent to: : | Integer(Duration(D*10.0)+Duration(0.5)) : I am not arguing with this, but which rule (or rules) in the RM specify the : above interpretation, please? I've searched and searched (even the AI95s)! : (Then again, I reckon my brain must be coming up for it's 20,000 mile : service anyway ;-) RM95 3.4.1(6-7) introduces the universal numeric types. RM95 4.2(8) says that a real literal is of type universal-real. RM95 4.5.5(18) defines the multiplication operator: univ-fixed * univ-fixed => univ-fixed RM95 8.6(21) indicates that any fixed-point type is acceptable when the expected type is universal-fixed, as is any universal type that "covers" universal-fixed (e.g. universal-real) (i.e., any fixed-point type is implicitly convertible to universal-fixed, as is universal-real). RM95 8.6(24) indicates that universal fixed is acceptable when the expected type is any specific fixed-point type (i.e., universal fixed is implicitly convertible to any fixed-point type). RM95 8.6(28) indicates that if there is exactly one acceptable interpretation for a complete context, then that one is chosen. There is only one directly visible "*" operator which can "accept" one operand of type Duration (D), and one univeral-real operand (10.0): univ-fixed * univ-fixed => univ-fixed. There is also only one directly visible "+" operator which can "accept" one universal-fixed operand (D*10.0) and one universal-real operand (the literal 0.5): Duration + Duration => Duration. Hence, the only acceptable interpretation is the one which is effectively equivalent to: Integer(Duration(D*10.0) + Duration(0.5)) Q.E.D. (I hope ;-). : ------------------------------------------- : Nick Roberts : ------------------------------------------- -- -Tucker Taft stt@averstar.com http://www.averstar.com/~stt/ Technical Director, Distributed IT Solutions (www.averstar.com/tools) AverStar (formerly Intermetrics, Inc.) Burlington, MA USA