diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-22 13:48:29 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-22 13:48:29 +0000 |
commit | 6d1f5070ce97d76452ba48c2baa27d8f818a1545 (patch) | |
tree | 798d53affab24a696799ac9e40404332b54eaab5 /tests/float/math_fun.py | |
parent | bd9c1ad601aceaa1a74c32790df883b12c43348d (diff) | |
download | micropython-6d1f5070ce97d76452ba48c2baa27d8f818a1545.tar.gz micropython-6d1f5070ce97d76452ba48c2baa27d8f818a1545.zip |
lib/libm: Add frexp and modf functions; use in stmhal; add tests.
Addresses issue #1081.
Diffstat (limited to 'tests/float/math_fun.py')
-rw-r--r-- | tests/float/math_fun.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/float/math_fun.py b/tests/float/math_fun.py index 7e5001ad03..03ee8e85d2 100644 --- a/tests/float/math_fun.py +++ b/tests/float/math_fun.py @@ -33,7 +33,6 @@ functions = [('sqrt', sqrt, p_test_values), ('ceil', ceil, test_values), ('fabs', fabs, test_values), ('floor', floor, test_values), - #('frexp', frexp, test_values), ('trunc', trunc, test_values) ] @@ -42,6 +41,16 @@ for function_name, function, test_vals in functions: for value in test_vals: print("{:.5g}".format(function(value))) +tuple_functions = [('frexp', frexp, test_values), + ('modf', modf, test_values), + ] + +for function_name, function, test_vals in tuple_functions: + print(function_name) + for value in test_vals: + x, y = function(value) + print("{:.5g} {:.5g}".format(x, y)) + binary_functions = [('copysign', copysign, [(23., 42.), (-23., 42.), (23., -42.), (-23., -42.), (1., 0.0), (1., -0.0)]) ] |