Splunk Search

eval - inconsistent math result

splunk_zen
Builder

How is it possible that an eval expression which its components total weight is 100, breach that expected value?

For a given period, I'm getting a result of 101,

while expression components weights are (it totals to 100)

100*(0.08 + 0.03 + 0.12 + 0.16 + 0.06 + 0.18 + 0.06 + 0.06 + 0.25)

and there is not even one component value which exceeds 1.

| eval TimeoutScore=100*( 
0.08*(bw1sdpSdfPccCsApdex) 
+ 0.03*bw1sdpSdfPccMnCsApdex 
+ 0.12*bw1sdpSdfPccPsApdex 
+ 0.16*(0.5*bw1sdpSdfPpsCsApdex +0.5*bw2sdpSdfPpsCsApdex) 
+ 0.06*(0.5*bw1sdpSdfPpsMnCsApdex +0.5*bw2sdpSdfPpsMnCsApdex)
+ 0.18*(0.5*bw1sdpSdfPpsPsApdex + 0.5*bw2sdpSdfPpsPsApdex)
+ 0.06*(0.5*bw1sdpSdfPpsVisaCsApdex + 0.5*bw2sdpSdfPpsVisaCsApdex) 
+ 0.06*bw1careSdfMnApdex 
+ 0.25*(0.5*bw1sdpSdfSlrApdex + 0.5*bw2sdpSdfSlrApdex))
| stats sum(TimeoutScore) as TimeoutScore sum(bw1sdpSdfPccCsApdex) sum(bw1sdpSdfPccMnCsApdex)     sum(bw1sdpSdfPccPsApdex) sum(bw1sdpSdfPpsCsApdex) sum(bw2sdpSdfPpsCsApdex) sum(bw1sdpSdfPpsMnCsApdex) sum(bw2sdpSdfPpsMnCsApdex) sum(bw1sdpSdfPpsPsApdex) sum(bw2sdpSdfPpsPsApdex) sum(bw1sdpSdfPpsVisaCsApdex) sum(bw2sdpSdfPpsVisaCsApdex) sum(bw1careSdfMnApdex) sum(bw1sdpSdfSlrApdex) sum(bw2sdpSdfSlrApdex)


TimeoutScore    sum(bw1sdpSdfPccCsApdex)    sum(bw1sdpSdfPccMnCsApdex)  sum(bw1sdpSdfPccPsApdex)    sum(bw1sdpSdfPpsCsApdex)    sum(bw2sdpSdfPpsCsApdex)    sum(bw1sdpSdfPpsMnCsApdex)  sum(bw2sdpSdfPpsMnCsApdex)  sum(bw1sdpSdfPpsPsApdex)    sum(bw2sdpSdfPpsPsApdex)    sum(bw1sdpSdfPpsVisaCsApdex)    sum(bw2sdpSdfPpsVisaCsApdex)    sum(bw1careSdfMnApdex)  sum(bw1sdpSdfSlrApdex)  sum(bw2sdpSdfSlrApdex)
101 1   0.854839    0.972727    1   1   1   1   0.975410    1   1   1   0.983871    1   1

EDIT:
Thanks to kristian.kolb suggestion, this issue was solved replacing

| eval TimeoutScore=...

by

| eval TimeoutScore=exact(...)
Tags (2)
0 Karma
1 Solution

kristian_kolb
Ultra Champion

splunk_zen
Builder

Dammit... Forgot that could be the culprit.
If you promote the comment to an answer I will gladly accept it 🙂

0 Karma

kristian_kolb
Ultra Champion

Rounding errors? perhaps the exact() function for eval might help?

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonEvalFunctions

Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...