math-exercises 2.0.20 → 2.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType3Exercise.js +8 -7
- package/lib/exercises/calculLitteral/inequations/firstDegreeInequationsType0.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/inequations/firstDegreeInequationsType0.js +3 -2
- package/lib/exercises/calculLitteral/inequations/firstDegreeInequationsType1.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/inequations/firstDegreeInequationsType1.js +2 -1
- package/lib/exercises/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/inequations/firstDegreeInequationsType2.js +2 -1
- package/lib/exercises/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/inequations/firstDegreeInequationsType3.js +2 -1
- package/lib/exercises/geometry/vectors/alignementViaColinearity.d.ts +12 -0
- package/lib/exercises/geometry/vectors/alignementViaColinearity.d.ts.map +1 -0
- package/lib/exercises/geometry/vectors/alignementViaColinearity.js +64 -0
- package/lib/exercises/geometry/vectors/colinearity.d.ts +10 -0
- package/lib/exercises/geometry/vectors/colinearity.d.ts.map +1 -0
- package/lib/exercises/geometry/vectors/colinearity.js +59 -0
- package/lib/exercises/geometry/vectors/fourthParallelogramPoint.d.ts +14 -0
- package/lib/exercises/geometry/vectors/fourthParallelogramPoint.d.ts.map +1 -0
- package/lib/exercises/geometry/vectors/fourthParallelogramPoint.js +65 -0
- package/lib/exercises/geometry/vectors/index.d.ts +5 -0
- package/lib/exercises/geometry/vectors/index.d.ts.map +1 -1
- package/lib/exercises/geometry/vectors/index.js +5 -0
- package/lib/exercises/geometry/vectors/paralellismViaColinearity.d.ts +14 -0
- package/lib/exercises/geometry/vectors/paralellismViaColinearity.d.ts.map +1 -0
- package/lib/exercises/geometry/vectors/paralellismViaColinearity.js +75 -0
- package/lib/exercises/geometry/vectors/parallelogramViaEqualVectors.d.ts +14 -0
- package/lib/exercises/geometry/vectors/parallelogramViaEqualVectors.d.ts.map +1 -0
- package/lib/exercises/geometry/vectors/parallelogramViaEqualVectors.js +67 -0
- package/lib/exercises/geometry/vectors/vectorCoordinatesFromTwoPoints.d.ts.map +1 -1
- package/lib/exercises/geometry/vectors/vectorCoordinatesFromTwoPoints.js +1 -1
- package/lib/exercises/probaStat/independancy.d.ts +9 -0
- package/lib/exercises/probaStat/independancy.d.ts.map +1 -0
- package/lib/exercises/probaStat/independancy.js +59 -0
- package/lib/exercises/probaStat/index.d.ts +1 -0
- package/lib/exercises/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/probaStat/index.js +1 -0
- package/lib/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.js +1 -1
- package/lib/exercises/sequences/geometric/geometricFindExplicitFormula.js +1 -1
- package/lib/exercises/utils/keys/coordinatesKeys.d.ts +3 -0
- package/lib/exercises/utils/keys/coordinatesKeys.d.ts.map +1 -0
- package/lib/exercises/utils/keys/coordinatesKeys.js +4 -0
- package/lib/index.d.ts +43 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/line.d.ts +11 -0
- package/lib/math/geometry/line.d.ts.map +1 -1
- package/lib/math/geometry/line.js +46 -0
- package/lib/math/geometry/point.d.ts +4 -15
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +29 -20
- package/lib/math/geometry/vector.d.ts +10 -5
- package/lib/math/geometry/vector.d.ts.map +1 -1
- package/lib/math/geometry/vector.js +21 -3
- package/lib/math/numbers/decimals/decimal.d.ts +1 -2
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +31 -87
- package/lib/math/numbers/reals/extendedRingElement.d.ts +2 -1
- package/lib/math/numbers/reals/extendedRingElement.d.ts.map +1 -1
- package/lib/server.js +0 -10
- package/lib/tree/nodes/functions/oppositeNode.d.ts +2 -1
- package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/oppositeNode.js +2 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +6 -0
- package/package.json +1 -1
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Decimal = exports.DecimalConstructor = void 0;
|
|
4
4
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
5
|
+
const round_1 = require("../../../math/utils/round");
|
|
5
6
|
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
6
7
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
7
8
|
const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
|
|
8
|
-
const integer_1 = require("../integer/integer");
|
|
9
9
|
const nombre_1 = require("../nombre");
|
|
10
10
|
const rational_1 = require("../rationals/rational");
|
|
11
11
|
class DecimalConstructor {
|
|
@@ -21,6 +21,7 @@ class DecimalConstructor {
|
|
|
21
21
|
}
|
|
22
22
|
return decimals;
|
|
23
23
|
}
|
|
24
|
+
//! a refacto, pour inclure "-0" et des min/max décimaux
|
|
24
25
|
static random(min, max, precision) {
|
|
25
26
|
let prec = precision ?? (0, randint_1.randint)(1, 4);
|
|
26
27
|
const int = (0, randint_1.randint)(min, max) + "";
|
|
@@ -57,84 +58,14 @@ class Decimal {
|
|
|
57
58
|
* @returns
|
|
58
59
|
*/
|
|
59
60
|
round(precision) {
|
|
60
|
-
|
|
61
|
-
if (precision < 0) {
|
|
62
|
-
if (precision < -intPartString.length)
|
|
63
|
-
throw Error("can't round to higher precision");
|
|
64
|
-
return new integer_1.Integer(this.intPart).round(-precision);
|
|
65
|
-
}
|
|
66
|
-
if (precision > this.precision)
|
|
67
|
-
throw Error("can't round to higher precision");
|
|
68
|
-
if (precision === this.precision)
|
|
69
|
-
return this;
|
|
70
|
-
let newFracPart = "", newIntPart = "";
|
|
71
|
-
const shouldRoundUp = Number(this.decimalPart[precision]) > 4;
|
|
72
|
-
if (shouldRoundUp) {
|
|
73
|
-
let retenue = true;
|
|
74
|
-
let i = precision - 1;
|
|
75
|
-
while (retenue) {
|
|
76
|
-
if (i > -1) {
|
|
77
|
-
const nb = (Number(this.decimalPart[i]) + 1) % 10;
|
|
78
|
-
if (nb || newFracPart) {
|
|
79
|
-
newFracPart = nb.toString() + newFracPart;
|
|
80
|
-
}
|
|
81
|
-
if (nb !== 0) {
|
|
82
|
-
retenue = false;
|
|
83
|
-
for (let j = i - 1; j > -1; j--) {
|
|
84
|
-
newFracPart = this.decimalPart[j] + newFracPart;
|
|
85
|
-
}
|
|
86
|
-
newIntPart = intPartString;
|
|
87
|
-
}
|
|
88
|
-
else
|
|
89
|
-
i--;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
const nb = (Number(intPartString[i + intPartString.length]) + 1) % 10;
|
|
93
|
-
newIntPart = nb + "" + newIntPart;
|
|
94
|
-
if (nb !== 0) {
|
|
95
|
-
retenue = false;
|
|
96
|
-
for (let j = i + intPartString.length - 1; j > -1; j--) {
|
|
97
|
-
newIntPart = intPartString[j] + newIntPart;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else
|
|
101
|
-
i--;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
let retenue = true;
|
|
107
|
-
let i = precision - 1;
|
|
108
|
-
while (retenue) {
|
|
109
|
-
if (i > -1) {
|
|
110
|
-
const nb = Number(this.decimalPart[i]);
|
|
111
|
-
if (nb || newFracPart) {
|
|
112
|
-
newFracPart = nb.toString() + newFracPart;
|
|
113
|
-
}
|
|
114
|
-
if (nb !== 0) {
|
|
115
|
-
retenue = false;
|
|
116
|
-
for (let j = i - 1; j > -1; j--) {
|
|
117
|
-
newFracPart = this.decimalPart[j] + newFracPart;
|
|
118
|
-
}
|
|
119
|
-
newIntPart = intPartString;
|
|
120
|
-
}
|
|
121
|
-
else
|
|
122
|
-
i--;
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
newIntPart = intPartString;
|
|
126
|
-
retenue = false;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return DecimalConstructor.fromParts(newIntPart, newFracPart);
|
|
61
|
+
return new Decimal((0, round_1.round)(this.value, precision));
|
|
131
62
|
}
|
|
132
63
|
multiplyByPowerOfTen(power) {
|
|
133
64
|
if (power === 0)
|
|
134
65
|
return this;
|
|
135
66
|
let newIntPart = "", newFracPart = "";
|
|
136
|
-
if (power >
|
|
137
|
-
newIntPart = this.
|
|
67
|
+
if (power > 0) {
|
|
68
|
+
newIntPart = (this.value + "").split(".")[0];
|
|
138
69
|
for (let i = 0; i < power; i++) {
|
|
139
70
|
newIntPart +=
|
|
140
71
|
i > this.decimalPart.length - 1 ? "0" : this.decimalPart[i];
|
|
@@ -142,35 +73,46 @@ class Decimal {
|
|
|
142
73
|
newFracPart = this.decimalPart.slice(power);
|
|
143
74
|
}
|
|
144
75
|
else {
|
|
145
|
-
const intPartString = this.intPart
|
|
76
|
+
const intPartString = this.intPart.toString().replace("-", "");
|
|
77
|
+
const isNegative = this.value < 0;
|
|
146
78
|
newFracPart = this.decimalPart;
|
|
147
79
|
for (let i = intPartString.length - 1; i > intPartString.length - 1 + power; i--) {
|
|
148
80
|
newFracPart = (i < 0 ? "0" : intPartString[i]) + newFracPart;
|
|
149
81
|
}
|
|
150
82
|
if (power + intPartString.length < 1)
|
|
151
|
-
newIntPart = "0";
|
|
83
|
+
newIntPart = isNegative ? "-0" : "0";
|
|
152
84
|
else
|
|
153
|
-
newIntPart =
|
|
85
|
+
newIntPart =
|
|
86
|
+
(isNegative ? "-" : "") +
|
|
87
|
+
intPartString.slice(0, power + intPartString.length);
|
|
154
88
|
}
|
|
89
|
+
console.log("in", newIntPart, newFracPart);
|
|
155
90
|
return DecimalConstructor.fromParts(newIntPart, newFracPart);
|
|
156
91
|
}
|
|
157
92
|
toScientificPart() {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
93
|
+
if (!this.decimalPart.length)
|
|
94
|
+
return new numberNode_1.NumberNode(this.intPart);
|
|
95
|
+
// const intString = this.intPart.toString();
|
|
96
|
+
// const intSize = intString.length;
|
|
97
|
+
// if (intSize === 0 && this.intPart !== 0) return this.toTree();
|
|
162
98
|
if (this.intPart === 0) {
|
|
99
|
+
//true for -0
|
|
163
100
|
const firstNonZeroIndex = this.decimalPart
|
|
164
101
|
.split("")
|
|
165
102
|
.findIndex((el) => Number(el) !== 0);
|
|
166
|
-
return new numberNode_1.NumberNode(Number("0."
|
|
103
|
+
return new numberNode_1.NumberNode(Number((this.tex[0] === "-" ? "-0." : "0.") +
|
|
104
|
+
this.decimalPart.slice(firstNonZeroIndex)));
|
|
167
105
|
}
|
|
168
|
-
|
|
106
|
+
const intString = this.intPart + "";
|
|
107
|
+
return new numberNode_1.NumberNode(Number((this.tex[0] === "-" ? "-" + this.tex[1] : this.tex[0]) +
|
|
108
|
+
"." +
|
|
109
|
+
(this.tex[0] === "-" ? intString.slice(2) : intString.slice(1)) +
|
|
110
|
+
this.decimalPart));
|
|
169
111
|
}
|
|
170
112
|
toScientificNotation() {
|
|
171
|
-
const intString = this.intPart
|
|
172
|
-
const intSize = intString.length;
|
|
173
|
-
if (
|
|
113
|
+
const intString = this.intPart + "";
|
|
114
|
+
// const intSize = intString.length + (this.value < 0 ? 1 : 0);
|
|
115
|
+
if (this.intPart > -10 && this.intPart < 10 && this.intPart !== 0)
|
|
174
116
|
return this.toTree();
|
|
175
117
|
const decNode = this.toScientificPart();
|
|
176
118
|
let leadingZeros = 0;
|
|
@@ -180,7 +122,9 @@ class Decimal {
|
|
|
180
122
|
break;
|
|
181
123
|
leadingZeros++;
|
|
182
124
|
}
|
|
183
|
-
const power = this.intPart === 0 ? -leadingZeros :
|
|
125
|
+
const power = this.intPart === 0 ? -leadingZeros : (this.intPart + "").length - 1;
|
|
126
|
+
if (power === 0)
|
|
127
|
+
return this.toTree();
|
|
184
128
|
if (power === 1)
|
|
185
129
|
return new multiplyNode_1.MultiplyNode(decNode, new numberNode_1.NumberNode(10));
|
|
186
130
|
return new multiplyNode_1.MultiplyNode(decNode, new powerNode_1.PowerNode(new numberNode_1.NumberNode(10), new numberNode_1.NumberNode(power)));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OppositeNode } from '../../../tree/nodes/functions/oppositeNode';
|
|
1
2
|
import { NumberNode } from '../../../tree/nodes/numbers/numberNode';
|
|
2
3
|
import { MultiplyNode } from '../../../tree/nodes/operators/multiplyNode';
|
|
3
4
|
import { SubstractNode } from '../../../tree/nodes/operators/substractNode';
|
|
@@ -11,6 +12,6 @@ export declare class ExtendedRingElement {
|
|
|
11
12
|
b: number;
|
|
12
13
|
algebraicElement: Nombre;
|
|
13
14
|
constructor(a: number, b: number, algebraicElement: Nombre);
|
|
14
|
-
toTree(): import("../../../tree/nodes/algebraicNode").AlgebraicNode | NumberNode | MultiplyNode | SubstractNode;
|
|
15
|
+
toTree(): import("../../../tree/nodes/algebraicNode").AlgebraicNode | NumberNode | MultiplyNode | OppositeNode | SubstractNode;
|
|
15
16
|
}
|
|
16
17
|
//# sourceMappingURL=extendedRingElement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extendedRingElement.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/reals/extendedRingElement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extendedRingElement.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/reals/extendedRingElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;GAGG;AACH,qBAAa,mBAAmB;IAM9B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,MAAM,CAAC;gBACb,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM;IAM1D,MAAM;CAeP"}
|
package/lib/server.js
CHANGED
|
@@ -41,16 +41,6 @@ const runServer = () => {
|
|
|
41
41
|
dotenv_1.default.config();
|
|
42
42
|
const app = (0, express_1.default)();
|
|
43
43
|
app.use((0, cors_1.default)());
|
|
44
|
-
// const string = "\\frac{9}{12}";
|
|
45
|
-
// const a = string.match(/^[0-9]+,?[0-9]*/);
|
|
46
|
-
// const before = Date.now();
|
|
47
|
-
// const parsed = parseLatex(string);
|
|
48
|
-
// console.log("res", parsed);
|
|
49
|
-
// console.log(parsed?.toTex());
|
|
50
|
-
// console.log(parsed?.simplify().toTex());
|
|
51
|
-
// console.log(parsed?.evaluate({ x: 1 }));
|
|
52
|
-
// console.log("time", Date.now() - before);
|
|
53
|
-
// tokenize(string);
|
|
54
44
|
app.get("/", (req, res) => {
|
|
55
45
|
res.json(allExercises);
|
|
56
46
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Node, NodeOptions, NodeType } from "../node";
|
|
2
2
|
import { FunctionNode, FunctionsIds } from "./functionNode";
|
|
3
|
+
import { NumberNode } from "../numbers/numberNode";
|
|
3
4
|
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode";
|
|
4
5
|
export declare function isOppositeNode(a: Node): a is OppositeNode;
|
|
5
6
|
export declare class OppositeNode implements FunctionNode {
|
|
@@ -19,7 +20,7 @@ export declare class OppositeNode implements FunctionNode {
|
|
|
19
20
|
*/
|
|
20
21
|
toAllValidTexs(opts?: NodeOptions): string[];
|
|
21
22
|
evaluate(vars: Record<string, number>): number;
|
|
22
|
-
simplify(opts?: SimplifyOptions): AlgebraicNode;
|
|
23
|
+
simplify(opts?: SimplifyOptions): AlgebraicNode | NumberNode;
|
|
23
24
|
equals(node: AlgebraicNode): boolean;
|
|
24
25
|
}
|
|
25
26
|
//# sourceMappingURL=oppositeNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oppositeNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/oppositeNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAMtD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"oppositeNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/oppositeNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAMtD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAgB,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMlE,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAGD,qBAAa,YAAa,YAAW,YAAY;IAC/C,EAAE,EAAE,YAAY,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;gBACP,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,WAAW;IAOpD,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAef,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,EAAE;IAgCtD;;;;OAIG;IACH,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAQ5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAGrC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe;IAI/B,MAAM,CAAC,IAAI,EAAE,aAAa;CAG3B"}
|
|
@@ -71,6 +71,8 @@ class OppositeNode {
|
|
|
71
71
|
return -this.child.evaluate(vars);
|
|
72
72
|
}
|
|
73
73
|
simplify(opts) {
|
|
74
|
+
if ((0, numberNode_1.isNumberNode)(this.child))
|
|
75
|
+
return new numberNode_1.NumberNode(-this.child.value);
|
|
74
76
|
return new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(-1), this.child).simplify(opts);
|
|
75
77
|
}
|
|
76
78
|
equals(node) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAK3E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKlE,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AACD,qBAAa,YAAa,YAAW,YAAY;IAC/C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAUpB,YAAY,IAAI,MAAM;IAItB,UAAU;IAGV,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IA2BpC,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAI5C,KAAK,IAAI,MAAM;IAaf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMrC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;
|
|
1
|
+
{"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAK3E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKlE,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AACD,qBAAa,YAAa,YAAW,YAAY;IAC/C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAUpB,YAAY,IAAI,MAAM;IAItB,UAAU;IAGV,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IA2BpC,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAI5C,KAAK,IAAI,MAAM;IAaf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMrC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IAyF/C,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;CAOrC"}
|
|
@@ -78,6 +78,12 @@ class FractionNode {
|
|
|
78
78
|
const simplifiedNum = this.leftChild.simplify(opts);
|
|
79
79
|
const simplifiedDenum = this.rightChild.simplify(opts);
|
|
80
80
|
const copy = new FractionNode(simplifiedNum, simplifiedDenum, this.opts);
|
|
81
|
+
if ((0, numberNode_1.isNumberNode)(simplifiedDenum) && simplifiedDenum.value === 1) {
|
|
82
|
+
return simplifiedNum;
|
|
83
|
+
}
|
|
84
|
+
if ((0, numberNode_1.isNumberNode)(simplifiedDenum) && simplifiedDenum.value === -1) {
|
|
85
|
+
return new oppositeNode_1.OppositeNode(simplifiedNum).simplify(opts);
|
|
86
|
+
}
|
|
81
87
|
const externalsNums = [];
|
|
82
88
|
const externalsDenums = [];
|
|
83
89
|
const recursiveNums = (node) => {
|