Skip to content

Commit 45f61d5

Browse files
committed
Reduced precision requirement to 7 digits
1 parent b6c7cf1 commit 45f61d5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pymatbridge/tests/test_precision.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_float64_roundtrip(self):
2323
for i in range(0,10):
2424
val = np.float64(rd.random())
2525
res = self.mlab.run_func('precision_pass.m', {'val':val})['result']
26-
npt.assert_almost_equal(res, val, decimal=8, err_msg="Float64 roundtrip error")
26+
npt.assert_almost_equal(res, val, decimal=7, err_msg="Float64 roundtrip error")
2727

2828
# Add two 64-bit floating number in Matlab and return the sum
2929
def test_float64_sum(self):
@@ -32,7 +32,7 @@ def test_float64_sum(self):
3232
val2 = np.float64(rd.random())
3333

3434
res = self.mlab.run_func('precision_sum.m', {'val1':val1, 'val2':val2})['result']
35-
npt.assert_almost_equal(res, val1 + val2, decimal=8, err_msg="Float64 sum error")
35+
npt.assert_almost_equal(res, val1 + val2, decimal=7, err_msg="Float64 sum error")
3636

3737
# Multiply two 64-bit floating number in Matlab and return the product
3838
def test_float64_multiply(self):
@@ -41,7 +41,7 @@ def test_float64_multiply(self):
4141
val2 = np.float64(rd.random())
4242

4343
res = self.mlab.run_func('precision_multiply.m', {'val1':val1, 'val2':val2})['result']
44-
npt.assert_almost_equal(res, val1 * val2, decimal=8, err_msg="Float64 multiply error")
44+
npt.assert_almost_equal(res, val1 * val2, decimal=7, err_msg="Float64 multiply error")
4545

4646
# Make a division in Matlab and return the results
4747
def test_float64_divide(self):
@@ -50,12 +50,12 @@ def test_float64_divide(self):
5050
val2 = np.float64(rd.random())
5151

5252
res = self.mlab.run_func('precision_divide.m', {'val1':val1, 'val2':val2})['result']
53-
npt.assert_almost_equal(res, val1 / val2, decimal=8, err_msg="Float64 divide error")
53+
npt.assert_almost_equal(res, val1 / val2, decimal=7, err_msg="Float64 divide error")
5454

5555
# Calculate the square root in Matlab and return the result
5656
def test_float64_sqrt(self):
5757
for i in range(0,10):
5858
val = np.float64(rd.random())
5959

6060
res = self.mlab.run_func('precision_sqrt.m', {'val':val})['result']
61-
npt.assert_almost_equal(res, np.sqrt(val), decimal=8, err_msg="Float64 square root error")
61+
npt.assert_almost_equal(res, np.sqrt(val), decimal=7, err_msg="Float64 square root error")

0 commit comments

Comments
 (0)