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


Groups > comp.lang.javascript > #16620

Re: Specification error for Math.round

From Dr J R Stockton <reply1241@merlyn.demon.co.uk.invalid>
Newsgroups comp.lang.javascript
Subject Re: Specification error for Math.round
Date 2012-10-13 19:31 +0100
Organization Home
Message-ID <jkEQRiKMObeQFw8b@invalid.uk.co.demon.merlyn.invalid> (permalink)
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>

Show all headers | View raw


In comp.lang.javascript message <CbGdnbfKl-UJW-rNnZ2dnUVZ_vydnZ2d@earthl
ink.com>, Fri, 12 Oct 2012 08:28:19, Patricia Shanahan <pats@acm.org>
posted:

>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.
>It is what you get if you add two numbers, and the exact sum has more
>than 53 bits, ignoring leading and trailing zeros.

Forced rounding because 53 bits is insufficient and voluntary rounding
by explicitly calling a rounding routine are two quite distinct cases,
and neither should influence the other.

-- 
 (c) John Stockton, nr London, UK.  Mail via homepage.  Turnpike v6.05  MIME.
  Web  <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms and links;
  Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.

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