misc.cpp

changeset 36
ac7779339b01
parent 35
2b0569fee5ad
child 37
a413d389b634
equal deleted inserted replaced
35:2b0569fee5ad 36:ac7779339b01
70 str ftoa (double fCoord) { 70 str ftoa (double fCoord) {
71 // Disable the locale first so that the decimal point will not 71 // Disable the locale first so that the decimal point will not
72 // turn into anything weird (like commas) 72 // turn into anything weird (like commas)
73 setlocale (LC_NUMERIC, "C"); 73 setlocale (LC_NUMERIC, "C");
74 74
75 str zRep = str::mkfmt ("%.3f", fCoord); 75 str zRep = str::mkfmt ("%.6f", fCoord);
76 76
77 // Remove trailing zeroes 77 // Remove trailing zeroes
78 while (zRep[~zRep - 1] == '0') 78 while (zRep[~zRep - 1] == '0')
79 zRep -= 1; 79 zRep -= 1;
80 80

mercurial