Skip to content

Commit

Permalink
Fix neg pow bug
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenrbrandt committed Mar 18, 2016
1 parent c14f445 commit e105185
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Auxiliary/Grammars/kranc2.peg
Expand Up @@ -27,7 +27,7 @@ fname = (a?sinh?|a?cosh?|a?tanh?|pow|exp|log|min|max|copysign|abs)
func = {fname} \( ({expr}( , {expr})*|) \)
neg = -
value = {neg}?({rawc}|{rawmath}|{func}|{dtensor}|{tensor}|{number}|{ifexpr}|\( {expr} \))
pow = {value}( \*\* {value}|)
pow = {neg}?{value}( \*\* {value}|)
mulop = [*/%]
mulimp = [ \t]*(?!-)
mul = {pow}( {mulop} {pow}|{mulimp}{pow})*
Expand Down
2 changes: 2 additions & 0 deletions Tools/CodeGen/CodeGenSchedule.m
Expand Up @@ -106,6 +106,8 @@
"TAGS: " <> lookup[spec, Tags] <> "\n",
""],

(* BoundaryWithGhosts *)
(* InteriorBoundaryGhosts -> 7 options *)
translateRegion[r_] := Switch[r,
Everywhere, "Everywhere",
Interior, "Interior",
Expand Down
2 changes: 2 additions & 0 deletions Tools/CodeGen/KrancScript.m
Expand Up @@ -292,6 +292,8 @@
process["mul"[cs___, a_, "mulop"["/"], b_]] := process["mul"[cs,a]] / process[b];
process["mexpr"["expr"[ex1_],"expr"[ex2_]]] := ThrowError[ToString[InputForm[ex1]]<> " :: "<>ToString[InputForm[ex2]]];

process["pow"["neg"[_],a_,b_]] := -process[a]^process[b];
process["pow"["neg"[_],a_]] := -process[a];
process["pow"[a_,b_]] := process[a]^process[b];
process["pow"[a_]] := process[a];

Expand Down

0 comments on commit e105185

Please sign in to comment.