digitalmars.D.bugs - incorrect casting of negative floating point constants (dmd 0.122)
-
zwang
(8/8)
May 05 2005
- Thomas Kuehne (22/30) May 06 2005 -----BEGIN PGP SIGNED MESSAGE-----
<code>
void main(){
const double d = -1.0;
int i = cast(int)d;
assert(-1 == i); // <- assertion failure
}
</code>
Negative "const double" or "const float" is always converted to zero.
May 05 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
zwang schrieb am Thu, 05 May 2005 15:47:54 +0800:
<code>
void main(){
const double d = -1.0;
int i = cast(int)d;
assert(-1 == i); // <- assertion failure
}
</code>
Negative "const double" or "const float" is always converted to zero.
Added to DStress as
http://dstress.kuehne.cn/run/const_20_A.d
http://dstress.kuehne.cn/run/const_20_B.d
http://dstress.kuehne.cn/run/const_20_C.d
http://dstress.kuehne.cn/run/const_20_D.d
http://dstress.kuehne.cn/run/const_21_A.d
http://dstress.kuehne.cn/run/const_21_B.d
http://dstress.kuehne.cn/run/const_21_C.d
http://dstress.kuehne.cn/run/const_21_D.d
http://dstress.kuehne.cn/run/const_22_A.d
http://dstress.kuehne.cn/run/const_22_B.d
http://dstress.kuehne.cn/run/const_22_C.d
http://dstress.kuehne.cn/run/const_22_D.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFCezkJ3w+/yD4P9tIRAs/PAJ9sOYfhWwb4D9vRIVLYQ1KjrQBpKwCdHQos
RAZLPiGSENUUghv6Krmt7ik=
=Yr0V
-----END PGP SIGNATURE-----
May 06 2005








Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn>