From b12cd121a5d63c0328f3e78c17f1677721f6b0e5 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sun, 14 Apr 2024 23:33:27 -0700 Subject: [PATCH] Use fabsf for l1_distance --- src/sparsevec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sparsevec.c b/src/sparsevec.c index 6ebdfba..82b52a1 100644 --- a/src/sparsevec.c +++ b/src/sparsevec.c @@ -807,9 +807,9 @@ sparsevec_l1_distance(PG_FUNCTION_ARGS) bi = b->indices[j]; if (ai == bi) - distance += fabs(ax[i] - bx[j]); + distance += fabsf(ax[i] - bx[j]); else if (ai > bi) - distance += fabs(bx[j]); + distance += fabsf(bx[j]); /* Update start for next iteration */ if (ai >= bi) @@ -821,11 +821,11 @@ sparsevec_l1_distance(PG_FUNCTION_ARGS) } if (ai != bi) - distance += fabs(ax[i]); + distance += fabsf(ax[i]); } for (int j = bpos; j < b->nnz; j++) - distance += fabs(bx[j]); + distance += fabsf(bx[j]); PG_RETURN_FLOAT8(distance); }