mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-12 15:46:54 +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);
|
Vector *a = PG_GETARG_VECTOR_P(0);
|
||||||
float *ax = a->x;
|
float *ax = a->x;
|
||||||
double norm = 0.0;
|
double norm = 0.0;
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
/* Fix precision on Windows */
|
||||||
|
double normf;
|
||||||
|
#else
|
||||||
float normf;
|
float normf;
|
||||||
|
#endif
|
||||||
Vector *result;
|
Vector *result;
|
||||||
float *rx;
|
float *rx;
|
||||||
|
|
||||||
@@ -767,7 +772,7 @@ normalize_l2(PG_FUNCTION_ARGS)
|
|||||||
norm += (double) ax[i] * (double) ax[i];
|
norm += (double) ax[i] * (double) ax[i];
|
||||||
|
|
||||||
norm = sqrt(norm);
|
norm = sqrt(norm);
|
||||||
normf = (float) norm;
|
normf = norm;
|
||||||
|
|
||||||
if (normf > 0)
|
if (normf > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user