aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/float.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-06-02 17:12:12 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-06-02 17:12:12 +0000
commit58193c5f37838b49043925437e3c99711ca66407 (patch)
treeada10d26ddba86b354edc3ebb4d272beae65251e /src/backend/utils/adt/float.c
parentfc7c16fd16747f2d3e56777a923262233d36f07a (diff)
downloadpostgresql-58193c5f37838b49043925437e3c99711ca66407.tar.gz
postgresql-58193c5f37838b49043925437e3c99711ca66407.zip
Paranoia about unordered comparisons in IEEE float math. If we are
given values that compare as unordered, make sure we reply that they are equal, which is better than giving an arbitrary answer --- at least it doesn't depend on which one is passed as which arg.
Diffstat (limited to 'src/backend/utils/adt/float.c')
-rw-r--r--src/backend/utils/adt/float.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index 06405d0cee1..42239cced02 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.71 2001/05/03 19:00:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.72 2001/06/02 17:12:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -566,10 +566,10 @@ float4_cmp_internal(float4 a, float4 b)
{
if (a > b)
return 1;
- else if (a == b)
- return 0;
- else
+ else if (a < b)
return -1;
+ else
+ return 0;
}
}
@@ -662,10 +662,10 @@ float8_cmp_internal(float8 a, float8 b)
{
if (a > b)
return 1;
- else if (a == b)
- return 0;
- else
+ else if (a < b)
return -1;
+ else
+ return 0;
}
}