mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
merge revision(s) d71be7274b
: [Backport #20873]
[Bug #20873] Consider `-FIXNUM_MIN` overflow `-FIXNUM_MIN` is usually greater than `FIXNUM_MAX` on platforms using two's complement representation.
This commit is contained in:
parent
9bcc5c5fd9
commit
a7b013b392
3 changed files with 6 additions and 2 deletions
|
@ -811,7 +811,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||
if (FIXNUM_P(num)) {
|
||||
if ((SIGNED_VALUE)num < 0) {
|
||||
long n = -FIX2LONG(num);
|
||||
num = LONG2FIX(n);
|
||||
num = LONG2NUM(n);
|
||||
sign = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,6 +227,10 @@ class TestSprintf < Test::Unit::TestCase
|
|||
|
||||
bug11766 = '[ruby-core:71806] [Bug #11766]'
|
||||
assert_equal("x"*10+" 1.0", sprintf("x"*10+"%8.1f", 1r), bug11766)
|
||||
|
||||
require 'rbconfig/sizeof'
|
||||
fmin, fmax = RbConfig::LIMITS.values_at("FIXNUM_MIN", "FIXNUM_MAX")
|
||||
assert_match(/\A-\d+\.\d+\z/, sprintf("%f", Rational(fmin, fmax)))
|
||||
end
|
||||
|
||||
def test_rational_precision
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||
#define RUBY_VERSION_TEENY 6
|
||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||
#define RUBY_PATCHLEVEL 236
|
||||
#define RUBY_PATCHLEVEL 237
|
||||
|
||||
#include "ruby/version.h"
|
||||
#include "ruby/internal/abi.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue