On Sep 24, 2008, at 9:01 AM, Mike Cowlishaw wrote: >> I'm not sure what you are getting at. a[1] and a[1.000] refer to the >> same property in ECMAScript, but a[1m] and a[1.000m] would not. Are >> you saying this isn't a problem? > > Absolutely not a problem ... many languages (and ES itself) which > index > 'arrays' by strings treat the index "1.000" as different from "1", and > this is not considered a problem.
But they do not treat 1.000 as an index differently from 1. Explicit string indexes, whether literally expressed or computed, are not the issue here. > This is, no doubt, because if one is treating array indexes as a > set of > integers you use integer operations on those indexes (almost > exclusively > +, -, and *). If one does use a divide, Maciej pointed out reciprocal multiplication as strength-reduced division; this is done often enough in graphics and other low-level code. > it would be carefully chosen to > produce an integer result; But what if scale is preserved? > anything which produced a result without an > exponent of 0 would always be more likely to give a non-zero > fraction that > .0, .00, .000, etc. -- and those non-zero ones would fail rapidly. Sorry, I didn't follow this ("that" should be "than"?). /be > _______________________________________________ Es-discuss mailing list Es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss