V
V
Vyacheslav Shevchenko2021-03-23 15:45:24
Sphinx
Vyacheslav Shevchenko, 2021-03-23 15:45:24

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.6059e2e25d0d8192848258.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vyacheslav Shevchenko, 2021-03-27
@WebDev2030

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.

P
Puma Thailand, 2021-03-24
@opium

Bringing skin types you use

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question