Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
trs
Commits
e463573b
Commit
e463573b
authored
Jun 04, 2012
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove match_multiply_zero in favor of match_multiply_numerics.
parent
5a7ecfed
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
23 deletions
+3
-23
src/rules/__init__.py
src/rules/__init__.py
+3
-4
src/rules/numerics.py
src/rules/numerics.py
+0
-19
No files found.
src/rules/__init__.py
View file @
e463573b
...
...
@@ -8,7 +8,7 @@ from .powers import match_add_exponents, match_subtract_exponents, \
match_raised_fraction
,
match_remove_negative_exponent
,
\
match_exponent_to_root
,
match_extend_exponent
,
match_constant_exponent
from
.numerics
import
match_add_numerics
,
match_divide_numerics
,
\
match_multiply_numerics
,
match_
multiply_zero
,
match_
raise_numerics
match_multiply_numerics
,
match_raise_numerics
from
.fractions
import
match_constant_division
,
match_add_fractions
,
\
match_multiply_fractions
,
match_divide_fractions
,
\
match_extract_fraction_terms
,
match_division_in_denominator
...
...
@@ -38,9 +38,8 @@ RULES = {
match_combine_groups
,
match_add_quadrants
,
match_add_logarithms
,
match_sort_polynome
],
OP_MUL
:
[
match_multiply_numerics
,
match_expand
,
match_add_exponents
,
match_multiply_zero
,
match_negated_factor
,
match_multiply_fractions
,
match_factor_in_multiplicant
,
match_sort_monomial
],
match_negated_factor
,
match_multiply_fractions
,
match_factor_in_multiplicant
,
match_sort_monomial
],
OP_DIV
:
[
match_subtract_exponents
,
match_divide_numerics
,
match_constant_division
,
match_divide_fractions
,
match_negated_division
,
match_extract_fraction_terms
,
...
...
src/rules/numerics.py
View file @
e463573b
...
...
@@ -165,25 +165,6 @@ MESSAGES[reduce_fraction_constants] = \
_
(
'Divide the nominator and denominator of fraction {0} by {1}.'
)
def
match_multiply_zero
(
node
):
"""
a * 0 -> 0
0 * a -> 0
-0 * a -> -0
0 * -a -> -0
-0 * -a -> 0
"""
assert
node
.
is_op
(
OP_MUL
)
left
,
right
=
node
if
(
left
.
is_leaf
and
left
.
value
==
0
)
\
or
(
right
.
is_leaf
and
right
.
value
==
0
):
return
[
P
(
node
,
multiply_zero
,
(
left
.
negated
+
right
.
negated
,))]
return
[]
def
match_multiply_numerics
(
node
):
"""
3 * 2 -> 6
...
...
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