garrethlee HF staff commited on
Commit
543ecab
1 Parent(s): 86a30d8

Update comprehensive-arithmetic-problems-carries.py

Browse files
comprehensive-arithmetic-problems-carries.py CHANGED
@@ -208,13 +208,18 @@ class ArithmeticProblemsDataset(GeneratorBasedBuilder):
208
  result = operand1 - operand2
209
  elif operator == Operator.ADD:
210
  if with_carry:
211
- # for testing addition
212
- operand2 = self._generate_number(
213
- min_val=max_value - operand1 ,
214
- max_val=max_value,
215
- is_float=is_float2,
216
- max_rounding_precision=max_rounding_precision,
217
- )
 
 
 
 
 
218
  else:
219
  # for testing addition
220
  operand2 = self._generate_number(
 
208
  result = operand1 - operand2
209
  elif operator == Operator.ADD:
210
  if with_carry:
211
+ while True:
212
+ try:
213
+ # for testing addition
214
+ operand2 = self._generate_number(
215
+ min_val=max_value - operand1 ,
216
+ max_val=max_value,
217
+ is_float=is_float2,
218
+ max_rounding_precision=max_rounding_precision,
219
+ )
220
+ except Exception:
221
+ continue
222
+ break
223
  else:
224
  # for testing addition
225
  operand2 = self._generate_number(