[matrix][cssom-view] DOMMatrix operating on single or double precision floating point numbers

Hi,

The DOMMatrix spec currently has an issue about the floating point precision [1].

Some people objected in using double precision, since double precision operations can take more computation cycles, especially on mobile devices. The counter proposal is to use single precision floating points and truncate on passing double precision values. Truncation to single precision and expanding to double precision (for instance to return a DOMPoint) takes more time as well. So even that has disadvantages. Note that arithmetic operations in JS are done with double precision, internal operations could still benefit of single precision operations.

On the other side, many implementations with at least one exception (Gecko) operate on double precision already. The web exposed, prefixed interfaces WebKitCSSMatrix [2] and MSCSSMatrix [3] for instance are operating on double precision values. This already causes accumulating errors that can be seen between Gecko's and WebKit's implementation of CSS Transforms when applying multiple transformations.

DOMQuad and DOMPoint will be involved in arithmetic operations as well and it would be great to find a consensus on the precision question which may solve problems on CSS Transforms as well.

Greetings,
Dirk

[1] http://www.w3.org/TR/matrix/#the-cssmatrix-interface
[2] https://developer.apple.com/library/safari/documentation/AudioVideo/Reference/WebKitCSSMatrixClassReference/WebKitCSSMatrix/WebKitCSSMatrix.html
[3] http://msdn.microsoft.com/en-us/library/windows/apps/hh453593.aspx

Received on Sunday, 22 September 2013 01:43:08 UTC