1require_relative '../../../spec_helper' 2 3ruby_version_is ''...'2.5' do 4 require 'mathn' 5 6 describe "Float#**" do 7 it "returns self raised to other (positive) power" do 8 (2.0 ** 4).should == 16.0 9 (2.0 ** 1.2).should be_close(2.2973967, TOLERANCE) 10 end 11 12 it "returns a complex number when negative and raised to a fractional power" do 13 ((-8.0) ** (1/3)).should be_close(Complex(1, 1.73205), TOLERANCE) 14 ((-8.0) ** (1.0/3)).should be_close(Complex(1, 1.73205), TOLERANCE) 15 end 16 end 17end 18