1require_relative '../../../spec_helper'
2
3ruby_version_is ''...'2.5' do
4  require 'mathn'
5
6  describe "Bignum#**" do
7    before :each do
8      @bignum = bignum_value(47)
9    end
10
11    it "returns self raised to other (positive) power" do
12      (@bignum ** 4).should == 7237005577332262361485077344629993318496048279512298547155833600056910050625
13      (@bignum ** 1.2).should be_close(57262152889751597425762.57804, TOLERANCE)
14    end
15
16    it "returns a complex number when negative and raised to a fractional power" do
17      ((-@bignum) ** (1/3)).should be_close(Complex(1048576,1816186.907597341), TOLERANCE)
18      ((-@bignum) ** (1.0/3)).should be_close(Complex(1048576,1816186.907597341), TOLERANCE)
19    end
20  end
21end
22