mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
* [fix] resolve basic_arithmetic fails when size is large by replacing zero divisor with 1
This commit is contained in:
parent
bf451d5197
commit
2d19f13e0f
2 changed files with 19 additions and 0 deletions
|
|
@ -191,6 +191,9 @@ class BasicArithmeticDataset(ProceduralDataset):
|
|||
space_parts.append(" ")
|
||||
space_parts.append(p)
|
||||
expression = "".join(space_parts).strip()
|
||||
# Avoid division-by-zero in final evaluation by converting '/0' patterns to '/1'
|
||||
if "/ 0" in expression:
|
||||
expression = expression.replace("/ 0", "/ 1")
|
||||
result = eval_floordiv(expression) # Note: eval is safe here as we control the input
|
||||
|
||||
return expression, result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue