
vec.precision( vector as vec.vector?, [precision as Number?] ) as vec.vector
Returns a new vector which is a copy of the input vector with reduced precision. The precision reduction is achieved by clearing the bottom (32 - precision) bits of the mantissa for each dimension's float value. This can be useful for reducing storage requirements or for creating approximate vector representations.
const vec1 = vec.vector([3.14159265, 2.71828182, 1.41421356]) vec.precision(vec1, 12) => "[ 3, 2.5, 1.375 ]"
const vec1 = vec.vector([3.14159265, 2.71828182, 1.41421356]) const reduced = vec.precision(vec1) String(vec1) + " VS " + String(reduced) => "[ 3.14159, 2.71828, 1.41421 ]" VS "[ 3.14062, 2.70312, 1.41406 ]"