KEMBAR78
Fix divmod and modulo by infinity to match Float#divmod and Float#modulo by tompng · Pull Request #429 · ruby/bigdecimal · GitHub
Skip to content

Conversation

@tompng
Copy link
Member

@tompng tompng commented Sep 13, 2025

Fix this bug

(-2.0).divmod(Float::INFINITY)
#=> [-1, Infinity]

BigDecimal(-2).divmod(BigDecimal::INFINITY)
#=> [0.0, -0.2e1] 

2.0.divmod(-Float::INFINITY)
#=> [-1, -Infinity]

BigDecimal(2).divmod(-BigDecimal::INFINITY)
#=> [0.0, 0.2e1]

@tompng tompng force-pushed the fix_modulo_by_infinity branch 3 times, most recently from 6893bfc to f304064 Compare September 13, 2025 12:49
@tompng tompng force-pushed the fix_modulo_by_infinity branch from f304064 to 02207ae Compare September 13, 2025 12:51
@tompng tompng merged commit 8ca3249 into ruby:master Sep 13, 2025
81 checks passed
@tompng tompng deleted the fix_modulo_by_infinity branch September 13, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant