Skip to content

Commit aa55cd6

Browse files
committed
fix radix issue
Signed-off-by: Jon Oster <[email protected]>
1 parent 1749692 commit aa55cd6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/bs_size.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,18 @@ static void strstrip(char *str) {
226226
/* Helper function to convert mpf_t to mpz_t with round-toward-zero (truncate decimal) */
227227
static void mpz_set_f_round_zero(mpz_t rop, const mpf_t op) {
228228
char *str;
229+
const char *radix_char;
229230
char *dot;
230231
char *exp;
231232

232233
/* Convert to decimal string with enough precision */
233234
gmp_asprintf(&str, "%.100Ff", op);
234235

235-
/* Find decimal point and truncate */
236-
dot = strchr(str, '.');
236+
/* Get the locale's decimal separator */
237+
radix_char = nl_langinfo(RADIXCHAR);
238+
239+
/* Find decimal point (using locale's separator) and truncate */
240+
dot = strchr(str, radix_char[0]);
237241
if (dot) {
238242
*dot = '\0';
239243
}

0 commit comments

Comments
 (0)