0

I have some fields of tfloat-type in solr.

But sometime its value is changed by solr probably.

In my case, I gave a value "812095000" Solr, however when I checked it in Solr-Admin, it showed the value was "812094980". I don't get it. Why changed?

And, can I get original values? I mean "812095000".

It looks that only if I give large number, this occurs.

  • Does this answer your question? [Is floating point math broken?](https://stackoverflow.com/questions/588004/is-floating-point-math-broken) – tripleee Jun 12 '22 at 16:55

1 Answers1

1

That's how floats work. Floats are not exact, and can't store all exact values. If you need to store a large integer, use long instead.

Regular 32-bit floats can't store the value 812095000 as you've discovered. Instead, use a type that suits the data you're inputting (if it's integers, use an integer or a long format, or use a double field if you need floating point numbers

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • Now I get it. Actually need to index point numbers, so I decided to use double field. Thanks for your advice. – Pathfinder Jun 09 '22 at 05:45