On VC++ 2008, ceil(-0.5) is returning -0.0. Is this usual/expected behavior? What is the best practice to avoid printing a -0.0 to i/o streams.
On VC++ 2008, ceil(-0.5) is returning -0.0 . Is this usual/expected behavior? What is
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ceilin C++ comes from the C standard library.The C standard says that if a platform implements IEEE-754 arithmetic,
ceil( )behaves as though its argument were rounded to integral according to the IEEE-754 roundTowardPositive rounding attribute. The IEEE-754 standard says (clause 6.3):So the sign of the result should always match the sign of the input. For inputs in the range
(-1,0), this means that the result should be-0.0.