1 | import { factory } from '../../utils/factory.js';
|
2 | import { typeOf } from '../../utils/is.js';
|
3 | var name = 'divideScalar';
|
4 | var dependencies = ['typed', 'numeric'];
|
5 | export var createDivideScalar = factory(name, dependencies, (_ref) => {
|
6 | var {
|
7 | typed,
|
8 | numeric
|
9 | } = _ref;
|
10 |
|
11 | |
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | return typed(name, {
|
24 | 'number, number': function numberNumber(x, y) {
|
25 | return x / y;
|
26 | },
|
27 | 'Complex, Complex': function ComplexComplex(x, y) {
|
28 | return x.div(y);
|
29 | },
|
30 | 'BigNumber, BigNumber': function BigNumberBigNumber(x, y) {
|
31 | return x.div(y);
|
32 | },
|
33 | 'Fraction, Fraction': function FractionFraction(x, y) {
|
34 | return x.div(y);
|
35 | },
|
36 | 'Unit, number | Fraction | BigNumber': function UnitNumberFractionBigNumber(x, y) {
|
37 | var res = x.clone();
|
38 |
|
39 | var one = numeric(1, typeOf(y));
|
40 | res.value = this(res.value === null ? res._normalize(one) : res.value, y);
|
41 | return res;
|
42 | },
|
43 | 'number | Fraction | BigNumber, Unit': function numberFractionBigNumberUnit(x, y) {
|
44 | var res = y.clone();
|
45 | res = res.pow(-1);
|
46 |
|
47 | var one = numeric(1, typeOf(x));
|
48 | res.value = this(x, y.value === null ? y._normalize(one) : y.value);
|
49 | return res;
|
50 | },
|
51 | 'Unit, Unit': function UnitUnit(x, y) {
|
52 | return x.divide(y);
|
53 | }
|
54 | });
|
55 | }); |
\ | No newline at end of file |