Re: Rounding Problems?

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: Rounding Problems?
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B5399E5B4@ntex2010i.host.magwien.gv.at
обсуждение исходный текст
Ответ на Re: Rounding Problems?  (elbriga <gabrielortizlour@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: elbriga
Дата:
Сообщение: Re: Rounding Problems?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Storing files: 2.3TBytes, 17M file count