Hi, You can use functions like _controlfp or _control87 (see float.h or MSDN for the latter) to enable/disable float exceptions among a lot of other stuff.. I guess NS is using exceptions to protect its internal scheduler against invalid operations since simulations often require a very precise timing resolution. Anyway, that function should help you but don't forget to re-enable the exceptions once you're done with your stuff...
Regards, Ilyes Gouta. On 4/26/06, Arkaitz Bitorika <[EMAIL PROTECTED]> wrote: > > I'm replying to myself, sorry. I forgot to add that I'm running this on > Linux Ubuntu Breezy on a dual Xeon computer. > Does someone know why the function below works fine in a basic C program but > crashes in NS-2? > > Thanks in advance, > Arkaitz > > > On 4/25/06, Arkaitz Bitorika <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > I am using a Python numerical library (http://www.numpy.org/) embedded in > > NS, and while there's no problem on most of the functionality, I've found > > that there's a function that throws a Floating point exception whenever it's > > called from NS. This function is pasted below, it has no dependency on > > Python, it also throws the Floating point exception when called from a > > vanilla NS-2 installation: > > > > double > > pinf_init(void) > > { > > double mul = 1e10; > > double tmp = 0.0; > > double pinf; > > > > pinf = mul; > > for (;;) { > > pinf *= mul; > > if (pinf == tmp) break; > > tmp = pinf; > > } > > return pinf; > > } > > > > This function runs fine when called from an empty main() C++ program, but > > if called from NS-2 I get the Floating point exception. Any idea what may be > > causing this crash? > > > > Thanks, > > Arkaitz > > >
