From 3921e6f856e39e17e678a0b5fa4a180ffcf1209c Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 17 Apr 2011 11:36:39 -0700 Subject: [PATCH] Fix floating point comparision issue. Closes GH-341. --- lib/compass/sass_extensions/functions/gradient_support.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compass/sass_extensions/functions/gradient_support.rb b/lib/compass/sass_extensions/functions/gradient_support.rb index 0e901462..c21f6b52 100644 --- a/lib/compass/sass_extensions/functions/gradient_support.rb +++ b/lib/compass/sass_extensions/functions/gradient_support.rb @@ -290,7 +290,7 @@ module Compass::SassExtensions::Functions::GradientSupport stop = pos.stop stop = stop.div(max).times(Sass::Script::Number.new(100,["%"])) if stop.numerator_units == max.numerator_units && max.numerator_units != ["%"] # Make sure the color stops are specified in the right order. - if last_value && stop.numerator_units == last_value.numerator_units && stop.denominator_units == last_value.denominator_units && BigDecimal.new(stop.value.to_s) < BigDecimal.new(last_value.value.to_s) + if last_value && stop.numerator_units == last_value.numerator_units && stop.denominator_units == last_value.denominator_units && (stop.value * 1000).round < (last_value.value * 1000).round raise Sass::SyntaxError.new("Color stops must be specified in increasing order. #{stop.value} came after #{last_value.value}.") end last_value = stop