Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
2d7ff071
Commit
2d7ff071
authored
Mar 20, 2014
by
Damien George
Browse files
py: Add mpz modulo operation.
parent
c412998c
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/objint_mpz.c
View file @
2d7ff071
...
...
@@ -100,9 +100,14 @@ mp_obj_t int_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
mpz_deinit
(
&
rem
);
break
;
}
//case RT_BINARY_OP_MODULO:
//case RT_BINARY_OP_INPLACE_MODULO:
case
RT_BINARY_OP_MODULO
:
case
RT_BINARY_OP_INPLACE_MODULO
:
{
// TODO check that this operation matches the CPython operation
mpz_t
quo
;
mpz_init_zero
(
&
quo
);
mpz_divmod_inpl
(
&
quo
,
&
res
->
mpz
,
zlhs
,
zrhs
);
mpz_deinit
(
&
quo
);
break
;
}
//case RT_BINARY_OP_AND:
//case RT_BINARY_OP_INPLACE_AND:
...
...
tests/basics/int-big-mod.py
0 → 100644
View file @
2d7ff071
# test % operation on big integers
delta
=
100000000000000000000000000000012345
for
i
in
range
(
11
):
for
j
in
range
(
11
):
x
=
delta
*
(
i
)
# - 5) # TODO reinstate negative number test when % is working with sign correctly
y
=
delta
*
(
j
)
# - 5) # TODO reinstate negative number test when % is working with sign correctly
if
y
!=
0
:
print
(
x
%
y
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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