Skip to content

Commit c70b7a8

Browse files
Accept 80-bit long double in <complex> (microsoft#1316)
Co-authored-by: Stephan T. Lavavej <stl@microsoft.com>
1 parent c47cedc commit c70b7a8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

stl/inc/complex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,21 @@ public:
223223
}
224224

225225
static bool _Isinf(_Ty _Left) { // test for infinity
226+
#if defined(__INTEL_COMPILER) && defined(__LONG_DOUBLE_SIZE__) && __LONG_DOUBLE_SIZE__ == 80
227+
return _CSTD _LDtest(&_Left) == _INFCODE;
228+
#else // ^^^ 80-bit long double (not supported by MSVC in general, see GH-1316) / 64-bit long double vvv
226229
const auto _Uint = _Bit_cast<uint64_t>(_Left);
227230
return (_Uint & 0x7fffffffffffffffU) == 0x7ff0000000000000U;
231+
#endif // ^^^ 64-bit long double ^^^
228232
}
229233

230234
static _CONSTEXPR20 bool _Isnan(_Ty _Left) {
235+
#if defined(__INTEL_COMPILER) && defined(__LONG_DOUBLE_SIZE__) && __LONG_DOUBLE_SIZE__ == 80
236+
return _CSTD _LDtest(&_Left) == _NANCODE;
237+
#else // ^^^ 80-bit long double (not supported by MSVC in general, see GH-1316) / 64-bit long double vvv
231238
const auto _Uint = _Bit_cast<uint64_t>(_Left);
232239
return (_Uint & 0x7fffffffffffffffU) > 0x7ff0000000000000U;
240+
#endif // ^^^ 64-bit long double ^^^
233241
}
234242

235243
static constexpr _Ty _Nanv() { // return NaN

0 commit comments

Comments
 (0)