| www.delorie.com/djgpp/mail-archives/browse.cgi | search |
| From: | "Elias Pschernig" <f DOT x DOT gruber-museum-arnsdorf AT magnet DOT at> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: A nice trap! |
| Date: | Sun, 31 May 1998 20:44:38 +0200 |
| Organization: | magnet Internet Services |
| Lines: | 24 |
| Message-ID: | <6ks9nc$jel$2@orudios.magnet.at> |
| References: | <35715A2E DOT A9A35953 AT net4you DOT co DOT at> |
| NNTP-Posting-Host: | 195.3.67.215 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Seawolf schrieb in Nachricht <35715A2E DOT A9A35953 AT net4you DOT co DOT at>...
>Do you know this one?
>Try it out :-)
>
>void main( void)
>{
> float f;
> f = 55 / 77;
> printf( "%f", f);
>}
>/* and please mail me YOUR results */
it could be that zero as a result is correct, although i was a bit
surprised too. but it's no bug in DJGPP.
what you want is 55.0/77.0, this gives you 0.714...
without the .0, in C/C++ a number is always treated as an integer
it seems.
Elias Pschernig
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |