From: | Christoph Berg <christoph(dot)berg(at)credativ(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: powerpc(32) point/polygon regression failures on Debian Jessie |
Date: | 2017-02-20 15:58:19 |
Message-ID: | 20170220155819.m2s43pf2pvkes4pc@msg.credativ.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Re: Tom Lane 2017-02-20 <30737(dot)1487598355(at)sss(dot)pgh(dot)pa(dot)us>
> Hmph. We haven't touched that code in awhile, and certainly not in the
> 9.4.x branch. I'd have to agree that this must be a toolchain change.
FYI, in the meantime we could indeed trace it back to an libc issue on
Jessie:
$ cat sqrt.c
#include <math.h>
#include <stdio.h>
#include <fenv.h>
double
pg_hypot(double x, double y)
{
double yx;
/* Some PG-specific code deleted here */
/* Else, drop any minus signs */
x = fabs(x);
y = fabs(y);
/* Swap x and y if needed to make x the larger one */
if (x < y)
{
double temp = x;
x = y;
y = temp;
}
/*
* If y is zero, the hypotenuse is x. This test saves a few cycles in
* such cases, but more importantly it also protects against
* divide-by-zero errors, since now x >= y.
*/
if (y == 0.0)
return x;
/* Determine the hypotenuse */
yx = y / x;
return x * sqrt(1.0 + (yx * yx));
}
int main ()
{
//fesetround(FE_TONEAREST);
printf("fegetround is %d\n", fegetround());
double r = pg_hypot(10.0, 10.0);
printf("14 %.14g\n", r);
printf("15 %.15g\n", r);
printf("16 %.16g\n", r);
printf("17 %.17g\n", r);
return 0;
}
Jessie output:
fegetround is 0
14 14.142135623731
15 14.1421356237309
16 14.14213562373095
17 14.142135623730949
Sid output:
fegetround is 0
14 14.142135623731
15 14.142135623731
16 14.14213562373095
17 14.142135623730951
The Sid output is what the point and polygon tests are expecting.
Possible culprit is this bug report from November:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=843904
(Though that doesn't explain why it affects 32bit powerpc only.)
Christoph
--
Senior Berater, Tel.: +49 2166 9901 187
credativ GmbH, HRB Mönchengladbach 12080, USt-ID-Nummer: DE204566209
Trompeterallee 108, 41189 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer
pgp fingerprint: 5C48 FE61 57F4 9179 5970 87C6 4C5A 6BAB 12D2 A7AE
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-02-20 16:12:23 | Re: powerpc(32) point/polygon regression failures on Debian Jessie |
Previous Message | Tom Lane | 2017-02-20 15:56:47 | Re: [PATCH] Suppress Clang 3.9 warnings |