libc/math/lib_asin.c: The function did not convert for some input values. Asin did not convert for values which do not belong to the domain of the function. But aside of that the function also did not convert for sine allowed values. I achieved a conversion of the function by reducing the DBL_EPSION and by checking if the input value is in the domain of the function. This is a fix for the problem but the function should always terminate after a given number of iterations. From Stefan Kolb.
This commit is contained in:
parent
bb385c242f
commit
5ac6de118e
13
ChangeLog
13
ChangeLog
@ -10917,4 +10917,15 @@
|
||||
* arch/arm/include/sama5 and src/sama5: Add basic chip description,
|
||||
configuration support and interrupt definitions for the SAMA5D2
|
||||
(2015-08-31).
|
||||
|
||||
* LPC43xx: Fix NVIC_SYSH_PRIORITY_STEP define. From Ilya Averyanov
|
||||
(2015-09-01).
|
||||
* LPC43xx: Fix missing #define in eeprom. From Ilya Averyanov
|
||||
(2015-09-01).
|
||||
* libc/math/lib_asin.c: The function did not convert for some input
|
||||
values. Asin did not convert for values which do not belong to the
|
||||
domain of the function. But aside of that the function also did not
|
||||
convert for sine allowed values. I achieved a conversion of the
|
||||
function by reducing the DBL_EPSION and by checking if the input
|
||||
value is in the domain of the function. This is a fix for the
|
||||
problem but the function should always terminate after a given
|
||||
number of iterations. From Stefan Kolb (2015-09-01).
|
||||
|
6
TODO
6
TODO
@ -1318,12 +1318,16 @@ o Libraries (libc/)
|
||||
it does not return at all as the loop in it does not
|
||||
converge, hanging your app.
|
||||
|
||||
"There are likely many other issues like these as the Rhombs
|
||||
"There are likely many other issues like these as the Rhombus
|
||||
OS code has not been tested or used that much. Sorry for not
|
||||
providing patches, but we found it easier just to switch the
|
||||
math library."
|
||||
|
||||
Ref: https://groups.yahoo.com/neo/groups/nuttx/conversations/messages/7805
|
||||
|
||||
UPDATE: 2015-09-01: A fix for the noted problems with asin()
|
||||
has been applied.
|
||||
|
||||
Status: Open
|
||||
Priority: Low for casual users but clearly high if you need care about
|
||||
these incorrect corner case behaviors in the math libraries.
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This file is a part of NuttX:
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Ported by: Darcy Gong
|
||||
*
|
||||
* It derives from the Rhombs OS math library by Nick Johnson which has
|
||||
@ -35,6 +35,13 @@
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
/************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************/
|
||||
|
||||
#undef DBL_EPSILON
|
||||
#define DBL_EPSILON 1e-12
|
||||
|
||||
/************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************/
|
||||
@ -42,7 +49,16 @@
|
||||
#ifdef CONFIG_HAVE_DOUBLE
|
||||
double asin(double x)
|
||||
{
|
||||
long double y, y_sin, y_cos;
|
||||
long double y;
|
||||
long double y_sin;
|
||||
long double y_cos;
|
||||
|
||||
/* Verify that the input value is in the domain of the function */
|
||||
|
||||
if (x < -1.0 || x > 1.0)
|
||||
{
|
||||
return NAN;
|
||||
}
|
||||
|
||||
y = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user