Boost logo

Boost Users :

From: Digvijoy Chatterjee (digvijoy.c_at_[hidden])
Date: 2007-04-01 01:02:35


Hello,
I am seeing this behavious with boost::lexical_cast<std::string>(double)
occasionaly numbers like 76.32 are being converted to strings of the
form 76.319999999
The expected behavior is seen for almost all doubles except for a few
which are reproducible
e.g. 76.32..

here is a simple program,
int main() {
double d=76.32;
std::string s = boost::lexical_cast<std::string>(d);
cout << s << endl;
}

output
76.319999999...

a) am i doing something wrong ??
b) if this is not wrong s this standard behavior ??

Thanks
Digz


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net