78 Commits

Author SHA1 Message Date
furunkel 08c877699a Use builtins for overflow math if possible 2015-04-17 17:37:09 +02:00
cremno 6f893b5183 re-implement mrb_float_to_str()
The new implementation is backwards incompatible, but I couldn't find
any usage outside mruby and I also couldn't think of a different and
good name.

All ISO C99 printf conversion specifiers for floating point numbers and
an optional precision are supported.

It is largely based on code from the MIT licensed musl libc
(http://www.musl-libc.org/) and its floating point printing is exact
(unlike the current code behind Float#to_s).
2015-02-13 09:33:03 +01:00
Yukihiro "Matz" Matsumoto 206f89e209 add MRB_API modifiers to mruby API functions 2014-08-04 00:47:08 +09:00
cremno cf8df563c0 add function for checked mrb_int subtraction 2014-05-05 15:28:26 +02:00
cremno 0f39304265 add function for checked mrb_int addition 2014-05-05 15:24:22 +02:00
cremno ff03cea79b temporary macros for checked arithmetic functions 2014-05-05 15:22:42 +02:00
Yukihiro "Matz" Matsumoto 514cafe6c3 do not use "to_f" to retrieve floats in mrb_get_args(); close #1965 2014-03-28 11:04:15 +09:00
cremno 61577e8d6b mrb_flo_to_str: internal linkage 2014-02-18 04:37:35 +01:00
cremno 1838099e00 more mrb_flo_to_str fixes
- remove float check (take mrb_float instead of mrb_value)
- support -0.0
- fix range error if log10 is called when n == 0.0
- MSVC older than 2013: add signbit macro (for double)
2014-02-17 12:37:39 +01:00
Yukihiro "Matz" Matsumoto 4b981adc58 remove max_digit from mrb_flo_to_str() 2014-02-17 09:40:30 +09:00
Yukihiro "Matz" Matsumoto cb5d690ece cancel f4c27c6 since mruby.h is required for mrb_value etc. anyway 2013-03-30 20:52:51 +09:00
Masaki Muranaka c260ef894e Rename mrb_fix2str() to mrb_fixnum_to_str(). This is for naming consistency. 2013-03-29 22:19:26 +09:00
Masaki Muranaka f4c27c6fb5 Include mrbconf.h as MRB_INT_MAX used here. 2013-03-29 22:19:26 +09:00
Masaki Muranaka f82ae7653a Change the second argument of mrb_flo_to_str().
Export mrb_flo_to_str() as API.
2013-03-29 22:19:26 +09:00
Masaki Muranaka 710f625254 Remove mrb_flt2big() as there is no bignum in the core.
Add new API mrb_flo_to_fixnum(). You can replace mrb_flt2big() to mrb_flo_to_fixnum() with few modifications.
2013-03-29 22:19:26 +09:00
Masaki Muranaka a01e968cdb Remove limits.h from numeric.h. Add limits.h to some C files. 2013-03-29 10:06:40 +09:00
Yukihiro Matsumoto 265fa03d2c defining mrb_int also requires MRB_INT_{MAX,MIN} to be defined 2012-10-17 00:40:23 +09:00
Yukihiro Matsumoto 7d02df3016 NaN boxing 2012-08-14 13:16:34 +09:00
Masaki Muranaka 7ac4b56141 Remove unimplemented declarations. 2012-07-29 20:35:23 +09:00
Yukihiro Matsumoto db3d72a471 move RSHIFT from numeric.h to numeric.c 2012-06-13 15:40:41 +09:00
Yukihiro Matsumoto 6a5019d37f optimized OP_{ADD,SUB,MUL,DIV} to use numeric function for fixnums to handle overflow 2012-06-13 15:38:18 +09:00
Yukihiro Matsumoto a4d3579e31 add extern "C" guards; close #126 2012-05-18 02:02:49 +09:00
Yukihiro Matsumoto 470da1eda0 redefine POST/NEG FIXABLE using INT_MIN/MAX 2012-05-17 09:32:23 +09:00
Yukihiro Matsumoto f4cf8ea423 partial VC support 2012-05-09 08:49:38 +09:00
roco 4ec6d41f16 rm whitespace 2012-04-30 14:29:19 -07:00
Yukihiro Matsumoto 7b3d628c86 use mrb_float instead of double 2012-04-26 11:13:45 +09:00
mimaki 835443614d add file header 2012-04-23 11:46:16 +09:00
mimaki e0d6430f63 add mruby sources 2012-04-20 09:39:03 +09:00