Re: float values can b rounded off?
From: CBFalconer (cbfalconer_at_yahoo.com)
Date: 01/21/05
- Next message: CBFalconer: "Re: interesting problem"
- Previous message: CBFalconer: "Re: how to write a tutorial"
- In reply to: sushant: "float values can b rounded off?"
- Next in thread: Keith Thompson: "Re: float values can b rounded off?"
- Reply: Keith Thompson: "Re: float values can b rounded off?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 21 Jan 2005 16:30:57 GMT
sushant wrote:
>
> the code:
>
> int main(void)
> {
> float i=6.10203;
> printf("%d",i);
> return 0;
> }
> is giving the o/p zero. why??????
Screw ups:
1. Posting via google and losing all indentation. See sig.
2. Failure to #include <stdio.h>
3. Lying to the compiler about the type of i in the printf.
4. lack of blanks within the code (foolish style).
Either of 2 or 3 result in undefined behavior.
-- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson
- Next message: CBFalconer: "Re: interesting problem"
- Previous message: CBFalconer: "Re: how to write a tutorial"
- In reply to: sushant: "float values can b rounded off?"
- Next in thread: Keith Thompson: "Re: float values can b rounded off?"
- Reply: Keith Thompson: "Re: float values can b rounded off?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
Loading