Skip to content

Commit

Permalink
fix: naPower/ntPower for exp 0,1,-1
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes14 authored and mohamed-barakat committed Nov 9, 2011
1 parent 08d98ae commit 35e86e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions libpolys/polys/ext_fields/algext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ void naPower(number a, int exp, number *b, const coeffs cf)
if (exp >= 0) *b = NULL;
else WerrorS(nDivBy0);
}
else if (exp == 0) *b = naInit(1, cf);
else if (exp == 1) *b = naCopy(a, cf);
else if (exp == -1) *b = naInvers(a, cf);
else if (exp == 0) { *b = naInit(1, cf); return; }
else if (exp == 1) { *b = naCopy(a, cf); return; }
else if (exp == -1) { *b = naInvers(a, cf); return; }

int expAbs = exp; if (expAbs < 0) expAbs = -expAbs;

Expand Down
6 changes: 3 additions & 3 deletions libpolys/polys/ext_fields/transext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,9 @@ void ntPower(number a, int exp, number *b, const coeffs cf)
if (exp >= 0) *b = NULL;
else WerrorS(nDivBy0);
}
else if (exp == 0) *b = ntInit(1, cf);
else if (exp == 1) *b = ntCopy(a, cf);
else if (exp == -1) *b = ntInvers(a, cf);
else if (exp == 0) { *b = ntInit(1, cf); return;}
else if (exp == 1) { *b = ntCopy(a, cf); return;}
else if (exp == -1) { *b = ntInvers(a, cf); return;}

int expAbs = exp; if (expAbs < 0) expAbs = -expAbs;

Expand Down

0 comments on commit 35e86e4

Please sign in to comment.