I did not receive my response either…
=================
Rehan,
You provide a viable and workable and quite clever solution to the problem.
However, technically a division by zero IS NOT zero. Most mathematical
processes interpret a division by zero as having an indeterminate result; the
IEEE Standard for Floating-Point Arithmetic (IEEE 754) indicates that zero can
have a sign (+ or -) and the result will be either positive or negative
INFINITY depending on the sign assigned to the zero divisor. Maybe assigning a
zero in this particular case would work, but in some circumstances it could be
misleading; I would personally assign a NULL value to operations that include
division by zero since it really is an undetermined value. Just my 2 cents.
=================
Javier,
Javier Valencia, PE
O: 913-829-0888
H: 913-397-9605
C: 913-915-3137
From: [email protected] [mailto:[email protected]] On Behalf Of rehan wyne
Sent: Tuesday, September 16, 2014 12:23 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Divide by Zero
I am reproducing my last email because I doubt that it may not be received by
any one or Rbase list.
Quote
"Dennis,
If you check the divisor first, in your select statement then you don't need to
create any view and it will be efficient too regardless how R:base is
processing Select Statement. As explained below:
Let Y is dividend and X is divisor.
Select Y,X,(ifeq(X,0,0,(Y/X))) from example
Here we explicitly put the division result to ZERO, as it should be.
Regards
Rehan Wyne
MIT"
unquote
On Thursday, September 11, 2014 9:18 PM, "Hodges, Dennis"
<[email protected]> wrote:
I’m getting a divide by zero from the following select statement. The values
for tothrs and activity.standard are all positive real numbers, no zeros or
nulls. Does anyone have a clue as to why I’m getting this error.
Somehow tothrs/activity.standard is evaluating to 0 as shown below.
Select
t3t.*,activity.activity,activity.unitmeas,activity.standard,(tothrs/activity.standard)
AS standardunits,(units/(tothrs/activity.standard)*100) AS expectedunits FROM
t3t, activity WHERE t3t.activity EQ activity.activity and activity.standard <> 0
Tothrs Units Activity UnitMEas Standard
StandardUnits
1.5 1.5 033 Manh 1
0
2 2 032 Manh
1 0
6.5 6.5 941 Manh 1
0
4 4 520 Unit
0.83 0
6 11 520 Unit
0.83 0
10 20 520 Unit
0.83 0
3 3 028 Manh
1 0
5 130 526 LnFt
0.25 0
10 14 520 Unit
0.83 0
Dennis Hodges
Maintenance Management Manager
FDOT Office of Maintenance MS #52
PH: (850) 410-5635
FAX: (850) 410-5511
<mailto:[email protected]> [email protected]
As far as we know, our computer has never had an undetected error.
Please note: e-mail may be subject to public disclosure.