mirror of
https://github.com/micropython/micropython.git
synced 2025-08-16 15:40:41 +02:00
lib/libm: Add frexp and modf functions; use in stmhal; add tests.
Addresses issue #1081.
This commit is contained in:
@@ -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)])
|
||||
]
|
||||
|
Reference in New Issue
Block a user