]> granicus.if.org Git - python/commitdiff
Subtle change to hex/oct formatting so the largest negative number
authorGuido van Rossum <guido@python.org>
Fri, 10 Jan 1997 17:39:30 +0000 (17:39 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 10 Jan 1997 17:39:30 +0000 (17:39 +0000)
does not receive a minus sign.

Objects/intobject.c

index 3598c90e8ebd83fe681673f76986a9bbb20d3f60..c4ade847fdceb4ef4adcf5d59d1f237d910790e7 100644 (file)
@@ -725,7 +725,7 @@ int_oct(v)
        long x = v -> ob_ival;
        if (x == 0)
                strcpy(buf, "0");
-       else if (x > 0)
+       else if (-x < 0)
                sprintf(buf, "0%lo", x);
        else
                sprintf(buf, "-0%lo", -x);
@@ -738,7 +738,7 @@ int_hex(v)
 {
        char buf[20];
        long x = v -> ob_ival;
-       if (x >= 0)
+       if (-x <= 0)
                sprintf(buf, "0x%lx", x);
        else
                sprintf(buf, "-0x%lx", -x);