Ticket #2700: 0001-Fix-significant-digit-issues-with-calculate.patch

File 0001-Fix-significant-digit-issues-with-calculate.patch, 821 bytes (added by lionaneesh, 8 years ago)
  • mathlib.py

    From d49799dde1a430ae3aaa3e8e2c1fee5461da313f Mon Sep 17 00:00:00 2001
    From: Aneesh Dogra <lionaneesh@gmail.com>
    Date: Thu, 6 Dec 2012 14:29:45 +0530
    Subject: [PATCH] Fix significant digit issues with calculate.
    
    Fix #2700
    ---
     mathlib.py | 4 ++++
     1 file changed, 4 insertions(+)
    
    diff --git a/mathlib.py b/mathlib.py
    index 746df48..950b5f6 100644
    a b class MathLib: 
    157157        if len(digits) > self.digit_limit:
    158158            exp += len(digits) - self.digit_limit
    159159            digits = digits[:self.digit_limit]
     160        if len(digits) < self.digit_limit:
     161            exp -= self.digit_limit - len(digits)
     162            digits += (0,) * (self.digit_limit - len(digits))
     163            print exp, digits
    160164        if sign:
    161165            res = "-"
    162166        else: