comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: NaN Magic Bingo!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: NaN Magic Bingo! [message #56802] Thu, 15 November 2007 13:16 Go to previous message
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
Mort Canty wrote:
<...>
> It was the CISCO VPN client! Thank you Peter. That was the best four
> cents I ever got! If you're ever anywhere near the town of Juelich,
> Germany, let me know. I owe you a big, cold, German beer.
>
> Mort
>
> PS. CISCO -> The Cisco Kid (50's radio) -> Mexico -> Coyote ... David
> was right, as usual.

Thanks Mort, I'll keep that beer in mind. I've never actually been to
Germany, even though my mother grew up next door (Switzerland).
I'm glad it worked out. It's hard to believe that something as mainstream
as VPN Client 4.x could have such a glitch in it but there you go. Seems
none of us software developers are safe from bugs.
In case anyone's curious, here's a simple little test routine that uses
brute force to expose the bug. (Sorry it's in C.)

Cheers
Peter

// Little FP integrity checker. MUST be called with VAL=1.

// Returns 0 if okay and 1 if not.

#pragma optimize( "", off ) //a smart compiler might see me coming and
avoid some of my calcs

static int FPIntegrity(HWND hw, int val)

{

register double a=val, b=val, c=val, d=val, e=val, f=val;

register int i, j, k;

for( j=1, k=0; j && (k<1000); ++k ) {

for( i=0x00400000; i&&j; --i ) { //do some simple calcs that shouldn't
change B, C, D, E or F (they should all remain at 1.0)

b *= a;

c += a-b;

d += b-a;

e *= b+c-d;

f -= (a-b+c-d)*e;

if( a-b+c-d+e-f ) {

char tx[256];

j=0;

sprintf( tx, "Floating-point Integrity broke on iteration %d.\nThe following
numbers should all have been 0:\n%f %f %f\n%f %f %f",
k,a-1,b-1,c-1,d-1,e-1,f-1 );

MessageBox( hw, tx, "Warning", MB_ICONWARNING|MB_OK|MB_TOPMOST );

} }

}

return j ? 0 : 1;

}

#pragma optimize( "", on )
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Multi-plot error. Could anyone help me?
Next Topic: Do you find this weird too?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 10:31:30 PDT 2025

Total time taken to generate the page: 0.96261 seconds