Remove unnecessary uses of Abs()
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 7 Oct 2022 11:28:38 +0000 (13:28 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Fri, 7 Oct 2022 11:29:33 +0000 (13:29 +0200)
Use C standard abs() or fabs() instead.

Reviewed-by: Zhang Mingli <zmlpostgres@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/4beb42b5-216b-bce8-d452-d924d5794c63%40enterprisedb.com

26 files changed:
contrib/btree_gist/btree_date.c
contrib/btree_gist/btree_float8.c
contrib/btree_gist/btree_int2.c
contrib/btree_gist/btree_int4.c
contrib/btree_gist/btree_interval.c
contrib/btree_gist/btree_time.c
contrib/btree_gist/btree_ts.c
contrib/btree_gist/btree_utils_num.h
contrib/btree_gist/btree_utils_var.c
contrib/cube/cube.c
contrib/intarray/_int_gist.c
contrib/intarray/_intbig_gist.c
contrib/ltree/_ltree_gist.c
contrib/seg/seg.c
src/backend/access/gist/gistproc.c
src/backend/optimizer/geqo/geqo_erx.c
src/backend/partitioning/partbounds.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/numeric.c
src/backend/utils/adt/rangetypes_gist.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/tsgistidx.c
src/backend/utils/adt/tsrank.c
src/backend/utils/misc/guc.c
src/interfaces/ecpg/pgtypeslib/interval.c

index 455a265a497538f44c2dbedd8eb603cf945cfc95..68a4107dbf0858b07ff477d6b437347460ed5af9 100644 (file)
@@ -95,7 +95,7 @@ gdb_date_dist(const void *a, const void *b, FmgrInfo *flinfo)
                                                                                   DateADTGetDatum(*((const DateADT *) a)),
                                                                                   DateADTGetDatum(*((const DateADT *) b)));
 
-       return (float8) Abs(DatumGetInt32(diff));
+       return (float8) abs(DatumGetInt32(diff));
 }
 
 
@@ -123,7 +123,7 @@ date_dist(PG_FUNCTION_ARGS)
                                                                                   PG_GETARG_DATUM(0),
                                                                                   PG_GETARG_DATUM(1));
 
-       PG_RETURN_INT32(Abs(DatumGetInt32(diff)));
+       PG_RETURN_INT32(abs(DatumGetInt32(diff)));
 }
 
 
index b95a08e228bbfaf0def4a45003a035a2911ad014..081a719b0061c535e251a4e51fa71004e5728bac 100644 (file)
@@ -79,7 +79,7 @@ gbt_float8_dist(const void *a, const void *b, FmgrInfo *flinfo)
        r = arg1 - arg2;
        if (unlikely(isinf(r)) && !isinf(arg1) && !isinf(arg2))
                float_overflow_error();
-       return Abs(r);
+       return fabs(r);
 }
 
 
@@ -110,7 +110,7 @@ float8_dist(PG_FUNCTION_ARGS)
        if (unlikely(isinf(r)) && !isinf(a) && !isinf(b))
                float_overflow_error();
 
-       PG_RETURN_FLOAT8(Abs(r));
+       PG_RETURN_FLOAT8(fabs(r));
 }
 
 /**************************************************
index a91b95ff3985335bd42f1deb798c7bd377fde26d..fdbf156586c938d81afc535be4328c9b84fdd5f6 100644 (file)
@@ -105,7 +105,7 @@ int2_dist(PG_FUNCTION_ARGS)
                                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                                 errmsg("smallint out of range")));
 
-       ra = Abs(r);
+       ra = abs(r);
 
        PG_RETURN_INT16(ra);
 }
index 7ea98c478c73bb33343fabb9f4112f3446c291d5..8915fb5d0877235c7ce425371d19117b77a39777 100644 (file)
@@ -106,7 +106,7 @@ int4_dist(PG_FUNCTION_ARGS)
                                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                                 errmsg("integer out of range")));
 
-       ra = Abs(r);
+       ra = abs(r);
 
        PG_RETURN_INT32(ra);
 }
index c2bf82086df4e7a9998da87eb79c0e0e7acdbea7..2c98b330cd7dfad016d486eda770b5a526398bd6 100644 (file)
@@ -83,7 +83,7 @@ intr2num(const Interval *i)
 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));
 }
 
 /*
index fd8774a2f0856e0a1f2b0620213930121f540c85..d89401c0f51e42711c0a94b75badc4be3da83ac2 100644 (file)
@@ -118,7 +118,7 @@ gbt_time_dist(const void *a, const void *b, FmgrInfo *flinfo)
        i = DatumGetIntervalP(DirectFunctionCall2(time_mi_time,
                                                                                          TimeADTGetDatumFast(*aa),
                                                                                          TimeADTGetDatumFast(*bb)));
-       return (float8) Abs(INTERVAL_TO_SEC(i));
+       return fabs(INTERVAL_TO_SEC(i));
 }
 
 
index a51900941e5c95d4855cb7120961f6c9c9e6d24d..3f5ba91891d803160cafd8f341eda45a00063680 100644 (file)
@@ -123,7 +123,7 @@ gbt_ts_dist(const void *a, const void *b, FmgrInfo *flinfo)
        i = DatumGetIntervalP(DirectFunctionCall2(timestamp_mi,
                                                                                          TimestampGetDatumFast(*aa),
                                                                                          TimestampGetDatumFast(*bb)));
-       return (float8) Abs(INTERVAL_TO_SEC(i));
+       return fabs(INTERVAL_TO_SEC(i));
 }
 
 
index 415a7a6459a739c2b25469dc0429ac29b8a78f7d..11e892311eeb3398a30f7082ec3fdeefd066caf3 100644 (file)
@@ -87,7 +87,7 @@ typedef struct
         (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);
index 2886c08b85e405629524cd9a46a51bf7c42a4f57..3ef82d0e208ed2613e2600405f935a91d5b802f5 100644 (file)
@@ -426,7 +426,7 @@ gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
                        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;
                }
 
index 01c6a9c5563ebc806fe788f862407307f5ce6210..4f32c5dc1d59103757a3f05c61ce652e2b28ecf0 100644 (file)
@@ -925,7 +925,7 @@ rt_cube_size(NDBOX *a, double *size)
        {
                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;
 }
index 6378aa74b079fcd68ec0563260f74a66dc4368a8..f67699bfccc5a3173678470893edf0c8059bad77 100644 (file)
@@ -4,6 +4,7 @@
 #include "postgres.h"
 
 #include <limits.h>
+#include <math.h>
 
 #include "_int.h"
 #include "access/gist.h"
@@ -539,7 +540,7 @@ g_int_picksplit(PG_FUNCTION_ARGS)
                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);
 
index c9d8f9b84ddd385c7f5c551e5023c9618272b398..887940ca3586e0f32ad0462607f2e7b4832df94c 100644 (file)
@@ -3,6 +3,8 @@
  */
 #include "postgres.h"
 
+#include <math.h>
+
 #include "_int.h"
 #include "access/gist.h"
 #include "access/reloptions.h"
@@ -389,7 +391,7 @@ g_intbig_picksplit(PG_FUNCTION_ARGS)
                _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);
 
index 88d4623621912cdcc2467e47a7e2ed0b4677f744..385a10283b0448009574780ae45981c1690aec41 100644 (file)
@@ -7,6 +7,8 @@
  */
 #include "postgres.h"
 
+#include <math.h>
+
 #include "access/gist.h"
 #include "access/reloptions.h"
 #include "access/stratnum.h"
@@ -315,7 +317,7 @@ _ltree_picksplit(PG_FUNCTION_ARGS)
                _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);
 
index cb677e0ae51cf242e003825bea590dbc1b87a209..9b58675266abbe12decee42afbf67c6563265d8a 100644 (file)
@@ -952,7 +952,7 @@ restore(char *result, float val, int n)
        }
        else
        {
-               if (Abs(exp) <= 4)
+               if (abs(exp) <= 4)
                {
                        /*
                         * remove the decimal point from the mantissa and write the digits
@@ -1039,7 +1039,7 @@ restore(char *result, float val, int n)
                        }
                }
 
-               /* 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. */
index 22f2c1853706589e16a7bb21df551e408bb6b629..406c65d6ec229f38dd2a12d1f3e211fbb9ee3fab 100644 (file)
@@ -797,8 +797,8 @@ gist_box_picksplit(PG_FUNCTION_ARGS)
                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)));
                }
 
                /*
index cc0661365f6e78c4c422a71dcdd4972bbc8d12b7..21ad7854118bb8cfdee1e8b7a560ecfa19845873 100644 (file)
@@ -162,7 +162,7 @@ gimme_edge(PlannerInfo *root, Gene gene1, Gene gene2, Edge *edge_table)
 
        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 */
@@ -249,14 +249,14 @@ remove_gene(PlannerInfo *root, Gene gene, Edge edge, Edge *edge_table)
 
        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--;
@@ -307,7 +307,7 @@ gimme_gene(PlannerInfo *root, Edge edge, Edge *edge_table)
                 * converting to absolute values
                 */
                if (friend < 0)
-                       return (Gene) Abs(friend);
+                       return (Gene) abs(friend);
 
 
                /*
index a49e97a225108160f5b8f89fb66d3edb661d5471..0823fa7b1dbab756ac17fd90d7d26699dd1494f6 100644 (file)
@@ -3206,7 +3206,7 @@ check_new_partition_bound(char *relname, Relation parent,
                                                                 * datums list.
                                                                 */
                                                                PartitionRangeDatum *datum =
-                                                               list_nth(spec->upperdatums, Abs(cmpval) - 1);
+                                                               list_nth(spec->upperdatums, abs(cmpval) - 1);
 
                                                                /*
                                                                 * The new partition overlaps with the
@@ -3232,7 +3232,7 @@ check_new_partition_bound(char *relname, Relation parent,
                                                 * 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];
index 904ac2353cf9a0e8ea7f15789b69f8b3fc031df7..a8b025f43fa176719aaa0b37dfc6d962d5535eb7 100644 (file)
@@ -448,14 +448,14 @@ AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros)
        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;
 
@@ -490,7 +490,7 @@ AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros)
                 * 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;
        }
index 85ee9ec4260613a6973f102badd1932c262954a1..cafe1ac47b04f5d27ce69f9b26708a3de112ed6b 100644 (file)
@@ -8870,7 +8870,7 @@ div_var_fast(const NumericVar *var1, const NumericVar *var2,
                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))
                        {
                                /*
@@ -8923,7 +8923,7 @@ div_var_fast(const NumericVar *var1, const NumericVar *var2,
                                fquotient = fdividend * fdivisorinverse;
                                qdigit = (fquotient >= 0.0) ? ((int) fquotient) :
                                        (((int) fquotient) - 1);        /* truncate towards -infinity */
-                               maxdiv += Abs(qdigit);
+                               maxdiv += abs(qdigit);
                        }
 
                        /*
@@ -9107,7 +9107,7 @@ div_var_int(const NumericVar *var, int ival, int ival_weight,
         * 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)
        {
@@ -9948,7 +9948,7 @@ exp_var(const NumericVar *arg, NumericVar *result, int rscale)
 
        /* 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,
@@ -9966,15 +9966,15 @@ exp_var(const NumericVar *arg, NumericVar *result, int rscale)
         * 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;
@@ -10116,7 +10116,7 @@ estimate_ln_dweight(const NumericVar *var)
                         *----------
                         */
                        ln_var = log((double) digits) + dweight * 2.302585092994046;
-                       ln_dweight = (int) log10(Abs(ln_var));
+                       ln_dweight = (int) log10(fabs(ln_var));
                }
                else
                {
@@ -10427,7 +10427,7 @@ power_var(const NumericVar *base, const NumericVar *exp, NumericVar *result)
        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,
@@ -10583,7 +10583,7 @@ power_var_int(const NumericVar *base, int exp, NumericVar *result, int rscale)
         * 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);
index 777fdf0e2e966fef634b66e2b09d4456d3816f13..5996de417de5f3788be6ae1bf5b634260a15e527 100644 (file)
@@ -743,8 +743,8 @@ range_gist_picksplit(PG_FUNCTION_ARGS)
                        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;
index 234fb665806292a30cc451743a6fca7d34af18fd..69e0fb98f5b2c9e2e5f637c2489501c1e7b8a63d 100644 (file)
@@ -7835,7 +7835,7 @@ brincostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
                                double          varCorrelation = 0.0;
 
                                if (sslot.nnumbers > 0)
-                                       varCorrelation = Abs(sslot.numbers[0]);
+                                       varCorrelation = fabs(sslot.numbers[0]);
 
                                if (varCorrelation > *indexCorrelation)
                                        *indexCorrelation = varCorrelation;
index 9799647e1a54431c220ade8ba9c8af07f15c5a6b..d8552a1f186425573365757807eead42772c79c2 100644 (file)
@@ -3290,7 +3290,7 @@ interval_mul(PG_FUNCTION_ARGS)
         * 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;
@@ -3347,7 +3347,7 @@ interval_div(PG_FUNCTION_ARGS)
        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;
index fe438f1c4d3f0ade32cfcf1ca0c279418845b619..728b5e9e713040292d68e192f38c973fece1646d 100644 (file)
@@ -700,7 +700,7 @@ gtsvector_picksplit(PG_FUNCTION_ARGS)
                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);
 
index 3858fc59281cdcc952a69f6cd9961f94c479c7e3..e353669dbaa122d6cf34fd345690c104019d6a05 100644 (file)
@@ -257,7 +257,7 @@ calc_rank_and(const float *w, TSVector t, TSQuery q)
                                {
                                        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;
index 013576603598bc2e017d3c62456505bbbb59113d..f997ec0f822f172602d70385632e98116f481d14 100644 (file)
@@ -5378,7 +5378,7 @@ estimate_variable_size(struct config_generic *gconf)
                                 * 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;
index 73bde94aaf0d83d56fa23248aa9dde5e5b764c19..dc083c13272b5e60ec99c69ddbdc6fbdbc947738 100644 (file)
@@ -742,9 +742,9 @@ AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros)
        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);
        }
 }