Commit 3c54623
authored
fix(simplify): Correct regression in simplify (#2394)
* fix(simplify): Correct regression in simplify
Also adds a 'debugConsole' option to simplify() so that it is possible
to see the effect of each rule. This was critical to identifying the problem,
which was that recent changes ended up with `simplifyConstant` in the
wrong position in the list of rules. Correcting that also removed the need
for the two rules coalescing negations with constants.
Resolves #2393.
* fix(simplify): Correct another regression based on rule ordering
Disccovered that `x - (y-y+x)` had also stopped simplifying due
to recent changes, again because of re-ordering of the rules. So
added it to the tests, and fixed the rule ordering (adding a more
extensive comment about it). A big part of the reason that rule
ordering is so sensitive is that the reduction engine only checks
once in each pass for each rule whether it matches. So an alternate
fix to changing the rule ordering back would have been to re-check
each rule after it's applied (in case its application created new
instances of the rule) but since the re-ordering worked, that seemed
simpler as a fix for now.1 parent bfa42ec commit 3c54623
File tree
2 files changed
+34
-12
lines changed- src/function/algebra
- test/unit-tests/function/algebra
2 files changed
+34
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
148 | 151 | | |
149 | 152 | | |
150 | 153 | | |
| |||
225 | 228 | | |
226 | 229 | | |
227 | 230 | | |
| 231 | + | |
228 | 232 | | |
229 | 233 | | |
230 | 234 | | |
| |||
233 | 237 | | |
234 | 238 | | |
235 | 239 | | |
| 240 | + | |
| 241 | + | |
236 | 242 | | |
| 243 | + | |
237 | 244 | | |
238 | 245 | | |
| 246 | + | |
239 | 247 | | |
240 | 248 | | |
241 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
242 | 260 | | |
243 | 261 | | |
244 | 262 | | |
| |||
309 | 327 | | |
310 | 328 | | |
311 | 329 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 330 | + | |
317 | 331 | | |
318 | 332 | | |
319 | 333 | | |
| |||
330 | 344 | | |
331 | 345 | | |
332 | 346 | | |
333 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
334 | 353 | | |
335 | | - | |
| 354 | + | |
| 355 | + | |
336 | 356 | | |
337 | 357 | | |
338 | 358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
273 | 274 | | |
274 | 275 | | |
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
278 | 279 | | |
| 280 | + | |
279 | 281 | | |
280 | 282 | | |
281 | 283 | | |
| |||
0 commit comments