digitalmars.D.bugs - [Issue 1892] New: min and max work improperly for mixed-sign numbers
- d-bugmail puremagic.com (25/25) Mar 04 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1892
- Bill Baxter (3/35) Mar 04 2008 So you *do* still read the newsgroups. ;-)
- d-bugmail puremagic.com (9/9) Mar 06 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1892
http://d.puremagic.com/issues/show_bug.cgi?id=1892 Summary: min and max work improperly for mixed-sign numbers Product: D Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: andrei metalanguage.com ReportedBy: andrei metalanguage.com (From a post by bearophile.) void main() { int a = -10; uint b = 10; writefln( min(a, b) ); } prints 10 as per the infamous "uint rot" that transforms everything touched by uint an uint as well. Not sure what the right solution is - either (a) fix CommonType to yield no common type for int and uint, (b) fix CommonType to yield long for those two, (c) leverage the semantics of min to yield int whenever the min of an int an uint is taken, (d) something else? --
Mar 04 2008
d-bugmail puremagic.com wrote:http://d.puremagic.com/issues/show_bug.cgi?id=1892 Summary: min and max work improperly for mixed-sign numbers Product: D Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: andrei metalanguage.com ReportedBy: andrei metalanguage.com (From a post by bearophile.) void main() { int a = -10; uint b = 10; writefln( min(a, b) ); } prints 10 as per the infamous "uint rot" that transforms everything touched by uint an uint as well. Not sure what the right solution is - either (a) fix CommonType to yield no common type for int and uint, (b) fix CommonType to yield long for those two, (c) leverage the semantics of min to yield int whenever the min of an int an uint is taken, (d) something else?So you *do* still read the newsgroups. ;-) --bb
Mar 04 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1892 andrei metalanguage.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed in 2.012. --
Mar 06 2008