1 | import { factory } from '../../utils/factory'
|
2 | import { deepMap } from '../../utils/collection'
|
3 | import { acothNumber } from '../../plain/number'
|
4 |
|
5 | const name = 'acoth'
|
6 | const dependencies = ['typed', 'config', 'Complex', 'BigNumber']
|
7 |
|
8 | export const createAcoth = factory(name, dependencies, ({ typed, config, Complex, BigNumber }) => {
|
9 | |
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | return typed(name, {
|
31 | number: function (x) {
|
32 | if (x >= 1 || x <= -1 || config.predictable) {
|
33 | return acothNumber(x)
|
34 | }
|
35 | return new Complex(x, 0).acoth()
|
36 | },
|
37 |
|
38 | Complex: function (x) {
|
39 | return x.acoth()
|
40 | },
|
41 |
|
42 | BigNumber: function (x) {
|
43 | return new BigNumber(1).div(x).atanh()
|
44 | },
|
45 |
|
46 | 'Array | Matrix': function (x) {
|
47 | return deepMap(x, this)
|
48 | }
|
49 | })
|
50 | })
|