diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-11-13 23:26:24 +0100 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-11-13 23:26:24 +0100 |
commit | 2c5a6588409a35689af5361eb82cc469d45d31da (patch) | |
tree | eff0ca8bc932e3b6bbd4aa6fe44fe48be87f62be /mpf/out_str.c | |
parent | f2f9810e4005a46af4c80a95642aad73c31c0451 (diff) | |
download | gmp-2c5a6588409a35689af5361eb82cc469d45d31da.tar.gz |
* mpf/out_str.c: Use localeconv for the decimal point.
Diffstat (limited to 'mpf/out_str.c')
-rw-r--r-- | mpf/out_str.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mpf/out_str.c b/mpf/out_str.c index d3b00a5f6..0149307b7 100644 --- a/mpf/out_str.c +++ b/mpf/out_str.c @@ -21,8 +21,15 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include <stdio.h> #include <string.h> + +#if HAVE_LOCALE_H +#include <locale.h> /* for localeconv */ +#endif + #include "gmp.h" #include "gmp-impl.h" @@ -61,8 +68,18 @@ mpf_out_str (FILE *stream, int base, size_t n_digits, mpf_srcptr op) n_digits--; } +#if HAVE_LOCALECONV + { + const char *dec = localeconv()->decimal_point; + size_t declen = strlen (dec); + putc ('0', stream); + fwrite (dec, 1, declen, stream); + written += declen + 1; + } +#else fwrite ("0.", 1, 2, stream); written += 2; +#endif /* Write mantissa */ { |