Dr said:
In comp.lang.javascript message <
[email protected]
rlyn.invalid>, Tue, 28 Jul 2009 17:43:56, Dr J R Stockton
Q ?
I'm not sure that toFixed is all that useful, due to rounding issues. I
mean, it is not something that could be used for money, right?
1.1255.toFixed(3);
IE7, some Safari versions:
1.126
Others:
1.125
Furthermore, the range of number magnitudes for which JScript
X.toFixed(0) wr0ngly gives 0 is not 0.50 to 0.94 as previously stated,
Is it? I see 0.95.toFixed(0)
IE7: 1
but 0.50 t0 0.95. Those numbers scale by /10 as the argument is
incremented.
JScript +(X.toFixed(0)) also differs from Math.round(X) for the negative
half-integers (as required by the standards).
JScript only, or implementations in general?
Page <URL:
http://www.merlyn.demon.co.uk/js-rndg1.htm> is updated in that
part, with demonstrations.
It occurs to me that, while it would be too long for the FAQ itself, it
might be useful to have in the Notes one or more pages which demonstrate
by code such variations between browsers, as in that page and in
<URL:
http://www.merlyn.demon.co.uk/js-datex.htm>. With code showing the
effect in the user's current browser, such a document can support all
browsers ; and, if differences are reported, one knows what the tests
were.
Automated Unit Tests for standards are something I've wanted to do but
have not done. This could be done for ECMAScript and would be very
useful for the DOM.
It came up a w3c mailing list, but didn't get much follow up.
http://lists.w3.org/Archives/Public/www-dom/2009JulSep/0035.html
My hesitations to setting up testing for the w3c is that it takes
effort. I don't want to abet those w3c members who would write tests for
what I think are very bad ideas. I think they would do this, and that it
could result in those bad ideas going into the latest build of whatever
browser, just to get a higher "compatibility rank" of passing more
tests. I do not endorse HTML 5. I don't want w3c members to use their
position to win arguments and write tests for bad ideas.
So, it is still a good idea, and I think it should be something that
members of this NG could start. That still takes effort, but instead of
testing the what wishlist, it can focus on existing w3c TRs and ECMAScript.
Garrett