From e8c3b2506d9ded8283c3aba286fc8a494f16d754 Mon Sep 17 00:00:00 2001 From: Muhammad Ahmed Cheema Date: Sun, 6 Sep 2026 14:54:36 -0700 Subject: [PATCH] Compare numbers without bigdecimal in the eval grader --- eval/compaction/grader.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/eval/compaction/grader.rb b/eval/compaction/grader.rb index 6eba96a..abc0d85 100644 --- a/eval/compaction/grader.rb +++ b/eval/compaction/grader.rb @@ -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 @@ -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