Commits

ZyX_I committed 8d8772d

Added abs() to first meaningful digit determination expression

  • Participants
  • Parent commits b0fa67d

Comments (0)

Files changed (1)

     def __str__(self):
         num=self.num
         acc=self.acc
-        numfmd=int(floor(log10(num)))
-        accfmd=int(floor(log10(acc)))
+        numfmd=int(floor(log10(abs(num))))
+        accfmd=int(floor(log10(abs(acc))))
         fmdiff=numfmd-accfmd
         suf=""
         if (1.0<=(self.acc/(10**accfmd))<2.0):
             accfmd-=1
         if fmdiff<0:
             f="{!r}"
-        elif accfmd>3 or accfmd<5:
+        elif accfmd>3 or accfmd<-5:
             num/=10**numfmd
             acc/=10**numfmd
             f="{:."+str(fmdiff)+"f}"