mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
8f259fb560
Support negative modulus in Integer#pow(exp, mod) with proper Ruby semantics. Previously, negative modulus caused an infinite loop in Barrett reduction. Now: - Use absolute value of modulus for computation - Apply signed modulo adjustment (result + m for non-zero result when m is negative) - Add early return for zero base with positive exponent (0^n = 0) Co-authored-by: Claude <noreply@anthropic.com>