Skip to content

Commit

Permalink
Merge pull request #10 from nrc-cnrc/hotfix
Browse files Browse the repository at this point in the history
Fix integer to a power bug
  • Loading branch information
hvparks authored May 7, 2020
2 parents 34339db + 1b3cdf6 commit 2230edc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
Binary file removed dist/metrolopy-0.5.4.tar.gz
Binary file not shown.
Binary file not shown.
Binary file added dist/metrolopy-0.5.5.tar.gz
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions dist/x
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

24 changes: 16 additions & 8 deletions metrolopy/ummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,10 +958,14 @@ def _pow(self,b):
x = self._x**b._x
dua = b._x*self._x**(b._x-1)*self._u
lgx = log(self._x)
try:
lgx = type(self._x)(lgx)
except:
pass

# don't exactly remember why I did this,
# but it causes problems if x is int.
#try:
#lgx = type(self._x)(lgx)
#except:
#pass

dub = lgx*self._x**b._x*b._u
u = _combu(dua,dub,c)

Expand Down Expand Up @@ -1002,10 +1006,14 @@ def _rpow(self,b):
raise ValueError('a negative number cannot raised to a power which has an uncertainty')

lgb = log(b)
try:
lgb = type(b)(lgb)
except:
pass

# don't exactly remember why I did this,
# but it causes problems if x is int.
#try:
#lgb = type(b)(lgb)
#except:
#pass

u = abs(b**self._x*lgb*self._u)
refs = -self._refs if b < 0 else self._refs
return type(self)(x,u,dof=self._ref,utype=refs)
Expand Down

0 comments on commit 2230edc

Please sign in to comment.