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,338371dbbe7075d,start X-Google-Attributes: gid103376,public From: JP Thornley Subject: [Q] Portability of <= and >= with real operands Date: 1996/11/29 Message-ID: <252531213wnr@diphi.demon.co.uk>#1/1 X-Deja-AN: 201453055 x-mail2news-path: relay-7.mail.demon.net!relay-5.mail.demon.net!diphi.demon.co.uk x-mail2news-user: jpt@diphi.demon.co.uk organization: None reply-to: jpt@diphi.demon.co.uk newsgroups: comp.lang.ada Date: 1996-11-29T00:00:00+00:00 List-Id: I'm having difficulty understanding the statements in the Ada Quality and Style Guide on the portability of relational expressions with real operands:- Section 5.5.6 - "... the use of <= is more portable than either < or =" Section 7.2.7 (in the Chapter on Portability) - "Strict relational comparisons (<, >, =, /=) are a general problem with computations involving real numbers" and there is an implication (but no direct statement) that the inclusive comparisons are not a problem. (The Ada 83 version did have a statement that <= and >= evaluated the same in all implementations but this has gone from the Ada 95 version.) Clearly = and /= are to be avoided, but I can't see why < and > are less portable than <= and >=. My understanding is based on the result being well defined (portable) if it is the same no matter which value is taken from the model intervals of the operands and undefined (non-portable) if this is not the case. But I can't make the quoted statements from the Guide fit with this, so what am I missing? (The reference (in the 7.2.7 rationale) to Sections G.4.1 and G.4.2 of the Ada 95 Rationale hasn't helped me much - there isn't any discussion of relational expressions in there.) [BTW, the Guide carefully refers to "real" operands throughout these two sections - is there really no difference between floating and fixed?] Phil Thornley -- ------------------------------------------------------------------------ | JP Thornley EMail jpt@diphi.demon.co.uk | ------------------------------------------------------------------------