Import locale insensitive strtod() from Ruby1.8; fix #3270

The function was renamed to `mrb_float_read(const char*, char**)`.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-12-03 18:47:04 +09:00
parent 802e396466
commit a0fbc46ccd
4 changed files with 245 additions and 8 deletions
+2 -3
View File
@@ -62,12 +62,12 @@ struct mrb_state;
# define MRB_PRIx PRIx32
#endif
MRB_API double mrb_float_read(const char*, char**);
#ifdef MRB_USE_FLOAT
typedef float mrb_float;
# define str_to_mrb_float(buf) strtof(buf, NULL)
#else
typedef double mrb_float;
# define str_to_mrb_float(buf) strtod(buf, NULL)
#endif
#if defined _MSC_VER && _MSC_VER < 1900
@@ -85,7 +85,6 @@ MRB_API int mrb_msvc_snprintf(char *s, size_t n, const char *format, ...);
# define isnan _isnan
# define isinf(n) (!_finite(n) && !_isnan(n))
# define signbit(n) (_copysign(1.0, (n)) < 0.0)
# define strtof (float)strtod
static const unsigned int IEEE754_INFINITY_BITS_SINGLE = 0x7F800000;
# define INFINITY (*(float *)&IEEE754_INFINITY_BITS_SINGLE)
# define NAN ((float)(INFINITY - INFINITY))