Commit Graph

5 Commits

Author SHA1 Message Date
David S. Alessio c145159c6b This commit fixes the following libc/math issues:
1) asin[f l]() use Newton’s method to converge on a solution. But Newton’s method converges very slowly (> 500,000 iterations) for values of x close to 1.0; and, in the case of asinl(), sometimes fails to converge (loops forever). The attached patch uses an trig identity for values of x > sqrt(2). The resultant functions converge in no more than 5 iterations, 6 for asinl().

2) The NuttX erf[f l]() functions are based on Chebyshev fitting to a good guess. The problem there’s a bug in the implementation that causes the functions to blow up with x near -3.0. This patch fixes that problem. It should be noted that this method returns the error function erf(x) with fractional error less than 1.2E-07 and that’s fine for the float version erff(), but the same method is used for double and long double version which will yield only slightly better precision. This patch doesn't address the issue of lower precision for erf() and erfl().

3) a faster version of copysignf() for floats is included.
2016-07-30 15:43:56 -06:00
David Alessio 261358f1f5 This change should significantly improve the performance of single precision floating point math library functions. The vast majority of changes have to do with preventing the compiler from needlessly promoting floats to doubles, performing the calculation with doubles, only to demote the result to float. These changes only affect the math lib functions that return float. 2016-07-11 07:02:50 -06:00
Gregory Nutt af086c40ff Remove dangling whitespace 2015-10-04 15:28:54 -06:00
Gregory Nutt 5b51a9fcdd Standardize the width of all comment boxes in C files 2015-10-02 17:43:18 -06:00
Gregory Nutt 7e177e1c12 Add error function to math library. From Brennan Ashton. 2015-01-26 13:58:47 -06:00