next up previous contents
Next: Declaring and Defining the NUM_ Functions
Up: THE NUM_ FUNCTIONS
Previous: NUM_ Type Conversion Functions


NUM_ Inter-comparison Functions

Inter-comparison of numbers stored using any numerical data type, to test for equality or inequality relations, may be performed by invoking the appropriate NUM_ inter-comparison functions, using statements such as:

RESULT = NUM_$<$ROPER$><$T$>$( ARG1, ARG2 )

Here, the NUM_ function takes two arguments of type $<$T$>$ and returns a logical result, having compared its arguments according to the relational operation specified by $<$ROPER$>$. The data type code $<$T$>$ may be any of those in Table [*] and $<$ROPER$>$ may be any of the relational operation codes specified in Table [*].


Table: The relational operation codes used in the names of NUM_ functions and the inter-comparisons to which they correspond.
Relational Operation Code
$<$ROPER$>$
Inter-comparison
EQ ARG1 .EQ. ARG2
NE ARG1 .NE. ARG2
GT ARG1 .GT. ARG2
GE ARG1 .GE. ARG2
LT ARG1 .LT. ARG2
LE ARG1 .LE. ARG2


Thus, for example, the logical function NUM_GTUB returns a .TRUE. result if the unsigned byte number ARG1 is greater than the unsigned byte number ARG2, while NUM_LED returns .TRUE. if the double precision number ARG1 is less than or equal to the double precision number ARG2.

Note that equivalent inter-comparison functions are not available in the VAL or VEC facilities.


next up previous contents
Next: Declaring and Defining the NUM_ Functions
Up: THE NUM_ FUNCTIONS
Previous: NUM_ Type Conversion Functions

PRIMDAT --- Processing of Primitive Numerical Data
Starlink User Note 39
R F Warren-Smith
28 February 1995
E-mail:ussc@star.rl.ac.uk

Copyright © 2009 Science and Technology Facilities Council