Index: src/test/org/apache/commons/lang/math/NumberUtilsTest.java
===================================================================
--- src/test/org/apache/commons/lang/math/NumberUtilsTest.java	(revision 607961)
+++ src/test/org/apache/commons/lang/math/NumberUtilsTest.java	(working copy)
@@ -1183,5 +1183,26 @@
         NumberUtils.createNumber("01l");
         NumberUtils.createNumber("1l");
     }
+
+    public void testLang381() {
+        assertTrue(Double.isNaN(NumberUtils.min(1.2, 2.5, Double.NaN)));
+        assertTrue(Double.isNaN(NumberUtils.max(1.2, 2.5, Double.NaN)));
+        assertTrue(Float.isNaN(NumberUtils.min(1.2f, 2.5f, Float.NaN)));
+        assertTrue(Float.isNaN(NumberUtils.max(1.2f, 2.5f, Float.NaN)));
+
+        double[] a = new double[] { 1.2, Double.NaN, 3.7, 27.0, 42.0, Double.NaN };
+        assertTrue(Double.isNaN(NumberUtils.max(a)));
+        assertTrue(Double.isNaN(NumberUtils.min(a)));
+
+        double[] b = new double[] { Double.NaN, 1.2, Double.NaN, 3.7, 27.0, 42.0, Double.NaN };
+        assertTrue(Double.isNaN(NumberUtils.max(b)));
+        assertTrue(Double.isNaN(NumberUtils.min(b)));
+
+        float[] aF = new float[] { 1.2f, Float.NaN, 3.7f, 27.0f, 42.0f, Float.NaN };
+        assertTrue(Float.isNaN(NumberUtils.max(aF)));
+
+        float[] bF = new float[] { Float.NaN, 1.2f, Float.NaN, 3.7f, 27.0f, 42.0f, Float.NaN };
+        assertTrue(Float.isNaN(NumberUtils.max(bF)));
+    }
     
 }
Index: src/java/org/apache/commons/lang/math/NumberUtils.java
===================================================================
--- src/java/org/apache/commons/lang/math/NumberUtils.java	(revision 607961)
+++ src/java/org/apache/commons/lang/math/NumberUtils.java	(working copy)
@@ -795,6 +795,9 @@
         // Finds and returns min
         double min = array[0];
         for (int i = 1; i < array.length; i++) {
+            if (Double.isNaN(array[i])) {
+                return Double.NaN;
+            }
             if (array[i] < min) {
                 min = array[i];
             }
@@ -822,6 +825,9 @@
         // Finds and returns min
         float min = array[0];
         for (int i = 1; i < array.length; i++) {
+            if (Float.isNaN(array[i])) {
+                return Float.NaN;
+            }
             if (array[i] < min) {
                 min = array[i];
             }
@@ -959,6 +965,9 @@
         // Finds and returns max
         double max = array[0];
         for (int j = 1; j < array.length; j++) {
+            if (Double.isNaN(array[j])) {
+                return Double.NaN;
+            }
             if (array[j] > max) {
                 max = array[j];
             }
@@ -986,6 +995,9 @@
         // Finds and returns max
         float max = array[0];
         for (int j = 1; j < array.length; j++) {
+            if (Float.isNaN(array[j])) {
+                return Float.NaN;
+            }
             if (array[j] > max) {
                 max = array[j];
             }
