Answer the question
In order to leave comments, you need to log in
Why is the wrong number written to the float attribute?
I write the sphinx field 28847244309.74 into float, 28847245312.000000 is written, while this integer 2884724430974 is written normally. Why can this be? I assume that it's just that a floating-point number does not fit into the field, but it seems to fit.
Answer the question
In order to leave comments, you need to log in
My number is 28847244309.74 . Under the float in the sphinx, 32 bits or 4 bytes are allocated. Even just an integer takes 35 bits. And for float, you still need to write down the position of the comma, the + or - sign, and the mantissa (fractional part), so there simply wasn’t enough memory. In my case, multiplying by 1000 and writing to bigint solved the problem, but if the fraction needs to be saved directly, then there is already a problem.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question