Re: Should %d round?

new topic     » goto parent     » topic index » view thread      » older message » newer message
gbonvehi said...
petelomax said...

Further to a recent post, I would like to solicit general opinion on whether

    printf(1,"%d\n",3.9999999) 

should print 3 (as it does now) or 4?

I would leave it as it is and state clearly in the manual that the %d argument using an atom will print only the integer part.
If it needs to be rounded, round it :)

Cheers, Guillermo

Sounds fine to me too :) But highlight it perhaps, or add it to the common (possible?) mistakes section.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu