www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 575] New: wrong evaluation of (creal * 2 + 1i)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=575

           Summary: wrong evaluation of (creal * 2 + 1i)
           Product: GDC
           Version: 0.19
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: glue layer
        AssignedTo: braddr puremagic.com
        ReportedBy: thomas-dloop kuehne.cn


# 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

--
Nov 19 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com 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-----
Nov 25 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=575


braddr puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|braddr puremagic.com        |dvdfrdmn users.sf.net




------- Comment #2 from braddr puremagic.com  2006-11-25 15:08 -------
Mass reassignment of gdc bugs from me to David.


-- 
Nov 25 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=575


dvdfrdmn users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




-- 
Dec 16 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=575


dvdfrdmn users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




------- Comment #3 from dvdfrdmn users.sf.net  2006-12-16 21:22 -------
Fixed in GDC 0.20


-- 
Dec 16 2006