Add a function to convert a double to a string
authorChris Lattner <sabre@nondot.org>
Sun, 15 Jul 2001 00:16:38 +0000 (00:16 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 15 Jul 2001 00:16:38 +0000 (00:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Tools/StringExtras.h

index 31dedb42488d95536acf2048422699b5c37f3531..819da2f054690d761319691b1b576ad2cb876a00 100644 (file)
@@ -9,6 +9,7 @@
 #define LLVM_TOOLS_STRING_EXTRAS_H
 
 #include <string>
+#include <stdio.h>
 #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