diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index b5a58c2f954d5571641760dfc6d2a9b8c5a40fea..fb94596224bc6c78b88f4114e4c51055b16cb01c 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -401,7 +401,7 @@
     as <literal>FrozenXID</>.  This XID does not follow the normal XID
     comparison rules and is always considered older
     than every normal XID. Normal XIDs are
-    compared using modulo-2<superscript>31</> arithmetic. This means
+    compared using modulo-2<superscript>32</> arithmetic. This means
     that for every normal XID, there are two billion XIDs that are
     <quote>older</> and two billion that are <quote>newer</>; another
     way to say it is that the normal XID space is circular with no
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 3cc0096d92ab016e94165d5a2e12fd8e9ebabdc1..b92a27bff36177c8c4529a56e4ae0246f5c46928 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -301,7 +301,7 @@ TransactionIdPrecedes(TransactionId id1, TransactionId id2)
 {
 	/*
 	 * If either ID is a permanent XID then we can just do unsigned
-	 * comparison.	If both are normal, do a modulo-2^31 comparison.
+	 * comparison.	If both are normal, do a modulo-2^32 comparison.
 	 */
 	int32		diff;