harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yang Paulex" <paulex.y...@gmail.com>
Subject Re: [classlib][math]Non-bug difference? (was Re: [jira] Created: (HARMONY-4623) BigDecimal.stripTrailingZero fails for 0.0000)
Date Thu, 16 Aug 2007 03:07:49 GMT
2007/8/15, Mikhail Loenko <mloenko@gmail.com>:
>
> Hi Paulex
>
> for some reason my mails to the dev list return. See my response below.
> Feel free to CC dev list if responding
>
> Thanks,
> Mikhail
>
> ---------- Forwarded message ----------
> From: Mikhail Loenko <mloenko@gmail.com>
> Date: 15.08.2007 15:42
> Subject: Re: [classlib][math]Non-bug difference? (was Re: [jira]
> Created: (HARMONY-4623) BigDecimal.stripTrailingZero fails for 0.0000)
> To: dev@harmony.apache.org
>
>
> Can you imagine a real app that would break if we change Harmony to
> follow the spec?


No, I cannot...I'm going to fix it following spec if no one objects.

Thanks,
> Mikhail
>
> 2007/8/15, Yang Paulex <paulex.yang@gmail.com>:
> > Hi, all,
> >
> > I'm looking at this issue, the spec on BigDecimal.stripTrialingZeros()
> > mentioned:
> >
> > "Returns a BigDecimal which is numerically equal to this one but with
> any
> > trailing zeros removed from the representation. For example, stripping
> the
> > trailing zeros from the BigDecimal value 600.0, which has [BigInteger,
> scale]
> > components equals to [6000, 1], yields 6E2 with [BigInteger, scale]
> > components equals to [6, -2]"
> >
> > While seems new BigDecimal("0.0000").stripTrialingZeros() just return
> this
> > without any changes, IMHO this is contradict with spec. Currently
> Harmony
> > has same behavior, should we follow RI or spec here?
> >
> > A quick and naive fix would be:
> >
> > --- main/java/java/math/BigDecimal.java (修订版 566012)
> > +++ main/java/java/math/BigDecimal.java (工作拷贝)
> > @@ -1314,7 +1314,7 @@
> >         long newScale = scale;
> >
> >         if (isZero()) {
> > -            return this;
> > +            return new BigDecimal("0");
> >         }
> >
> > 2007/8/14, Imran Ghory (JIRA) <jira@apache.org>:
> > >
> > > BigDecimal.stripTrailingZero fails for 0.0000
> > > ---------------------------------------------
> > >
> > >                  Key: HARMONY-4623
> > >                  URL:
> https://issues.apache.org/jira/browse/HARMONY-4623
> > >              Project: Harmony
> > >           Issue Type: Bug
> > >           Components: Classlib
> > >             Reporter: Imran Ghory
> > >             Priority: Minor
> > >
> > >
> > > BigDecimal.stripTrailingZero fails for "0.0000" (leaves it unstriped).
> > > This behaviour occurs in the RI as well, however from the
> specification it
> > > seems this behaviour is incorrect. Will attach test case.
> > >
> > > --
> > > This message is automatically generated by JIRA.
> > > -
> > > You can reply to this email to add a comment to the issue online.
> > >
> > >
> >
> >
> > --
> > Paulex Yang
> > China Software Development laboratory
> > IBM
> >
>



-- 
Paulex Yang
China Software Development laboratory
IBM
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message