#include "utils/builtins.h"
#include "utils/date.h"
#include "utils/datum.h"
+#include "utils/float.h"
#include "utils/inet.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
float a1 = PG_GETARG_FLOAT4(0);
float a2 = PG_GETARG_FLOAT4(1);
+ /* if both values are NaN, then we consider them the same */
+ if (isnan(a1) && isnan(a2))
+ PG_RETURN_FLOAT8(0.0);
+
+ /* if one value is NaN, use infinite distance */
+ if (isnan(a1) || isnan(a2))
+ PG_RETURN_FLOAT8(get_float8_infinity());
+
/*
* We know the values are range boundaries, but the range may be collapsed
* (i.e. single points), with equal values.
double a1 = PG_GETARG_FLOAT8(0);
double a2 = PG_GETARG_FLOAT8(1);
+ /* if both values are NaN, then we consider them the same */
+ if (isnan(a1) && isnan(a2))
+ PG_RETURN_FLOAT8(0.0);
+
+ /* if one value is NaN, use infinite distance */
+ if (isnan(a1) || isnan(a2))
+ PG_RETURN_FLOAT8(get_float8_infinity());
+
/*
* We know the values are range boundaries, but the range may be collapsed
* (i.e. single points), with equal values.
(1 row)
VACUUM brintest_multi; -- force a summarization cycle in brinidx
+-- Try inserting a values with NaN, to test distance calculation.
+insert into public.brintest_multi (float4col) values (real 'nan');
+insert into public.brintest_multi (float8col) values (real 'nan');
UPDATE brintest_multi SET int8col = int8col * int4col;
-- Tests for brin_summarize_new_values
SELECT brin_summarize_new_values('brintest_multi'); -- error, not an index
SELECT brin_desummarize_range('brinidx_multi', 0);
VACUUM brintest_multi; -- force a summarization cycle in brinidx
+-- Try inserting a values with NaN, to test distance calculation.
+insert into public.brintest_multi (float4col) values (real 'nan');
+insert into public.brintest_multi (float8col) values (real 'nan');
+
UPDATE brintest_multi SET int8col = int8col * int4col;
-- Tests for brin_summarize_new_values