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
This commit is contained in:
Chris Lattner 2001-07-15 00:16:38 +00:00
parent d2fdd91c66
commit 2e35bedc82

View 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