@nittalasub, I have converted @DalJeanis' comment to answer. Please accept to mark this question as answered. Kindly also up vote other comments that helped.
@DalJeanis, I need to take not just Splunk lessons from you but maths also 🙂
How about dividend < divisor? like (3/7)?
3%7 is 3, so (3%7)/7 = 3/7
The formula only fails (potentially)for negative numbers.
Depending on implementation -3%7 can be considered to be either -3 or +4. Those two numbers are identities in mod 7 ring theory and whatever the other relevant branches of discrete math are.... but not when you are calculating real world stuff.
So, for safety, if I couldn't run a quick test, I'd end up coding that as...
Following is the run anywhere search. While modular division is possible, you are actually looking just to extract decimal places.
| makeresults | eval dividend=7 | eval divisor=2 | eval value=dividend/divisor | eval remainder=dividend%divisor | eval quotient=replace(value,"(\d+).(\d+)","\1") | eval decimal=replace(value,"(\d+)(\.\d+)","0\2") | table dividend divisor value remainder quotient decimal
Following are the results:
dividend divisor value remainder quotient decimal 7 2 3.5 1 3 0.5