i’m testing some wild idea of finding matches in quite a large dataset. part of the problem is that scaling of input is unknown, 123 might be correct match for 1.23 or for 12.3.
here’s an expression that returns me n=4 most significant digits of each float from the input array:
SELECT arrayMap(x -> if(x = 0, 0, floor(pow(10, 3 - floor(log10(abs(x)))) * abs(x)) * sign(x)), [10, 23, 11.1, 3783.3, -0.3213, 0, 9831982732196.318]) AS res ββresβββββββββββββββββββββββββββββββββ β [1000,2300,1110,3783,-3212,0,9831] β ββββββββββββββββββββββββββββββββββββββ