November 08, 2005 *, /, and .im of complex numbers is wrong at compile time. | ||||
---|---|---|---|---|
| ||||
DMD 0.138, Windows. It works for add + subtract, but returns 0 (with the correct sign) whenever * or / is involved (BUG 1-4). I think the root cause lies with ireal.im, which behaves _very_ oddly. (BUG 5 and BUG 6) Looks like it's grabbing the wrong part of the syntax tree. BUG 1------------------------------- static assert(1i * 1i == -1); bug.d(1): static assert (-0 == -1) is false BUG 2------------------------------- static assert(3.0i /1.0i == 3); bug.d(1): static assert (0 == 3) is false BUG 3------------------------------- static assert(3.0i *2 == 6i); bug.d(1): static assert (0i == 6i) is false BUG 4------------------------------- static assert((2.0i).im == 2.0); bug.d(1): static assert (2i == 2) is false BUG 5------------------------------ static assert((3+2.0i).im == 2.0); bug.d(1): static assert (3 == 2) is false |
November 12, 2005 Re: *, /, and .im of complex numbers is wrong at compile time. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston Attachments: | Don Clugston schrieb am 2005-11-08: > DMD 0.138, Windows. > It works for add + subtract, but returns 0 (with the correct sign) > whenever * or / is involved (BUG 1-4). > I think the root cause lies with ireal.im, which behaves _very_ oddly. > (BUG 5 and BUG 6) Looks like it's grabbing the wrong part of the syntax > tree. > > BUG 1------------------------------- > static assert(1i * 1i == -1); > bug.d(1): static assert (-0 == -1) is false > > BUG 2------------------------------- > static assert(3.0i /1.0i == 3); > bug.d(1): static assert (0 == 3) is false > > BUG 3------------------------------- > static assert(3.0i *2 == 6i); > bug.d(1): static assert (0i == 6i) is false > > BUG 4------------------------------- > static assert((2.0i).im == 2.0); > bug.d(1): static assert (2i == 2) is false > > BUG 5------------------------------ > static assert((3+2.0i).im == 2.0); > bug.d(1): static assert (3 == 2) is false Added to DStress as http://dstress.kuehne.cn/run/c/cdouble_02_A.d http://dstress.kuehne.cn/run/c/cdouble_02_B.d http://dstress.kuehne.cn/run/c/cdouble_02_C.d http://dstress.kuehne.cn/run/c/cfloat_03_A.d http://dstress.kuehne.cn/run/c/cfloat_03_B.d http://dstress.kuehne.cn/run/c/cfloat_03_C.d http://dstress.kuehne.cn/run/c/creal_27_A.d http://dstress.kuehne.cn/run/c/creal_27_B.d http://dstress.kuehne.cn/run/c/creal_27_C.d http://dstress.kuehne.cn/run/o/opAdd_07_A.d http://dstress.kuehne.cn/run/o/opAdd_07_B.d http://dstress.kuehne.cn/run/o/opDiv_12_A.d http://dstress.kuehne.cn/run/o/opDiv_12_B.d http://dstress.kuehne.cn/run/o/opMul_08_A.d http://dstress.kuehne.cn/run/o/opMul_08_B.d http://dstress.kuehne.cn/run/o/opMul_08_C.d http://dstress.kuehne.cn/run/o/opMul_08_D.d http://dstress.kuehne.cn/run/o/opMul_08_E.d http://dstress.kuehne.cn/run/o/opSub_07_A.d http://dstress.kuehne.cn/run/o/opSub_07_B.d Thomas |
Copyright © 1999-2021 by the D Language Foundation