Geometry interfaces tests shouldn't compare double numbers without any tolerance
Reported by
ossy.sze...@gmail.com,
Dec 5 2016
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0 Steps to reproduce the problem: I found this issue when tried to land an inverse matrix optimization - https://codereview.chromium.org/2545473002/ var matrix3d = new DOMMatrix([10, 20, 30, 40, 40, 40, 30, 20, 10, 20, 40, 30, 20, 40, 50, 100]); matrix3d.invertSelf(); assert_3d_matrix_equals(matrix3d, [-1.6, 0.05, 0.6, 0.45, 2.05, -0.025, -0.8, -0.575, -0.4, 0, 0.2, 0.1, -0.3, 0, 0.1, 0.1]); The problem here is that many numbers aren't representable accurately by doubles, for example -1.6 , 0.05, 0.6, ... The last step of the matrix inverse algorithm is to divide by the determinant, which is -40000 for this matrix. If we multiply with the reciprocal of the determinant, the result won't be exactly same because of minor rounding differences. 2.05000000000000026645 != 2.04999999999999982236 82000 / 4000 != 82000 * (1/4000) What is the expected behavior? The test shouldn't expect exact results without any tolerance. What went wrong? . Did this work before? N/A Chrome version: Channel: n/a OS Version: Flash Version: Other tests don't use assert_3d_matrix_equals, but assert_matrix_almost_equals which has 10^-10 tolerance.
,
Dec 5 2016
Marking this Untriaged as CL is under review and change the status accordingly once the CL is committed.
,
Dec 7 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/b023c5634a6287bc0ed0635015372c04c4fade6e commit b023c5634a6287bc0ed0635015372c04c4fade6e Author: ossy.szeged <ossy.szeged@gmail.com> Date: Wed Dec 07 10:22:27 2016 Geometry interfaces tests shouldn't compare double numbers without any tolerance BUG= 671173 Review-Url: https://codereview.chromium.org/2552743002 Cr-Commit-Position: refs/heads/master@{#436905} [modify] https://crrev.com/b023c5634a6287bc0ed0635015372c04c4fade6e/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-invert.html [modify] https://crrev.com/b023c5634a6287bc0ed0635015372c04c4fade6e/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly-inverse.html
,
Jan 2 2017
The fix already landed, it can be closed. (but I don't have the power to do it)
,
Jan 2 2017
Okay great! |
|||
►
Sign in to add a comment |
|||
Comment 1 by ossy.sze...@gmail.com
, Dec 5 2016