15
0
Files
python-fontPens/fix-fp-issue.patch
Matej Cepl 6691d247fb Accepting request 814145 from home:alarrosa:branches:devel:languages:python
- Add patch to fix floating point precission issue that made tests
  fail depending on where the package is built
  * fix-fp-issue.patch

OBS-URL: https://build.opensuse.org/request/show/814145
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-fontPens?expand=0&rev=4
2020-06-12 11:56:30 +00:00

27 lines
1.1 KiB
Diff

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))