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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...