Bug at Math.round

Jim Laskey (Oracle) james.laskey at oracle.com
Wed May 29 05:28:40 PDT 2013


This looks to be an artifact of String.toString.  We will address.

jjs> java.lang.System.out["println(double)"](java.lang.Math.copySign(0.0, -1));
-0.0
jjs> java.lang.System.out["println(double)"](java.lang.Math.sin(-0.0));
-0.0

Cheers,

-- Jim





On 2013-05-29, at 12:45 AM, toshiyuki kojima <basabasafoo at gmail.com> wrote:

> Hello,
> 
> 
> I found a bug:
> 
> Math.round(-0) should return -0, but Math.round(-0) returns +0 in nashorn.
> 
> 
> I confirmed this bug using revision:
> 
>  changeset:   d56168970de1
> 
>  date:        Tue May 28 16:37:11 2013 +0530
> 
>  summary:     8015459: Octane test run fails on Turkish locale
> 
> 
> 
> http://ecma-international.org/ecma-262/5.1/#sec-15.8.2.15
> 
> http://jsfiddle.net/gocho/TscsU/
> 
> http://hg.openjdk.java.net/nashorn/jdk8/nashorn/file/d56168970de1/src/jdk/nashorn/internal/objects/NativeMath.java
> 
> 
> Thanks,
> 
> --gocho
> 
> twitter.com/gocho



More information about the nashorn-dev mailing list