Subject | Re: Procedure Problem, Div By 0 |
---|---|
Author | andyh20012003 |
Post date | 2003-08-07T19:18:25Z |
--- In firebird-support@yahoogroups.com, "Alexander V.Nevsky"
<ded@h...> wrote:
what happens
would I be better off changing them to float?
IB5 doesnt like Abs
Andy
<ded@h...> wrote:
> --- In firebird-support@yahoogroups.com, "andyh20012003"Into :EHTestedval, :EHNode, :EHSub, :EHCir, :ELTestedVal, :ELNode,
> <andyholcomb@c...> wrote:
> > CREATE PROCEDURE EACHNODE_NETLIST_2
> > RETURNS (
> > EHTESTEDVAL DOUBLE PRECISION,
> > EHNODE INTEGER,
> > EHSUB INTEGER,
> > EHCIR INTEGER,
> > ELTESTEDVAL DOUBLE PRECISION,
> > ELNODE INTEGER,
> > ELSUB INTEGER,
> > ELCIR INTEGER)
> > AS
> > begin
> > for
> > select ENH.TestedValue,
> > ENH.Node,
> > ENH.SubstrateNum,
> > ENH.CircuitNum,
> > ENL.TestedValue,
> > ENL.Node,
> > ENL.SubstrateNum,
> > ENL.CircuitNum
> >
> > From EachNode ENH, EachNode ENL
> >
> > Where
> > (ENH.JobNum = "2621") and
> > (ENH.ProberNum = 1) and
> > (ENL.JobNum = "2621") and
> > (ENL.ProberNum = 1) and
> > ((ENH.Passed = 1) or (ENL.Passed = 1)) and
> > (ENH.SubstrateNum = ENL.SubstrateNum ) and
> > (ENH.CircuitNum = ENL.CircuitNum) and
> > (ENH.Node = 2) and
> > (ENL.Node = 92) and
> > (
> > ((ENH.TestedValue != 0) and (ENL.TestedValue != 0))
> > and
> > (
> > ((ENH.TestedValue/ENL.TestedValue)>0 ) and
> > ( (100 -((ENH.TestedValue/ENL.TestedValue)
> > *100)) > (100 - 98))
> > or(
> > (ENL.TestedValue/ENH.TestedValue)>0 ) and
> > ( (100 -((ENL.TestedValue/ENH.TestedValue)
> > *100)) > (100 - 98))
> > )
> > )
> >
> >
> >
> :Eare
> > LSub, :ELCir
> >
> > do suspend;
> > end
>
> Andy, IB/FB perform complete boolean evaluation (all conditions
> always calcualted even if it is clear already will result be trueor
> false), so yourI thought something like this was the case.
>This will be my first time for if thens, I will mess with it and see
> (ENH.TestedValue != 0) and (ENL.TestedValue != 0)
>
> don't protect you from division by zero in next condition. I can
> suggest to remove check for 2% accuracy from query and make this
> inside loop execution, something like
>
> For Select
> ...
> Do
> if ((EHTestedVal<>0) And (ELTestedVal<>0))
> then
> if ((((EHTestedVal/ELTestedVal)>0) and
> ((100 -(EHTestedVal/ELTestedVal)*100) > 2)
> )
> Or
> (((ELTestedVal/EHTestedVal)>0) and
> ((100 -(ELTestedVal/EHTestedVal)*100) > 2)
> )
> then
> Suspend;
>
what happens
> BTW, seems your TestedValue is Double Precision, and compare itwith
> 0 is incorrect, I recommend to use as precision value which can beThis happened when I copied the tables from the paradox tables,
> treated as zero for your application, like
>
> if ((Abs(EHTestedVal)>PrecVal) And (Abs(ELTestedVal)>PrecVal))
would I be better off changing them to float?
>own
> I don't remember have IB5 UDF ABS or not, if not you can write
IB5 doesnt like Abs
> or use BETWEEN -PrecVal And PrecVal.Can you give me a example of this, Please
>Thank you
> Best regards, Alexander.
Andy