UNPKG

1.13 kBJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5function factorial(a) {
6 if (a % 1 || !(+a >= 0)) return NaN;
7 if (a > 170) return Infinity;else if (a === 0) return 1;else {
8 return a * factorial(a - 1);
9 }
10}
11function power(a, b) {
12 return Math.pow(a, b);
13}
14function sqrt(a) {
15 return Math.sqrt(a);
16}
17var exponentialSymbols = {
18 symbols: {
19 '!': {
20 postfix: {
21 symbol: '!',
22 f: factorial,
23 notation: 'postfix',
24 precedence: 6,
25 rightToLeft: 0,
26 argCount: 1
27 },
28 symbol: '!',
29 regSymbol: '!'
30 },
31 '^': {
32 infix: {
33 symbol: '^',
34 f: power,
35 notation: 'infix',
36 precedence: 5,
37 rightToLeft: 1,
38 argCount: 2
39 },
40 symbol: '^',
41 regSymbol: '\\^'
42 },
43 sqrt: {
44 func: {
45 symbol: 'sqrt',
46 f: sqrt,
47 notation: 'func',
48 precedence: 0,
49 rightToLeft: 0,
50 argCount: 1
51 },
52 symbol: 'sqrt',
53 regSymbol: 'sqrt\\b'
54 }
55 }
56};
57var _default = exports["default"] = exponentialSymbols;
58module.exports = exports.default;
\No newline at end of file