PDA

View Full Version : [Mondrian] question about rounding



John V. Sichi
04-06-2007, 10:46 PM
The following query returns 0, whereas if the quotient is 51/100, it
returns 1.

with member [Measures].x as '50/100', format_string = '0'
select {[Measures].x} on rows
from sales;

Is there a reason it matches BigDecimal.ROUND_HALF_DOWN instead of the
much more common BigDecimal.ROUND_HALF_UP? Is
BigDecimal.ROUND_HALF_DOWN required by the Visual Basic format string
standard?

JVS
_______________________________________________
Mondrian mailing list
Mondrian (AT) pentaho (DOT) org
http://lists.pentaho.org/mailman/listinfo/mondrian

Julian Hyde
04-07-2007, 04:10 PM
> John Sichi wrote:
>
> The following query returns 0, whereas if the quotient is 51/100, it
> returns 1.
>
> with member [Measures].x as '50/100', format_string = '0'
> select {[Measures].x} on rows
> from sales;
>
> Is there a reason it matches BigDecimal.ROUND_HALF_DOWN
> instead of the
> much more common BigDecimal.ROUND_HALF_UP? Is
> BigDecimal.ROUND_HALF_DOWN required by the Visual Basic format string
> standard?

No particular reason -- I've never given it much thought. If mondrian
doesn't do the same as MSAS, please change it.

Julian

_______________________________________________
Mondrian mailing list
Mondrian (AT) pentaho (DOT) org
http://lists.pentaho.org/mailman/listinfo/mondrian

John V. Sichi
04-09-2007, 05:32 PM
OK, I just tested MSAS, and it gives BigDecimal.ROUND_HALF_UP behavior,
as you would expect, so I'll make the change. I'll let the amount of
fallout from test updates determine whether to do it as a property vs.
just making the change without any property (unless I hear from someone
who really wants the property).

JVS

Julian Hyde wrote:
>
>> John Sichi wrote:
>>
>> The following query returns 0, whereas if the quotient is 51/100, it
>> returns 1.
>>
>> with member [Measures].x as '50/100', format_string = '0'
>> select {[Measures].x} on rows
>> from sales;
>>
>> Is there a reason it matches BigDecimal.ROUND_HALF_DOWN
>> instead of the
>> much more common BigDecimal.ROUND_HALF_UP? Is
>> BigDecimal.ROUND_HALF_DOWN required by the Visual Basic format string
>> standard?
>
> No particular reason -- I've never given it much thought. If mondrian
> doesn't do the same as MSAS, please change it.
>
> Julian
>
> _______________________________________________
> Mondrian mailing list
> Mondrian (AT) pentaho (DOT) org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>

_______________________________________________
Mondrian mailing list
Mondrian (AT) pentaho (DOT) org
http://lists.pentaho.org/mailman/listinfo/mondrian