Mercurial > hg > octave-lojdl
changeset 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 | f3dbea0e8a1d |
children | ac7f334d9652 |
files | liboctave/ChangeLog liboctave/lo-specfun.cc |
diffstat | 2 files changed, 25 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2008-10-29 Michael Goffioul <michael.goffioul@gmail.com> + + * lo-specfun.cc (cbesj, cbesy, cbesi, cbesk, cbesh1, cbesh2): Do not + use std::complex::real() and std::complex::imag() as l-value, this is + not supported under MSVC. + 2008-10-28 John W. Eaton <jwe@octave.org> * lo-specfun.cc: Fix prototypes for the Fortran subroutines cbesh,
--- 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);