You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
581 B

4 months ago
const reflect = (f) => {
return (x) => -f(-x);
};
export const logs = (base, shouldReflect) => {
const baseCache = Math.log(base);
const log = base === Math.E
? Math.log
: base === 10
? Math.log10
: base === 2
? Math.log2
: (x) => Math.log(x) / baseCache;
return shouldReflect ? reflect(log) : log;
};
export const pows = (base, shouldReflect) => {
const pow = base === Math.E ? Math.exp : (x) => base ** x;
return shouldReflect ? reflect(pow) : pow;
};
//# sourceMappingURL=log.js.map