<commit_before>require_relative '../../spec_helper'
require_relative 'fixtures/classes'

describe "Math.log2" do
  it "returns a float" do
    Math.log2(5.79).should be_close(2.53356334821451, TOLERANCE)
  end

  it "returns the natural logarithm of the argument" do
    Math.log2(1.1).should be_close(0.137503523749935, TOLERANCE)
    Math.log2(3.14).should be_close(1.6507645591169, TOLERANCE)
    Math.log2((2**101+45677544234809571)).should be_close(101.00000000000003, TOLERANCE)

    Math.log2((2**10001+45677544234809571)).should == 10001.0
    Math.log2((2**301+45677544234809571)).should == 301.0
  end

  it "raises an Errno::EDOM if the argument is less than 0" do
    -> { Math.log2(-1e-15) }.should raise_error( Math::DomainError)<commit_msg>Fix incorrect description in log2_spec.rb<commit_after>require_relative '../../spec_helper'
require_relative 'fixtures/classes'

describe "Math.log2" do
  it "returns a float" do
    Math.log2(5.79).should be_close(2.53356334821451, TOLERANCE)
  end

  it "returns the natural logarithm of the argument" do
    Math.log2(1.1).should be_close(0.137503523749935, TOLERANCE)
    Math.log2(3.14).should be_close(1.6507645591169, TOLERANCE)
    Math.log2((2**101+45677544234809571)).should be_close(101.00000000000003, TOLERANCE)

    Math.log2((2**10001+45677544234809571)).should == 10001.0
    Math.log2((2**301+45677544234809571)).should == 301.0
  end

  it "raises Math::DomainError if the argument is less than 0" do
    -> { Math.log2(-1e-15) }.should raise_error( Math::DomainError)
{'fraction_non_alphanumeric': 0.13432835820895522, 'fraction_numerical': 0.2044127190136275, 'mean_word_length': 4.648351648351649, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4515994', 'n_tokens_mistral': 762, 'n_tokens_neox': 588, 'n_words': 112}