Integer functions
Adds support (freezing, typing, printing) for the following integer functions from sympyextensions.integer_functions
:
- bit_shift_left
- bit_shift_right
- bitwise_and
- bitwise_or
- bitwise_xor
- int_div
- int_power_of_2
- modulo_floor
The following are left for future work because they can be conveniently implemented with an if
expression (the ternary if operator ?:
in C) which is currently not available.
- modulo_ceil
- div_ceil
div_floor
is also not implemented because to me the semantics of this function are unclear.
Is it supposed to compute
The typifier tries to infer the integer type of the arguments/result and always raises if the type is non-integer.
Note that this can lead to cases in which an exception is raised because the inference fails.
For example int_div(2, 3)
where both arguments are untyped constants.
This could be improved in the typifier, e.g. by adding type constraints to deferred constants (also left for future work).
Merge request reports
Activity
added ongoing label
assigned to @he66coqe
added 1 commit
- a3ab67b0 - add integer functions div_floor, int_power_of_2, modulo_floor
removed ongoing label
requested review from @da15siwa
- Resolved by Frederik Hennig
enabled an automatic merge when the pipeline for ebc36d2d succeeds
mentioned in commit 075ae357
mentioned in issue #88 (closed)