Hi,

I agree it's a bit ugly. Other databases don't use this notation.
Simplified test case:

SELECT 1.00 / 3 * 0.00 FROM TEST;
SELECT 1.00000 / 3 * 0.0000 FROM TEST;
SELECT 1.0000000 / 3 * 0.00000 FROM TEST;
SELECT 1.0000000 / 3 * 0.000000 FROM TEST;

The conversion is done in ValueDecimal.getString(). What about:

    public String getString() {
        if (valueString == null) {
            String p = value.toPlainString();
            if (p.length() < 40) {
                valueString = p;
            } else {
                valueString = value.toString();
            }
        }
        return valueString;
    }

The the result of the test above would be:

0.00000000000000000000000000000
0.0000000000000000000000000000000000
0.0000000000000000000000000000000000000
0E-38

Regards,
Thomas



On Thu, Mar 15, 2012 at 10:37 AM, Noel Grandin <[email protected]> wrote:
> That's just how BigDecimal prints it's numbers.
>
>
> On 2012-03-15 10:17, cool2man wrote:
>>
>> CREATE SCHEMA IF NOT EXISTS TEST AUTHORIZATION SA;
>>
>> CREATE CACHED TABLE IF NOT EXISTS TEST.TEST(
>>     PRM NUMERIC(8, 2),
>>     SBT NUMERIC(8, 2)
>> );
>>
>> INSERT INTO TEST.TEST(PRM, SBT) VALUES (17852.08, 0.00);
>>
>> SELECT PRM, SBT, CASE WHEN PRM>  0 THEN 100 / PRM * SBT ELSE 0 END
>> FROM TEST.TEST;
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to