www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - ifloat/idouble/ireal and .im/.re

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

ifloat a = 1.0i;
assert(a.im == 1.0);

const ifloat b = 2.0i;
static assert(a.im == 2.0i); // FAIL

Added to DStress as
http://dstress.kuehne.cn/run/i/idouble_04_A.d
http://dstress.kuehne.cn/run/i/idouble_04_B.d
http://dstress.kuehne.cn/run/i/ifloat_05_A.d
http://dstress.kuehne.cn/run/i/ifloat_05_B.d
http://dstress.kuehne.cn/run/i/ireal_05_A.d
http://dstress.kuehne.cn/run/i/ireal_05_B.d

Thomas

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

iD8DBQFDdj0Q3w+/yD4P9tIRAjJ5AKCzMlMs4hWkEWqARSkt0AeC5aZCCwCghzaI
9dH9MtFBizkeoKNQcrMdfuQ=
=xr5R
-----END PGP SIGNATURE-----
Nov 12 2005
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"Thomas Kuehne" <thomas-dloop kuehne.cn> wrote in message
news:tk-18a2189c960032901deaef67 birke.kuehne.cn...
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 ifloat a = 1.0i;
 assert(a.im == 1.0);

 const ifloat b = 2.0i;
 static assert(a.im == 2.0i); // FAIL

I think you meant b.im. In any case, the .im property returns the imaginary part as a real, not as an imaginary, float.
 Added to DStress as
 http://dstress.kuehne.cn/run/i/idouble_04_A.d
 http://dstress.kuehne.cn/run/i/idouble_04_B.d
 http://dstress.kuehne.cn/run/i/ifloat_05_A.d
 http://dstress.kuehne.cn/run/i/ifloat_05_B.d
 http://dstress.kuehne.cn/run/i/ireal_05_A.d
 http://dstress.kuehne.cn/run/i/ireal_05_B.d

 Thomas

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

 iD8DBQFDdj0Q3w+/yD4P9tIRAjJ5AKCzMlMs4hWkEWqARSkt0AeC5aZCCwCghzaI
 9dH9MtFBizkeoKNQcrMdfuQ=
 =xr5R
 -----END PGP SIGNATURE-----

Nov 13 2005
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Walter Bright schrieb am 2005-11-13:
 "Thomas Kuehne" <thomas-dloop kuehne.cn> wrote in message
 news:tk-18a2189c960032901deaef67 birke.kuehne.cn...
 ifloat a = 1.0i;
 assert(a.im == 1.0);

 const ifloat b = 2.0i;
 static assert(a.im == 2.0i); // FAIL

I think you meant b.im. In any case, the .im property returns the imaginary part as a real, not as an imaginary, float.

Yes, the content of the message was incorrect, whereas the test cases look sane. const ifloat b = 2.0i; static assert(b.im == 2.0); Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDeDmJ3w+/yD4P9tIRAjbaAKCqs+55lxIWO++dgEMqZPGRWkKUAgCgjQZG B6VfJOFtQKH/YZr6EDLNhhM= =caYN -----END PGP SIGNATURE-----
Nov 13 2005