Sha256: a365d34822a4c650496637cb21b02d320b45db87575e9748e10684fab7b03748
Contents?: true
Size: 515 Bytes
Versions: 6
Compression:
Stored size: 515 Bytes
Contents
# -*- encoding: utf-8 -*- require 'test_helper' require 'hexapdf/utils' describe HexaPDF::Utils do include HexaPDF::Utils it "checks floats for equality with a certain precision" do assert(float_equal(1.0, 1)) assert(float_equal(1.0, 1.0000003)) end it "compares floats like the <=> operator" do assert_equal(0, float_compare(1.0, 1)) assert_equal(0, float_compare(1.0, 1.0000003)) assert_equal(-1, float_compare(1.0, 1.03)) assert_equal(1, float_compare(1.0, 0.9997)) end end
Version data entries
6 entries across 6 versions & 1 rubygems