Re: multiplication yield strange results



"Gilles Rosselet" <gilles.rosselet@xxxxxxx> schreef in bericht
news:1160751505_29@xxxxxxxxxxxxxxxxxxx
Hello,

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.
Typical value before failure:
self.n[0].A -9.39E-7
self.n[1].A -9.45E-7
self.n[2].A -9.45E-7
self.alpha[0].c -30.08
self.alpha[1].c 62.99
self.alpha[2].c -32.90
self.alpha[0].b -30.08
self.alpha[1].b 62.99
self.alpha[2].b -57.07


This does not happen always at the same iteration, so I suspect the
problem could be something completely unrelated to this piece of code,
like an unitialized pointer.

Using memProof I have got a lot of error related to VirtuallAloc trying to
reference an invalid address. Could that be relevent?


As long as you have invalid pointer references an anlalysis of results will
be difficult. And we cannot help you since we can not reproduce the effects.
Locate and solve the pointer problems first!
Tom


.



Relevant Pages

  • Re: pointer address is physical or virtual.
    ... begins its execution and exits its execution.) ... void afun ... Pointer: 0x804844e ... physicall one. ...
    (comp.os.linux.development.system)
  • Re: pointer address is physical or virtual.
    ... begins its execution and exits its execution.) ... void afun ... Pointer: 0x804844e ... physicall one. ...
    (comp.os.linux.development.system)
  • Re: Passing execution to a memory address
    ... execution to this and execute the file. ... You can't assign a void pointer to a function ... Try to use the system function. ... or would the programmer need to put in some assembly code ...
    (comp.lang.c)
  • Re: __builtins__ magic behavior
    ... dictionary to create a weak form of restricted execution" not only ... globals() or with a copy of globals. ... The exec statement, when given a string source, compiles it and eventually calls PyEval_EvalCodeEx, which creates a new frame using PyFrame_New and finally executes it. ... A frame object contains a pointer to the previous frame, the code to be executed, a pointer to the current globals *and* a separate pointer to the current builtins. ...
    (comp.lang.python)
  • Re: Passing execution to a memory address
    ... execution to this and execute the file. ... You can't assign a void pointer to a function ... Try to use the system function. ...
    (comp.lang.c)