Skip to content

Allocate is raising an ArgumentError when passing rationals #725

@alexdunae

Description

@alexdunae

Hi there -- thanks for the great gem. I've run into an issue passing an array of rational numbers to allocate. You can reproduce it like so:

> ratios = 7.times.map { Rational(950, 6650) } # 7 x 1/7
> Money.us_dollar(6650).allocate(ratios)
ArgumentError: splits add to more then 100%

Setting different conversion_precision values does change things (e.g. it works at 17 and 14 but not 15) but not predictably.

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