Re: RFR: 8174722: Wrong behavior of DecimalFormat with RoundingMode.UP in special case [v3]

2023-08-02 Thread Justin Lu
> Please review this PR, which addresses a case where Decimal Format would > violate certain RoundingMode contracts given the right pattern and input > decimal String. > > For example, > > > DecimalFormat df = new DecimalFormat(); > df.setRoundingMode(RoundingMode.UP); > double small = 0.0001;

Re: RFR: 8174722: Wrong behavior of DecimalFormat with RoundingMode.UP in special case

2023-05-24 Thread Naoto Sato
On Wed, 24 May 2023 18:47:45 GMT, Joe Darcy wrote: >>> I just wonder if it is ok to reverse the rounding/truncation only in this >>> special case. If the truncation always comes first, then 0.00 would be >>> correct (then 1.01 may be something wrong). Looks to me that the original >>> comment

Re: RFR: 8174722: Wrong behavior of DecimalFormat with RoundingMode.UP in special case [v2]

2023-05-24 Thread Justin Lu
> Please review this PR, which addresses a case where Decimal Format would > violate certain RoundingMode contracts given the right pattern and double. > > For example, > > > DecimalFormat df = new DecimalFormat(); > df.setRoundingMode(RoundingMode.UP); > double small = 0.0001; > double big = 1

Re: RFR: 8174722: Wrong behavior of DecimalFormat with RoundingMode.UP in special case

2023-05-24 Thread Joe Darcy
On Wed, 24 May 2023 18:36:39 GMT, Justin Lu wrote: > > I just wonder if it is ok to reverse the rounding/truncation only in this > > special case. If the truncation always comes first, then 0.00 would be > > correct (then 1.01 may be something wrong). Looks to me that the original > > comment

Re: RFR: 8174722: Wrong behavior of DecimalFormat with RoundingMode.UP in special case

2023-05-24 Thread Justin Lu
On Wed, 24 May 2023 17:36:50 GMT, Naoto Sato wrote: > I just wonder if it is ok to reverse the rounding/truncation only in this > special case. If the truncation always comes first, then 0.00 would be > correct (then 1.01 may be something wrong). Looks to me that the original > comment suggest

Re: RFR: 8174722: Wrong behavior of DecimalFormat with RoundingMode.UP in special case

2023-05-24 Thread Naoto Sato
On Tue, 23 May 2023 23:16:01 GMT, Justin Lu wrote: > Please review this PR, which addresses a case where Decimal Format would > violate certain RoundingMode contracts given the right pattern and double. > > For example, > > > DecimalFormat df = new DecimalFormat(); > df.setRoundingMode(Roundi

Re: RFR: 8174722: Wrong behavior of DecimalFormat with RoundingMode.UP in special case

2023-05-23 Thread Justin Lu
On Tue, 23 May 2023 23:30:11 GMT, Joe Darcy wrote: > Note there are some hazards here with respect to the numerical values of > double and the decimal string used to represent the double; in exact terms: > > ``` > jshell> new BigDecimal(1.0001) > $2 ==> 1.88986587595718447118997

Re: RFR: 8174722: Wrong behavior of DecimalFormat with RoundingMode.UP in special case

2023-05-23 Thread Joe Darcy
On Tue, 23 May 2023 23:16:01 GMT, Justin Lu wrote: > Please review this PR, which addresses a case where Decimal Format would > violate certain RoundingMode contracts given the right pattern and double. > > For example, > > > DecimalFormat df = new DecimalFormat(); > df.setRoundingMode(Roundi

RFR: 8174722: Wrong behavior of DecimalFormat with RoundingMode.UP in special case

2023-05-23 Thread Justin Lu
Please review this PR, which addresses a case where Decimal Format would violate certain RoundingMode contracts given the right pattern and double. For example, DecimalFormat df = new DecimalFormat(); df.setRoundingMode(RoundingMode.UP); double small = 0.0001; double big = 1.0001; df.applyPatte