summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2014-01-12 14:44:46 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2014-01-12 14:44:46 +0000
commit79addb8d8f3016ae3721a40ce21bb79c8fb255ae (patch)
tree133df2272649938a08255fffd7c937270c894834 /llvm/lib/Support/raw_ostream.cpp
parentd7032ac21e758605cef80f41e64d1f2d306a2f64 (diff)
downloadbcm5719-llvm-79addb8d8f3016ae3721a40ce21bb79c8fb255ae.tar.gz
bcm5719-llvm-79addb8d8f3016ae3721a40ce21bb79c8fb255ae.zip
raw_stream formatter: [Win32] Use std::signbit() if available, instead of _fpclass().
FIXME: It should be generic to C++11. For now, it is dedicated to mingw-w64. llvm-svn: 199052
Diffstat (limited to 'llvm/lib/Support/raw_ostream.cpp')
-rw-r--r--llvm/lib/Support/raw_ostream.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index cb9648981a3..84f5ab592e6 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -227,11 +227,17 @@ raw_ostream &raw_ostream::operator<<(double N) {
// On MSVCRT and compatible, output of %e is incompatible to Posix
// by default. Number of exponent digits should be at least 2. "%+03d"
// FIXME: Implement our formatter to here or Support/Format.h!
+#if __cplusplus >= 201103L && defined(__MINGW32__)
+ // FIXME: It should be generic to C++11.
+ if (N == 0.0 && std::signbit(N))
+ return *this << "-0.000000e+00";
+#else
int fpcl = _fpclass(N);
// negative zero
if (fpcl == _FPCLASS_NZ)
return *this << "-0.000000e+00";
+#endif
char buf[16];
unsigned len;
OpenPOWER on IntegriCloud