mirror of
https://github.com/nasa/trick.git
synced 2025-01-29 15:43:57 +00:00
Replace unreliable 'divide-by-zero' way of generating NaNs with math.h NAN in deuler routines. (#668)
This commit is contained in:
parent
00b4b2c8d9
commit
9a5ecd1294
@ -120,13 +120,12 @@ int euler123(
|
||||
/* Error: Out of normal range and beyond tolerance
|
||||
for asin function */
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
@ -116,13 +116,12 @@ int euler123_quat(
|
||||
/* Error: Out of normal range and beyond tolerance
|
||||
for asin function */
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
@ -137,13 +137,12 @@ int euler132(
|
||||
* for asin function
|
||||
*/
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
@ -117,13 +117,12 @@ int euler132_quat(
|
||||
* for asin function
|
||||
*/
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
@ -124,13 +124,12 @@ int euler213(double angle[3], /* In: r Method=0, 0=PITCH , 1=ROLL , 2=YAW */
|
||||
/* Error: Out of normal range & beyond tolerance
|
||||
for asin func */
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
@ -114,13 +114,12 @@ int euler213_quat(
|
||||
/* Error: Out of normal range & beyond tolerance
|
||||
for asin func */
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
@ -120,13 +120,12 @@ int euler231( /* Return: -- None. */
|
||||
}
|
||||
/* Error: Out of normal range & beyond tolerance for asin func*/
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
@ -112,13 +112,12 @@ int euler231_quat(
|
||||
}
|
||||
/* Error: Out of normal range & beyond tolerance for asin func*/
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
@ -118,13 +118,12 @@ int euler312(
|
||||
}
|
||||
/* Error: Out of normal range & beyond tolerance for asin func*/
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
@ -112,13 +112,12 @@ int euler312_quat(
|
||||
}
|
||||
/* Error: Out of normal range & beyond tolerance for asin func*/
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
@ -120,13 +120,12 @@ int euler321(
|
||||
}
|
||||
/* Error: Out of normal range & beyond tolerance for asin func*/
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
@ -112,13 +112,12 @@ int euler321_quat(
|
||||
}
|
||||
/* Error: Out of normal range & beyond tolerance for asin func*/
|
||||
else {
|
||||
double zero = 0.0;
|
||||
ret = TM_ANG_NAN;
|
||||
if ( error_flag[4] == 0 ) {
|
||||
tm_print_error(ret);
|
||||
error_flag[4]=1;
|
||||
}
|
||||
angle[0] = angle[1] = angle[2] = 0.0 / zero;
|
||||
angle[0] = angle[1] = angle[2] = NAN;
|
||||
}
|
||||
#undef TOLERANCE
|
||||
} else if (method == 2) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user