Skip to content

Wrong remainder calculation #350

Closed
@tompng

Description

@tompng

x.modulo(y) and x.remainder(y) should be equal for positive x and y

x.remainder(y) means x-y*(x/y).truncate
a%b = a - (a.to_f/b).floor * b
x=BigDecimal('0.12345e10')
y=BigDecimal('0.23456e-10')

x.modulo y
# => 0.3456e-11

x.remainder y
# => 0.216e-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions