[format] negative 0?
I use boost 1.32 with VS 6.0 (sp5) on Windows2000. If I try this : int anIntValue(-0); std::cout << anIntValue << '\n';\ I get : 0 And, if I try this : boost::format formatTest("My test : %0.0f \n"); double theValue(-0.0002); std::string theString = boost::io::str(formatTest % theValue); I get : "My test : -0" Is it the right behavior? I was expecting the same result (simply a 0). Maybe I am wrong... Thank you for any advise / suggestion. Alain
On Tue, 29 Nov 2005, Alain Cormier wrote:
I use boost 1.32 with VS 6.0 (sp5) on Windows2000.
If I try this :
int anIntValue(-0); std::cout << anIntValue << '\n';\
I get : 0
And, if I try this : boost::format formatTest("My test : %0.0f \n"); double theValue(-0.0002); std::string theString = boost::io::str(formatTest % theValue);
I get : "My test : -0"
Is it the right behavior? I was expecting the same result (simply a 0). Maybe I am wrong...
Thank you for any advise / suggestion.
Yes, it is expected to print that, because the value you print is not zero, but a small negative value. Even if there is some rounding done, a negative sign is usually left to indicate that. -- François Duranleau LIGUM, Université de Montréal "Oh mighty one... Please forgive me for wanting to fulfil my biological purpose..." - Robert Anton Wilson, _Prometheus Rising_, 1983 _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Alain Cormier
-
François Duranleau