In comp.lang.javascript message <48***********************@news.sunsite.

dk>, Fri, 10 Oct 2008 23:00:02, FAQ server <ja********@dotinternet.be>

posted:

>ECMAScript numbers are represented in binary as IEEE-754 (IEC 559)

Doubles, with a resolution of 53 bits, giving an accuracy of

15-16 decimal digits; integers up to about ` 9e15 ` are precise, but

few decimal fractions are. Given this, arithmetic is as exact

as possible, but no more. Operations on integers are exact if

the true result and all intermediates are integers within that

range.

The last sentence is correct. However, the semi-literate may not

recognise the difference between the concepts expressed by "if" and

"only if".

One can say that "Operations on Numbers are exact if the true result

and all intermediates can be expressed exactly as binary fractions with

a 53-bit mantissa and an exponent in the range -X to +Y" which is also

(I think) exact and covers more, but not all, cases. One can say that

"Operations on Numbers are exact if the true result and all

intermediates can be expressed exactly as IEEE Doubles", but that won't

mean anything to the intended audience.

Can the wording be briefly improved so that naive readers will realise

that operations on numbers which are multiples of 0.5, 0,25, 0,125,

.... about 1.1102230246251565404236316680908e-16 are safe? Or is "few

decimal fractions" good enough?

--

(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.

Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.

Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)

Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)