Date: Thu, 22 Nov 2001 19:16:04 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Graham Rangel-Sharp cc: djgpp AT delorie DOT com Subject: Re: Win2000 DJGPP Problem Report Calculations = NaN In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 22 Nov 2001, Graham Rangel-Sharp wrote: > The problem is that im having to compile software written about 5 years ago > on a sun machine. I can get it to compile and run on win2000 but after some > time into the program, some of the calcutlations come out with answers of > NaN. The software runs a simulation of a transister and incorporates many > iterations, they seem to start of okay, giving sensible answers but about > 20-30 mins into the running the strange results appear. I dont think its a > problem with the code since it works fine on a friends linux machine. GNU/Linux systems use a different math library, and also a different setup of the FP processor. So assuming it's a DJGPP problem because the GNU/Linux binary runs okay is not a recommended approach. Let's begin with the basics: what compiler switches were used during compilation and link of the program? Was libm.a, the math library, linked in (do you see the -lm switch in the link command line)? > I recently tried the win2k djdev204_alpha_win2k.zip which resulted in the > NaN`s coming very much sooner during the program. I suspect uninitialized memory (Unix and GNU/Linux systems initialize memory allocated off the heap to all zeroes, while DJGPP doesn't do that, for performance reasons). Try building the program with the _CRT0_FLAG_FILL_SBRK_MEMORY bit set in the _crt0_startup_flags variable, and see if the problems go away.