Re: geo_decls.h oopsie...

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Dann Corbit" <DCorbit(at)connx(dot)com>, "Hackers List" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: geo_decls.h oopsie...
Date: 2002-02-14 00:28:38
Message-ID: D90A5A6C612A39408103E6ECDD77B8290FD4E4@voyager.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Probably a lot more sensible to change the interface to both functions
below to return int instead of double.

#include <float.h>
double double_compare(double d1, double d2)
{
if (d1 > d2)
if ((d1 - d2) < fabs(d1 * DBL_EPSILON))
return 0;
else
return 1;
if (d1 < d2)
if ((d2 - d1) < fabs(d2 * DBL_EPSILON))
return 0;
else
return -1;
return 0;
}

float float_compare(float d1, float d2)
{
if (d1 > d2)
if ((d1 - d2) < fabs(d1 * FLT_EPSILON))
return 0;
else
return 1;
if (d1 < d2)
if ((d2 - d1) < fabs(d2 * FLT_EPSILON))
return 0;
else
return -1;
return 0;
}

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-02-14 00:44:41 Re: When and where to check for function permissions
Previous Message Dann Corbit 2002-02-14 00:26:34 geo_decls.h oopsie...