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


Groups > comp.lang.javascript > #16594

Re: Specification error for Math.round

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From Dr J R Stockton <reply1241@merlyn.demon.co.uk.invalid>
Newsgroups comp.lang.javascript
Subject Re: Specification error for Math.round
Date Fri, 12 Oct 2012 23:00:41 +0100
Organization Home
Lines 29
Message-ID <Jml6BCIJMJeQFwYf@invalid.uk.co.demon.merlyn.invalid> (permalink)
References <6dc8cb55-c29c-4bb2-ab6d-d9a9447cffd4@googlegroups.com> <sMudna--d5iv-uvNnZ2dnUVZ_tydnZ2d@earthlink.com>
Mime-Version 1.0
Content-Type text/plain;charset=us-ascii
Injection-Info mx04.eternal-september.org; posting-host="530603207bb5dc63eadbc45c88da0024"; logging-data="9786"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18LzKM6KOUb2iwFGmP7dRZZwTYLOS1MRXo="
User-Agent Turnpike/6.05-S (<hg+ExxAgcsscjA9uK+8bCnc9V5>)
Cancel-Lock sha1:cdFbU6GgjCnZiom7qGGjI67pFE0=
Xref csiph.com comp.lang.javascript:16594

Show key headers only | View raw


In comp.lang.javascript message <sMudna--d5iv-uvNnZ2dnUVZ_tydnZ2d@earthl
ink.com>, Thu, 11 Oct 2012 07:29:07, Patricia Shanahan <pats@acm.org>
posted:

>Most rounding is being done according to IEEE 754 round to nearest, in
>which ties go to the even number. This particular rounding is sending
>ties to the larger number. For example, Firefox gives "9" as the result
>of "Math.round(8.5)".

Bankers' Rounding is good, I suppose, for Bankers.  It is bad for
technical work.  The ECMA spec should keep Math.round as it is, and add
Math.roundBankers.

<http://www.merlyn.demon.co.uk/js-rndg3.htm#CT> purports to provide
Bankers' Rounding, of two types.

Since JavaScript non-integer arithmetic is commonly inexact, it may be
desirable to round values which are almost half-integer to half-integer
before doing Bankers; my page provides that.

To get the ECMA standard debugged,
"omnes labores adhuc exantlati (exatlanti?) omni fructu caruissent"
(Enestrom 304).

-- 
 (c) John Stockton, nr London UK. E-addr via Homepage. Turnpike v6.05  MIME.
   <http://www.merlyn.demon.co.uk/>  TP/BP/Delphi/&c., FAQqy topics & links;
   <http://www.merlyn.demon.co.uk/clpb-faq.txt>    RAH Prins : c.l.p.b mFAQ;
   <ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip>  Timo Salmi's Turbo Pascal FAQ.

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