Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions eval/compaction/grader.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "bigdecimal"

module CompactionEval
# Deterministic grading: a probe passes when the reply carries the expected
# value after normalization, a yes/no probe when its first word is the
Expand Down Expand Up @@ -47,7 +45,7 @@ def carries?(body, candidate)
def same?(actual, expected)
left = normalize(actual)
right = normalize(expected)
return BigDecimal(left) == BigDecimal(right) if [left, right].all? { |v| v.match?(NUMBER) }
return left.to_r == right.to_r if [left, right].all? { |v| v.match?(NUMBER) }

left == right || carries?(left, right)
end
Expand Down
Loading