From 2e35bedc825ab1e125d1173a69faca784e2b5a2f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 15 Jul 2001 00:16:38 +0000 Subject: [PATCH] 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 --- include/llvm/Tools/StringExtras.h | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- 2.34.1