Opened 7 years ago

Closed 7 years ago

#11554 closed Bugs (wontfix)

lexical_cast<string>(124.4)

Reported by: anonymous Owned by: Antony Polukhin
Milestone: To Be Determined Component: lexical_cast
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

#include <string> #include <iostream>

using std::cout; using std::endl; using std::string;

int _tmain(int argc, _TCHAR* argv[]) {

using boost::lexical_cast;

string out = lexical_cast<string>(124.4); cout << "out = " << out << endl; system("pause");

return 0;

}

Change History (3)

comment:1 by John Maddock, 7 years ago

Component: Nonelexical_cast
Owner: set to Antony Polukhin

comment:2 by John Maddock, 7 years ago

What's the bug?

You're aware that 124.4 has no exact binary representation and so you will not get "124.4" printed out?

comment:3 by Antony Polukhin, 7 years ago

Resolution: wontfix
Status: newclosed

Floating point types have no exact representation. See #5796 for more details and in-depth description.

Note: See TracTickets for help on using tickets.