Skip to content

Commit fdef445

Browse files
committed
fix counting trailing zeros when we also have leading zeros, add tests
1 parent 7e13771 commit fdef445

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

src/conversion/latex-to-ast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ export class LatexToAst {
11461146
if (parsedNumber !== number.toString()) {
11471147
const p = number.toString();
11481148
// @ts-ignore
1149-
const sub = result
1149+
const sub = parsedNumber
11501150
// @ts-ignore
11511151
.substring(p.length)
11521152
.split("")

src/fixtures/latex-equal/literal/literal.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,20 @@ export default {
1515
opts: { literal: { allowTrailingZeros: true } },
1616
},
1717
{
18-
only:true,
1918
target: "0.500",
2019
eq: [".500000"],
20+
opts: { literal: { allowTrailingZeros: true } },
21+
ne: [".5001"],
22+
},
23+
{
24+
target: "0.500",
25+
ne: [".500000"],
26+
opts: { literal: { allowTrailingZeros: false } },
27+
},
28+
{
29+
target: "0.500",
30+
eq: [".500"],
31+
opts: { literal: { allowTrailingZeros: true } },
2132
ne: [".5001"],
2233
},
2334
{

src/latex-equal.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ export const latexEqual = (a: Latex, b: Latex, opts: Opts) => {
2626
}
2727

2828
const al = lta.convert(a);
29-
console.log(al, "al")
30-
3129

3230
const bl = lta.convert(b);
33-
console.log(bl, "bl")
31+
3432
if (differenceIsTooGreat(al, bl)) {
3533
return false;
3634
}

0 commit comments

Comments
 (0)