change the floating point printing format to be more concise. It wouldn't surprise me if this

wasn't perfect, but it is close enough for now.  We now print 4.0 instead of 4.000000.



Swift SVN r1558
This commit is contained in:
Chris Lattner
2012-04-23 02:57:10 +00:00
parent e98e2f4368
commit 34b6a8065a

View File

@@ -339,7 +339,11 @@ extern "C" void _TSs5printFT3valNSs5Int64_T_(int64_t l) {
}
extern "C" void _TSs5printFT3valNSs6Double_T_(double l) {
printf("%f", l);
char Buffer[256];
sprintf(Buffer, "%g", l);
if (llvm::StringRef((char*)Buffer).find_first_of(".e") == llvm::StringRef::npos)
strcat(Buffer, ".0");
printf("%s", Buffer);
}
extern "C" void _TSs9printCharFT9characterNSs5Int32_T_(int32_t l) {