Add a function to convert a double to a string

llvm-svn: 187
This commit is contained in:
Chris Lattner 2001-07-15 00:16:38 +00:00
parent 08d936465f
commit 2cded30974
1 changed files with 7 additions and 0 deletions

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