Discussion:
[HACKERS] IEEE 754
(too old to reply)
Bruce Momjian
2004-01-05 00:51:13 UTC
Permalink
I would like to share my concerns about the IEEE 754 specification and
floating point handling by PostgreSQL .
What specifically are your concerns regarding floating point handling
and PostgreSQL? I'm not in a position to address your concerns, but I
would like to know what they are.
Floating point math itself is not precise, but rather an approximation,
usually of 8 or 14 digits. You can't approximate money. This isn't a
PostgreSQL issue but rather a general programming issue.
--
Bruce Momjian | http://candle.pha.pa.us
***@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ***@postgresql.org)
Sai Hertz And Control Systems
2004-01-12 16:36:14 UTC
Permalink
Dear Jan Wieck ,
Post by Bruce Momjian
Floating point math itself is not precise, but rather an approximation,
usually of 8 or 14 digits. You can't approximate money. This isn't a
PostgreSQL issue but rather a general programming issue.
Thanks, Bruce. I assume the arbitrary precision arithmetic Jan
mentioned which is used for the NUMERIC type takes care of this.
That was the whole intention. Although Bruce is wrong, since most of
the time money is approximated. It is only in "bookkeeping" where this
is not allowed.
Yes I agree with you Jan , most of the time we round the amount and
this is done by truncating greater than 3 decimal digits and rounding
the 3 digit to 2 in other words :
select trunc(1000.236897,3);
then
selecr round(1000.236,2);
This takes care of the rounding factor in money as per Indian standards
ok, how will you verify it simple just use log and you will get the
correct output.


Regards,
Vishal Kashyap


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
Sai Hertz And Control Systems
2004-01-12 18:00:19 UTC
Permalink
Dear Jan Wieck ,
Post by Sai Hertz And Control Systems
Yes I agree with you Jan , most of the time we round the amount and
this is done by truncating greater than 3 decimal digits and
select trunc(1000.236897,3);
then
selecr round(1000.236,2);
This takes care of the rounding factor in money as per Indian
standards ok, how will you verify it simple just use log and you will
get the correct output.
People are often under the impression that effective APR's and all
that stuff fall into the same category as your bank or credit card
account balance. But that is not true.
What are you suggesting thattruncing and rounding is not good in
financial terms

Regards,
Vishal Kashyap


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ***@postgresql.org)
Loading...