D - Complex bug
- dickl (14/14) Feb 19 2004 When casting using (idouble) to set the imaginary part of a complex doub...
 - Manfred Nowak (6/8) Feb 19 2004 Confirmed but not a bug. Casting a number to idouble or double yields ju...
 - dickl (7/15) Feb 20 2004 Ok, but it makes it a little tedious to build a complex number from
 - Manfred Nowak (7/9) Feb 21 2004 `cdouble var = a + b * 1i;'
 
When casting using (idouble) to set the imaginary part of a complex double,
the imaginary part of a cdouble never gets set.
int main()
{
   double a=5;
   double b=-0.5;
   cdouble plx = a +b*1.0i;
   cdouble ply = a+ (idouble)b;
   printf("re:%f im:%f\n",plx.re,plx.im);
   printf("re:%f im:%f\n",ply.re,ply.im);
    return 1;
}
prints out   re:5.0 im:-0.5
                 re:5.0  im:0.0
 Feb 19 2004
On Thu, 19 Feb 2004 17:12:28 -0500, dickl wrote:When casting using (idouble) to set the imaginary part of a complex double, the imaginary part of a cdouble never gets set.Confirmed but not a bug. Casting a number to idouble or double yields just the imaginary or the real part of that number. How else should that casts be defined? What should the result of `cast(idouble)(2+3i)' be? So long.
 Feb 19 2004
Ok, but it makes it a little tedious to build a complex number from individual variables. It would be nice to have a way to say cdouble var = a + (imaginary)b; "Manfred Nowak" <svv1999 hotmail.com> wrote in message news:c13se2$2pue$1 digitaldaemon.com...On Thu, 19 Feb 2004 17:12:28 -0500, dickl wrote:double,When casting using (idouble) to set the imaginary part of a complexthe imaginary part of a cdouble never gets set.Confirmed but not a bug. Casting a number to idouble or double yields just the imaginary or the real part of that number. How else should that casts be defined? What should the result of `cast(idouble)(2+3i)' be? So long.
 Feb 20 2004
dickl wrote: [...]It would be nice to have a way to say cdouble var = a + (imaginary)b;`cdouble var = a + b * 1i;' is even shorter. Why to introduce something special, that needs more effort? And dont forget the cast! In D the cast keyword is obligate. Only dmd is so kind to forget about that. So long.
 Feb 21 2004








 
 
 
 Manfred Nowak <svv1999 hotmail.com>