DateADTGetDatum(*((const DateADT *) a)),
DateADTGetDatum(*((const DateADT *) b)));
- return (float8) Abs(DatumGetInt32(diff));
+ return (float8) abs(DatumGetInt32(diff));
}
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1));
- PG_RETURN_INT32(Abs(DatumGetInt32(diff)));
+ PG_RETURN_INT32(abs(DatumGetInt32(diff)));
}
r = arg1 - arg2;
if (unlikely(isinf(r)) && !isinf(arg1) && !isinf(arg2))
float_overflow_error();
- return Abs(r);
+ return fabs(r);
}
if (unlikely(isinf(r)) && !isinf(a) && !isinf(b))
float_overflow_error();
- PG_RETURN_FLOAT8(Abs(r));
+ PG_RETURN_FLOAT8(fabs(r));
}
/**************************************************
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("smallint out of range")));
- ra = Abs(r);
+ ra = abs(r);
PG_RETURN_INT16(ra);
}
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("integer out of range")));
- ra = Abs(r);
+ ra = abs(r);
PG_RETURN_INT32(ra);
}
static float8
gbt_intv_dist(const void *a, const void *b, FmgrInfo *flinfo)
{
- return (float8) Abs(intr2num((const Interval *) a) - intr2num((const Interval *) b));
+ return fabs(intr2num((const Interval *) a) - intr2num((const Interval *) b));
}
/*
i = DatumGetIntervalP(DirectFunctionCall2(time_mi_time,
TimeADTGetDatumFast(*aa),
TimeADTGetDatumFast(*bb)));
- return (float8) Abs(INTERVAL_TO_SEC(i));
+ return fabs(INTERVAL_TO_SEC(i));
}
i = DatumGetIntervalP(DirectFunctionCall2(timestamp_mi,
TimestampGetDatumFast(*aa),
TimestampGetDatumFast(*bb)));
- return (float8) Abs(INTERVAL_TO_SEC(i));
+ return fabs(INTERVAL_TO_SEC(i));
}
(ivp)->day * (24.0 * SECS_PER_HOUR) + \
(ivp)->month * (30.0 * SECS_PER_DAY))
-#define GET_FLOAT_DISTANCE(t, arg1, arg2) Abs( ((float8) *((const t *) (arg1))) - ((float8) *((const t *) (arg2))) )
+#define GET_FLOAT_DISTANCE(t, arg1, arg2) fabs( ((float8) *((const t *) (arg1))) - ((float8) *((const t *) (arg2))) )
extern Interval *abs_interval(Interval *a);
tmp[1] = (unsigned char) (((VARSIZE(uk.lower) - VARHDRSZ) <= ul) ? 0 : (VARDATA(uk.lower)[ul]));
tmp[2] = (unsigned char) (((VARSIZE(ok.upper) - VARHDRSZ) <= ul) ? 0 : (VARDATA(ok.upper)[ul]));
tmp[3] = (unsigned char) (((VARSIZE(uk.upper) - VARHDRSZ) <= ul) ? 0 : (VARDATA(uk.upper)[ul]));
- dres = Abs(tmp[0] - tmp[1]) + Abs(tmp[3] - tmp[2]);
+ dres = abs(tmp[0] - tmp[1]) + abs(tmp[3] - tmp[2]);
dres /= 256.0;
}
{
result = 1.0;
for (i = 0; i < DIM(a); i++)
- result *= Abs(UR_COORD(a, i) - LL_COORD(a, i));
+ result *= fabs(UR_COORD(a, i) - LL_COORD(a, i));
}
*size = result;
}
#include "postgres.h"
#include <limits.h>
+#include <math.h>
#include "_int.h"
#include "access/gist.h"
union_d = inner_int_union(datum_r, datum_alpha);
rt__int_size(union_d, &size_beta);
pfree(union_d);
- costvector[i - 1].cost = Abs((size_alpha - size_l) - (size_beta - size_r));
+ costvector[i - 1].cost = fabs((size_alpha - size_l) - (size_beta - size_r));
}
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
*/
#include "postgres.h"
+#include <math.h>
+
#include "_int.h"
#include "access/gist.h"
#include "access/reloptions.h"
_j = GETENTRY(entryvec, j);
size_alpha = hemdist(datum_l, _j, siglen);
size_beta = hemdist(datum_r, _j, siglen);
- costvector[j - 1].cost = Abs(size_alpha - size_beta);
+ costvector[j - 1].cost = abs(size_alpha - size_beta);
}
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
*/
#include "postgres.h"
+#include <math.h>
+
#include "access/gist.h"
#include "access/reloptions.h"
#include "access/stratnum.h"
_j = GETENTRY(entryvec, j);
size_alpha = hemdist(datum_l, _j, siglen);
size_beta = hemdist(datum_r, _j, siglen);
- costvector[j - 1].cost = Abs(size_alpha - size_beta);
+ costvector[j - 1].cost = abs(size_alpha - size_beta);
}
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
}
else
{
- if (Abs(exp) <= 4)
+ if (abs(exp) <= 4)
{
/*
* remove the decimal point from the mantissa and write the digits
}
}
- /* do nothing for Abs(exp) > 4; %e must be OK */
+ /* do nothing for abs(exp) > 4; %e must be OK */
/* just get rid of zeroes after [eE]- and +zeroes after [Ee]. */
/* ... this is not done yet. */
for (i = 0; i < commonEntriesCount; i++)
{
box = DatumGetBoxP(entryvec->vector[commonEntries[i].index].key);
- commonEntries[i].delta = Abs(float8_mi(box_penalty(leftBox, box),
- box_penalty(rightBox, box)));
+ commonEntries[i].delta = fabs(float8_mi(box_penalty(leftBox, box),
+ box_penalty(rightBox, box)));
}
/*
for (i = 0; i < edges; i++)
{
- if ((Gene) Abs(edge_table[city1].edge_list[i]) == city2)
+ if ((Gene) abs(edge_table[city1].edge_list[i]) == city2)
{
/* mark shared edges as negative */
for (i = 0; i < edge.unused_edges; i++)
{
- possess_edge = (int) Abs(edge.edge_list[i]);
+ possess_edge = abs(edge.edge_list[i]);
genes_remaining = edge_table[possess_edge].unused_edges;
/* find the input gene in all edge_lists and delete it */
for (j = 0; j < genes_remaining; j++)
{
- if ((Gene) Abs(edge_table[possess_edge].edge_list[j]) == gene)
+ if ((Gene) abs(edge_table[possess_edge].edge_list[j]) == gene)
{
edge_table[possess_edge].unused_edges--;
* converting to absolute values
*/
if (friend < 0)
- return (Gene) Abs(friend);
+ return (Gene) abs(friend);
/*
* datums list.
*/
PartitionRangeDatum *datum =
- list_nth(spec->upperdatums, Abs(cmpval) - 1);
+ list_nth(spec->upperdatums, abs(cmpval) - 1);
/*
* The new partition overlaps with the
* if we have equality, point to the first one.
*/
datum = cmpval == 0 ? linitial(spec->lowerdatums) :
- list_nth(spec->lowerdatums, Abs(cmpval) - 1);
+ list_nth(spec->lowerdatums, abs(cmpval) - 1);
overlap = true;
overlap_location = datum->location;
with = boundinfo->indexes[offset + 1];
Assert(precision >= 0);
if (fillzeros)
- cp = pg_ultostr_zeropad(cp, Abs(sec), 2);
+ cp = pg_ultostr_zeropad(cp, abs(sec), 2);
else
- cp = pg_ultostr(cp, Abs(sec));
+ cp = pg_ultostr(cp, abs(sec));
/* fsec_t is just an int32 */
if (fsec != 0)
{
- int32 value = Abs(fsec);
+ int32 value = abs(fsec);
char *end = &cp[precision + 1];
bool gotnonzero = false;
* which will generate a correct answer in the minimum valid width.
*/
if (value)
- return pg_ultostr(cp, Abs(fsec));
+ return pg_ultostr(cp, abs(fsec));
return end;
}
if (qdigit != 0)
{
/* Do we need to normalize now? */
- maxdiv += Abs(qdigit);
+ maxdiv += abs(qdigit);
if (maxdiv > (INT_MAX - INT_MAX / NBASE - 1) / (NBASE - 1))
{
/*
fquotient = fdividend * fdivisorinverse;
qdigit = (fquotient >= 0.0) ? ((int) fquotient) :
(((int) fquotient) - 1); /* truncate towards -infinity */
- maxdiv += Abs(qdigit);
+ maxdiv += abs(qdigit);
}
/*
* become as large as divisor * NBASE - 1, and so it requires a 64-bit
* integer if this exceeds UINT_MAX.
*/
- divisor = Abs(ival);
+ divisor = abs(ival);
if (divisor <= UINT_MAX / NBASE)
{
/* Guard against overflow/underflow */
/* If you change this limit, see also power_var()'s limit */
- if (Abs(val) >= NUMERIC_MAX_RESULT_SCALE * 3)
+ if (fabs(val) >= NUMERIC_MAX_RESULT_SCALE * 3)
{
if (val > 0)
ereport(ERROR,
* Reduce x to the range -0.01 <= x <= 0.01 (approximately) by dividing by
* 2^ndiv2, to improve the convergence rate of the Taylor series.
*
- * Note that the overflow check above ensures that Abs(x) < 6000, which
+ * Note that the overflow check above ensures that fabs(x) < 6000, which
* means that ndiv2 <= 20 here.
*/
- if (Abs(val) > 0.01)
+ if (fabs(val) > 0.01)
{
ndiv2 = 1;
val /= 2;
- while (Abs(val) > 0.01)
+ while (fabs(val) > 0.01)
{
ndiv2++;
val /= 2;
*----------
*/
ln_var = log((double) digits) + dweight * 2.302585092994046;
- ln_dweight = (int) log10(Abs(ln_var));
+ ln_dweight = (int) log10(fabs(ln_var));
}
else
{
val = numericvar_to_double_no_overflow(&ln_num);
/* initial overflow/underflow test with fuzz factor */
- if (Abs(val) > NUMERIC_MAX_RESULT_SCALE * 3.01)
+ if (fabs(val) > NUMERIC_MAX_RESULT_SCALE * 3.01)
{
if (val > 0)
ereport(ERROR,
* Now we can proceed with the multiplications.
*/
neg = (exp < 0);
- mask = Abs(exp);
+ mask = abs(exp);
init_var(&base_prod);
set_var_from_var(base, &base_prod);
emptyCount = total_count - nonEmptyCount;
if (infCount > 0 && nonInfCount > 0 &&
- (Abs(infCount - nonInfCount) <=
- Abs(emptyCount - nonEmptyCount)))
+ (abs(infCount - nonInfCount) <=
+ abs(emptyCount - nonEmptyCount)))
{
classes_groups[CLS_NORMAL] = SPLIT_RIGHT;
classes_groups[CLS_CONTAIN_EMPTY] = SPLIT_RIGHT;
double varCorrelation = 0.0;
if (sslot.nnumbers > 0)
- varCorrelation = Abs(sslot.numbers[0]);
+ varCorrelation = fabs(sslot.numbers[0]);
if (varCorrelation > *indexCorrelation)
*indexCorrelation = varCorrelation;
* cascade from months and days. It might still be >24 if the combination
* of cascade and the seconds factor operation itself.
*/
- if (Abs(sec_remainder) >= SECS_PER_DAY)
+ if (fabs(sec_remainder) >= SECS_PER_DAY)
{
result->day += (int) (sec_remainder / SECS_PER_DAY);
sec_remainder -= (int) (sec_remainder / SECS_PER_DAY) * SECS_PER_DAY;
sec_remainder = (orig_day / factor - result->day +
month_remainder_days - (int) month_remainder_days) * SECS_PER_DAY;
sec_remainder = TSROUND(sec_remainder);
- if (Abs(sec_remainder) >= SECS_PER_DAY)
+ if (fabs(sec_remainder) >= SECS_PER_DAY)
{
result->day += (int) (sec_remainder / SECS_PER_DAY);
sec_remainder -= (int) (sec_remainder / SECS_PER_DAY) * SECS_PER_DAY;
costvector[j - 1].pos = j;
size_alpha = hemdistcache(&(cache[seed_1]), &(cache[j]), siglen);
size_beta = hemdistcache(&(cache[seed_2]), &(cache[j]), siglen);
- costvector[j - 1].cost = Abs(size_alpha - size_beta);
+ costvector[j - 1].cost = abs(size_alpha - size_beta);
}
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
{
for (p = 0; p < lenct; p++)
{
- dist = Abs((int) WEP_GETPOS(post[l]) - (int) WEP_GETPOS(ct[p]));
+ dist = abs((int) WEP_GETPOS(post[l]) - (int) WEP_GETPOS(ct[p]));
if (dist || (dist == 0 && (pos[i] == POSNULL || pos[k] == POSNULL)))
{
float curw;
* small values. Maximum value is 2147483647, i.e. 10 chars.
* Include one byte for sign.
*/
- if (Abs(*conf->variable) < 1000)
+ if (abs(*conf->variable) < 1000)
valsize = 3 + 1;
else
valsize = 10 + 1;
else
{
if (fillzeros)
- sprintf(cp, "%02d.%0*d", abs(sec), precision, (int) Abs(fsec));
+ sprintf(cp, "%02d.%0*d", abs(sec), precision, abs(fsec));
else
- sprintf(cp, "%d.%0*d", abs(sec), precision, (int) Abs(fsec));
+ sprintf(cp, "%d.%0*d", abs(sec), precision, abs(fsec));
TrimTrailingZeros(cp);
}
}