@@ -112,6 +112,34 @@ if ($can_complex_power) {
112112is $pa -> at(0), ' 16' , ' sqrt orig value ok' ;
113113}
114114
115+ { # csqrt
116+ my $pi =4*atan2 (1,1);
117+ my $eiO = exp (i()*(sequence(8)-3)*$pi /4);
118+ my $eiO2 = exp (i()*(sequence(8)-3)*$pi /8);
119+ my $sqrt =csqrt($eiO );
120+ is_pdl($sqrt , $eiO2 , " csqrt of complex" );
121+ my $i =csqrt(-1);
122+ is_pdl($i , i(), " csqrt of real -1" );
123+ my $squares =" -9 -4 -1 0 1 4 9" ;
124+ my $roots =" 3i 2i i 0 1 2 3" ;
125+ my $lsqrt =long($squares )-> csqrt;
126+ is_pdl($lsqrt , cdouble($roots ), " csqrt of long" );
127+ my $llsqrt =longlong($squares )-> csqrt;
128+ is_pdl($llsqrt , cdouble($roots ), " csqrt of longlong" );
129+ my $fsqrt =float($squares )-> csqrt;
130+ is_pdl($fsqrt , cfloat($roots ), " csqrt of float" );
131+ my $dsqrt =double($squares )-> csqrt;
132+ is_pdl($dsqrt ,cdouble($roots ), " csqrt of double" );
133+ my $ldsqrt =ldouble($squares )-> csqrt;
134+ is_pdl($ldsqrt , cldouble($roots ), " csqrt of ldouble" );
135+ my $cfsqrt =cfloat($squares )-> csqrt;
136+ is_pdl($cfsqrt , cfloat($roots ), " csqrt of cfloat" );
137+ my $cdsqrt =cdouble($squares )-> csqrt;
138+ is_pdl($cdsqrt ,cdouble($roots ), " csqrt of cdouble" );
139+ my $cldsqrt =cldouble($squares )-> csqrt;
140+ is_pdl($cldsqrt ,cldouble($roots ), " csqrt of cldouble" );
141+ }
142+
115143{ # csqrt_up
116144 my $pi =4*atan2 (1,1);
117145 my $eiO = exp (i()*sequence(8)*$pi /4);
0 commit comments