Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
4b8ec525
Commit
4b8ec525
authored
Feb 03, 2017
by
Damien George
Browse files
py/objfloat: Raise ZeroDivisionError for 0 to negative power.
parent
05c70fdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/objfloat.c
View file @
4b8ec525
...
...
@@ -228,7 +228,12 @@ mp_obj_t mp_obj_float_binary_op(mp_uint_t op, mp_float_t lhs_val, mp_obj_t rhs_i
}
break
;
case
MP_BINARY_OP_POWER
:
case
MP_BINARY_OP_INPLACE_POWER
:
lhs_val
=
MICROPY_FLOAT_C_FUN
(
pow
)(
lhs_val
,
rhs_val
);
break
;
case
MP_BINARY_OP_INPLACE_POWER
:
if
(
lhs_val
==
0
&&
rhs_val
<
0
)
{
goto
zero_division_error
;
}
lhs_val
=
MICROPY_FLOAT_C_FUN
(
pow
)(
lhs_val
,
rhs_val
);
break
;
case
MP_BINARY_OP_DIVMOD
:
{
if
(
rhs_val
==
0
)
{
goto
zero_division_error
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment