Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stéphane Adjemian
dynare
Commits
82bd6bcd
Commit
82bd6bcd
authored
Mar 25, 2015
by
Stéphane Adjemian
Browse files
Options
Downloads
Patches
Plain Diff
Fixed c++ warnings.
parent
a97973d0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
dynare++/parser/cc/tree.cpp
+12
-6
12 additions, 6 deletions
dynare++/parser/cc/tree.cpp
with
12 additions
and
6 deletions
dynare++/parser/cc/tree.cpp
+
12
−
6
View file @
82bd6bcd
// Copyright (C) 2005-2011, Ondra Kamenik
// Copyright (C) 2005-2011, Ondra Kamenik
#include
"utils/cc/exception.h"
#include
"utils/cc/exception.h"
#include
"tree.h"
#include
"tree.h"
...
@@ -55,7 +56,7 @@ int OperationTree::add_unary(code_t code, int op)
...
@@ -55,7 +56,7 @@ int OperationTree::add_unary(code_t code, int op)
code
==
SQRT
||
code
==
SQRT
||
code
==
ERF
))
code
==
ERF
))
return
zero
;
return
zero
;
if
(
op
==
zero
&&
code
==
LOG
||
op
==
nan
)
if
(
(
op
==
zero
&&
code
==
LOG
)
||
op
==
nan
)
return
nan
;
return
nan
;
if
(
op
==
zero
&&
(
code
==
EXP
||
if
(
op
==
zero
&&
(
code
==
EXP
||
code
==
COS
||
code
==
COS
||
...
@@ -86,39 +87,43 @@ int OperationTree::add_binary(code_t code, int op1, int op2)
...
@@ -86,39 +87,43 @@ int OperationTree::add_binary(code_t code, int op1, int op2)
if
(
op1
==
nan
||
op2
==
nan
)
if
(
op1
==
nan
||
op2
==
nan
)
return
nan
;
return
nan
;
// for plus
// for plus
if
(
code
==
PLUS
)
if
(
code
==
PLUS
)
{
if
(
op1
==
zero
&&
op2
==
zero
)
if
(
op1
==
zero
&&
op2
==
zero
)
return
zero
;
return
zero
;
else
if
(
op1
==
zero
)
else
if
(
op1
==
zero
)
return
op2
;
return
op2
;
else
if
(
op2
==
zero
)
else
if
(
op2
==
zero
)
return
op1
;
return
op1
;
}
// for minus
// for minus
if
(
code
==
MINUS
)
if
(
code
==
MINUS
)
{
if
(
op1
==
zero
&&
op2
==
zero
)
if
(
op1
==
zero
&&
op2
==
zero
)
return
zero
;
return
zero
;
else
if
(
op1
==
zero
)
else
if
(
op1
==
zero
)
return
add_unary
(
UMINUS
,
op2
);
return
add_unary
(
UMINUS
,
op2
);
else
if
(
op2
==
zero
)
else
if
(
op2
==
zero
)
return
op1
;
return
op1
;
}
// for times
// for times
if
(
code
==
TIMES
)
if
(
code
==
TIMES
)
{
if
(
op1
==
zero
||
op2
==
zero
)
if
(
op1
==
zero
||
op2
==
zero
)
return
zero
;
return
zero
;
else
if
(
op1
==
one
)
else
if
(
op1
==
one
)
return
op2
;
return
op2
;
else
if
(
op2
==
one
)
else
if
(
op2
==
one
)
return
op1
;
return
op1
;
}
// for divide
// for divide
if
(
code
==
DIVIDE
)
if
(
code
==
DIVIDE
)
{
if
(
op1
==
op2
)
if
(
op1
==
op2
)
return
one
;
return
one
;
else
if
(
op1
==
zero
)
else
if
(
op1
==
zero
)
return
zero
;
return
zero
;
else
if
(
op2
==
zero
)
else
if
(
op2
==
zero
)
return
nan
;
return
nan
;
}
// for power
// for power
if
(
code
==
POWER
)
if
(
code
==
POWER
)
{
if
(
op1
==
zero
&&
op2
==
zero
)
if
(
op1
==
zero
&&
op2
==
zero
)
return
nan
;
return
nan
;
else
if
(
op1
==
zero
)
else
if
(
op1
==
zero
)
...
@@ -129,6 +134,7 @@ int OperationTree::add_binary(code_t code, int op1, int op2)
...
@@ -129,6 +134,7 @@ int OperationTree::add_binary(code_t code, int op1, int op2)
return
one
;
return
one
;
else
if
(
op2
==
one
)
else
if
(
op2
==
one
)
return
op1
;
return
op1
;
}
// order operands of commutative operations
// order operands of commutative operations
if
(
code
==
TIMES
||
code
==
PLUS
)
if
(
code
==
TIMES
||
code
==
PLUS
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment