<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 - Double Signaling NaN converted to float becomes INF"
href="https://bugs.llvm.org/show_bug.cgi?id=43907">43907</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Double Signaling NaN converted to float becomes INF
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>9.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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>feildel@corona-renderer.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The following piece of code produce incorrect result with clang (and clang-cl)
on Windows:
```
#include <cmath>
#include <limits>
int main() {
const double quiet_nan_double = std::numeric_limits<double>::quiet_NaN();
const float converted_to_float = float(quiet_nan_double);
const bool isnan = std::isnan(converted_to_float);
return isnan ? 1 : 0;
}
```
The program should return 1. It does on Linux with majors compilers. On Windows
clang (and clang-cl) returns 0 no matter what compilation flags I tried. Here
are some flags I used:
clang -O3 -Wall -Wextra -g nan_d2f.cpp
clang -O0 -Wall -Wextra -g nan_d2f.cpp
clang -Wall -Wextra -g nan_d2f.cpp
clang-cl /Ox /W4 /EHsc nan_d2f.cpp
clang-cl /W4 /EHsc nan_d2f.cpp
Here is version reported by `clang -v`:
```
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\scoop\apps\llvm\current\bin
```
It was downloaded from here:
<a href="https://releases.llvm.org/9.0.0/LLVM-9.0.0-win64.exe#/dl.7z">https://releases.llvm.org/9.0.0/LLVM-9.0.0-win64.exe#/dl.7z</a>
Let me know if you need more info or cannot reproduce.</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>