Skip to content

Commit

Permalink
fix(bug): not_equal_to_one() returned invalid results for float < 1
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffyoungs committed Oct 22, 2023
1 parent 39b6d18 commit a0459eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/morandi/image_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def apply_crop!

return if crop.nil? && config_for('image.auto-crop').eql?(false)

crop = crop.split(/,/).map(&:to_i) if crop.is_a?(String) && crop =~ /^\d+,\d+,\d+,\d+/
crop = crop.split(',').map(&:to_i) if crop.is_a?(String) && crop =~ /^\d+,\d+,\d+,\d+/

crop = nil unless crop.is_a?(Array) && crop.size.eql?(4) && crop.all? do |i|
i.is_a?(Numeric)
Expand Down Expand Up @@ -238,7 +238,7 @@ def apply_decorations!
private

def not_equal_to_one(float)
(float - 1.0) >= Float::EPSILON
(float - 1.0).abs >= Float::EPSILON
end
end
# rubocop:enable Metrics/ClassLength
Expand Down

0 comments on commit a0459eb

Please sign in to comment.