delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/19/03:17:36

From: Oon Lin <Oon DOT Lin AT jcu DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: simple thing
Date: Thu, 16 Oct 1997 10:16:16 +1000
Organization: University of Queensland
Lines: 38
Message-ID: <34455CCF.41C6@jcu.edu.au>
NNTP-Posting-Host: cuda.jcu.edu.au
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi !

I was doing a simple printf but it seems like I don't get the result I
want...

The statement was  :

  printf("Vertical Retrace Time = %f \n", 1/70) ;


I was careful to use '\n' to force the statement above to be printed out
but what I got was

   Vertical Retrace Time = 0.000000


Wha ??? 


When I cast the calculation 
 
  printf("Vertical Retrace Time = %f \n", (float)(1/70)) ;

I got the result that I want....

Is this a bug in GNU ??


Kean

/////////////////////////////////////////////////////////////////////

Oon DOT Lin AT jcu DOT edu DOT au
http://lionfish.jcu.edu.au/~sci-okl

"May you never live with another segmentation fault again..."

/////////////////////////////////////////////////////////////////////

- Raw text -


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