Prevent overflow at cost to speed

This commit is contained in:
Andrew Kane
2023-08-09 12:36:29 -07:00
parent 47e361a93d
commit 9ed7e63fb7
3 changed files with 14 additions and 5 deletions

View File

@@ -72,6 +72,12 @@ SELECT normalize_l2('[0,0]');
[0,0]
(1 row)
SELECT normalize_l2('[3e38]');
normalize_l2
--------------
[1]
(1 row)
SELECT l2_distance('[0,0]', '[3,4]');
l2_distance
-------------

View File

@@ -16,6 +16,7 @@ SELECT normalize_l2('[3,4]');
SELECT normalize_l2('[3,0]');
SELECT normalize_l2('[0,0.1]');
SELECT normalize_l2('[0,0]');
SELECT normalize_l2('[3e38]');
SELECT l2_distance('[0,0]', '[3,4]');
SELECT l2_distance('[0,0]', '[0,1]');