Skip to content

Commit

Permalink
lib: remove pointless computation from PValuation
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Jan 21, 2017
1 parent 3096e36 commit 0589f10
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/numtheor.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ end );


InstallGlobalFunction(PValuation,function(n,p)
local a,v;
local v;
if not IsPrimeInt(p) or not IsRat(n) then
Error("wrong parameters");
fi;
Expand All @@ -1401,10 +1401,8 @@ local a,v;
return PValuation(NumeratorRat(n),p)-PValuation(DenominatorRat(n),p);
elif n<0 then n:=-n;
fi;
a:=1;
v:=0;
while n mod p=0 do
a:=a*p;
v:=v+1;
n:=n/p;
od;
Expand Down

0 comments on commit 0589f10

Please sign in to comment.