Sha256: 29c11a796aaaa9281ea612e280b187345edc9298f83a98eccb556f31c570f3a1

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

require File.expand_path('../shared/mult', __FILE__)
require 'bigdecimal'

describe "BigDecimal#*" do
  it_behaves_like :bigdecimal_mult, :*, []
end

describe "BigDecimal#*" do
  before(:each) do
    @e3_minus = BigDecimal("3E-20001")
    @e3_plus = BigDecimal("3E20001")
    @e = BigDecimal("1.00000000000000000000123456789")
    @one = BigDecimal("1")
  end

  it "multiply self with other" do
    (@one * @one).should == @one
    (@e3_minus * @e3_plus).should == BigDecimal("9")
    # Can't do this till we implement **
    # (@e3_minus * @e3_minus).should == @e3_minus ** 2
    # So let's rewrite it as:
    (@e3_minus * @e3_minus).should == BigDecimal("9E-40002")
    (@e * @one).should == @e
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubysl-bigdecimal-1.0.0 spec/multiply_spec.rb
rubysl-bigdecimal-2.0.2 spec/multiply_spec.rb