Peter Eisentraut wrote:
>
> peter=# select 1.0/0.0;
> ERROR: float8div: divide by zero error
>
> Division by zero is not an "error" in floating point arithmetic.
No?
Oh, then 7 = 5 because:
Assuming 2a = b | * 2 4a = 2b
| + 10a 14a = 10a + 2b | - 7b 14a - 7b = 10a - 5b
| () 7 (2a - b) = 5 (2a - b) | / (2a - b)
7 = 5
In the given context, you should find the mistake pretty easy. Maybe the message should be changed to
ERROR: floatdiv: divide by zero nonsense ^^^^^^^^
because a division by zero results in nonsense? Or should it just return a random value? What is the result of a
division by zero? It's definitely not infinity, as the above demonstrates!
You might be looking from a managers PoV. Managers usually use this kind of arithmetic to choose salaries. Any
engineer knows that
work = power * time
We all know that time is money and that power is knowlede. So
work = knowledge * money
and thus
work money = --------- knowledge
Obviously, the lesser you know, the more money you get, independant of the work to be done. As soon as
youknow nothing (zero), any money you get for the work is nonsense!
This applies well to the real world, so it makes sense from an OO PoV. But in science, I think it's still an
error.
Since PostgreSQL is an ORDBMS (not an OODBMS), I think it's correct to report an error instead of returning some
random.
:-)
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #