Solved

Floating Point: Overflow

Posted on 1998-06-11
13
2,231 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
  • 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 600 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jQuery or Javascript animation question 6 68
File names with & character 6 78
Problem to file 3 75
Optimum versions of Selenium Webdriver with Python On Windows 7 1 113
When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

809 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