Skip to content

Fix divmod and modulo by infinity to match Float#divmod and Float#modulo#429

Merged
tompng merged 1 commit into
ruby:masterfrom
tompng:fix_modulo_by_infinity
Sep 13, 2025
Merged

Fix divmod and modulo by infinity to match Float#divmod and Float#modulo#429
tompng merged 1 commit into
ruby:masterfrom
tompng:fix_modulo_by_infinity

Conversation

@tompng

@tompng tompng commented Sep 13, 2025

Copy link
Copy Markdown
Member

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