Skip to content

Bigint: incorrect division behavior #6451

Description

@hoshiumiarata

It seems that the division of a bigint by a small integer, where one of the operands is negative, is not working correctly.

Non-bigint division behavior:

-10**10 / 3
 => -3333333334

Bigint division behavior:

-10**20 / 3
 => -33333333333333333332

The result should be -33333333333333333334 (Ruby 3.3 and mruby 3.3.0 also give this result).

The problem is probably caused by not correctly handling rounding in the division algorithm.

Test cases are placed in this pull request: #6444

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions