aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/CBackend/CBackend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r--lib/Target/CBackend/CBackend.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 960abd9caf..b8208d4a4c 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -590,7 +590,15 @@ void CWriter::printConstant(Constant *CPV) {
Out << "LLVM_INF" << (FPC->getType() == Type::FloatTy ? "F" : "")
<< " /*inf*/ ";
} else {
- std::string Num = ftostr(FPC->getValue());
+ std::string Num;
+#if HAVE_PRINTF_A
+ // Print out the constant as a floating point number.
+ char Buffer[100];
+ sprintf(Buffer, "%a", FPC->getValue());
+ Num = Buffer;
+#else
+ Num = ftostr(FPC->getValue());
+#endif
Out << Num;
}
}