15
0
Files
python-fontPens/fix-fp-issue.patch

27 lines
1.1 KiB
Diff
Raw Permalink Normal View History

Subject: Fix floating point precission issue in tests
Author: Antonio Larrosa <alarrosa@suse.com>
Depending on the computer where the tests run, the result of
estimateQuadraticCurveLength((0, 0), (50, 20), (100, 40))
can be
107.70329614269009
or
107.70329614269008
so it's better to ignore the final digit
Index: antonio/obs/home/alarrosa/branches/devel/languages/python/fonts/python-fontPens/fontPens-0.2.4/Lib/fontPens/penTools.py
===================================================================
--- fontPens-0.2.4/Lib/fontPens/penTools.py
+++ fontPens-0.2.4.new/Lib/fontPens/penTools.py
@@ -160,8 +160,8 @@ def estimateQuadraticCurveLength(pt0, pt
0.0
>>> estimateQuadraticCurveLength((0, 0), (50, 0), (80, 0)) # collinear points
80.0
- >>> estimateQuadraticCurveLength((0, 0), (50, 20), (100, 40)) # collinear points
- 107.70329614269009
+ >>> int(10000000000000 * estimateQuadraticCurveLength((0, 0), (50, 20), (100, 40))) # collinear points
+ 1077032961426900
>>> estimateQuadraticCurveLength((0, 0), (0, 100), (100, 0))
153.6861437729263
>>> estimateQuadraticCurveLength((0, 0), (50, -10), (80, 50))