summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2017-12-02 12:43:19 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2017-12-02 12:43:19 +0000
commit0e87273c0ab6e99a24f834fc5c1e5b88f16bbc90 (patch)
treea49438b60e491f299740f781b9de40225957c2e8
parent9bf80a2af191af4c6b995957e92e35b6e0d7087a (diff)
make 0Z do what the original dc and gnu bcc do; ok tom@
-rw-r--r--usr.bin/dc/bcode.c4
-rw-r--r--usr.bin/dc/dc.13
2 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/dc/bcode.c b/usr.bin/dc/bcode.c
index adc132841de..3c13de8f38e 100644
--- a/usr.bin/dc/bcode.c
+++ b/usr.bin/dc/bcode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcode.c,v 1.57 2017/12/01 19:04:15 otto Exp $ */
+/* $OpenBSD: bcode.c,v 1.58 2017/12/02 12:43:18 otto Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -705,7 +705,7 @@ count_digits(const struct number *n)
int bits;
if (BN_is_zero(n->number))
- return n->scale ? n->scale : 1;
+ return n->scale;
int_part = BN_new();
bn_checkp(int_part);
diff --git a/usr.bin/dc/dc.1 b/usr.bin/dc/dc.1
index efcd2ce0e51..c5e1ab8f7e4 100644
--- a/usr.bin/dc/dc.1
+++ b/usr.bin/dc/dc.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: dc.1,v 1.32 2017/12/02 07:35:46 otto Exp $
+.\" $OpenBSD: dc.1,v 1.33 2017/12/02 12:43:18 otto Exp $
.\"
.\" Copyright (C) Caldera International Inc. 2001-2002.
.\" All rights reserved.
@@ -313,6 +313,7 @@ Replaces the number on the top of the stack with its length.
The length of a string is its number of characters.
The length of a number is its number of digits, not counting the minus sign
and decimal point.
+The length of a zero value is its scale.
.It Ic z
The stack level is pushed onto the stack.
.It Cm \&[ Ns ... Ns Cm \&]