From: | Karel Zak - Zakkr <zakkr(at)zf(dot)jcu(dot)cz> |
---|---|
To: | Jan Wieck <wieck(at)debis(dot)com> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] Datatype MONEY |
Date: | 1999-12-14 14:54:10 |
Message-ID: | Pine.LNX.3.96.991214154001.862A-100000@ara.zf.jcu.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)zf(dot)jcu(dot)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)
-----------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1999-12-14 16:23:24 | Re: [HACKERS] Questionable codes |
Previous Message | Vince Vielhaber | 1999-12-14 14:37:23 | Re: [HACKERS] libpq questions...when threads collide |