Re: [HACKERS] Datatype MONEY

Поиск
Список
Период
Сортировка
От Karel Zak - Zakkr
Тема Re: [HACKERS] Datatype MONEY
Дата
Msg-id Pine.LNX.3.96.991214154001.862A-100000@ara.zf.jcu.cz
обсуждение исходный текст
Ответ на Re: [HACKERS] Datatype MONEY  (wieck@debis.com (Jan Wieck))
Список pgsql-hackers

On Mon, 13 Dec 1999, Jan Wieck wrote:

>         text *numeric_to_char(Numeric num, format text)
>         {
>             char    *numstr;
>             int32    scale;
> 
>             ... /* calculate the wanted number of digits */
>             ... /* after DP in scale depending on format */
> 
>             numstr = numeric_out(numeric_round(num, scale));
>         }
> 
>     There will be "scale" number of digits after the DP, which is
>     missing if scale is zero. The value will  be  correct  rouded
>     and/or zero padded at the end.
> 
>     Wouldn't that be enough for you?

My answer :-)

test=> select numeric_to_char(545454.98, '"der Preis: "L999G999D99');
numeric_to_char
------------------------
der Preis: DM 545.454,98
(1 row)

>     Well,  you  must  work  on the string only and cannot read it
>     into a float internally, but with the above preprocessing, it
>     should be fairly simple.

Yes, I good understend your previous letter(s). Formatting routine in
to_char() is independent on datetype and for all use string. 

(IMHO numeric is very interesting type and not has 16-decimal limitation as
float8, it is good, good, good...  

Again Thank!                        Karel

----------------------------------------------------------------------
Karel Zak <zakkr@zf.jcu.cz>              http://home.zf.jcu.cz/~zakkr/

Docs:        http://docs.linux.cz                    (big docs archive)    
Kim Project: http://home.zf.jcu.cz/~zakkr/kim/        (process manager)
FTP:         ftp://ftp2.zf.jcu.cz/users/zakkr/        (C/ncurses/PgSQL)
-----------------------------------------------------------------------



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Vince Vielhaber
Дата:
Сообщение: Re: [HACKERS] libpq questions...when threads collide
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Questionable codes