<commit_before>require File.expand_path('../../../spec_helper', __FILE__)

describe "Float#/" do
  it "returns self divided by other" do
    (5.75 / -2).should be_close(-2.875,TOLERANCE)
    (451.0 / 9.3).should be_close(48.494623655914,TOLERANCE)
    (91.1 / -0xffffffff).should be_close(-2.12108716418061e-08, TOLERANCE)
  end
  
  it "properly handles BigDecimal argument" do
    require 'bigdecimal'
    (2.0 / BigDecimal.new('5.0')).should be_close(0.4, TOLERANCE)<commit_msg>Added spec to test Float#/ properly coercing other object<commit_after>require File.expand_path('../../../spec_helper', __FILE__)

module Specs
  module Float
    class CanCoerce
      def initialize(a)
        @a = a
      end

      def coerce(b)
        [self.class.new(b), @a]
      end

      def /(b)
        @a.to_i % b.to_i
      end
    end
  end
end

describe "Float#/" do
  it "returns self divided by other" do
    (5.75 / -2).should be_close(-2.875,TOLERANCE)
    (451.0 / 9.3).should be_close(48.494623655914,TOLERANCE)
    (91.1 / -0xffffffff).should be_close(-2.12108716418061e-08, TOLERANCE)
  end
  
  it "properly coerces objects" do
    (5.0 / Specs::Float::CanCoerce.new(5)).should be_close(0, TOLERANCE)
  end
  
  it "properly handles BigDecimal argument" do
    require 'bigdecimal'
    (2.0 / BigDecimal.new('5.0')).should be_close(0.4, TOLERANCE)
{'fraction_non_alphanumeric': 0.1419068736141907, 'fraction_numerical': 0.08425720620842572, 'mean_word_length': 2.8685714285714288, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5416489', 'n_tokens_mistral': 580, 'n_tokens_neox': 519, 'n_words': 113}