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,6a6947f0ba40d152 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Interrupt "Get" Date: 1998/05/21 Message-ID: #1/1 X-Deja-AN: 355425168 References: <356368C8.6EDF@info.polymtl.ca> X-Complaints-To: usenet@news.nyu.edu X-Trace: news.nyu.edu 895803181 19804 (None) 128.122.140.58 Organization: New York University Newsgroups: comp.lang.ada Date: 1998-05-21T00:00:00+00:00 List-Id: Matthew said <> Now we are carrying legalisms to the point of absurdity. The description in the RM that the result is universal fixed is for semantic description purposes only, it has nothing at all to do with the actual code, which obviously does not produce a universal fixed result. Matthew, you seem to think that the code actually reflects the RM, i.e. that you first do a universal fixed division, and then a subtype conversion. A little thought will show you that this is entirely impractical, and that of course in practice, the generated code involves scaling operations and multiplications and divisions that are *equivalent to* to the result of first doing a universal fixed division and then doing the subtype conversion. I guess that's what is confusing you here!!!! In fact the comment about division by zero is exactly right, thankyou Simon for pointing this out. It is not immediately obvious that this is the case (this case cannot arise for example for normal integer division except in very peculiar cases). But consider, let's use decimal, it's easier we want to divide 5.15 by 3.00 the representations are 515 and 300, but of course we cannot compute the result as result = 515/300 * 100 since that would lose precision. Instead we compute result = (100 * 515) / 300 Now in general this scaling means the numerator is double length, and it can definitely occur that the most significant word of this double length result is greater than the dividend, which is the condition for integer overflow. So, it is quite true that if we have a positive scale, which is the normal case, as in the above (scale here = number of digits after point), then we can get zero divide even with a non-zero divisor. The test therefore is not simply a comparison with zero, but a comparison for an excessively small value, and that is as easy a test to do!