http://d.puremagic.com/issues/show_bug.cgi?id=10448
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from [email protected] 2013-06-22 13:13:06 PDT --- (In reply to comment #0) > (and so are probably minCount, minPos, or mostly everything else that is > related to opCmp). > > From the discussion https://github.com/D-Programming-Language/phobos/pull/1360 > : > min(0, float.nan); //Yields 0 > max(0, float.nan); //Yields 0 > min(float.nan, 0); //Yields float.nan > max(float.nan, 0); //Yields float.nan > > Not sure what the correct solution is: Throwing an exception on NaN might be > too expensive? How about an assert, combined with an explicit: "Passing nan is > an ERROR", and let the user decide if/ifnot to pay for the check? I don't see why one would throw on nan, and it would be expensive. I believe the accepted convention is that nan is treated as missing data for min/max, so that min(0, float.nan); //Yields 0 max(0, float.nan); //Yields 0 min(float.nan, 0); //Yields 0 max(float.nan, 0); //Yields 0 related discussion: http://bytes.com/topic/c/answers/528404-max-nan-0-should-nan matlab does it that way btw. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
