Skip to content

Bigint: weird mod behavior #6452

@hoshiumiarata

Description

@hoshiumiarata

It seems that the % operator and divmod method behave differently from Ruby when used with negative numbers.

-1 % (10**20)

mruby: 1.0e+20
Ruby 3.3: 99999999999999999999

-1.divmod(10**20)

mruby: [NaN, NaN]
Ruby 3.3: [-1, 99999999999999999999]

The problem is probably caused by mruby converting bigints to float at some point.

Test cases are placed in this pull request: #6444

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions