Fixed infinite values with vector addition and subtraction

This commit is contained in:
Andrew Kane
2023-05-31 13:54:19 -07:00
parent dee2c4feb1
commit 0ef0467a0f
4 changed files with 15 additions and 0 deletions

View File

@@ -656,6 +656,10 @@ vector_add(PG_FUNCTION_ARGS)
for (int i = 0, imax = a->dim; i < imax; i++)
rx[i] = ax[i] + bx[i];
for (int i = 0, imax = a->dim; i < imax; i++)
if (isinf(rx[i]))
float_overflow_error();
PG_RETURN_POINTER(result);
}
@@ -682,6 +686,10 @@ vector_sub(PG_FUNCTION_ARGS)
for (int i = 0, imax = a->dim; i < imax; i++)
rx[i] = ax[i] - bx[i];
for (int i = 0, imax = a->dim; i < imax; i++)
if (isinf(rx[i]))
float_overflow_error();
PG_RETURN_POINTER(result);
}