1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.pows = exports.logs = void 0;
|
4 | const reflect = (f) => {
|
5 | return (x) => -f(-x);
|
6 | };
|
7 | const logs = (base, shouldReflect) => {
|
8 | const baseCache = Math.log(base);
|
9 | const log = base === Math.E
|
10 | ? Math.log
|
11 | : base === 10
|
12 | ? Math.log10
|
13 | : base === 2
|
14 | ? Math.log2
|
15 | : (x) => Math.log(x) / baseCache;
|
16 | return shouldReflect ? reflect(log) : log;
|
17 | };
|
18 | exports.logs = logs;
|
19 | const pows = (base, shouldReflect) => {
|
20 | const pow = base === Math.E ? Math.exp : (x) => base ** x;
|
21 | return shouldReflect ? reflect(pow) : pow;
|
22 | };
|
23 | exports.pows = pows;
|
24 |
|
\ | No newline at end of file |