4 #ifndef __BTREE_UTILS_NUM_H__
5 #define __BTREE_UTILS_NUM_H__
50 int (*f_cmp) (
const void *,
const void *,
FmgrInfo *);
64 #define penalty_num(result,olower,oupper,nlower,nupper) do { \
67 if ( (nupper) > (oupper) ) \
68 tmp += ( ((double)nupper)*0.49F - ((double)oupper)*0.49F ); \
69 if ( (olower) > (nlower) ) \
70 tmp += ( ((double)olower)*0.49F - ((double)nlower)*0.49F ); \
73 (*(result)) += FLT_MIN; \
74 (*(result)) += (float) ( ((double)(tmp)) / ( (double)(tmp) + ( ((double)(oupper))*0.49F - ((double)(olower))*0.49F ) ) ); \
75 (*(result)) *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1)); \
85 #define INTERVAL_TO_SEC(ivp) \
86 (((double) (ivp)->time) / ((double) USECS_PER_SEC) + \
87 (ivp)->day * (24.0 * SECS_PER_HOUR) + \
88 (ivp)->month * (30.0 * SECS_PER_DAY))
90 #define GET_FLOAT_DISTANCE(t, arg1, arg2) fabs( ((float8) *((const t *) (arg1))) - ((float8) *((const t *) (arg2))) )
static const gbtree_vinfo tinfo
Interval * abs_interval(Interval *a)
void gbt_num_bin_union(Datum *u, GBT_NUMKEY *e, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
float8 gbt_num_distance(const GBT_NUMKEY_R *key, const void *query, bool is_leaf, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
GISTENTRY * gbt_num_fetch(GISTENTRY *entry, const gbtree_ninfo *tinfo)
bool gbt_num_consistent(const GBT_NUMKEY_R *key, const void *query, const StrategyNumber *strategy, bool is_leaf, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
bool gbt_num_same(const GBT_NUMKEY *a, const GBT_NUMKEY *b, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
GISTENTRY * gbt_num_compress(GISTENTRY *entry, const gbtree_ninfo *tinfo)
void * gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
GIST_SPLITVEC * gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)