Dear Stephen,
Please try this one Select Y,X,(ifeq(X,0,0,(Y/(ifeq(X,0,1,X))))) from example Here the outer "ifeq" is used to get result of the division, put NULL or Zero or whatever you want to see in the true part, when X=0. The second "ifeq" is actually used to stop the division when X=0. Regards Rehan Wyne MIT On Tuesday, September 23, 2014 10:05 PM, Stephen Markson <[email protected]> wrote: Oops, I forgot to dot my variables: Should have been SET VAR Z=(IFEQ(.x,0,0,.y/.x)) Regards, Stephen Markson The Pharmacy Examining Board of Canada 416.979.2431 x251 From:[email protected] [mailto:[email protected]] On Behalf Of Stephen Markson Sent: September-23-14 10:03 To: RBASE-L Mailing List Subject: [RBASE-L] - Re: Divide by Zero Hello Rehan, Select Y,X,(ifeq(X,0,0,(Y/X))) from example will generate a divide by zero error whenever X=0. It’s just the way that R:Base works – it calculates the two outcome values before evaluating the IFEQ. SET VAR Z=(IFEQ(.x,0,0,y/x)) will give Z a null value when X=0 (regardless of ZERO setting). Regards, Stephen Markson The Pharmacy Examining Board of Canada 416.979.2431 x251 From:[email protected] [mailto:[email protected]] On Behalf Of rehan wyne Sent: September-16-14 13:23 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 [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.

