B
Brent Hill
Hello All!
I just have a quick little question that I have not been
able to solve myself. Within a program being developed in
VS.NET, I have written a private function with the
following code:
Private Function FmaxTest()
Dim varianceHi, varianceLo, Fmax As Double
........
(In this part of the code, the values of varianceHi and
varianceLo are established; depending on the dataset, it
is possible that varianceLo = 0 in some scenarios.)
........
Try
Fmax = varianceHi / varianceLo
Catch ex As NotFiniteNumberException
MsgBox("Division by zero not allowed.")
Exit Function
End Try
........
(This part of the code is for reporting the values of
varianceHi, varianceLo, and Fmax.)
........
End Function
I originally tried the DivideByZeroException, but
discovered that it was for use only with integers. I then
tried NotFiniteNumberException because (as I understand
it) it will throw an exception when there is +infinity, -
infinity, or NaN.
However, in such cases where varianceLo = 0, there are no
exceptions thrown, the algorithm continues as normal, and
the value of Fmax is reported to be Infinity. Any ideas
about what I am doing wrong? Thanks in advance for any
ideas.
I just have a quick little question that I have not been
able to solve myself. Within a program being developed in
VS.NET, I have written a private function with the
following code:
Private Function FmaxTest()
Dim varianceHi, varianceLo, Fmax As Double
........
(In this part of the code, the values of varianceHi and
varianceLo are established; depending on the dataset, it
is possible that varianceLo = 0 in some scenarios.)
........
Try
Fmax = varianceHi / varianceLo
Catch ex As NotFiniteNumberException
MsgBox("Division by zero not allowed.")
Exit Function
End Try
........
(This part of the code is for reporting the values of
varianceHi, varianceLo, and Fmax.)
........
End Function
I originally tried the DivideByZeroException, but
discovered that it was for use only with integers. I then
tried NotFiniteNumberException because (as I understand
it) it will throw an exception when there is +infinity, -
infinity, or NaN.
However, in such cases where varianceLo = 0, there are no
exceptions thrown, the algorithm continues as normal, and
the value of Fmax is reported to be Infinity. Any ideas
about what I am doing wrong? Thanks in advance for any
ideas.