When JS reads a float value from CSS, it gets it back as a string. As the following console session shows, we format long floats to six digits. This should be checked against other browsers, unified, and spec'd. > document.foobar = 1/9; 0.1111111111111111 > document.foobar 0.1111111111111111 > var x = document.getElementById('header') undefined > x <div id="header"> > x.style.opacity = 1/9; 0.1111111111111111 > x.style.opacity 0.111111
Another related question is what the upper bound on CSS values are. E.g., can I set foobar.style.left = 100000000000000000000000px?
Created attachment 45276 [details] Page for testing float handling
+simon, in case he's curious The attachment tries to summarize some corner cases that browsers might have. Next I need to run this on various browsers and see if there's any pattern they might agree on. (I only have a Linux box at the moment, but when I'm back at work I can test IE, Safari, and Opera.)
I can take this to the CSS Working group.
By the way, I realized that this attachment is probably confusing things a bit because we might be doing a float -> string conversion to print out the result in the table. That's probably using another printf()-like call that will introduce exponential notation etc. that may not be part of the code this is intending to test.