This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author marco_ocram
Recipients marco_ocram
Date 2020-08-20.09:39:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1597916377.13.0.981755252162.issue41598@roundup.psfhosted.org>
In-reply-to
Content
hello, please insert following simple but useful roundings in new lib math.

def rnd(x, n=0):
   a = x*10**n
   b = int(a)
   if abs(a - b) >= 0.5: b += 1 if x >= 0 else -1
   return b/10**n

def rndup(x, n=0):
   a = x*10**n
   b = int(a)
   if abs(a - b) > 0: b += 1 if x >= 0 else -1
   return b/10**n

thanks a lot, marco.
History
Date User Action Args
2020-08-20 09:39:37marco_ocramsetrecipients: + marco_ocram
2020-08-20 09:39:37marco_ocramsetmessageid: <1597916377.13.0.981755252162.issue41598@roundup.psfhosted.org>
2020-08-20 09:39:37marco_ocramlinkissue41598 messages
2020-08-20 09:39:37marco_ocramcreate