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 NotFiniteNumber Exception
MsgBox("Divisio n 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 DivideByZeroExc eption, but
discovered that it was for use only with integers. I then
tried NotFiniteNumber Exception 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. 5 2111
Haven't got a clue about the problem, but in practical terms why not just
use a...
If varianceLo = 0 Then
....somewhere?
Sorry if that's not esoteric enough.
"Brent Hill" <br****@okstate .edu> wrote in message
news:1c******** *************** ******@phx.gbl. .. 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 NotFiniteNumber Exception MsgBox("Divisio n 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 DivideByZeroExc eption, but discovered that it was for use only with integers. I then tried NotFiniteNumber Exception 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.
Hi,
The / operation will not throw an exception when you divide by zero.
Take a look at double.ispositi veinfinity, double.isnegati veinfinity, and
double.isnan
If Double.IsPositi veInfinity(1.1 / 0.0) Then
MessageBox.Show ("Divide by zero")
End If
Ken
--------------------------
"Brent Hill" <br****@okstate .edu> wrote in message
news:1c******** *************** ******@phx.gbl. .. 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 NotFiniteNumber Exception MsgBox("Divisio n 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 DivideByZeroExc eption, but discovered that it was for use only with integers. I then tried NotFiniteNumber Exception 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.
That is what I have been using for this particular type of
exception. However, I was thinking that it would be much
more practical to enclose all my calculations in a single
Try..Catch...Fi nally statement rather than create an
If...Then statement for each of the *many* calculations to
be performed. I would have to create many If...Then
statements because very few of the calculations being
performed share the same denominator term.
So, esoterica is not my concern, only pragmatics. But
thanks for trying anyway! -----Original Message----- Haven't got a clue about the problem, but in practical
terms why not justuse a...
If varianceLo = 0 Then
....somewher e?
Sorry if that's not esoteric enough.
"Ken Tucker [MVP]" <vb***@bellsout h.net> schrieb Hi,
The / operation will not throw an exception when you divide by zero. Take a look at double.ispositi veinfinity, double.isnegati veinfinity, and double.isnan
If Double.IsPositi veInfinity(1.1 / 0.0) Then
MessageBox.Show ("Divide by zero")
End If
Is this also valid?
if (1.1/0.0) = double.positive infinity then
It works, so I think it is, but I'm not 100% sure.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Hi,
Yes.
Ken
---------------
"Armin Zingler" <az*******@free net.de> wrote in message
news:40******** *************** @news.freenet.d e... "Ken Tucker [MVP]" <vb***@bellsout h.net> schrieb Hi,
The / operation will not throw an exception when you divide by zero. Take a look at double.ispositi veinfinity, double.isnegati veinfinity, and double.isnan
If Double.IsPositi veInfinity(1.1 / 0.0) Then
MessageBox.Show ("Divide by zero")
End If
Is this also valid? if (1.1/0.0) = double.positive infinity then
It works, so I think it is, but I'm not 100% sure.
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: eScrewDotCom |
last post by:
eScrew
Welcome to eScrew!
eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew
story if you promise eScrew to consider eScrew story as joke. eScrew
story is very funny. eScrew story is so funny that eScrew will have to
take break from time to time because eScrew needs some rest from
laughing. Oh boy, here it comes... eScrew funny laugh laughing
screaming crying must stop can not take any more this is killing eScrew...
|
by: Brandon J. Van Every |
last post by:
What's better about Ruby than Python? I'm sure there's something. What is
it?
This is not a troll. I'm language shopping and I want people's answers. I
don't know beans about Ruby or have any preconceived ideas about it. I have
noticed, however, that every programmer I talk to who's aware of Python is
also talking about Ruby. So it seems that Ruby has the potential to compete
with and displace Python. I'm curious on what basis it...
|
by: Brandon J. Van Every |
last post by:
I'm realizing I didn't frame my question well.
What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump
up in your chair and scream "Wow! Ruby has *that*? That is SO FRICKIN'
COOL!!! ***MAN*** that would save me a buttload of work and make my life
sooooo much easier!"
As opposed to minor differences of this feature here, that feature there.
Variations on style are of no interest to me. I'm coming at this from a...
|
by: eScrewDotCom |
last post by:
eScrew
Welcome to eScrew!
eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew
story if you promise eScrew to consider eScrew story as joke. eScrew
story is very funny. eScrew story is so funny that eScrew will have to
take break from time to time because eScrew needs some rest from
laughing. Oh boy, here it comes... eScrew funny laugh laughing
screaming crying must stop can not take any more this is killing eScrew...
|
by: Sarah Tanembaum |
last post by:
Beside its an opensource and supported by community, what's the fundamental
differences between PostgreSQL and those high-price commercial database (and
some are bloated such as Oracle) from software giant such as Microsoft SQL
Server, Oracle, and Sybase?
Is PostgreSQL reliable enough to be used for high-end commercial
application? Thanks
| |
by: eScrewDotCom |
last post by:
www.eScrew.com
eScrew
Welcome to eScrew!
eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew
story if you promise eScrew to consider eScrew story as joke. eScrew
story is very funny. eScrew story is so funny that eScrew will have to
take break from time to time because eScrew needs some rest from
laughing. Oh boy, here it comes... eScrew funny laugh laughing
|
by: eScrewDotCom |
last post by:
eScrew
Welcome to eScrew!
eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew
story if you promise eScrew to consider eScrew story as joke. eScrew
story is very funny. eScrew story is so funny that eScrew will have to
take break from time to time because eScrew needs some rest from
laughing. Oh boy, here it comes... eScrew funny laugh laughing
screaming crying must stop can not take any more this is killing eScrew...
|
by: Edward Yang |
last post by:
A few days ago I started a thread "I think C# is forcing us to write
more (redundant) code" and got many replies (more than what I had
expected). But after reading all the replies I think my question about
local variable initialization is still not solved. And some of the
replies forked into talking about out parameters. And the thread is
becoming way too deep.
So I open a new thread here. My question in the previous thead has
turned...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |