Skip to content

Commit

Permalink
Tweak the length(0) change
Browse files Browse the repository at this point in the history
After carefully reading the standard (which just says "significant
digits") and the definition of significant digits, I believe that 0 with
no digits after the decimal point would have 0 significant digits.
  • Loading branch information
Gavin Howard committed Feb 26, 2021
1 parent 78ecfcf commit 986ff37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/num.c
Original file line number Diff line number Diff line change
Expand Up @@ -2138,7 +2138,7 @@ size_t bc_num_len(const BcNum *restrict n) {

size_t len = n->len;

if (BC_NUM_ZERO(n)) return n->scale ? n->scale : 1;
if (BC_NUM_ZERO(n)) return n->scale;

if (BC_NUM_RDX_VAL(n) == len) {

Expand Down
2 changes: 1 addition & 1 deletion tests/bc/length_results.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1
0
4
8
11
Expand Down

0 comments on commit 986ff37

Please sign in to comment.