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

Date: Fri, 20 Dec 2002 23:36:11 -0500
Message-Id: <200212210436.gBL4aBR01780@envy.delorie.com>
X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT delorie DOT com using -f
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
CC: lars DOT o DOT hansen AT gmx DOT de
In-reply-to: <au0qd9$hkj$1@news.online.de> (lars.o.hansen@gmx.de)
Subject: Re: C preprocessor not capable of floating point division ?
References: <au0qd9$hkj$1 AT news DOT online DOT de>
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

This is a simple misunderstanding of the C language.

The number 8 is an integer value.

The number 8.0 is a floating point value.

When you divide two integers, you get an integer.

When you divide two floats, you get a float.

The preprocessor doesn't do any optimization, but the compiler often
does.  It still obeys the rules above.

- Raw text -


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