Skip to content

Commit

Permalink
2004-03-18 Nick Drochak <ndrochak@ieee.org>
Browse files Browse the repository at this point in the history
	* Math.cs: Use IsNaN() method not "x == NaN".

svn path=/trunk/mcs/; revision=24275
  • Loading branch information
Nick Drochak committed Mar 18, 2004
1 parent 32556a8 commit 357375f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions mcs/class/corlib/System/ChangeLog
@@ -1,3 +1,7 @@
2004-03-18 Nick Drochak <ndrochak@ieee.org>

* Math.cs: Use IsNaN() method not "x == NaN".

2004-03-16 Andreas Nahr <ClassDevelopment@A-SoftTech.com>

* EntryPointNotFoundException.cs
Expand Down
12 changes: 6 additions & 6 deletions mcs/class/corlib/System/Math.cs
Expand Up @@ -130,15 +130,15 @@ public static decimal Max (decimal val1, decimal val2)

public static double Max (double val1, double val2)
{
if (val1 == Double.NaN || val2 == Double.NaN) {
if (Double.IsNaN (val1) || Double.IsNaN (val2)) {
return Double.NaN;
}
return (val1 > val2)? val1: val2;
}

public static float Max (float val1, float val2)
{
if (val1 == Single.NaN || val2 == Single.NaN) {
if (Single.IsNaN (val1) || Single.IsNaN (val2)) {
return Single.NaN;
}
return (val1 > val2)? val1: val2;
Expand Down Expand Up @@ -195,15 +195,15 @@ public static decimal Min (decimal val1, decimal val2)

public static double Min (double val1, double val2)
{
if (val1 == Double.NaN || val2 == Double.NaN) {
if (Double.IsNaN (val1) || Double.IsNaN (val2)) {
return Double.NaN;
}
return (val1 < val2)? val1: val2;
}

public static float Min (float val1, float val2)
{
if (val1 == Single.NaN || val2 == Single.NaN) {
if (Single.IsNaN (val1) || Single.IsNaN (val2)) {
return Single.NaN;
}
return (val1 < val2)? val1: val2;
Expand Down Expand Up @@ -302,15 +302,15 @@ public static int Sign (decimal value)

public static int Sign (double value)
{
if (value == Double.NaN)
if (Double.IsNaN (value))
throw new ArithmeticException ("NAN");
if (value > 0) return 1;
return (value == 0)? 0: -1;
}

public static int Sign (float value)
{
if (value == Single.NaN)
if (Single.IsNaN (value))
throw new ArithmeticException ("NAN");
if (value > 0) return 1;
return (value == 0)? 0: -1;
Expand Down

0 comments on commit 357375f

Please sign in to comment.