-
Notifications
You must be signed in to change notification settings - Fork 1
/
unary.ts
56 lines (55 loc) · 1.76 KB
/
unary.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* Represents any kind of operator that only takes one operand to operate on.
*/
export enum UnaryOperator {
/** Represents the negative of a scalar. */
NEG = "neg",
/** Represents the trigonometric sine function. */
SIN = "sin",
/** Represents the trigonometric cosine function. */
COS = "cos",
/** Represents the trigonometric tangent function. */
TAN = "tan",
/** Represents the inverse trigonometric sine function. */
ASIN = "asin",
/** Represents the inverse trigonometric cosine function. */
ACOS = "acos",
/** Represents the inverse trigonometric tangent function. */
ATAN = "atan",
/** Represents the hyperbolic sine function. */
SINH = "sinh",
/** Represents the hyperbolic cosine function. */
COSH = "cosh",
/** Represents the hyperbolic tangent function. */
TANH = "tanh",
/** Represents the inverse hyperbolic sine function. */
ASINH = "asinh",
/** Represents the inverse hyperbolic cosine function. */
ACOSH = "acosh",
/** Represents the inverse hyperbolic tangent function. */
ATANH = "atanh",
/** Represents the common logarithm function (to the base 10). */
LOG = "log",
/** Represents the natural logarithm function (to the base `e`). */
LN = "ln",
/** Represents the exponentiation function. */
EXP = "exp",
/** Represents the square root function. */
SQRT = "sqrt",
/** Represents the absolute value function. */
ABS = "abs",
/** Represents the greatest integer function. */
FLOOR = "floor",
/** Represents the least integer function. */
CEIL = "ceil"
}
/**
* Checks whether the passed string has been defined as a UnaryOperator.
*/
export function isUnaryOperator(s: string): s is UnaryOperator {
type iter = keyof typeof UnaryOperator;
for(let elt in UnaryOperator)
if(UnaryOperator[<iter>elt] === s)
return true;
return false;
}