www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/11/22/12:20:46

Date: Thu, 22 Nov 2001 19:16:04 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Graham Rangel-Sharp <een7gdr AT leeds DOT ac DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Win2000 DJGPP Problem Report Calculations = NaN
In-Reply-To: <Gn7LD6.A0D@leeds.ac.uk>
Message-ID: <Pine.SUN.3.91.1011122190942.18209I-100000@is>
MIME-Version: 1.0
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

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019