Re: multiplication yield strange results
- From: Hans-Peter Diettrich <DrDiettrich1@xxxxxxx>
- Date: Sat, 14 Oct 2006 01:08:44 +0200
Gilles Rosselet wrote:
I call the following bit of code repeatedly during the execution of my program:
Bx:= self.n[0].A*self.alpha[0].c + self.n[1].A*self.alpha[1].c + self.n[2].A*self.alpha[2].c;
By:= -self.n[0].A*self.alpha[0].b - self.n[1].A*self.alpha[1].b - self.n[2].A*self.alpha[2].b;
Bsqr:= Bx*Bx + By*By;
At first all goes well but suddenly Bx and By get extremly large (around 1E205) which turn Bsqr to INF.
Well I am completely lost any help apreciated.
I suspect that you have uninitialized values somewhere, maybe pointers, local variables, function results, or incompletely initialized arrays.
Perhaps it helps to initialize all array members in the above formulas to NaN, prior to filling in the actual values (i.e. after allocation of dynamic memory...). Then you'll get an exception whenever an element was not properly initialized. An according check should be placed after every function/method call, which should fill in all or an specific part of the data structure. I also would check for compiler warnings "possibly undefined...".
DoDi
.
- References:
- multiplication yield strange results
- From: Gilles Rosselet
- multiplication yield strange results
- Prev by Date: Re: Link my help file to my application install path
- Next by Date: Re: Link my help file to my application install path
- Previous by thread: Re: multiplication yield strange results
- Index(es):
Relevant Pages
|