summaryrefslogtreecommitdiffstatshomepage
path: root/tests/float/math_fun.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-12-18 14:44:02 +0000
committerDamien George <damien.p.george@gmail.com>2014-12-18 14:44:02 +0000
commitf04329e93b7bfa5462f232832d64aac3dc52d5db (patch)
tree96b06142670e0bb1ddfddcd353872f4612954bf8 /tests/float/math_fun.py
parent6936f4626c8748c077ad2c63827d4deeb43b867d (diff)
downloadmicropython-f04329e93b7bfa5462f232832d64aac3dc52d5db.tar.gz
micropython-f04329e93b7bfa5462f232832d64aac3dc52d5db.zip
lib/libm: Add acosh, asinh, atanh, tan; get working with stmhal.
acoshf, asinhf, atanhf were added from musl. mathsincos.c was split up into its original, separate files (from newlibe-nano-2). tan was added. All of the important missing float functions are now implemented, and pyboard now passes tests/float/math_fun.py (finally!).
Diffstat (limited to 'tests/float/math_fun.py')
-rw-r--r--tests/float/math_fun.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/float/math_fun.py b/tests/float/math_fun.py
index fa111e33e3..7e5001ad03 100644
--- a/tests/float/math_fun.py
+++ b/tests/float/math_fun.py
@@ -8,18 +8,19 @@ except ImportError:
sys.exit()
test_values = [-100., -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.]
+test_values_small = [-10., -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 10.] # so we don't overflow 32-bit precision
p_test_values = [0.1, 0.5, 1.23456]
unit_range_test_values = [-1., -0.75, -0.5, -0.25, 0., 0.25, 0.5, 0.75, 1.]
functions = [('sqrt', sqrt, p_test_values),
- ('exp', exp, test_values),
- ('expm1', expm1, test_values),
+ ('exp', exp, test_values_small),
+ ('expm1', expm1, test_values_small),
('log', log, p_test_values),
('log2', log2, p_test_values),
('log10', log10, p_test_values),
- ('cosh', cosh, test_values),
- ('sinh', sinh, test_values),
- ('tanh', tanh, test_values),
+ ('cosh', cosh, test_values_small),
+ ('sinh', sinh, test_values_small),
+ ('tanh', tanh, test_values_small),
('acosh', acosh, [1.0, 5.0, 1.0]),
('asinh', asinh, test_values),
('atanh', atanh, [-0.99, -0.5, 0.0, 0.5, 0.99]),
@@ -39,7 +40,7 @@ functions = [('sqrt', sqrt, p_test_values),
for function_name, function, test_vals in functions:
print(function_name)
for value in test_vals:
- print("{:.7g}".format(function(value)))
+ print("{:.5g}".format(function(value)))
binary_functions = [('copysign', copysign, [(23., 42.), (-23., 42.), (23., -42.),
(-23., -42.), (1., 0.0), (1., -0.0)])