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
d32f994f
Commit
d32f994f
authored
Nov 18, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parentheses for logarithms are now added using OP_PARENS instead of the old hacky way
parent
b30cbe67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
src/node.py
src/node.py
+6
-8
No files found.
src/node.py
View file @
d32f994f
...
@@ -342,17 +342,17 @@ class ExpressionNode(Node, ExpressionBase):
...
@@ -342,17 +342,17 @@ class ExpressionNode(Node, ExpressionBase):
base
=
self
[
1
].
value
base
=
self
[
1
].
value
if
base
==
DEFAULT_LOGARITHM_BASE
:
if
base
==
DEFAULT_LOGARITHM_BASE
:
return
self
.
value
+
'('
return
self
.
value
if
base
==
E
:
if
base
==
E
:
return
'ln
(
'
return
'ln'
base
=
str
(
self
[
1
])
base
=
str
(
self
[
1
])
if
not
re
.
match
(
'^[0-9]+|[a-zA-Z]$'
,
base
):
if
not
re
.
match
(
'^[0-9]+|[a-zA-Z]$'
,
base
):
base
=
'('
+
base
+
')'
base
=
'('
+
base
+
')'
return
'%s_%s
(
'
%
(
self
.
value
,
base
)
return
'%s_%s'
%
(
self
.
value
,
base
)
if
self
.
op
==
OP_DXDER
:
if
self
.
op
==
OP_DXDER
:
return
self
.
value
+
str
(
self
[
1
])
return
self
.
value
+
str
(
self
[
1
])
...
@@ -374,14 +374,12 @@ class ExpressionNode(Node, ExpressionBase):
...
@@ -374,14 +374,12 @@ class ExpressionNode(Node, ExpressionBase):
return
bounds_str
(
ExpressionNode
(
OP_BRACKETS
,
Fx
),
a
,
b
)
return
bounds_str
(
ExpressionNode
(
OP_BRACKETS
,
Fx
),
a
,
b
)
def
preprocess_str_exp
(
self
):
def
preprocess_str_exp
(
self
):
if
self
.
op
==
OP_PRIME
and
not
self
[
0
].
is_op
(
OP_PRIME
):
if
self
.
op
==
OP_LOG
:
self
[
0
]
=
ExpressionNode
(
OP_PARENS
,
self
[
0
])
elif
self
.
op
==
OP_PRIME
and
not
self
[
0
].
is_op
(
OP_PRIME
):
self
[
0
]
=
ExpressionNode
(
OP_BRACKETS
,
self
[
0
])
self
[
0
]
=
ExpressionNode
(
OP_BRACKETS
,
self
[
0
])
def
postprocess_str
(
self
,
s
):
def
postprocess_str
(
self
,
s
):
# A bit hacky, but forced because of operator() method
if
self
.
op
==
OP_LOG
:
return
s
.
replace
(
'( '
,
'('
)
+
')'
if
self
.
op
==
OP_INT
:
if
self
.
op
==
OP_INT
:
return
'%s d%s'
%
(
s
,
self
[
1
])
return
'%s d%s'
%
(
s
,
self
[
1
])
...
...
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