RE: [sv-bc] 'inside' on real operands

From: Steven Sharp <sharp_at_.....>
Date: Sat Sep 08 2007 - 19:05:34 PDT
>From: "Warmke, Doug" <doug_warmke@mentor.com>

>Will there be rounding and/or truncation problems with this sort of
>comparison operation?

When doing equality comparisons on reals, you need to be aware of the
potential for roundoff error in computing the real values.  But this
is already an issue with the existing equality operator on reals.
Extending the 'inside' operator does not appear to create any new
issues that don't already exist with the equivalent expression using
multiple equality operators.

The 'inside' operator would be more useful for reals if you could
use the range comparisons instead of just the equality compares.
For example,

  realvar inside { [1.5 : 2.5], [3.5 : 4.5] }
	
meaning the same thing as

  ((realvar >= 1.5 && realvar <= 2.5) || (realvar >= 3.5 && realvar <= 4.5))
	
It looks strange to see real values inside the ranges, because we are
used to ranges being used for array/vector ranges and part selects, which
are indexed by integral values.  But the square brackets on an 'inside'
are not index ranges; they are just an unusual syntax used to delimit the
operands of the 'inside' operator.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sat Sep 8 19:05:54 2007

This archive was generated by hypermail 2.1.8 : Sat Sep 08 2007 - 19:06:02 PDT