diff --git a/extra/math/compare/compare-docs.factor b/extra/math/compare/compare-docs.factor
index 6c20db10fd..4cbe1a1ae0 100644
--- a/extra/math/compare/compare-docs.factor
+++ b/extra/math/compare/compare-docs.factor
@@ -18,6 +18,6 @@ HELP: negmin
 { $description "Returns the most-negative value, or zero if both are positive." } ;
 
 HELP: clamp
-{ $values { "a" number } { "value" number } { "b" number } { "x" number } }
+{ $values { "value" number } { "a" number } { "b" number } { "x" number } }
 { $description "Returns the value when between " { $snippet "a" } " and " { $snippet "b" } ", " { $snippet "a" } " if <= " { $snippet "a" } ", or " { $snippet "b" } " if >= " { $snippet "b" } "." } ;
 
diff --git a/extra/math/compare/compare-tests.factor b/extra/math/compare/compare-tests.factor
index 272471fe5d..9accc8e98b 100644
--- a/extra/math/compare/compare-tests.factor
+++ b/extra/math/compare/compare-tests.factor
@@ -15,7 +15,7 @@ IN: math.compare.tests
 [ -3 ] [ 1 -3 negmin ] unit-test
 [ -1 ] [ -1 3 negmin ] unit-test
 
-[ 0 ] [ 0 -1 2 clamp ] unit-test
-[ 1 ] [ 0 1 2 clamp ] unit-test
-[ 2 ] [ 0 3 2 clamp ] unit-test
+[ 0 ] [ -1 0 2 clamp ] unit-test
+[ 1 ] [ 1 0 2 clamp ] unit-test
+[ 2 ] [ 3 0 2 clamp ] unit-test
 
diff --git a/extra/math/compare/compare.factor b/extra/math/compare/compare.factor
index 826f0ecf16..93a8da7cf3 100644
--- a/extra/math/compare/compare.factor
+++ b/extra/math/compare/compare.factor
@@ -1,6 +1,8 @@
 ! Copyright (C) 2008 John Benediktsson.
 ! See http://factorcode.org/license.txt for BSD license
+
 USING: math math.order kernel ;
+
 IN: math.compare
 
 : absmin ( a b -- x )
@@ -15,5 +17,5 @@ IN: math.compare
 : negmin ( a b -- x )
     0 min min ;
 
-: clamp ( a value b -- x )
-    min max ;
+: clamp ( value a b -- x )
+    [ max ] [ min ] bi* ;