View mode: basic / threaded / horizontal-split · Log in · Help
May 05, 2005
incorrect casting of negative floating point constants (dmd 0.122)
<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 06, 2005
Re: incorrect casting of negative floating point constants (dmd 0.122)
-----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-----
Top | Discussion index | About this forum | D home