mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
eval_error.c: log10(0) is ERANGE
By definition, the logarithm of 0 is negative infinity. This is a pole error (cf: cf: ISO/IEC 9899:1999 section 7.12.1 paragraph 3) and of course, cannot fit into an `int` value. We have to resort to INT_MIN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b7f5c573ef
commit
06e2873ed1
1 changed files with 1 additions and 1 deletions
|
@ -195,7 +195,7 @@ print_backtrace(const VALUE eclass, const VALUE errat, const VALUE str, int reve
|
|||
long len = RARRAY_LEN(errat);
|
||||
int skip = eclass == rb_eSysStackError;
|
||||
const int threshold = 1000000000;
|
||||
int width = ((int)log10((double)(len > threshold ?
|
||||
int width = (len <= 1) ? INT_MIN : ((int)log10((double)(len > threshold ?
|
||||
((len - 1) / threshold) :
|
||||
len - 1)) +
|
||||
(len < threshold ? 0 : 9) + 1);
|
||||
|
|
Loading…
Reference in a new issue