[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Simulavr-devel] [bug #47629] adc_diff_t25 tests 00 and 02 fail on 64bit
From: |
anonymous |
Subject: |
[Simulavr-devel] [bug #47629] adc_diff_t25 tests 00 and 02 fail on 64bit Ubuntu 14.04 |
Date: |
Tue, 05 Apr 2016 20:38:42 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0 |
URL:
<http://savannah.nongnu.org/bugs/?47629>
Summary: adc_diff_t25 tests 00 and 02 fail on 64bit Ubuntu
14.04
Project: Simulavr: an AVR simulator
Submitted by: None
Submitted on: Втр 05 Апр 2016 20:38:41
Category: Test Suite
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Component Version: simulavr
_______________________________________________________
Details:
Simulavr version: rel-1.1 branch (commit: 4d3c8c0fae3efa95)
Test suite fails on 64bit Ubuntu 14.04 with following errors:
======================================================================
FAIL: test_00 (adc_diff_t25.TestCase)
adc_diff_t25_attiny25::check adc conversion, differential channel, bipolar
mode
----------------------------------------------------------------------
Traceback (most recent call last):
File "adc_diff_t25.py", line 83, in test_00
self.assertValue(0.8, 1.0, 2.56, False)
File "adc_diff_t25.py", line 52, in assertValue
self.assertEqual(v, e, "expected adc value is 0x%x, got 0x%x" % (e, v))
AssertionError: expected adc value is 0x3d9, got 0x3d8
======================================================================
FAIL: test_02 (adc_diff_t25.TestCase)
adc_diff_t25_attiny25::check adc conversion, differential channel, unipolar
mode with IPR
----------------------------------------------------------------------
Traceback (most recent call last):
File "adc_diff_t25.py", line 147, in test_02
self.assertValue(1.0, 0.8, 2.56)
File "adc_diff_t25.py", line 52, in assertValue
self.assertEqual(v, e, "expected adc value is 0x%x, got 0x%x" % (e, v))
AssertionError: expected adc value is 0x4f, got 0x50
== Environment ==
Ubuntu 14.04.4 LTS (GNU/Linux 4.2.0-27-generic x86_64)
$ uname -a
Linux ubuntu64 4.2.0-27-generic #32~14.04.1-Ubuntu SMP Fri Jan 22 15:32:26 UTC
2016 x86_64 x86_64 x86_64 GNU/Linux
$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4
$ python --version
Python 2.7.6
== Investigation ==
Floating point calculations give slightly different result in C++ Simulavr
code and in Python tests. And after truncation of the fractional part, integer
results differ by 1.
The code from adc_diff_t25.py:
def assertValue(self, pValue, nValue, refValue, unipolar = True):
if unipolar:
rng = 1024
else:
rng = 512
v = self.sim.getWordByName(self.dev, "adc_value")
e = int(((pValue - nValue) / refValue) * rng) & 0x3ff
self.assertEqual(v, e, "expected adc value is 0x%x, got 0x%x" % (e, v))
Failure in test_00 is caused by following values:
v = 984
((pValue - nValue) / refValue) * rng = -39.9999999999999929 (after truncation
to int becomes -39 and not -40)
Failure in test_02 is caused by following values:
v = 80
((pValue - nValue) / refValue) * rng = 79.9999999999999858 (after truncation
to int becomes 79 and not 80)
Probably, the behavior described here takes place:
[http://www.viva64.com/en/b/0074/]
== Solution ==
Test voltage value(s) should be adjusted to produce a more stable result (I've
changed 0.8 to 0.79999).
The patch attached.
Best regards,
Igor A. Perminov
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Втр 05 Апр 2016 20:38:41 Name: fix_regress_amd64.patch Size: 1kB
By: None
<http://savannah.nongnu.org/bugs/download.php?file_id=36843>
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?47629>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Simulavr-devel] [bug #47629] adc_diff_t25 tests 00 and 02 fail on 64bit Ubuntu 14.04,
anonymous <=