<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - The libc++ library sstream cannot properly process some limit values."
href="https://bugs.llvm.org/show_bug.cgi?id=50916">50916</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>The libc++ library sstream cannot properly process some limit values.
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>2077213809@qq.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>I have this use case, when I construct the maximum value of the double type.
After sstream is used to convert a character string to a double type, it is
found that the conversion fails that used libc++. Although value is correctly
assigned, a failure is returned, and libstdc++ is successful.
libc++:
2.22507e-308
error: -2.22507e-308
libstdc++:
2.22507e-308
ok: -2.22507e-308
#include <iostream>
#include <istream>
#include <string>
#include <sstream>
#include <limits>
using namespace std;
int main()
{
double value;
string str = "-2.22507e-308";
stringstream is(str);
is << str;
double minD = std::numeric_limits<double>::min();
cout << minD << endl;
if (!(is >> value)) {
std::cout << "error: " << value << std::endl;
return 0;
}
std::cout << "ok: " << value << std::endl;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>