← Back to index
|
Original Bugzilla link
Bug 575 – wrong evaluation of (creal * 2 + 1i)
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2006-11-19T16:47:00Z
Last change time
2015-06-09T05:15:04Z
Keywords
wrong-code
Assigned to
dvdfrdmn
Creator
thomas-dloop
Comments
Comment #0
by thomas-dloop — 2006-11-19T16:47:04Z
# cfloat test_f(cfloat a){ # return a * 2 + 1i; # } # cdouble test_d(cdouble a){ # return a * 2 + 1i; # } # creal test_r(creal a){ # return a * 2 + 1i; # } # # import std.stdio; # void main(){ # cfloat f = 1.0 + 2.0i; # writefln("f:\t%s", f * 2 + 1i); # writefln("test_f:\t%s", test_f(f)); # # cdouble d = 1.0 + 2.0i; # writefln("d:\t%s", d * 2 + 1i); # writefln("test_d:\t%s", test_d(d)); # # creal r = 1.0 + 2.0i; # writefln("r:\t%s", r * 2 + 1i); # writefln("test_r:\t%s", test_r(r)); # # writefln("direct:\t%s", (1.0 + 2.0i) * 2 + 1i); # } output: > f: 3+4i > test_f: 3+4i > d: 3+4i > test_d: 3+4i > r: 3+4i > test_r: 3+4i > direct: 2+5i expected output: > f: 2+5i > test_f: 2+5i > d: 2+5i > test_d: 2+5i > r: 2+5i > test_r: 2+5i > direct: 2+5i
Comment #1
by thomas-dloop — 2006-11-25T12:05:39Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
[email protected]
schrieb am 2006-11-19: >
http://d.puremagic.com/issues/show_bug.cgi?id=575
> # cfloat test_f(cfloat a){ > # return a * 2 + 1i; > # } > # cdouble test_d(cdouble a){ > # return a * 2 + 1i; > # } > # creal test_r(creal a){ > # return a * 2 + 1i; > # } > # > # import std.stdio; > # void main(){ > # cfloat f = 1.0 + 2.0i; > # writefln("f:\t%s", f * 2 + 1i); > # writefln("test_f:\t%s", test_f(f)); > # > # cdouble d = 1.0 + 2.0i; > # writefln("d:\t%s", d * 2 + 1i); > # writefln("test_d:\t%s", test_d(d)); > # > # creal r = 1.0 + 2.0i; > # writefln("r:\t%s", r * 2 + 1i); > # writefln("test_r:\t%s", test_r(r)); > # > # writefln("direct:\t%s", (1.0 + 2.0i) * 2 + 1i); > # } > > output: >> f: 3+4i >> test_f: 3+4i >> d: 3+4i >> test_d: 3+4i >> r: 3+4i >> test_r: 3+4i >> direct: 2+5i > > expected output: >> f: 2+5i >> test_f: 2+5i >> d: 2+5i >> test_d: 2+5i >> r: 2+5i >> test_r: 2+5i >> direct: 2+5i Added to DStress as
http://dstress.kuehne.cn/run/c/cfloat_11_A.d
http://dstress.kuehne.cn/run/c/cfloat_11_B.d
http://dstress.kuehne.cn/compile/c/cfloat_11_C.d
http://dstress.kuehne.cn/run/c/cdouble_11_A.d
http://dstress.kuehne.cn/run/c/cdouble_11_B.d
http://dstress.kuehne.cn/compile/c/cdouble_11_C.d
http://dstress.kuehne.cn/run/c/creal_36_A.d
http://dstress.kuehne.cn/run/c/creal_36_B.d
http://dstress.kuehne.cn/compile/c/creal_36_C.d
Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFaIDlLK5blCcjpWoRAhQpAKCRKaJ8vQR23fR+muEKkMwI2FaOtgCglc9x R6C50C6danfHe7MR/SbNeLg= =rL0l -----END PGP SIGNATURE-----
Comment #2
by braddr — 2006-11-25T15:08:22Z
Mass reassignment of gdc bugs from me to David.
Comment #3
by dvdfrdmn — 2006-12-16T21:22:35Z
Fixed in GDC 0.20