comp.lang.ada
 help / color / mirror / Atom feed
* [Q] Portability of <= and >= with real operands
@ 1996-11-29  0:00 JP Thornley
  1996-11-29  0:00 ` Robert Dewar
  1996-12-01  0:00 ` Tucker Taft
  0 siblings, 2 replies; 11+ messages in thread
From: JP Thornley @ 1996-11-29  0:00 UTC (permalink / 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                           |
------------------------------------------------------------------------






^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~1996-12-04  0:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-29  0:00 [Q] Portability of <= and >= with real operands JP Thornley
1996-11-29  0:00 ` Robert Dewar
1996-12-03  0:00   ` Keith Thompson
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-03  0:00     ` Robert Dewar
1996-12-01  0:00 ` Tucker Taft
1996-12-02  0:00   ` Norman H. Cohen

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