www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - complex float > compare to .max causing 'abnormal program termination' - 'constfold.c' line 575

reply David L. Davis <SpottedTiger yahoo.com> writes:
# // constfold_error.d at line 575 (on WinXP with dmd v0.121)
# // Bug1: abnormal program termination
# // Bug2: overflow 1.17549e-38+1.17549e-38i > 3.40282e+38+3.40282e+38i
# //
# // Note: This mainly appears to be a bug comparing '>' (greater-than)
# //       only against the complex float constant .max 
# //       (bug1: cfloat.min > cfloat.max, bug2: cf > cfloat.max) 
# private import std.stdio;
# 
# int main()
# {
#     //cfloat  cf = cfloat.min;
#     //cdouble cd = cdouble.min;
#     //creal   cr = creal.min;
# 
#     if (cfloat.min > cfloat.max) // <-- Look at output 1
#     //if (cfloat.min.re > cfloat.max.re &&
#     //    cfloat.min.im > cfloat.max.im)   // ok
#     //if (cf == cfloat.max)      // <-- Look at output 2
#         goto Loverflow;
# 
#     return 0;
# 
#     Loverflow:
#        writefln("overflow %g > %g", cfloat.min, cfloat.max);
#        //writefln("overflow %g > %g", cf, cfloat.max);
#        return 1;
# }

* All of the complex float (cfloat, cdouble, and creal) constants 
compares of .min > .max fail. (ex: cfloat.min > cfloat.max)

Output 1:
---------
C:\dmd>dmd constfold_error.d
Assertion failure: '0' on line 575 in file 'constfold.c'

abnormal program termination

C:\dmd>
------------------

* All of the complex float (cfloat, cdouble, and creal) .max constants 
when compared against a complex float variable set to .min of that datatype, 
return that .min is '>' .max. (ex: cf=cfloat.min; cf > cfloat.max)

Output 2: How can cfloat.min be > cfloat.max; 
---------
C:\dmd>dmd constfold_error.d
C:\dmd\bin\..\..\dm\bin\link.exe constfold_error,,,user32+kernel32/noi;

C:\dmd>constfold_error
overflow 1.17549e-38+1.17549e-38i > 3.40282e+38+3.40282e+38i

C:\dmd>

David L.

-------------------------------------------------------------------
"Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
-------------------------------------------------------------------

MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
Apr 23 2005
next sibling parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David L  Davis schrieb am Sat, 23 Apr 2005 12:18:31 +0000 (UTC):
 # // constfold_error.d at line 575 (on WinXP with dmd v0.121)
 # // Bug1: abnormal program termination
 # // Bug2: overflow 1.17549e-38+1.17549e-38i > 3.40282e+38+3.40282e+38i
 # //
 # // Note: This mainly appears to be a bug comparing '>' (greater-than)
 # //       only against the complex float constant .max 
 # //       (bug1: cfloat.min > cfloat.max, bug2: cf > cfloat.max) 
 # private import std.stdio;
 # 
 # int main()
 # {
 #     //cfloat  cf = cfloat.min;
 #     //cdouble cd = cdouble.min;
 #     //creal   cr = creal.min;
 # 
 #     if (cfloat.min > cfloat.max) // <-- Look at output 1
 #     //if (cfloat.min.re > cfloat.max.re &&
 #     //    cfloat.min.im > cfloat.max.im)   // ok
 #     //if (cf == cfloat.max)      // <-- Look at output 2
 #         goto Loverflow;
 # 
 #     return 0;
 # 
 #     Loverflow:
 #        writefln("overflow %g > %g", cfloat.min, cfloat.max);
 #        //writefln("overflow %g > %g", cf, cfloat.max);
 #        return 1;
 # }

 * All of the complex float (cfloat, cdouble, and creal) constants 
 compares of .min > .max fail. (ex: cfloat.min > cfloat.max)

 Output 1:
 ---------
 C:\dmd>dmd constfold_error.d
 Assertion failure: '0' on line 575 in file 'constfold.c'

 abnormal program termination

 C:\dmd>
 ------------------

 * All of the complex float (cfloat, cdouble, and creal) .max constants 
 when compared against a complex float variable set to .min of that datatype, 
 return that .min is '>' .max. (ex: cf=cfloat.min; cf > cfloat.max)

 Output 2: How can cfloat.min be > cfloat.max; 
 ---------
 C:\dmd>dmd constfold_error.d
 C:\dmd\bin\..\..\dm\bin\link.exe constfold_error,,,user32+kernel32/noi;

 C:\dmd>constfold_error
 overflow 1.17549e-38+1.17549e-38i > 3.40282e+38+3.40282e+38i
Added to DStress as http://dstress.kuehne.cn/run/bug_constfold_575_A.d http://dstress.kuehne.cn/run/bug_constfold_575_B.d http://dstress.kuehne.cn/run/bug_constfold_575_C.d http://dstress.kuehne.cn/run/bug_constfold_575_D.d http://dstress.kuehne.cn/run/bug_constfold_575_E.d http://dstress.kuehne.cn/run/bug_constfold_575_F.d http://dstress.kuehne.cn/run/bug_constfold_575_G.d http://dstress.kuehne.cn/run/bug_constfold_575_H.d http://dstress.kuehne.cn/run/bug_constfold_575_I.d http://dstress.kuehne.cn/run/bug_constfold_575_J.d http://dstress.kuehne.cn/run/bug_constfold_575_K.d http://dstress.kuehne.cn/run/bug_constfold_575_L.d http://dstress.kuehne.cn/run/bug_constfold_575_M.d http://dstress.kuehne.cn/run/bug_constfold_575_N.d http://dstress.kuehne.cn/run/bug_constfold_575_O.d http://dstress.kuehne.cn/run/bug_constfold_575_P.d http://dstress.kuehne.cn/run/bug_constfold_575_Q.d http://dstress.kuehne.cn/run/bug_constfold_575_R.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCbIxc3w+/yD4P9tIRAjt+AJ93ocy+eXvHCcM/lu8NXPCZavvzIwCfRkxG 3HrTCOSF+Ef8KfIb40zDujQ= =Dvng -----END PGP SIGNATURE-----
Apr 24 2005
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
The trouble is that <, <=, >, >= comparisons are not defined for complex
operands. I've fixed the compiler to now issue the appropriate error
message.
May 03 2005
parent reply David L. Davis <SpottedTiger yahoo.com> writes:
In article <d58tbl$da5$1 digitaldaemon.com>, Walter says...
The trouble is that <, <=, >, >= comparisons are not defined for complex
operands. I've fixed the compiler to now issue the appropriate error
message.
Walter, thanks for checking into this! :) By complex operands, you must mean just the cfloat, cdouble, and creal...right? David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
May 04 2005
parent "Walter" <newshound digitalmars.com> writes:
"David L. Davis" <SpottedTiger yahoo.com> wrote in message
news:d5ath8$2bkk$1 digitaldaemon.com...
 In article <d58tbl$da5$1 digitaldaemon.com>, Walter says...
The trouble is that <, <=, >, >= comparisons are not defined for complex
operands. I've fixed the compiler to now issue the appropriate error
message.
Walter, thanks for checking into this! :) By complex operands, you must mean just the cfloat, cdouble, and
creal...right? Right.
May 08 2005