You are here: Surpac Concepts > Macros > SCL > Range Commands > SclRangeIncludes
GEOVIA Surpac

SclRangeIncludes

Overview

Determines if a value is included, within a tolerance, of the values in the range object that has been previously created using the SclRangeExpand command.

Synopsis

SclRangeIncludes $RangeHandle $Value $Epsilon

Description

SclRangeIncludes returns $SCL_OK if Value is included in the range object, within the Epsilon tolerance. $SCL_ERROR is returned otherwise.

The Epsilon argument is included because the values managed by the Scl range object are all floating point numbers. Since equality comparisons of floating point numers on computers are problematic, an error tolerance for equality comparisons prevents undesirable errors from ocurring.

Arguments

  • RangeHandle
  • Passed by value. The handle to the Scl range object that has been previously created by the SclRangeExpand command.

  • Value
  • Passed by value. The value that is to be tested to see if it is defined by the range within the required tolerance.

  • Tolerance
  • Passed by value. When Value is an integer and the range defines a set of integer values use an epsilon value of 0.5. When Value is a floating point number use a much smaller epsilon.

Examples

#
# test an integer value for inclusion
#
set status [SclRangeExpand handle "1,10,1"]
if {[SclRangeIncludes $handle 1 0.5] == $SCL_OK} {
  puts "Value is in the range"
} else {
  puts "Value is not in the range"
}
SclDestroy handle
#
# test an floating point value for inclusion
#
set status [SclRangeExpand handle "1,10,0.2"]
if {[SclRangeIncludes $handle 1.4 0.0005] == $SCL_OK} {
  puts "Value is in the range"
} else {
  puts "Value is not in the range"
}
SclDestroy handle

See Also

SclRangeExpand
SclRangeGetCount
SclRangeGet