diff options
-rw-r--r-- | ext/bcmath/libbcmath/src/sqrt.c | 2 | ||||
-rw-r--r-- | ext/bcmath/tests/bcsqrt.phpt | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/ext/bcmath/libbcmath/src/sqrt.c b/ext/bcmath/libbcmath/src/sqrt.c index 6358ff7bcd..96cff29475 100644 --- a/ext/bcmath/libbcmath/src/sqrt.c +++ b/ext/bcmath/libbcmath/src/sqrt.c @@ -70,7 +70,6 @@ bc_sqrt (bc_num *num, int scale) /* Initialize the variables. */ rscale = MAX (scale, (*num)->n_scale); - bc_init_num(&guess); bc_init_num(&guess1); bc_init_num(&diff); point5 = bc_new_num (1,1); @@ -87,6 +86,7 @@ bc_sqrt (bc_num *num, int scale) else { /* The number is greater than 1. Guess should start at 10^(exp/2). */ + bc_init_num(&guess); bc_int2num (&guess,10); bc_int2num (&guess1,(*num)->n_len); diff --git a/ext/bcmath/tests/bcsqrt.phpt b/ext/bcmath/tests/bcsqrt.phpt index 9f4a8ec6a5..b2a8d8adbc 100644 --- a/ext/bcmath/tests/bcsqrt.phpt +++ b/ext/bcmath/tests/bcsqrt.phpt @@ -9,8 +9,10 @@ bcmath.scale=0 echo bcsqrt("9"),"\n"; echo bcsqrt("9.444", 2),"\n"; echo bcsqrt("1928372132132819737213", 5),"\n"; +echo bcsqrt("0.5", 5), "\n"; ?> --EXPECT-- 3 3.07 43913234134.28826 +0.70710 |