Rational errors fix

- Better debug information on float errors (lines 231 and 251).
- line 246 fixes ruby rational errors
This commit is contained in:
pk-2000 2021-09-01 00:09:15 +03:00 committed by GitHub
parent 990843a50b
commit a5a12ecf21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -228,7 +228,7 @@ rb_float_arg(VALUE arg, double *out, int argPos = 0)
break;
default:
rb_raise(rb_eTypeError, "Argument %d: Expected float", argPos);
rb_raise(rb_eTypeError, "Argument %d: Expected float(got 0x%x)", argPos, rb_type(arg));
}
}
@ -243,11 +243,12 @@ rb_int_arg(VALUE arg, int *out, int argPos = 0)
break;
case RUBY_T_FIXNUM :
case RUBY_T_RATIONAL :
*out = FIX2INT(arg);
break;
default:
rb_raise(rb_eTypeError, "Argument %d: Expected fixnum", argPos);
rb_raise(rb_eTypeError, "Argument %d: Expected fixnum(got 0x%x)", argPos, rb_type(arg));
}
}