test/math_test.rb in polynomials-0.1.1 vs test/math_test.rb in polynomials-0.1.2
- old
+ new
@@ -14,13 +14,13 @@
polynomial = Polynomial.parse('3x^2 + 2x - 40')
p = 2.0/3.0
q = -40.0/3.0
root = Math.sqrt((p/2)**2 - q)
fraction = -(p/2)
- assert_equal Set[fraction - root, fraction + root],polynomial.nulls
+ assert_equal Set[(fraction - root).round(10), (fraction + root).round(10)],polynomial.nulls
polynomial = Polynomial.parse('3x^2 - 40')
- assert_equal Set[Math.sqrt(40.0/3), -Math.sqrt(40.0/3)], polynomial.nulls
+ assert_equal Set[Math.sqrt(40.0/3).round(10), -Math.sqrt(40.0/3).round(10)], polynomial.nulls
end
def test_nulls_for_cubic_functions
polynomial = Polynomial.parse('1x^3 + 1x^2 + 2x - 1')
assert_equal(1, polynomial.nulls.size)