Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
a628552
1
Parent(s):
6024c83
Fix LaTeX precision tests
Browse files- test/test.py +3 -3
test/test.py
CHANGED
@@ -550,8 +550,8 @@ class TestLaTeXTable(unittest.TestCase):
|
|
550 |
# Different precision:
|
551 |
latex_table_str = model.latex_table(precision=5)
|
552 |
middle_part = r"""
|
553 |
-
$x_{0}$ & $1$ & $1.
|
554 |
-
$\cos{\left(x_{0} \right)}$ & $2$ & $0.
|
555 |
$x_{0} + x_{1} - \cos{\left(x_{0} x_{1} \right)}$ & $8$ & $1.1235 \cdot 10^{-15}$ \\
|
556 |
"""
|
557 |
true_latex_table_str = self.create_true_latex(middle_part)
|
@@ -580,7 +580,7 @@ class TestLaTeXTable(unittest.TestCase):
|
|
580 |
expr = sympy.Float(4583.4485748, dps=50)
|
581 |
self.assertEqual(to_latex(expr, prec=6), r"4583.45")
|
582 |
self.assertEqual(to_latex(expr, prec=5), r"4583.4")
|
583 |
-
self.assertEqual(to_latex(expr, prec=4), r"4583.
|
584 |
self.assertEqual(to_latex(expr, prec=3), r"4.58 \cdot 10^{3}")
|
585 |
self.assertEqual(to_latex(expr, prec=2), r"4.6 \cdot 10^{3}")
|
586 |
|
|
|
550 |
# Different precision:
|
551 |
latex_table_str = model.latex_table(precision=5)
|
552 |
middle_part = r"""
|
553 |
+
$x_{0}$ & $1$ & $1.0520$ \\
|
554 |
+
$\cos{\left(x_{0} \right)}$ & $2$ & $0.023150$ \\
|
555 |
$x_{0} + x_{1} - \cos{\left(x_{0} x_{1} \right)}$ & $8$ & $1.1235 \cdot 10^{-15}$ \\
|
556 |
"""
|
557 |
true_latex_table_str = self.create_true_latex(middle_part)
|
|
|
580 |
expr = sympy.Float(4583.4485748, dps=50)
|
581 |
self.assertEqual(to_latex(expr, prec=6), r"4583.45")
|
582 |
self.assertEqual(to_latex(expr, prec=5), r"4583.4")
|
583 |
+
self.assertEqual(to_latex(expr, prec=4), r"4583.")
|
584 |
self.assertEqual(to_latex(expr, prec=3), r"4.58 \cdot 10^{3}")
|
585 |
self.assertEqual(to_latex(expr, prec=2), r"4.6 \cdot 10^{3}")
|
586 |
|