Faster Integer.sqrt for large bignum

Integer.sqrt uses Newton's method.
This pull request reduces the precision which was unnecessarily high in each calculation step.
This commit is contained in:
tompng 2024-03-17 23:03:38 +09:00 committed by Nobuyoshi Nakada
parent dcfbe36cb5
commit 0ff2c7fe6f
3 changed files with 13 additions and 70 deletions

View file

@ -86,6 +86,7 @@ VALUE rb_int_equal(VALUE x, VALUE y);
VALUE rb_int_divmod(VALUE x, VALUE y);
VALUE rb_int_and(VALUE x, VALUE y);
VALUE rb_int_lshift(VALUE x, VALUE y);
VALUE rb_int_rshift(VALUE x, VALUE y);
VALUE rb_int_div(VALUE x, VALUE y);
int rb_int_positive_p(VALUE num);
int rb_int_negative_p(VALUE num);