tahsynx's blog

By tahsynx, history, 9 years ago, In English

printf("%.3lf\n", -0.0001); This shows -0.000, but shouldn't it be 0.000?

How to print it correctly ? Without the minus sign, only 0.000 ?

  • Vote: I like it
  • +8
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

No, it shouldn't be 0.000, because there's notion of signed zero in the doubles standard.