delorie.com/archives/browse.cgi | search |
From: | ams AT ludd DOT luth DOT se (Martin Str|mberg) |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: float is not working |
Date: | 14 Apr 1999 17:13:22 GMT |
Organization: | University of Lulea, Sweden |
Lines: | 16 |
Message-ID: | <7f2ibi$262$1@news.luth.se> |
References: | <3714C932 DOT 1E5E452B AT spektracom DOT de> |
NNTP-Posting-Host: | queeg.ludd.luth.se |
X-Newsreader: | TIN [UNIX 1.3 950824BETA PL0] |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Andrej Aderhold (dra AT spektracom DOT de) wrote: : why is this not working ?? : : float m = 1 / 2; : : (m will be 0) Because "(one_int) / (another_int)" performs an integer division (all according to the definition of c). Try either "1.0 / 2", "1 / 2.0" or "((float)1) / 2". Right, MartinS
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |