File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,6 @@ bc_sqrt (bc_num *num, int scale)
70
70
71
71
/* Initialize the variables. */
72
72
rscale = MAX (scale , (* num )-> n_scale );
73
- bc_init_num (& guess );
74
73
bc_init_num (& guess1 );
75
74
bc_init_num (& diff );
76
75
point5 = bc_new_num (1 ,1 );
@@ -87,6 +86,7 @@ bc_sqrt (bc_num *num, int scale)
87
86
else
88
87
{
89
88
/* The number is greater than 1. Guess should start at 10^(exp/2). */
89
+ bc_init_num (& guess );
90
90
bc_int2num (& guess ,10 );
91
91
92
92
bc_int2num (& guess1 ,(* num )-> n_len );
Original file line number Diff line number Diff line change @@ -9,8 +9,10 @@ bcmath.scale=0
9
9
echo bcsqrt ("9 " ),"\n" ;
10
10
echo bcsqrt ("9.444 " , 2 ),"\n" ;
11
11
echo bcsqrt ("1928372132132819737213 " , 5 ),"\n" ;
12
+ echo bcsqrt ("0.5 " , 5 ), "\n" ;
12
13
?>
13
14
--EXPECT--
14
15
3
15
16
3.07
16
17
43913234134.28826
18
+ 0.70710
You can’t perform that action at this time.
0 commit comments