Commit Graph

176 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 0c7d29dff6 FIXABLE() may work wrong on MRB_INT64; fix #2909 2015-08-07 15:30:52 +09:00
Simon Génier d6865a9cc7 Avoid a narrowing cast in flo_round under MRB_INT64. 2015-06-29 20:19:19 -04:00
Franck Verrot 2588507285 Remove unnecessary backticks.
Dr Markus Kuhn published in 1999 an article [1] explaining in details
why we shouldn't use the ASCII grave accent (0x60) as a left quotation.

Backticks have been used most notably to produce nice-looking LaTeX
documents but it doesn't seem to be an issue on modern platforms and
for the oldest ones, there are workarounds as mentioned by Dr Kuhn.

[1]: https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
2015-06-24 13:07:07 +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 70c9866751 add Float::{INFINITY,NAN} if available 2014-11-12 15:46:31 +09:00
Hiroshi Mimaki ed15477c74 Pacify MSVC warnings for numeric.c, proc.c, and symbol.c 2014-10-02 13:37:49 +09:00
Yukihiro "Matz" Matsumoto 296b0571be remove unnecessary MRB_API from mrb_num_div(); close #2578 2014-08-30 16:15:31 +09:00
Yukihiro "Matz" Matsumoto 73a012c808 Merge pull request #2561 from cubicdaiya/issues/space_EOL
Remove spaces in end-of-line.
2014-08-26 02:25:05 +09:00
Tatsuhiko Kubo 0e9f98c430 Fix Numeric#pow behavior.
* Before

2 ** -1 #=> 0

 * After

2 ** -1 #=> 0.5
2014-08-25 17:17:37 +09:00
Tatsuhiko Kubo 6961317fb3 Remove spaces in end-of-line. 2014-08-25 16:49:15 +09:00
Yukihiro "Matz" Matsumoto 6496195d21 Merge pull request #2533 from suzukaze/fix-indents
Fix indents in numeric.c
2014-08-15 22:59:18 +09:00
Jun Hiroe 2ba257ccb4 Fix indents in numeric.c 2014-08-15 20:51:43 +09:00
Jun Hiroe 9b176207a4 Refactor flo_mod func in numeric.c 2014-08-15 20:50:20 +09:00
chasonr f7389bb1e6 Remove some roundoff from mrb_flo_to_str 2014-08-13 23:31:22 -04:00
Yukihiro "Matz" Matsumoto 170ba511f2 remove unnecessary mrb_float casting; ref #2531 2014-08-13 21:58:52 +09:00
kkkkkt a9b37bff4b refactor mrb_hash_shift, num_pow, flo_eq, flo_finite_p method 2014-08-13 18:26:58 +09:00
Yukihiro "Matz" Matsumoto 206f89e209 add MRB_API modifiers to mruby API functions 2014-08-04 00:47:08 +09:00
Yukihiro "Matz" Matsumoto 61ce5892cc remove spaces after open parens 2014-07-12 20:36:45 +09:00
David Turnbull 249f05e7d7 Clean up value.h and mrb_value boxing 2014-07-09 06:32:11 +09:00
take_cheeze a50464fe01 Fix type checking in mrb_flo_to_fixnum. 2014-07-04 16:16:06 +09:00
yui-knk 76593ee0e7 Add comment to Fixnum Class. 2014-05-17 13:51:16 +09:00
Carson McDonald 01988e3be7 Make sure c is large enough if there is an overflow 2014-05-13 11:46:29 -04:00
Yukihiro "Matz" Matsumoto c12f64271a fix overflow error like #2244 on MRB_WORD_BOXING 2014-05-13 23:15:44 +09:00
Akira Kuroda c445c6c7da refactor fix_mod
fix unreachable condition
use b
2014-05-05 23:43:37 +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 86cfcd20d6 simply use isfinite 2014-05-04 01:50:17 +02:00
Jun Hiroe 129e5a6c21 Refactor rshift 2014-05-03 01:13:43 +09:00
Nobuyoshi Nakada ab67c57f65 remove trailing spaces 2014-04-30 09:50:14 +09:00
Jun Hiroe 68ce209f7e Refactor fix_xor() 2014-04-26 11:52:45 +09:00
Jun Hiroe 8916381dba Refactor fix_or() 2014-04-26 11:52:45 +09:00
Jun Hiroe c2d46a43b2 Refactor fix_and() 2014-04-26 11:52:45 +09:00
Jun Hiroe 1bf4633ced Refactor flo_finite_p() 2014-04-26 11:52:45 +09:00
Jun Hiroe cdb49ab608 Refactor fix_to_f in numeric.c 2014-04-16 13:42:40 +09:00
Jun Hiroe 212b3409ae Refactor lshift in numeric.c 2014-04-16 13:42:40 +09:00
Jun Hiroe 0823b23623 Refactor fix_shift_get_width in numeric.c 2014-04-16 13:42:40 +09:00
Yukihiro "Matz" Matsumoto 5138f62d6b resolve conflict 2014-04-15 10:55:46 +09:00
Yukihiro "Matz" Matsumoto 6c02935eb1 Merge branch 'master' of github.com:mruby/mruby 2014-04-13 17:34:27 +09:00
Yukihiro "Matz" Matsumoto b631e0f8d5 avoid function style parens after "return"; ref #2055 2014-04-13 17:34:06 +09:00
Jun Hiroe 70e93da724 Fix indent in bit_coerce 2014-04-13 03:11:58 +09:00
Jun Hiroe 996343caa2 Refactor fix_rshift 2014-04-13 00:41:22 +09:00
Jun Hiroe f8e1633c0d Refactor fix_lshift 2014-04-13 00:37:55 +09:00
Jun Hiroe 8496f84b9b Refactor fix_rev 2014-04-12 23:45:22 +09:00
Yukihiro "Matz" Matsumoto bff93ba93f simplify Fixnum#== 2014-04-12 16:38:28 +09:00
Yukihiro "Matz" Matsumoto 1ef77ab3ff simplify Numeric#eql? 2014-04-12 16:30:45 +09:00
Yukihiro "Matz" Matsumoto 8321ad3f56 remove num_equal() that potentially cause infinite loop 2014-04-12 16:08:47 +09:00
Yukihiro "Matz" Matsumoto b20d711c4d Numeric#round takes optinal argument; close #2042 2014-04-11 14:22:48 +09: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
ksss 8891cea41c Float#round fix bug for infinity and nan cases 2014-03-21 22:24:33 +09:00
Masaki Muranaka 1df355e300 Reduce implicit type casts. 2014-03-18 17:36:47 +09:00