Next Previous Up Contents
Next: Distances
Up: Functions
Previous: CoordsRadians
Standard arithmetic functions including things like rounding,
sign manipulation, and maximum/minimum functions.
-
roundUp( x )
-
Rounds a value up to an integer value.
Formally, returns the smallest (closest to negative infinity)
integer value that is not less than the argument.
-
x
(floating point): a value.
- return value (integer):
x
rounded up
-
roundDown( x )
-
Rounds a value down to an integer value.
Formally, returns the largest (closest to positive infinity)
integer value that is not greater than the argument.
-
x
(floating point): a value
- return value (integer):
x
rounded down
-
round( x )
-
Rounds a value to the nearest integer.
Formally,
returns the integer that is closest in value
to the argument. If two integers are
equally close, the result is the even one.
-
x
(floating point): a floating point value.
- return value (integer):
x
rounded to the nearest integer
-
roundDecimal( x, dp )
-
Rounds a value to a given number of decimal places.
The result is a
float
(32-bit floating point value),
so this is only suitable for relatively low-precision values.
It's intended for truncating the number of apparent significant
figures represented by a value which you know has been obtained
by combining other values of limited precision.
For more control, see the functions in the Formats
class.
-
x
(floating point): a floating point value
-
dp
(integer): number of decimal places (digits after the decimal point)
to retain
- return value (floating point): floating point value close to
x
but with a
limited apparent precision
-
abs( x )
-
Returns the absolute value of an integer value.
If the argument is not negative, the argument is returned.
If the argument is negative, the negation of the argument is returned.
-
x
(integer): the argument whose absolute value is to be determined
- return value (integer): the absolute value of the argument.
-
abs( x )
-
Returns the absolute value of a floating point value.
If the argument is not negative, the argument is returned.
If the argument is negative, the negation of the argument is returned.
-
x
(floating point): the argument whose absolute value is to be determined
- return value (floating point): the absolute value of the argument.
-
max( a, b )
-
Returns the greater of two integer values.
If the arguments have the same value, the result is that same value.
Multiple-argument maximum functions are also provided in the
Arrays
and Lists
packages.
-
a
(integer): an argument.
-
b
(integer): another argument.
- return value (integer): the larger of
a
and b
.
-
maxNaN( a, b )
-
Returns the greater of two floating point values.
If the arguments have the same value, the result is that same
value. If either value is blank, then the result is blank.
-
a
(floating point): an argument.
-
b
(floating point): another argument.
- return value (floating point): the larger of
a
and b
.
-
maxReal( a, b )
-
Returns the greater of two floating point values, ignoring blanks.
If the arguments have the same value, the result is that same value.
If one argument is blank, the result is the other one.
If both arguments are blank, the result is blank.
Multiple-argument maximum functions are also provided in the
Arrays
and Lists
packages.
-
a
(floating point): an argument
-
b
(floating point): another argument
- return value (floating point): the larger non-blank value of
a
and b
-
min( a, b )
-
Returns the smaller of two integer values.
If the arguments have the same value, the result is that same value.
Multiple-argument minimum functions are also provided in the
Arrays
and Lists
packages.
-
a
(integer): an argument.
-
b
(integer): another argument.
- return value (integer): the smaller of
a
and b
.
-
minNaN( a, b )
-
Returns the smaller of two floating point values.
If the arguments have the same value, the result is that same value.
If either value is blank, then the result is blank.
-
a
(floating point): an argument.
-
b
(floating point): another argument.
- return value (floating point): the smaller of
a
and b
.
-
minReal( a, b )
-
Returns the smaller of two floating point values, ignoring blanks.
If the arguments have the same value, the result is that same value.
If one argument is blank, the result is the other one.
If both arguments are blank, the result is blank.
Multiple-argument minimum functions are also provided in the
Arrays
and Lists
packages.
-
a
(floating point): an argument
-
b
(floating point): another argument
- return value (floating point): the larger non-blank value of
a
and b
Next Previous Up Contents
Next: Distances
Up: Functions
Previous: CoordsRadians
STILTS - Starlink Tables Infrastructure Library Tool Set
Starlink User Note256
STILTS web page:
http://www.starlink.ac.uk/stilts/
Author email:
m.b.taylor@bristol.ac.uk
Mailing list:
topcat-user@jiscmail.ac.uk