diff options
Diffstat (limited to 'lstrlib.c')
-rw-r--r-- | lstrlib.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.226 2015/02/09 18:05:46 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.227 2015/03/28 19:14:47 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -803,6 +803,7 @@ static int str_gsub (lua_State *L) { | |||
803 | ** Hexadecimal floating-point formatter | 803 | ** Hexadecimal floating-point formatter |
804 | */ | 804 | */ |
805 | 805 | ||
806 | #include <locale.h> | ||
806 | #include <math.h> | 807 | #include <math.h> |
807 | 808 | ||
808 | #define SIZELENMOD (sizeof(LUA_NUMBER_FRMLEN)/sizeof(char)) | 809 | #define SIZELENMOD (sizeof(LUA_NUMBER_FRMLEN)/sizeof(char)) |
@@ -850,7 +851,7 @@ static int num2straux (char *buff, lua_Number x) { | |||
850 | m = adddigit(buff, n++, m * (1 << L_NBFD)); /* add first digit */ | 851 | m = adddigit(buff, n++, m * (1 << L_NBFD)); /* add first digit */ |
851 | e -= L_NBFD; /* this digit goes before the radix point */ | 852 | e -= L_NBFD; /* this digit goes before the radix point */ |
852 | if (m > 0) { /* more digits? */ | 853 | if (m > 0) { /* more digits? */ |
853 | buff[n++] = '.'; /* add radix point */ | 854 | buff[n++] = lua_getlocaledecpoint(); /* add radix point */ |
854 | do { /* add as many digits as needed */ | 855 | do { /* add as many digits as needed */ |
855 | m = adddigit(buff, n++, m * 16); | 856 | m = adddigit(buff, n++, m * 16); |
856 | } while (m > 0); | 857 | } while (m > 0); |