in Search

What is a Divide by Zero error and what can I do about it?

Last post 11-23-2005, 19:13 by johnl. 2 replies.
Sort Posts: Previous Next
  •  04-01-2005, 18:09 878

    What is a Divide by Zero error and what can I do about it?

    A divide-by-zero error will occur whenever there is a denominator in the formula that could end up having a value of zero (even if there is no chance it will ever happen), such as this sample

    formula: Close/(High-Low)

    In this formula, if High-Low equates to zero (because the High and Low are equal), then a divide-by-zero error occurs.

    To avoid divide-by-zero errors, the division that is giving the problem has to be identified and then rewritten to trap the zero, for instance, using the same sample formula above, we could do this:

    Z:=If(H-L=0,.00001,H-L);

    Close/(z);

    Thus, when the zero would normally occur we substitute a value very near zero, .00001, to avoid the error. This does introduce a minimal, probably non-significant, error into the calculation, but it is often worth it.
    My Site
  •  04-01-2005, 18:12 880 in reply to 878

    What does the number stand for directly following the error

    What does the number stand for directly following the divide by zero error?

    It is the number of times that the calculation ran into the zero value.
    My Site
  •  11-23-2005, 19:13 11780 in reply to 878

    Re: What does the number stand for directly following the error

    What does the number stand for directly following the divide by zero error?
    It is the number of times that the calculation ran into the zero value.

    Believe it is their error#, I get it also and when I switch charts the same # comes up.
View as RSS news feed in XML