www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/10/03:17:05

Date: Sat, 10 Feb 1996 16:10:10 -0800 (GMT)
From: Orlando Andico <oandico AT eee DOT upd DOT edu DOT ph>
To: DJGPP Mailing List <djgpp AT delorie DOT com>
Message-ID: <Pine.SOL.3.91.960210160705.555A@gollum>
MIME-Version: 1.0

Ignore the last missive --   =)
I just discovered the cause.

Given the following:

#define X  5
#define Y  6

float z;

z = X / Y * 5.6;

Turbo C++ evaluates X and Y as integers (!) which is what caused my 
acos() domain errors. However, GCC 2.7.2 (DJGPP 2.0) _correctly_ 
evaluates the above; both X and Y seem to be treated as floats. "Fixing" 
the defines like so:

#define  X 5.0

or

#define  X (float)5

now, which is the ANSI-defined behavior, that of Turbo C, or that of 
DJGPP? (the evaluate-as-integer problem appeared using both Turbo C 2.0 
and Turbo C++ 3.0)

Thanks,

/----------------------------------------------------------------------------\
|  Orlando A. Andico                 "I have no concept of time, other than  |
|  oandico AT eee DOT upd DOT edu DOT ph               it is flying." -- Alanis Morissette  |
\----------------------------------------------------------------------------/

- Raw text -


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