Re: Rounding Problems? - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Rounding Problems?
Date
Msg-id A737B7A37273E048B164557ADEF4A58B5399E5B4@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to Re: Rounding Problems?  (elbriga <gabrielortizlour@gmail.com>)
List pgsql-general
elbriga wrote:
> Thanks for the detailed answer!
> 
> Changing the function sinature seams to have solved the problem:
> CREATE OR REPLACE FUNCTION ceilDecimal(num numeric) RETURNS float AS
> $BODY$
> BEGIN
>     RETURN CEIL(num * 100) / 100;
> END
> $BODY$
> LANGUAGE 'plpgsql';
> 
> 
> SELECT ceilDecimal(0.07);
>  ceildecimal
> -------------
>         0.07

Yes, because "numeric" stores the exact number, so it will be
exactly 0.07 after conversion.

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: elbriga
Date:
Subject: Re: Rounding Problems?
Next
From: Adrian Klaver
Date:
Subject: Re: Storing files: 2.3TBytes, 17M file count