Mail Archives: djgpp/1997/01/06/12:03:33
From: | span AT PROBLEM_WITH_INEWS_GATEWAY_FILE (M.M. Span)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | floats and ints
|
Date: | 6 Jan 1997 15:46:58 GMT
|
Organization: | Rijksuniversiteit Groningen
|
Lines: | 25
|
Message-ID: | <5ar6pi$8go@info.service.rug.nl>
|
NNTP-Posting-Host: | psy.ppsw.rug.nl
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Maybe this is a generic C or C++ question, but I use DJGPP, so why not here?
int main( int argc, char** argv )
{
int i=1;
int npoints=500;
float omega = 0.0
omega = i/npoints;
cout << omega << endl;
return 0;
}
yields:
0
casting (float)i/(float)npoints;
will yield the correct answer.
is this a bug or a feature.
- Raw text -