<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63881>63881</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
_BitInt(192) conversion to double produces wrong value
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:codegen
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tbaederr
</td>
</tr>
</table>
<pre>
This seems to be a problem in codegen, since evaluation at compile time works: https://godbolt.org/z/T7r9voe6c
```c++
constexpr _BitInt(192) a = 11488350477184223;
constexpr double d = a;
static_assert(d == 11488350477184224.0);
int main () {
unsigned _BitInt(192) u = 11488350477184223;
__builtin_printf ("%.1f\n", (double) u);
if ((double) u != 11488350477184224.0)
__builtin_abort ();
}
```
The printed value is instead `9007199254740992.0`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU01v4zgM_TX0hagh03ZsHXxoGwTYe--BZDGJdmXJkOR0d3_9wE6mLZrBDCDI1sd7fE8kVUr27JkHaF-g3RdqyZcQh6wVG46x0MH8N7xdbMLEPCXMATWjwjkG7XhC63EMhs_sgV4xWT8y8lW5RWUbPKqMY5hm6xiznRjfQ_wnQf2Ml5zn9QfoAHQ4B6ODy2WIZ6DD_0CHty7Ka-DdCGIP4vk-78RtjEAv69h2x-BT5n_niMcXm__yGaivJAFJVAj1Hquq6fu6FU3XVX1DVEP9ADVh0Y7RbAD1cSFlle14VClxXHm3819xNqUAkh-422x9xklZj0D9Kge6-zHi4rd3N4-alz9oRjwe9WJdtv44R-vz6UZPQG1ZnaB99dvidd2-2dpoH-WhvUO_XkOg6jcG7xK-ilA6xHy3-Bmh23_L2dfIbxfGTTsbXIuF0Sa0ay6UQdgJKURXSUlt0zVCSipXgvKGLcxQG1lLVfBQ7XrZiF1Xi-IycC9PujNdoxrdnJSuzUmoqpKaTlKRrgo7kKBadFUrurpvRVlXvW4167bbqV6QhkbwpKwrnbtOazEWNqWFh13d91XhlGaXtkYhGp3yZ6ifP4qf1u6Jw4p80ss5QSOcTTl9cmWbHQ8P-R6Dv3JMa7fk8LMO5xjMMnLC9xj8-fZGxRLd8K1vbL4suhzDBHRYA90_T3MMf_OYgQ6bgwR02Ez8CAAA__8hgiJF">