| 130 |
130 |
| 131 // ============================================================================= |
131 // ============================================================================= |
| 132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
| 133 // ============================================================================= |
133 // ============================================================================= |
| 134 // Float to string. Removes trailing zeroes and is locale-independant. |
134 // Float to string. Removes trailing zeroes and is locale-independant. |
| 135 str ftoa (double fCoord) { |
135 str ftoa (double num) { |
| 136 // Disable the locale first so that the decimal point will not |
136 // Disable the locale first so that the decimal point will not |
| 137 // turn into anything weird (like commas) |
137 // turn into anything weird (like commas) |
| 138 setlocale (LC_NUMERIC, "C"); |
138 setlocale (LC_NUMERIC, "C"); |
| 139 |
139 |
| 140 str zRep = fmt ("%f", fCoord); |
140 str zRep = fmt ("%f", num); |
| 141 |
141 |
| 142 // Remove trailing zeroes |
142 // Remove trailing zeroes |
| 143 while (zRep[~zRep - 1] == '0') |
143 while (zRep[~zRep - 1] == '0') |
| 144 zRep -= 1; |
144 zRep -= 1; |
| 145 |
145 |