-- unlike percentile values passed to tdigest_percentile(), values passed to -- the tdigest_percentile_of() functions are not validated and instead return -- hard-coded values for NaN/infinity \set VERBOSITY terse -- values are not checked anywhere, instead we just return NaN/-infinity/infinity SELECT tdigest_percentile_of(1.0::double precision, 10, 'NaN'::double precision); tdigest_percentile_of ----------------------- NaN (1 row) SELECT tdigest_percentile_of(1.0::double precision, 10, '-infinity'::double precision); tdigest_percentile_of ----------------------- 0 (1 row) SELECT tdigest_percentile_of(1.0::double precision, 10, 'infinity'::double precision); tdigest_percentile_of ----------------------- 1 (1 row) SELECT tdigest_percentile_of(1.0::double precision, 10, ARRAY['NaN', '-infinity', 'infinity']::double precision[]); tdigest_percentile_of ----------------------- {NaN,0,1} (1 row) SELECT tdigest_percentile_of('flags 1 count 3 compression 10 centroids 3 (1, 1) (2, 1) (3, 1)'::tdigest, 'NaN'::double precision); tdigest_percentile_of ----------------------- NaN (1 row) SELECT tdigest_percentile_of('flags 1 count 3 compression 10 centroids 3 (1, 1) (2, 1) (3, 1)'::tdigest, '-infinity'::double precision); tdigest_percentile_of ----------------------- 0 (1 row) SELECT tdigest_percentile_of('flags 1 count 3 compression 10 centroids 3 (1, 1) (2, 1) (3, 1)'::tdigest, 'infinity'::double precision); tdigest_percentile_of ----------------------- 1 (1 row) SELECT tdigest_percentile_of('flags 1 count 3 compression 10 centroids 3 (1, 1) (2, 1) (3, 1)'::tdigest, ARRAY['NaN', '-infinity', 'infinity']::double precision[]); tdigest_percentile_of ----------------------- {NaN,0,1} (1 row) -- the value/count API does not check the values either SELECT tdigest_percentile_of(1.0::double precision, 2::bigint, 10, 'NaN'::double precision); tdigest_percentile_of ----------------------- NaN (1 row) SELECT tdigest_percentile_of(1.0::double precision, 2::bigint, 10, '-infinity'::double precision); tdigest_percentile_of ----------------------- 0 (1 row) SELECT tdigest_percentile_of(1.0::double precision, 2::bigint, 10, 'infinity'::double precision); tdigest_percentile_of ----------------------- 1 (1 row) SELECT tdigest_percentile_of(1.0::double precision, 2::bigint, 10, ARRAY['NaN']::double precision[]); tdigest_percentile_of ----------------------- {NaN} (1 row) SELECT tdigest_percentile_of(1.0::double precision, 2::bigint, 10, ARRAY['-infinity']::double precision[]); tdigest_percentile_of ----------------------- {0} (1 row) SELECT tdigest_percentile_of(1.0::double precision, 2::bigint, 10, ARRAY['infinity']::double precision[]); tdigest_percentile_of ----------------------- {1} (1 row)