Thu, Apr 04, 2019 at 04:53:01PM CEST, jurbanov(a)redhat.com wrote:
From: Jozef Urbanovsky <jurbanov(a)redhat.com>
Rate_deviation was using int division instead of float, therefore
truncation caused error in deviation calculation
Signed-off-by: Jozef Urbanovsky <jurbanov(a)redhat.com>
---
test_modules/Netperf.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test_modules/Netperf.py b/test_modules/Netperf.py
index 8e66215..5a6d55b 100644
--- a/test_modules/Netperf.py
+++ b/test_modules/Netperf.py
@@ -519,7 +519,7 @@ class Netperf(TestGeneric):
rate_deviation = 2*res_data["std_deviation"]
elif len(rates) == 1 and self._confidence is not None:
result = results[0]
- rate_deviation = rate * (int(result["confidence"][1]) / 100)
+ rate_deviation = rate * (float(result["confidence"][1]) / 100)
else:
rate_deviation = 0.0
Maybe I'm missing something here, but according to [1], the float
division is done if operator is '/'. The float conversion should
not be necessary.
Also a quick check show something different:
$ python3
Python 3.6.8 (default, Mar 21 2019, 10:08:12)
[GCC 8.3.1 20190223 (Red Hat 8.3.1-2)] on linux
Type "help", "copyright", "credits" or "license"
for more information.
>> 3/4
0.75
>> int(3)/4
0.75
>> 3//4
0
>>
[1]
https://www.python.org/dev/peps/pep-0238/#semantics-of-true-division