digitalmars.D.bugs - mistake in the calculation when compiling
- Hiroshi Sakurai (12/12) Aug 24 2005 Hi.
- zwang (2/21) Aug 24 2005 Already reported. See D.bugs:4750.
- Hasan Aljudy (34/57) Aug 24 2005 but this is kind of different, it's not treated as positive (or atleast
- Hiroshi Sakurai (6/63) Aug 27 2005 Thank you for having already taught what the bug has reported.
- =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= (12/29) Aug 27 2005 -----BEGIN PGP SIGNED MESSAGE-----
Hi. This topic writen U in Japanese D Language Wiki. http://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F19 foo(-288*1000/360) is not -800. void main(char[][] arg) { printf("ok %d\n", 3/3);// 1 printf("ok %d\n", -(3/3));// -1 printf("ng %d\n", -3/3);// 1431655764 int a = cast(int)(-3/3); printf("ng %d\n", a);// 1431655764 printf("ng %d\n", (-3)/3);// 1431655764 }
Aug 24 2005
Hiroshi Sakurai wrote:Hi. This topic writen U in Japanese D Language Wiki. http://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F19 foo(-288*1000/360) is not -800. void main(char[][] arg) { printf("ok %d\n", 3/3);// 1 printf("ok %d\n", -(3/3));// -1 printf("ng %d\n", -3/3);// 1431655764 int a = cast(int)(-3/3); printf("ng %d\n", a);// 1431655764 printf("ng %d\n", (-3)/3);// 1431655764 }Already reported. See D.bugs:4750.
Aug 24 2005
zwang wrote:Hiroshi Sakurai wrote:but this is kind of different, it's not treated as positive (or atleast doesn't seem like that) funny thing is, -2/2 works fine!! and so does -3/1 it's kind of odd .. in some cases it works, some cases it doesn't .. maybe an optamization bug? <bug.d> void main(char[][] arg) { printf("-5/3 prints: %d\n", -5/3); printf("-5/2 prints: %d\n", -5/2); printf("-7/3 prints: %d\n", -7/3); printf("-7/4 prints: %d\n", -7/4); printf("-7/7 prints: %d\n", -7/7); printf("-8/7 prints: %d\n", -8/7); printf("-9/7 prints: %d\n", -9/7); printf("-11/8 prints: %d\n", -11/8); printf("-7/9 prints: %d\n", -7/9); } </bug.d> output: D:\Documents and Settings\Aljudy\temp>dmd bug E:\dmd\dmd\bin\..\..\dm\bin\link.exe bug,,,user32+kernel32/noi; D:\Documents and Settings\Aljudy\temp>bug -5/3 prints: 1431655763 -5/2 prints: -3 -7/3 prints: 1431655763 -7/4 prints: -2 -7/7 prints: -1840700271 -8/7 prints: -1840700271 -9/7 prints: -1840700271 -11/8 prints: -2 -7/9 prints: 1908874353Hi. This topic writen U in Japanese D Language Wiki. http://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F19 foo(-288*1000/360) is not -800. void main(char[][] arg) { printf("ok %d\n", 3/3);// 1 printf("ok %d\n", -(3/3));// -1 printf("ng %d\n", -3/3);// 1431655764 int a = cast(int)(-3/3); printf("ng %d\n", a);// 1431655764 printf("ng %d\n", (-3)/3);// 1431655764 }Already reported. See D.bugs:4750.
Aug 24 2005
zwang wrote:Thank you for having already taught what the bug has reported. I am not reading all Newsgroups. Therefore, I did not notice it. I thought that it was interesting that -2/2 had moved well. I also thought that it might have happened while the bug had optimized the code. Hiroshi Sakurai.Hiroshi Sakurai wrote:but this is kind of different, it's not treated as positive (or atleast doesn't seem like that) funny thing is, -2/2 works fine!! and so does -3/1 it's kind of odd .. in some cases it works, some cases it doesn't .. maybe an optamization bug? <bug.d> void main(char[][] arg) { printf("-5/3 prints: %d\n", -5/3); printf("-5/2 prints: %d\n", -5/2); printf("-7/3 prints: %d\n", -7/3); printf("-7/4 prints: %d\n", -7/4); printf("-7/7 prints: %d\n", -7/7); printf("-8/7 prints: %d\n", -8/7); printf("-9/7 prints: %d\n", -9/7); printf("-11/8 prints: %d\n", -11/8); printf("-7/9 prints: %d\n", -7/9); } </bug.d> output: D:\Documents and Settings\Aljudy\temp>dmd bug E:\dmd\dmd\bin\..\..\dm\bin\link.exe bug,,,user32+kernel32/noi; D:\Documents and Settings\Aljudy\temp>bug -5/3 prints: 1431655763 -5/2 prints: -3 -7/3 prints: 1431655763 -7/4 prints: -2 -7/7 prints: -1840700271 -8/7 prints: -1840700271 -9/7 prints: -1840700271 -11/8 prints: -2 -7/9 prints: 1908874353Hi. This topic writen U in Japanese D Language Wiki. http://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F19 foo(-288*1000/360) is not -800. void main(char[][] arg) { printf("ok %d\n", 3/3);// 1 printf("ok %d\n", -(3/3));// -1 printf("ng %d\n", -3/3);// 1431655764 int a = cast(int)(-3/3); printf("ng %d\n", a);// 1431655764 printf("ng %d\n", (-3)/3);// 1431655764 }Already reported. See D.bugs:4750.
Aug 27 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hiroshi Sakurai schrieb:Hi. This topic writen U in Japanese D Language Wiki. http://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F19 foo(-288*1000/360) is not -800. void main(char[][] arg) { printf("ok %d\n", 3/3);// 1 printf("ok %d\n", -(3/3));// -1 printf("ng %d\n", -3/3);// 1431655764 int a = cast(int)(-3/3); printf("ng %d\n", a);// 1431655764 printf("ng %d\n", (-3)/3);// 1431655764 }Added to DStress as http://dstress.kuehne.cn/run/o/opDiv_10_A.d http://dstress.kuehne.cn/run/o/opDiv_10_B.d Thomas -----BEGIN PGP SIGNATURE----- iD4DBQFDEJss3w+/yD4P9tIRAiTUAJi0XU4grbgT6BRLeg7ew3+WVTviAKCWEyBI 1G6VcZpxQGO4+qnUN0s3Og== =MlOX -----END PGP SIGNATURE-----
Aug 27 2005