This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

complex numbers problem: with the first calculation I recieve NaN.With the second, everything is Ok.


Hello.

I'm not sure this is the right place to ask questions. May be this is
gcc related problem. Even this may be my problem. But I hope for some
help here.

The short description of my problem is here:

printf ("Vp = %e, D = %e, %e; KD1 =%e, %e.\n", priv->Vp[0],
  creal(self->D[1]), cimag(self->D[1]), creal((0.5)*KD1[1]),
  cimag((0.5)*KD1[1]));
printf ("%e, %e.\n", creal(priv->Vp[0]*(self->D[1] + 0.5*KD1[1])),
  cimag(priv->Vp[0]*(self->D[1] + 0.5*KD1[1])));

This are two consequent lines of my code. The output is here:
Vp = -9.756559e-02, D = 0.000000e+00, 0.000000e+00; KD1 =0.000000e+00,
0.000000e+00.
-0.000000e+00, nan.

Vp is double. KC1, KD1 are complex double...

Why nan??? :( It seems to me that this is the libc's problem with
complex numbers. If I remove cimag(...) in the second printf I receive
nan in the second line of output in place of -0.000000e+00...

Please, help me. May be you can see here something I can not?

This program is written without threads. libc-3.3.5. gentoo
distribution.

Any way. Thank you for your time,
Peter.

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]