From: Chris Lattner Date: Sun, 15 Jul 2001 00:16:38 +0000 (+0000) Subject: Add a function to convert a double to a string X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2e35bedc825ab1e125d1173a69faca784e2b5a2f;p=oota-llvm.git Add a function to convert a double to a string git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Tools/StringExtras.h b/include/llvm/Tools/StringExtras.h index 31dedb42488..819da2f0546 100644 --- a/include/llvm/Tools/StringExtras.h +++ b/include/llvm/Tools/StringExtras.h @@ -9,6 +9,7 @@ #define LLVM_TOOLS_STRING_EXTRAS_H #include +#include #include "llvm/Tools/DataTypes.h" static inline string utostr(uint64_t X, bool isNeg = false) { @@ -60,4 +61,10 @@ static inline string itostr(int X) { return utostr((unsigned)X); } +static inline string ftostr(double V) { + char Buffer[200]; + snprintf(Buffer, 200, "%f", V); + return Buffer; +} + #endif