#Strange double value formatting, when there is 0 decimal points

10 messages · Page 1 of 1 (latest)

near zodiacBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

fluid garnet
#

;compile

#include <stdio.h>

int main()
{
    printf("%.1f" "\n", 420.0); /* outputs 420.0 */
    printf("%.0f" "\n", 420.0); /* outputs 4200, why not 420??? */
}
dusky galleonBOT
#
Program Output
420.0
420
fluid garnet
#

it doesnt....

zinc flume
#

ok, im stupid, its my fricking bash prompt having 0 at the start (dont ask why), and i thought number ended with 0.

#

off to delete this post to not confuse other people

near zodiacBOT
#

@zinc flume

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

craggy delta
#

like if you type false does it change to 1