vec_distance_cosine function can sometimes return negative values. Apparently it is a result of a rounding error, but still, it looks strange and probably can lead to unexpected results when used in an application.
set @x=vec_fromtext('[94.542572,8.735560,60.050098,74.043800,90.068710,28.212160,70.854660,69.636841,35.620232,69.190628]');
|
select vec_distance_cosine(@x,@x);
|
bb-11.6-MDEV-32887-vector e19526802732b5723664b17ac026a1ea36f99dce
|
MariaDB [test]> select vec_distance_cosine(@x,@x);
|
+----------------------------+
|
| vec_distance_cosine(@x,@x) |
|
+----------------------------+
|
| -0.00000011920928955078125 |
|
+----------------------------+
|
1 row in set (0.001 sec)
|