diff --git a/compiler/sparc/float.lisp b/compiler/sparc/float.lisp
index d2e22014e317de2bc3bbcab6f74c6c91f08df18a..7b336a01f3d4e2bf426d889691a9f9a362389d87 100644
--- a/compiler/sparc/float.lisp
+++ b/compiler/sparc/float.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/float.lisp,v 1.43 2003/10/27 18:30:27 toy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/float.lisp,v 1.44 2004/03/29 18:47:03 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -2485,13 +2485,13 @@
 (defun %%min (x y)
   (declare (type (or (unsigned-byte 32) (signed-byte 32)
 		     single-float double-float) x y))
-  (if (< x y)
+  (if (<= x y)
       x y))
 
 (defun %%max (x y)
   (declare (type (or (unsigned-byte 32) (signed-byte 32)
 		     single-float double-float) x y))
-  (if (> x y)
+  (if (>= x y)
       x y))
   
 (macrolet
@@ -2609,22 +2609,28 @@
 
 ;; Derive the types of max and min
 (defoptimizer (max derive-type) ((x y))
+  ;; It's Y < X instead of X < Y because that's how the
+  ;; source-transform, the deftransform and the max function do the
+  ;; comparisons.  This is important if the types of X and Y are
+  ;; different types, like integer vs double-float because CMUCL
+  ;; returns the actual arg, instead of applying float-contagion to
+  ;; the result.
   (multiple-value-bind (definitely-< definitely->=)
-      (ir1-transform-<-helper x y)
+      (ir1-transform-<-helper y x)
     (cond (definitely-<
-	      (continuation-type y))
-	  (definitely->=
 	      (continuation-type x))
+	  (definitely->=
+	      (continuation-type y))
 	  (t
 	   (make-canonical-union-type (list (continuation-type x)
 					    (continuation-type y)))))))
 
 (defoptimizer (min derive-type) ((x y))
-  (multiple-value-bind (definitely-< definitely->=)
-      (ir1-transform-<-helper x y)
-    (cond (definitely-<
+  (multiple-value-bind (definitely-> definitely-<=)
+      (ir1-transform-<-helper y x)
+    (cond (definitely-<=
 	      (continuation-type x))
-	  (definitely->=
+	  (definitely->
 	      (continuation-type y))
 	  (t
 	   (make-canonical-union-type (list (continuation-type x)
diff --git a/compiler/srctran.lisp b/compiler/srctran.lisp
index 0bfc797bce663440afa7e63751d4f843b5d82b32..22b7c99a12dd24e378b0eb5fc96fc068f929a6d7 100644
--- a/compiler/srctran.lisp
+++ b/compiler/srctran.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/srctran.lisp,v 1.143 2004/01/19 20:15:28 toy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/srctran.lisp,v 1.144 2004/03/29 18:47:03 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -3295,7 +3295,7 @@
       `(values (the real ,arg))
       (once-only ((arg1 arg)
 		  (arg2 `(max ,@more-args)))
-	`(if (> ,arg1 ,arg2)
+	`(if (>= ,arg1 ,arg2)
 	     ,arg1 ,arg2))))
 ;;;
 (def-source-transform min (arg &rest more-args)
@@ -3303,7 +3303,7 @@
       `(values (the real ,arg))
       (once-only ((arg1 arg)
 		  (arg2 `(min ,@more-args)))
-	`(if (< ,arg1 ,arg2)
+	`(if (<= ,arg1 ,arg2)
 	     ,arg1 ,arg2))))
 
 )