comp.lang.ada
 help / color / mirror / Atom feed
From: JP Thornley <jpt@diphi.demon.co.uk>
Subject: [Q] Portability of <= and >= with real operands
Date: 1996/11/29
Date: 1996-11-29T00:00:00+00:00	[thread overview]
Message-ID: <252531213wnr@diphi.demon.co.uk> (raw)


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                           |
------------------------------------------------------------------------






             reply	other threads:[~1996-11-29  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-29  0:00 JP Thornley [this message]
1996-11-29  0:00 ` [Q] Portability of <= and >= with real operands Robert Dewar
1996-12-03  0:00   ` Keith Thompson
1996-12-03  0:00     ` Robert Dewar
1996-12-03  0:00     ` Tucker Taft
1996-12-03  0:00       ` Larry Kilgallen
1996-12-03  0:00         ` Robert Dewar
1996-12-04  0:00       ` Keith Thompson
1996-12-03  0:00     ` Thomas Koenig
1996-12-01  0:00 ` Tucker Taft
1996-12-02  0:00   ` Norman H. Cohen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox