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!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...