Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #16607

Re: Specification error for Math.round

Message-ID <1836672.QNfzn4bpLz@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-10-13 22:14 +0200
Subject Re: Specification error for Math.round
Newsgroups comp.lang.javascript
References <6dc8cb55-c29c-4bb2-ab6d-d9a9447cffd4@googlegroups.com> <b07ab1c9-fbf6-4c55-964e-17a69be1a7f3@googlegroups.com> <39e06fb5-7d74-4b5d-83bf-d2f7b3181168@googlegroups.com> <CbGdnbfKl-UJW-rNnZ2dnUVZ_vydnZ2d@earthlink.com>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Patricia Shanahan wrote:

> RobG wrote:
>> If x is an integer, then for simple rounding you are correct. But as
>> Patricia said, a common rounding algorithm is to round to the nearest
>> even number (sometimes called "bankers rounding") to attenuate
>> rounding inaccuracy.
> 
> It's perhaps worth emphasizing the fact that the ties go to nearest even
> style of rounding is the normal rounding mode in JavaScript arithmetic.
                                                   ^^^^^^^^^^
That would be _ECMAScript_.¹  But you are oversimplifying, see ES 5.1 
§9.8.1.  One additional caveat here is that the numbers you *see* are only 
string representations of Number values.

BTW, your quoting style is suboptimal.  Omissions, if any, should be 
indicated at the same quotation level as the text from which text has been 
omitted.  `[...]' or (typographically correct) `[…]' should be used to 
indicate omission, to distinguish it from an ellipsis in the quoted text.


PointedEars
___________
¹  But perhaps one should be grateful already that you are not writing
   "Javascript" or "javascript" instead.  Sigh. [psf 10.1]
-- 
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Specification error for Math.round RobG <rgqld@iinet.net.au> - 2012-10-10 19:52 -0700
  Re: Specification error for Math.round Patricia Shanahan <pats@acm.org> - 2012-10-11 07:29 +0100
    Re: Specification error for Math.round Dr J R Stockton <reply1241@merlyn.demon.co.uk.invalid> - 2012-10-12 23:00 +0100
  Re: Specification error for Math.round Danny <dann90038@gmail.com> - 2012-10-11 13:16 -0700
    Re: Specification error for Math.round Patricia Shanahan <pats@acm.org> - 2012-10-12 00:14 +0100
    Re: Specification error for Math.round RobG <rgqld@iinet.net.au> - 2012-10-11 21:46 -0700
      Re: Specification error for Math.round Patricia Shanahan <pats@acm.org> - 2012-10-12 08:28 +0100
        Re: Specification error for Math.round Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-10-13 22:14 +0200
          Re: Specification error for Math.round Patricia Shanahan <pats@acm.org> - 2012-10-13 21:45 +0100
            Re: Specification error for Math.round "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-10-13 23:59 +0200
        Re: Specification error for Math.round Dr J R Stockton <reply1241@merlyn.demon.co.uk.invalid> - 2012-10-13 19:31 +0100
      Re: Specification error for Math.round Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-14 11:09 +0000
  Re: Specification error for Math.round Dr J R Stockton <reply1241@merlyn.demon.co.uk.invalid> - 2012-10-12 22:48 +0100

csiph-web