Commit Graph

28 Commits

Author SHA1 Message Date
David Lechner
0eead94181 lib/libm: Use __asm__ instead of asm.
`asm` is not part of the C standard and causes a complier error when
`-std=c99` is used. `__asm__` is the recommended alternative.

https://gcc.gnu.org/onlinedocs/gcc/extensions-to-the-c-language-family/alternate-keywords.html

Signed-off-by: David Lechner <david@pybricks.com>
2022-11-10 11:36:41 +11:00
Damien George
38959ed8f1 lib/libm: Reduce size of static two_over_pi array.
Thanks to Jeff Epler for the idea.

Signed-off-by: Damien George <damien@micropython.org>
2020-09-04 00:45:56 +10:00
stijn
d6243568a0 all: Remove commented-out include statements. 2020-04-23 11:24:15 +10:00
stijn
70affd9ba2 all: Fix implicit floating point to integer conversions.
These are found when building with -Wfloat-conversion.
2020-04-18 22:42:24 +10:00
stijn
bcf01d1686 all: Fix implicit conversion from double to float.
These are found when building with -Wfloat-conversion.
2020-04-18 22:42:24 +10:00
Damien George
8960a28238 lib/libm/math: Add implementation of __signbitf, if needed by a port. 2018-09-27 15:21:04 +10:00
Damien George
4c08932e73 lib/libm/math: Fix int type in float union, uint64_t should be uint32_t.
A float is 32-bits wide.
2018-09-27 15:19:53 +10:00
Damien George
b9a133e5ad lib/libm/wf_tgamma: Fix tgammaf handling of -inf, should return nan. 2018-09-04 17:00:35 +10:00
Damien George
afc7ddca31 lib/libm/math: Make tanhf more efficient and handle large numbers.
Prior to this patch tanhf(large number) would return nan due to inf/inf.
2018-09-04 17:00:30 +10:00
Damien George
81a06d2c9c lib/libm: Remove implementation of log2f, use MP_NEED_LOG2 instead. 2017-10-10 16:01:13 +11:00
Damien George
f869d6b2e3 lib/libm: Fix tanhf so that it correctly handles +/- infinity args. 2017-10-04 21:14:00 +11:00
Alexander Steffen
55f33240f3 all: Use the name MicroPython consistently in comments
There were several different spellings of MicroPython present in comments,
when there should be only one.
2017-07-31 18:35:40 +10:00
Damien George
3bedff0b3c lib/libm/math: Remove implementations of float conversion functions.
These implementations are incorrect (eg f2d and d2f don't handle special
values like 0.0) and proper versions can be provided by libgcc (or
equivalent depending on the toolchain).

libgcc is now linked with the stmhal port so that library will provide
these functions from now on.
2017-06-14 17:18:23 +10:00
Damien George
b53a63517a lib/libm: Use isfinite instead of finitef, for C99 compatibility. 2017-05-31 11:34:29 +10:00
Damien George
fb161aa45a lib/libm: Add implementation of nearbyintf, from musl-1.1.16. 2017-03-24 10:38:11 +11:00
Damien George
cd527bb324 lib/libm: Move Thumb-specific sqrtf function to separate file.
This allows it to be used only when the hardware supports VFP
instructions, preventing compile errors.
2016-11-03 12:26:32 +11:00
Damien George
7ddd85f933 lib/libm: Remove unused definition of "one". 2016-06-25 22:30:40 +01:00
Damien George
873853f1a8 lib/libm: Format code to pass gcc v6.1.1 warning.
gcc 6.1.1 warns when indentation is misleading, and in this case the
formatting of the code really is misleading.  So adjust the formatting
to be clear of the meaning of the code.
2016-06-25 22:28:43 +01:00
Damien George
a67651406d lib/libm: Allow math funcs to be used by non-Thumb archs.
Requires addition of software implementation of sqrtf function.
2015-12-18 21:05:44 +00:00
Damien George
9ab94c468c lib/libm: Add implementations of erf, erfc, lgamma, tgamma. 2015-02-22 14:47:11 +00:00
Damien George
6d1f5070ce lib/libm: Add frexp and modf functions; use in stmhal; add tests.
Addresses issue #1081.
2015-01-22 13:48:29 +00:00
Paul Sokolovsky
8a2cc1c7e4 stmhal: Add fake implementation of __aeabi_f2lz().
To make mp_obj_new_int_from_float() somehow work.
2014-12-30 00:52:41 +02:00
Damien George
f04329e93b 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!).
2014-12-18 14:44:02 +00:00
Damien George
1559a97810 py: Add builtin round function.
Addresses issue #934.
2014-10-31 11:28:50 +00:00
Damien George
8594ce2280 py: Implement divmod, % and proper // for floating point.
Tested and working on unix and pyboard.
2014-09-13 18:43:09 +01:00
Damien George
20beff9ae3 py and libm: Add asinf,acosf; print higher precision for float.
Also use less stack space when printing single precision float.

Addition of asinf and acosf addresses issue #851.
2014-09-11 22:24:45 +01:00
Damien George
4d3fc46326 lib, libm: Add back dummy definition of tanf. 2014-08-29 23:24:00 +01:00
Damien George
8707ea3421 lib: Add lib and libm, moving current files from stmhal.
Top-level lib directory is for standard C libraries that we want to
provide our own versions of (for efficiency and stand-alone reasons).
It currently has libm in it for math functions.

Also add atanf and atan2f, which addresses issue #837.
2014-08-29 22:42:26 +01:00