Please enable JavaScript to view this site.

Codolex

The Checks activity returns a boolean value for a validation check of a number.

uses System.Math

 

MathChecks

Activity properties

 

Possible checks:

 

Is Infinite

Indicates when a variable represents an infinite value.

 

Example:

IntegerValue = 10

 

begin

var CheckValue: Boolean;

 CheckValue := IsInfinite(IntegerValue);

end;

Result = False

 

Is not a number

Indicates when a variable represents a 'Not a number' (Nan) value.

 

Example:

IntegerValue = 10

 

begin

var CheckValue: Boolean;

 CheckValue := IsNan(IntegerValue);

end;

Result = False

 

Is zero

Indicates when a floating-point variable or expression evaluates to zero with a deviation.

 

Example:

DecimalValue = 0.5

Deviation = 1

 

begin

var CheckValue: Boolean;

 CheckValue := IsZero(DecimalValue, 1);

end;

Result = True

 

Is same value

Indicates whether two floating-point values are equal. with a possible deviation.

 

Example:

IntegerValue =2

DecimalValue = 0.5

Deviation = 1

 

begin

var CheckValue: Boolean;

 CheckValue := SameValue(DecimalValue, IntegerValue, 1);

end;

Result = False

 

Is positive value

Indicates whether a numeric value is positive.

 

Example:

IntegerValue = 10

 

begin

var CheckValue: Boolean;

var SignValue := Sign(IntegerValue);

 CheckValue := SignValue = TValueSign(PositiveValue);

end;

Result = True

 

Is negative value

Indicates whether a numeric value is negative.

 

Example:

IntegerValue = 10

 

begin

var CheckValue: Boolean;

var SignValue := Sign(IntegerValue);

 CheckValue := SignValue = TValueSign(NegativeValue);

end;

Result = False

 

In range

Indicates whether a value falls within a specified range.

 

Example:

IntegerValue = 2

MinRange = 1

MaxRange = 3

 

begin

var CheckValue: Boolean;

 CheckValue := InRange(IntegerValue, 1, 3);

end;

Result = True

 

Providing a higher minimum than maximum is possible, but is also never true.

© by GDK Software