small optimization in bexp; from kshe
authorotto <otto@openbsd.org>
Fri, 29 Dec 2017 08:16:55 +0000 (08:16 +0000)
committerotto <otto@openbsd.org>
Fri, 29 Dec 2017 08:16:55 +0000 (08:16 +0000)
usr.bin/dc/bcode.c

index eea7346..e1e9a7b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: bcode.c,v 1.61 2017/12/12 19:07:10 otto Exp $ */
+/*     $OpenBSD: bcode.c,v 1.62 2017/12/29 08:16:55 otto Exp $ */
 
 /*
  * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -1178,11 +1178,11 @@ bexp(void)
                bn_checkp(f);
                split_number(p, i, f);
                if (!BN_is_zero(f))
-                       warnx("Runtime warning: non-zero fractional part in exponent");
-               BN_free(i);
+                       warnx("Runtime warning: non-zero fractional part "
+                           "in exponent");
+               BN_free(p->number);
+               p->number = i;
                BN_free(f);
-
-               normalize(p, 0);
        }
 
        neg = BN_is_negative(p->number);