Home, Up: Operators and Constants
1-argument operators replace their argument (the value to their left) and themselves with the result of the operation.
On this page:
Arithmetic Operators, Trigonometric Operators, Limiting Operators, "IS" Operators, Random True Operator, Measurement Unit Conversion Operators, Large Number Units, Notes.
SQ means "square" -- example: 3 SQ = 9
SQRT means "square root" -- example: 9 SQRT = 3
CUBE means "cube" -- example: 3 CUBE = 27
CBRT means "cubic root" (argument can be negative) -- example: -27 CBRT = -3
LN means "natural logarithm" -- example: 100 LN = 4.605...
LOG10 means "logarithm base 10" -- example: 100 LOG10 = 2
LOG2 means "logarithm base 2" -- example: 64 LOG2 = 6
EXP means "e to the power of ..." -- example: 2 EXP = 7.389...
EXP10 means "10 to the power of ..." -- example: 2 EXP10 = 100
EXP2 means "2 to the power of ..." -- example: 6 EXP2 = 64
! means "factorial" (argument must be 0 or positive integer, max. 449) -- example: 4 ! = 24
RCP means "reciprocal value" -- example: 5 RCP = 0.2
+- means "invert sign" -- example: 3 +- = -3
ABS means "absolute value" -- example: -3 ABS = 3
SIGN means "sign (+1, 0 or -1)" -- example: -3 SIGN = -1 (SIGN observes the zero threshold)
INT means "integer part" -- example: 3.25 INT = 3
FRAC means "fractional part" -- example: 3.25 FRAC = 0.25
DIGITS means "number of digits before or number of zeros after decimal point" -- examples: 27.3 DIGITS = 2, 0.00273 DIGITS = -2
Regarding angles, Hypatia can be in "degrees" or in "radians" mode. Radians mode is default. The commands USE DEG and USE RAD set "degrees" or "radians" mode.
For more on this topic, see page Angles in chapter "Numbers".
RAD means "convert degrees to radians" -- example: 180 RAD = 3.141...
DEG means "convert radians to degrees" -- example: PI DEG = 180 (Hypatia knows the constant PI)
SIN means "sine"
COS means "cosine"
TAN means "tangent"
ASIN means "arcsine"
ACOS means "arccos"
ATAN means "arctangent"
POS means "only positive value, otherwise 0" -- examples: 3 POS = 3, -3 POS = 0
NEG means "only negative value, otherwise 0" -- examples: 3 NEG = 0, -3 NEG = -3
Compare the 2-argument limit operators GATE, UPLIMIT, LOLIMIT and ABSLIMIT.
The result of an "is" operator is 1 if the statement about its argument is true, and 0 if it is false.
The numerical "is" operators observe the zero threshold (see "Notes" below), this does not apply to ISPOSINT and ISPRIME.
IS0 means "is zero" -- example: 0.3 IS0 = 0
ISNOT0 means "is not zero" -- example: 0.3 ISNOT0 = 1 (you can also write IS+-)
IS+ means "is positive" -- example: 0 IS+ = 0
IS+0 means "is positive or zero" -- example: 0 IS+0 = 1 (you can also write IS0+)
IS- means "is negative" -- example: 0 IS- = 0
IS-0 means "is negative or zero" -- example: 0 IS-0 = 1 (you can also write IS0-)
ISPOSINT means "is positive integer" -- example: 3 ISPOSINT = 1
ISPRIME means "is prime number" -- example: 13 ISPRIME = 1
The logical operators do not observe the zero threshold, only arguments exactly zero are taken as false.
ISFALSE means "is (exactly) zero" -- example: 0.3 ISFALSE = 0 (similar to IS0, but does not observe the zero threshold)
ISTRUE means "is not (exactly) zero" -- example: 0.3 ISTRUE = 1 (similar to ISNOT0, but does not observe the zero threshold)
RANDTRUE means "1 with specified probability (from 0 to 1), else 0" -- example: 0.3 RANDTRUE = 1 with a probability of 30%
Compare the RAND pseudo constant and the RANDINT and RANDND 2-argument operators.
The names of all unit conversion operators begin with a colon. They work the same as other operators.
:F means "convert degrees Celsius to Fahrenheit"
:C means "convert degrees Fahrenheit to Celsius"
:MI means "convert km to international miles"
:KM means "convert international miles to km"
:NAUTMI means "convert km to nautical miles", or "convert km/h to knots"
:NAUTKM means "convert nautical miles to km", or "convert knots to km/h"
:IN means "convert cm to inches"
:CM means "convert inches to cm"
:FT means "convert meter to feet" (1 ft = 12 in)
:M means "convert feet to meter" (1 ft = 12 in)
:LB means "convert kg to avoirdupois pounds"
:KG means "convert avoirdupois pounds to kg"
:OZ means "convert g to avoirdupois ounces" (1 lb = 16 oz)
:G means "convert avoirdupois ounces to g" (1 lb = 16 oz)
:TOZ means "convert g to troy ounces"
:TG means "convert troy ounces to g"
:GAL means "convert liters to US liquid gallons"
:L means "convert US liquid gallons to liters"
:MPG means "convert miles per gallon to liters per 100km", and also "convert liters per 100km to miles per gallon"
(By default, Hypatia inserts apostrophes in numbers with more than 3 digits -- see page Output Format in chapter "Numbers".)
LAKH means "multiply value by one hundred thousand" (Indian numbering system) -- example: 3.1 LAKH = 310'000
MILLION means "multiply value by one million" -- example: 3.1 MILLION = 3'100'000
CRORE means "multiply value by ten million" (Indian numbering system) -- example: 3.1 CRORE = 31'000'000
Large number units work like 1-argument operators -- example: 2 1 MILLION + = 1'000'002, 2 1 + MILLION = 3'000'000.
They differ from other 1-argument operators in two ways:
- you can use them in MAXLOOP n, DO n and REPEAT n commands
- you can use them after numbers at the beginning of lines in chain calculations:
? 3
= 3
? MILLION
= 3'000'000
? 2 MILLION +
= 5'000'000
SIN and COS round results less than plus/minus 1e-18 to zero.
TAN requires absolute value of argument to be less than pi/2 or 90 degrees.
Do not confuse the RAD and DEG operators with the USE DEG and USE RAD commands!
The zero threshold gets explained in chapter "Numbers".
The zero threshold applies to SIGN and to the "is" operators IS0, ISNOT0, IS+, IS+0, IS- and IS-0.
FRAC rounds the absolute value of its result down to 0.999999999999999 (15 digits) if it is higher, to avoid showing the result 1.
Home, Up: Operators and Constants, Next: 2-Argument Operators