www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - opDiv & ifloat

reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

# 
# idouble f = 4.0i / 2.0i;
#
dmd: cannot implicitly convert expression (4i / 2i) of type float to ifloat

Added to DStress as
http://dstress.kuehne.cn/run/o/opDiv_10_A.d
http://dstress.kuehne.cn/run/o/opDiv_10_B.d
http://dstress.kuehne.cn/run/o/opDiv_10_C.d
http://dstress.kuehne.cn/run/o/opDiv_10_D.d
http://dstress.kuehne.cn/run/o/opDiv_10_E.d
http://dstress.kuehne.cn/run/o/opDiv_10_F.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFCglyc3w+/yD4P9tIRAjj+AJ4+uZoiMXovPi9A35k3YHH+lZyufwCeL2fs
TP0QVz5xutS0ChsGReWPU60=
=XAKG
-----END PGP SIGNATURE-----
May 11 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Thomas Kuehne" <thomas-dloop kuehne.thisisspam.cn> wrote in message
news:rit129-at3.ln1 lnews.kuehne.cn...
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 #
 # idouble f = 4.0i / 2.0i;
 #
 dmd: cannot implicitly convert expression (4i / 2i) of type float to

Which is correct. An imaginary divided by an imaginary is a real number.
May 11 2005
parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Walter schrieb am Wed, 11 May 2005 10:26:57 -0700:
 "Thomas Kuehne" <thomas-dloop kuehne.thisisspam.cn> wrote in message
 news:rit129-at3.ln1 lnews.kuehne.cn...
 #
 # idouble f = 4.0i / 2.0i;
 #
 dmd: cannot implicitly convert expression (4i / 2i) of type float to

Which is correct. An imaginary divided by an imaginary is a real number.

Interresting: The documentations I used (one math, the other computing) disagree with eachother. I'll take a closer look at this tomorrow. Note: I'm not talking about # cfloat a = 0.0 + 4.0i; # cfloat b = 0.0 + 2.0i; # cfloat c = a / b; but about # ifloat a = 4.0i; # ifloat b = 2.0i; # ifloat c = a / b; Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCgnHy3w+/yD4P9tIRAmShAJ9CzULIqlvulubMsD5GERIiYE3OegCfS6K1 K/PTQ3fWptIq/jWawRbI7jM= =xscW -----END PGP SIGNATURE-----
May 11 2005
parent reply "Uwe Salomon" <post uwesalomon.de> writes:
 #
 # idouble f = 4.0i / 2.0i;
 #
 dmd: cannot implicitly convert expression (4i / 2i) of type float to

Which is correct. An imaginary divided by an imaginary is a real number.

Interresting: The documentations I used (one math, the other computing) disagree with eachother.

Well, then the one which says that it is ok is wrong. Walter is 100% right about the underlying maths here. Note that 4.0i * 2.0i is also a real value: -8.0. Ciao uwe
May 11 2005
parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Uwe Salomon schrieb am Wed, 11 May 2005 22:12:38 +0200:
 #
 # idouble f = 4.0i / 2.0i;
 #
 dmd: cannot implicitly convert expression (4i / 2i) of type float to

Which is correct. An imaginary divided by an imaginary is a real number.

Interresting: The documentations I used (one math, the other computing) disagree with eachother.

Well, then the one which says that it is ok is wrong. Walter is 100% right about the underlying maths here. Note that 4.0i * 2.0i is also a real value: -8.0.

The computing docu used the "unusuall" approach of independent root dimensions: real (dim A) imaginary (dim B) complex (dim A+B) The math docu used the normal approach: real (dim A) complex (dim A+B) imaginary (dim A+B where the values in A=0) Moved the test cases to nocompile. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCgrYS3w+/yD4P9tIRAv1wAKCy+ZPHe3/42E9pxl42j4MzRxKNKACeLQVS EtjFU+eVhlKyrWRQOd0aSRc= =+tfd -----END PGP SIGNATURE-----
May 11 2005