New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 671173 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Jan 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Geometry interfaces tests shouldn't compare double numbers without any tolerance

Reported by ossy.sze...@gmail.com, Dec 5 2016

Issue description

UserAgent: 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.
 

Comment 2 by ajha@chromium.org, Dec 5 2016

Cc: jinho.b...@samsung.com dominicc@chromium.org
Labels: M-57
Status: Untriaged (was: Unconfirmed)
Marking this Untriaged as CL is under review and change the status accordingly once the CL is committed.


The fix already landed, it can be closed. (but I don't have the power to do it)
Status: Fixed (was: Untriaged)
Okay great!

Sign in to add a comment