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