This behavior still exists in Ruby 3.2.2.
In order to fix this Complex#** would need to handle the special cases of self being 0+1i and 0-1i.
Correct:
irb(main):052:0> Complex(0, -1) ** 1000000000000000000
=> (1+0i)
irb(main):053:0> Complex(0, -1) ** 1000000000000000001
=> (0-1i)
irb(main):054:0> Complex(0, -1) ** 1000000000000000002
=> (-1+0i)
irb(main):055:0> Complex(0, -1) ** 1000000000000000003
=> (0+1i)
irb(main):056:0> Complex(0, -1) ** 1000000000000000004
=> (1+0i)
irb(main):057:0> Complex(0, 1) ** 1000000000000000000
=> (1+0i)
irb(main):058:0> Complex(0, 1) ** 1000000000000000001
=> (0+1i)
irb(main):059:0> Complex(0, 1) ** 1000000000000000002
=> (-1+0i)
irb(main):060:0> Complex(0, 1) ** 1000000000000000003
=> (0-1i)
irb(main):061:0> Complex(0, 1) ** 1000000000000000004
=> (1+0i)
Suboptimal:
irb(main):066:0> Complex(0, -1) ** 10000000000000000000
(irb):66: warning: in a**b, b may be too big
=> (-0.9125701512929312+0.40892018655135703i)
irb(main):067:0> Complex(0, -1) ** 10000000000000000001
(irb):67: warning: in a**b, b may be too big
=> (-0.9125701512929312+0.40892018655135703i)
irb(main):068:0> Complex(0, -1) ** 10000000000000000002
(irb):68: warning: in a**b, b may be too big
=> (-0.9125701512929312+0.40892018655135703i)
irb(main):069:0> Complex(0, -1) ** 10000000000000000003
(irb):69: warning: in a**b, b may be too big
=> (-0.9125701512929312+0.40892018655135703i)
irb(main):070:0> Complex(0, -1) ** 10000000000000000004
(irb):70: warning: in a**b, b may be too big
=> (-0.9125701512929312+0.40892018655135703i)
irb(main):071:0> Complex(0, 1) ** 10000000000000000000
(irb):71: warning: in a**b, b may be too big
=> (-0.9125701512929312-0.40892018655135703i)
irb(main):072:0> Complex(0, 1) ** 10000000000000000001
(irb):72: warning: in a**b, b may be too big
=> (-0.9125701512929312-0.40892018655135703i)
irb(main):073:0> Complex(0, 1) ** 10000000000000000002
(irb):73: warning: in a**b, b may be too big
=> (-0.9125701512929312-0.40892018655135703i)
irb(main):074:0> Complex(0, 1) ** 10000000000000000003
(irb):74: warning: in a**b, b may be too big
=> (-0.9125701512929312-0.40892018655135703i)
irb(main):075:0> Complex(0, 1) ** 10000000000000000004
(irb):75: warning: in a**b, b may be too big
=> (-0.9125701512929312-0.40892018655135703i)
irb(main):076:0> in):070:0> Complex(0, -1) ** 10000000000000000004
=> (-0.9125701512929312-0.40892018655135703i)