Skip to content

Commit

Permalink
Remove a small inefficiency in sqrt()
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin D. Howard <[email protected]>
  • Loading branch information
gavinhoward committed Dec 18, 2023
1 parent 52c335a commit 307d6fd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/num.c
Original file line number Diff line number Diff line change
Expand Up @@ -4133,11 +4133,10 @@ bc_num_sqrt(BcNum* restrict a, BcNum* restrict b, size_t scale)

// There is a division by two in the formula. We set up a number that's 1/2
// so that we can use multiplication instead of heavy division.
bc_num_one(&half);
bc_num_setToZero(&half, 1);
half.num[0] = BC_BASE_POW / 2;
half.len = 1;
BC_NUM_RDX_SET_NP(half, 1);
half.scale = 1;

bc_num_init(&f, len);
bc_num_init(&fprime, len);
Expand Down

0 comments on commit 307d6fd

Please sign in to comment.