Commit b27b2d63
b27b2d63aa62Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified
Description
feat: add Integer#pow / Float#pow as alias for **
Works for int, float, and bigint receivers.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- b27b2d63aa62
- Parent
- e6625e276955
spinel_codegen.rbmodifiedView file
@@ -1614,7 +1614,7 @@
16141614
end16151615
return "int"16161616
end1617-
if mname == "**"1617+
if mname == "**" || mname == "pow"16181618
if recv >= 016191619
lt = infer_type(recv)16201620
if lt == "float"@@ -11199,7 +11199,7 @@
1119911199
if mname == "%"1120011200
return "sp_bigint_mod(" + rc + ", " + arg + ")"1120111201
end11202-
if mname == "**"11202+
if mname == "**" || mname == "pow"1120311203
return "sp_bigint_pow(" + rc + ", " + compile_arg0(nid) + ")"1120411204
end1120511205
if mname == ">"@@ -11222,7 +11222,7 @@
1122211222
end1122311223
end1122411224
# Operators11225-
if mname == "**"11225+
if mname == "**" || mname == "pow"1122611226
lt = infer_type(recv)1122711227
if lt == "int"1122811228
return "((mrb_int)pow((double)" + compile_expr(recv) + ", (double)" + compile_arg0(nid) + "))"