?
Solved

Floating Point: Overflow

Posted on 1998-06-11
13
Medium Priority
?
2,274 Views
Last Modified: 2013-12-26
I made a big enough program that has a bug. Sometimes it makes an error and then terminates. The error message is Floating Point: Overflow, coming from BC450RTL.DLL, and I can't find the point where the problem comes from.
The program trains neural networks, and as the training is an iterative process I can't know the moment when the error will happen, and that makes too tedious to run the program step by step to find the bug.
I have tried exception handling (try and catch), but I don't know which argument I must use in catch.
So, if anyone has an idea for finding the bug I will be very glad, because I'm a little bit desperate now.
0
Comment
Question by:emilio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 2
  • 2
  • +1
13 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1299695
Hi friend,
I used to have several of those float ugly errors when programming NNS with real valued weigths. The most common of all are overflow especially if you have a large number of connections. Tell me what NN you use (BPN, Kohonen, ART) and I may help further.
by the way you can catch all exceptions with
  catch(...) {
  }
Regards, Igor
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 2400 total points
ID: 1299696
Floating point errors cannot be caught with catch. You need to set up a signal handler for that. You need to use SIG_FPE to catch the floating point error.
0
 

Author Comment

by:emilio
ID: 1299697
Certainly, I don't find the way to catch the floating point error, but I don't know how to set up a signal handler.
On the other hand, to give more information about my problem, the kind of network that I use is a special case of RBF, with the neurons of the hidden layer feedbacked with FIR filters. The floating point error comes when the filters have an order greater than 2. I thought that I understood how to do it, but the system doesn't work as expected, and I'm a little bit down for it.
I apprecciate your help
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 5

Expert Comment

by:inter
ID: 1299698
Hi again,
Lets think together. When the order of FIR filters are > 2 either there may occur an overflow due to power operation or the denomitators approaches to 0. So my first suggestion is to check your DIVISION operations.
For example
*  if Dividend is > 1 and your Divisor is < 1E-10 set the result to your MAX but not divide
           this may cause an overflow
Regards, Igor
0
 

Author Comment

by:emilio
ID: 1299699
What happens is a little bit strange. The error comes during the training, and when the order of the filter is 0, that is, a common RBF, everything works perfectly, so the problem must be during the propagation of a signal through the net, or during the updating of the coeficients in the filters.
Every neuron in the net is implemented as an object, and I checked out the operations with possible error, that is exponentials. Well, setting up a limit in these operations doesn't solve the problem. The error comes anyway.
I could send you the code for the object "neuron" if you want to, though the comments will not help very much, since they're in Spanish :-|

0
 

Author Comment

by:emilio
ID: 1299700
What happens is a little bit strange. The error comes during the training, and when the order of the filter is 0, that is, a common RBF, everything works perfectly, so the problem must be during the propagation of a signal through the net, or during the updating of the coeficients in the filters.
Every neuron in the net is implemented as an object, and I checked out the operations with possible error, that is exponentials. Well, setting up a limit in these operations doesn't solve the problem. The error comes anyway.
I could send you the code for the object "neuron" if you want to, though the comments will not help very much, since they're in Spanish :-|

0
 

Author Comment

by:emilio
ID: 1299701
Adjusted points to 600
0
 
LVL 3

Expert Comment

by:JPM
ID: 1299702
"try"   that code !

__try {
...................//code to test
{

__except (  (GetExceptionCode() == EXCEPTION_FLT_OVERFLOW)  ?   EXCEPTION_EXECUTE_HANDLER  :  EXCEPTION_C0NTINUE_SEARCH )
{
   //   overflow management

}

Jean-Paul

0
 

Author Comment

by:emilio
ID: 1299703
The part of the code where the problem comes from can be seen at
http://www.geocities.com/SiliconValley/Hills/6142/Neuron.doc
There I wrote the theoretical formulas for the algorithm, and the code to implement a neuron in the hidden layer. If anyone wants to have a look.
0
 
LVL 3

Expert Comment

by:JPM
ID: 1299704
Hi emilio !

I just have visited your Home page.....
but where have you hidden your Neuron. doc ???????

JPaul
0
 

Author Comment

by:emilio
ID: 1299705
I have been at some friends home this weekend and I could get to this document without any problem from their computer.
So the document is there, and not hiding. Anyway I'll try to upload it to any ftp server.
Once again, the address is:
http://www.geocities.com/SiliconValley/Hills/6142/Neuron.doc 
Anyway, thanks a lot for trying.
0
 

Author Comment

by:emilio
ID: 1299706
There is now an ftp site to reach the problematic code:
the server is ftp.oce.orst.edu
and the directory is /pub/incoming/emilio/
There you can find these three files:
- Neuron.doc, with the algorithm explanation
- GAUSS.CPP, with the code for the neuron (it's included in the former document)
- NEURONA.HPP, with the headings and class declarations (also included in Neuron.doc)
The first document is still available in the other http site.

0
 

Author Comment

by:emilio
ID: 1299707
Hi, friends.
I thank you all your help. I finally found the bug in my program, just reviewing the algorithm. The problem that I had was not only the ugly floating point error. The training didn't give good results, because I was not applying the algorithm properly, but reviewing the theory I solved at the same time the training problem and the overflow. The bug was only an index, that made the gradient descent go wrong.
Now I'd like to upgrade all of your answers, thui, inter and JPM. I don't know which one will get the points, but even though I found the bug I thank you all.
I think I will be able to show my graduation design project in a couple of weeks.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question