mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-30 17:51:18 +08:00
Fixed precision on Windows
This commit is contained in:
@@ -755,7 +755,12 @@ normalize_l2(PG_FUNCTION_ARGS)
|
||||
Vector *a = PG_GETARG_VECTOR_P(0);
|
||||
float *ax = a->x;
|
||||
double norm = 0.0;
|
||||
#ifdef _MSC_VER
|
||||
/* Fix precision on Windows */
|
||||
double normf;
|
||||
#else
|
||||
float normf;
|
||||
#endif
|
||||
Vector *result;
|
||||
float *rx;
|
||||
|
||||
@@ -767,7 +772,7 @@ normalize_l2(PG_FUNCTION_ARGS)
|
||||
norm += (double) ax[i] * (double) ax[i];
|
||||
|
||||
norm = sqrt(norm);
|
||||
normf = (float) norm;
|
||||
normf = norm;
|
||||
|
||||
if (normf > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user