Insert a hack into get_float8_nan (both core and ecpg copies) to deal with
the fact that NetBSD/mips is currently broken, as per buildfarm member pika. Also add regression tests to ensure that get_float8_nan and get_float4_nan are exercised even on platforms where they are not needed by float8in/float4in. Zoltán Böszörményi and Tom Lane
This commit is contained in:
parent
bf379837dc
commit
4d17a2146c
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.165 2010/02/08 20:39:51 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.166 2010/02/27 21:53:21 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -130,7 +130,8 @@ get_float4_infinity(void)
|
|||||||
double
|
double
|
||||||
get_float8_nan(void)
|
get_float8_nan(void)
|
||||||
{
|
{
|
||||||
#ifdef NAN
|
/* (double) NAN doesn't work on some NetBSD/MIPS releases */
|
||||||
|
#if defined(NAN) && !(defined(__NetBSD__) && defined(__mips__))
|
||||||
/* C99 standard way */
|
/* C99 standard way */
|
||||||
return (double) NAN;
|
return (double) NAN;
|
||||||
#else
|
#else
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.50 2010/02/26 02:01:29 momjian Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.51 2010/02/27 21:53:21 tgl Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "ecpgtype.h"
|
#include "ecpgtype.h"
|
||||||
@ -85,7 +86,8 @@ get_float8_infinity(void)
|
|||||||
static double
|
static double
|
||||||
get_float8_nan(void)
|
get_float8_nan(void)
|
||||||
{
|
{
|
||||||
#ifdef NAN
|
/* (double) NAN doesn't work on some NetBSD/MIPS releases */
|
||||||
|
#if defined(NAN) && !(defined(__NetBSD__) && defined(__mips__))
|
||||||
return (double) NAN;
|
return (double) NAN;
|
||||||
#else
|
#else
|
||||||
return (double) (0.0 / 0.0);
|
return (double) (0.0 / 0.0);
|
||||||
|
@ -119,6 +119,12 @@ SELECT 'nan'::float4 / 'nan'::float4;
|
|||||||
NaN
|
NaN
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
SELECT 'nan'::numeric::float4;
|
||||||
|
float4
|
||||||
|
--------
|
||||||
|
NaN
|
||||||
|
(1 row)
|
||||||
|
|
||||||
SELECT '' AS five, * FROM FLOAT4_TBL;
|
SELECT '' AS five, * FROM FLOAT4_TBL;
|
||||||
five | f1
|
five | f1
|
||||||
------+--------------
|
------+--------------
|
||||||
|
@ -119,6 +119,12 @@ SELECT 'nan'::float4 / 'nan'::float4;
|
|||||||
NaN
|
NaN
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
SELECT 'nan'::numeric::float4;
|
||||||
|
float4
|
||||||
|
--------
|
||||||
|
NaN
|
||||||
|
(1 row)
|
||||||
|
|
||||||
SELECT '' AS five, * FROM FLOAT4_TBL;
|
SELECT '' AS five, * FROM FLOAT4_TBL;
|
||||||
five | f1
|
five | f1
|
||||||
------+-------------
|
------+-------------
|
||||||
|
@ -119,6 +119,12 @@ SELECT 'nan'::float8 / 'nan'::float8;
|
|||||||
NaN
|
NaN
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
SELECT 'nan'::numeric::float8;
|
||||||
|
float8
|
||||||
|
--------
|
||||||
|
NaN
|
||||||
|
(1 row)
|
||||||
|
|
||||||
SELECT '' AS five, * FROM FLOAT8_TBL;
|
SELECT '' AS five, * FROM FLOAT8_TBL;
|
||||||
five | f1
|
five | f1
|
||||||
------+----------------------
|
------+----------------------
|
||||||
|
@ -123,6 +123,12 @@ SELECT 'nan'::float8 / 'nan'::float8;
|
|||||||
NaN
|
NaN
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
SELECT 'nan'::numeric::float8;
|
||||||
|
float8
|
||||||
|
--------
|
||||||
|
NaN
|
||||||
|
(1 row)
|
||||||
|
|
||||||
SELECT '' AS five, * FROM FLOAT8_TBL;
|
SELECT '' AS five, * FROM FLOAT8_TBL;
|
||||||
five | f1
|
five | f1
|
||||||
------+----------------------
|
------+----------------------
|
||||||
|
@ -123,6 +123,12 @@ SELECT 'nan'::float8 / 'nan'::float8;
|
|||||||
NaN
|
NaN
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
SELECT 'nan'::numeric::float8;
|
||||||
|
float8
|
||||||
|
--------
|
||||||
|
NaN
|
||||||
|
(1 row)
|
||||||
|
|
||||||
SELECT '' AS five, * FROM FLOAT8_TBL;
|
SELECT '' AS five, * FROM FLOAT8_TBL;
|
||||||
five | f1
|
five | f1
|
||||||
------+----------------------
|
------+----------------------
|
||||||
|
@ -119,6 +119,12 @@ SELECT 'nan'::float8 / 'nan'::float8;
|
|||||||
NaN
|
NaN
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
SELECT 'nan'::numeric::float8;
|
||||||
|
float8
|
||||||
|
--------
|
||||||
|
NaN
|
||||||
|
(1 row)
|
||||||
|
|
||||||
SELECT '' AS five, * FROM FLOAT8_TBL;
|
SELECT '' AS five, * FROM FLOAT8_TBL;
|
||||||
five | f1
|
five | f1
|
||||||
------+----------------------
|
------+----------------------
|
||||||
|
@ -40,7 +40,7 @@ SELECT ' INFINITY x'::float4;
|
|||||||
SELECT 'Infinity'::float4 + 100.0;
|
SELECT 'Infinity'::float4 + 100.0;
|
||||||
SELECT 'Infinity'::float4 / 'Infinity'::float4;
|
SELECT 'Infinity'::float4 / 'Infinity'::float4;
|
||||||
SELECT 'nan'::float4 / 'nan'::float4;
|
SELECT 'nan'::float4 / 'nan'::float4;
|
||||||
|
SELECT 'nan'::numeric::float4;
|
||||||
|
|
||||||
SELECT '' AS five, * FROM FLOAT4_TBL;
|
SELECT '' AS five, * FROM FLOAT4_TBL;
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ SELECT ' INFINITY x'::float8;
|
|||||||
SELECT 'Infinity'::float8 + 100.0;
|
SELECT 'Infinity'::float8 + 100.0;
|
||||||
SELECT 'Infinity'::float8 / 'Infinity'::float8;
|
SELECT 'Infinity'::float8 / 'Infinity'::float8;
|
||||||
SELECT 'nan'::float8 / 'nan'::float8;
|
SELECT 'nan'::float8 / 'nan'::float8;
|
||||||
|
SELECT 'nan'::numeric::float8;
|
||||||
|
|
||||||
SELECT '' AS five, * FROM FLOAT8_TBL;
|
SELECT '' AS five, * FROM FLOAT8_TBL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user