[LCP]Rounding questions

Chuck Martin nrocinu at myrealbox.com
Thu Sep 5 22:21:05 UTC 2002


On Thu, Sep 05, 2002 at 01:48:18PM +0300, Andrew Weaver wrote:
> Chuck, this gets weirder...
> 
> try this...
> 
> double a = 390;
> printf("\nf = %f, e = %e, g = %g", a,a,a);
> printf("\nf = %f, e = %e, g = %g", round((double)390), round((double)390),
> round((double)390));

Yup!  I just tried it, and that's definitely strange.  It almost looks like
it's interpreting pointers.  Since your previous result was slightly
different from mine, I don't know if you got the same thing for this, but
I got 0.000000 for %f, which is consistent with what I was getting in the
original program I was working on, but not with my original test program.

Chuck





More information about the linuxCprogramming mailing list