Hi Dan,

I'm not very familiar with how Solr implements function-queries, but I
agree this seems like a bug.

Taking a glance at the code it looks like most of the "math"
function-queries cast to floats, so I wonder whether this behavior
(intentional or not) wouldn't occur more widely too.  e.g. "sum",
"sub", "pow" all cast to float as well - would they be affected
similarly by the cast-related roundin that you're running into for
"mod"?

Anyway, I'd say file a JIRA ticket for the issue.  That should get
more eyes on the problem and maybe someone with more context can
correct my thoughts above.  If you're willing to write up a patch/PR
too I'd be happy to review!

Best,

Jason

On Thu, Aug 18, 2022 at 12:35 PM Dan Rosher <[email protected]> wrote:
>
> Hi,
>
> I was surprised when using the mod function query, the modulus was wrong on
> my largeish int.
>
> This was because the int was cast to float, meaning the modulus was wrong
> for any int above 2^24
>
> Should the mod function change to int modulus instead of float and have
> another fmod function (like c/c++)?
>
> Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to