File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -2868,7 +2868,11 @@ mrb_float_read(const char *string, char **endPtr)
2868
2868
mantSize -= 1 ; /* One of the digits was the point. */
2869
2869
}
2870
2870
if (mantSize > 18 ) {
2871
- fracExp = decPt - 18 ;
2871
+ if (decPt - 18 > 29999 ) {
2872
+ fracExp = 29999 ;
2873
+ } else {
2874
+ fracExp = decPt - 18 ;
2875
+ }
2872
2876
mantSize = 18 ;
2873
2877
} else {
2874
2878
fracExp = decPt - mantSize ;
@@ -2922,6 +2926,9 @@ mrb_float_read(const char *string, char **endPtr)
2922
2926
}
2923
2927
while (isdigit (* p )) {
2924
2928
exp = exp * 10 + (* p - '0' );
2929
+ if (exp > 19999 ) {
2930
+ exp = 19999 ;
2931
+ }
2925
2932
p += 1 ;
2926
2933
}
2927
2934
}
Original file line number Diff line number Diff line change @@ -596,10 +596,14 @@ def to_str
596
596
a = '' . to_f
597
597
b = '123456789' . to_f
598
598
c = '12345.6789' . to_f
599
+ d = '1e-2147483648' . to_f
600
+ e = '1e2147483648' . to_f
599
601
600
602
assert_float ( 0.0 , a )
601
603
assert_float ( 123456789.0 , b )
602
604
assert_float ( 12345.6789 , c )
605
+ assert_float ( 0 , d )
606
+ assert_float ( Float ::INFINITY , e )
603
607
end
604
608
605
609
assert ( 'String#to_i' , '15.2.10.5.39' ) do
You can’t perform that action at this time.
0 commit comments