Commit
•
9b5dcef
1
Parent(s):
543ecab
Update comprehensive-arithmetic-problems-carries.py
Browse files
comprehensive-arithmetic-problems-carries.py
CHANGED
@@ -210,6 +210,12 @@ class ArithmeticProblemsDataset(GeneratorBasedBuilder):
|
|
210 |
if with_carry:
|
211 |
while True:
|
212 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
# for testing addition
|
214 |
operand2 = self._generate_number(
|
215 |
min_val=max_value - operand1 ,
|
@@ -221,13 +227,24 @@ class ArithmeticProblemsDataset(GeneratorBasedBuilder):
|
|
221 |
continue
|
222 |
break
|
223 |
else:
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
result = operand1 + operand2
|
232 |
elif operator == Operator.MULTIPLY:
|
233 |
result = operand1 * operand2
|
|
|
210 |
if with_carry:
|
211 |
while True:
|
212 |
try:
|
213 |
+
operand1 = self._generate_number(
|
214 |
+
min_val=min_value,
|
215 |
+
max_val=max_value,
|
216 |
+
is_float=is_float1,
|
217 |
+
max_rounding_precision=max_rounding_precision,
|
218 |
+
)
|
219 |
# for testing addition
|
220 |
operand2 = self._generate_number(
|
221 |
min_val=max_value - operand1 ,
|
|
|
227 |
continue
|
228 |
break
|
229 |
else:
|
230 |
+
while True:
|
231 |
+
try:
|
232 |
+
operand1 = self._generate_number(
|
233 |
+
min_val=min_value,
|
234 |
+
max_val=max_value,
|
235 |
+
is_float=is_float1,
|
236 |
+
max_rounding_precision=max_rounding_precision,
|
237 |
+
)
|
238 |
+
# for testing addition
|
239 |
+
operand2 = self._generate_number(
|
240 |
+
min_val=min_value,
|
241 |
+
max_val=max_value - operand1 - 1,
|
242 |
+
is_float=is_float2,
|
243 |
+
max_rounding_precision=max_rounding_precision,
|
244 |
+
)
|
245 |
+
except Exception:
|
246 |
+
continue
|
247 |
+
break
|
248 |
result = operand1 + operand2
|
249 |
elif operator == Operator.MULTIPLY:
|
250 |
result = operand1 * operand2
|