Mercurial > hg > octave-nkf
diff liboctave/lo-specfun.cc @ 8288:2368aa769ab9
Work around missing std::complex members under MSVC
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Wed, 29 Oct 2008 21:56:29 -0400 |
parents | b3734f1cb592 |
children | eb63fbe60fab |
line wrap: on
line diff
--- a/liboctave/lo-specfun.cc +++ b/liboctave/lo-specfun.cc @@ -1299,13 +1299,12 @@ if (kode != 2) { - float expz = exp (std::abs (imag (z))); - y.real () *= expz; - y.imag () *= expz; + float expz = exp (std::abs (imag (z))); + y *= expz; } if (imag (z) == 0.0 && real (z) >= 0.0) - y.imag () = 0.0; + y = FloatComplex (y.real (), 0.0); retval = bessel_return_value (y, ierr); } @@ -1363,12 +1362,11 @@ if (kode != 2) { float expz = exp (std::abs (imag (z))); - y.real () *= expz; - y.imag () *= expz; + y *= expz; } if (imag (z) == 0.0 && real (z) >= 0.0) - y.imag () = 0.0; + y = FloatComplex (y.real (), 0.0); } return bessel_return_value (y, ierr); @@ -1421,7 +1419,7 @@ } if (imag (z) == 0.0 && real (z) >= 0.0) - y.imag () = 0.0; + y = FloatComplex (y.real (), 0.0); retval = bessel_return_value (y, ierr); } @@ -1481,14 +1479,14 @@ float rexpz = real (expz); float iexpz = imag (expz); - float tmp = real (y) * rexpz - imag (y) * iexpz; - - y.imag () = real (y) * iexpz + imag (y) * rexpz; - y.real () = tmp; + float tmp_r = real (y) * rexpz - imag (y) * iexpz; + float tmp_i = real (y) * iexpz + imag (y) * rexpz; + + y = FloatComplex (tmp_r, tmp_i); } if (imag (z) == 0.0 && real (z) >= 0.0) - y.imag () = 0.0; + y = FloatComplex (y.real (), 0.0); } retval = bessel_return_value (y, ierr); @@ -1523,10 +1521,10 @@ float rexpz = real (expz); float iexpz = imag (expz); - float tmp = real (y) * rexpz - imag (y) * iexpz; - - y.imag () = real (y) * iexpz + imag (y) * rexpz; - y.real () = tmp; + float tmp_r = real (y) * rexpz - imag (y) * iexpz; + float tmp_i = real (y) * iexpz + imag (y) * rexpz; + + y = FloatComplex (tmp_r, tmp_i); } retval = bessel_return_value (y, ierr); @@ -1565,10 +1563,10 @@ float rexpz = real (expz); float iexpz = imag (expz); - float tmp = real (y) * rexpz - imag (y) * iexpz; - - y.imag () = real (y) * iexpz + imag (y) * rexpz; - y.real () = tmp; + float tmp_r = real (y) * rexpz - imag (y) * iexpz; + float tmp_i = real (y) * iexpz + imag (y) * rexpz; + + y = FloatComplex (tmp_r, tmp_i); } retval = bessel_return_value (y, ierr);