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
5a1c1bc2
Commit
5a1c1bc2
authored
Apr 19, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Slightly tweaked a fraction rule.
parent
104b353c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/rules/fractions.py
src/rules/fractions.py
+3
-3
No files found.
src/rules/fractions.py
View file @
5a1c1bc2
...
@@ -179,8 +179,8 @@ MESSAGES[constant_to_fraction] = \
...
@@ -179,8 +179,8 @@ MESSAGES[constant_to_fraction] = \
def
match_multiply_fractions
(
node
):
def
match_multiply_fractions
(
node
):
"""
"""
a / b *
(c / d) -> ac
/ (bd)
a / b *
c / d -> (ac)
/ (bd)
a / b * c and (
c in Z or eval(a / b) not in Z) -> ac
/ b
a / b * c and (
eval(c) in Z or eval(a / b) not in Z) -> (ac)
/ b
"""
"""
assert
node
.
is_op
(
OP_MUL
)
assert
node
.
is_op
(
OP_MUL
)
...
@@ -192,7 +192,7 @@ def match_multiply_fractions(node):
...
@@ -192,7 +192,7 @@ def match_multiply_fractions(node):
p
.
append
(
P
(
node
,
multiply_fractions
,
(
scope
,
ab
,
cd
)))
p
.
append
(
P
(
node
,
multiply_fractions
,
(
scope
,
ab
,
cd
)))
for
ab
,
c
in
product
(
fractions
,
others
):
for
ab
,
c
in
product
(
fractions
,
others
):
if
c
.
is_numeric
(
)
or
not
evals_to_numeric
(
ab
):
if
evals_to_numeric
(
c
)
or
not
evals_to_numeric
(
ab
):
p
.
append
(
P
(
node
,
multiply_with_fraction
,
(
scope
,
ab
,
c
)))
p
.
append
(
P
(
node
,
multiply_with_fraction
,
(
scope
,
ab
,
c
)))
return
p
return
p
...
...
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