delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/12/20/23:45:03

From: "A. Sinan Unur" <asu1 AT c-o-r-n-e-l-l DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C preprocessor not capable of floating point division ?
Date: 21 Dec 2002 04:44:45 GMT
Organization: Cornell University
Lines: 29
Sender: asu1 AT cornell DOT invalid (on pool-141-149-208-78.syr.east.verizon.net)
Message-ID: <Xns92EAF18D1776Casu1cornelledu@132.236.56.8>
References: <au0qd9$hkj$1 AT news DOT online DOT de>
NNTP-Posting-Host: pool-141-149-208-78.syr.east.verizon.net
X-Trace: news01.cit.cornell.edu 1040445885 14579 141.149.208.78 (21 Dec 2002 04:44:45 GMT)
X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu
NNTP-Posting-Date: 21 Dec 2002 04:44:45 GMT
User-Agent: Xnews/5.04.25
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Lars O. Hansen" <lars DOT o DOT hansen AT gmx DOT de> wrote in
news:au0qd9$hkj$1 AT news DOT online DOT de: 

> so sth. like int a=4/8  (which the preprocessor should evaluate)  does
> not become 0.5 ?   (although it is highly unlikely that the programmer
> did not intend to have just that) 

i would not call that person a programmer.

> or #define sth 8; int a=2/sth;  results in a being 0?
> 
> Is this a problem of the C language or specific to gccs C
> preprocessor? 

no offense, but the problem is in your head. an int is not a floating 
point variable.

how do you propose to store 0.5 in an integer?

> How can I achieve floating point division or similar having the same
> result by the C preprocessor for #define d values ?

you'll have to clarify what you are trying to do.

-- 
A. Sinan Unur
asu1 AT c-o-r-n-e-l-l DOT edu
Remove dashes for address
Spam bait: mailto:uce AT ftc DOT gov

- Raw text -


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