Skip to content

Commit

Permalink
FIX: Let TANGENT 90 return an infinity value instead of throwing over…
Browse files Browse the repository at this point in the history
…flow error
  • Loading branch information
Oldes committed Jun 24, 2018
1 parent d7fd2ec commit f2d3cda
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/n-math.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,14 @@ enum {SINE, COSINE, TANGENT};
***********************************************************************/
{
REBDEC dval = Trig_Value(ds, TANGENT);
if (Eq_Decimal(fabs(dval), pi1 / 2.0)) Trap0(RE_OVERFLOW);
if (Eq_Decimal(fabs(dval), pi1 / 2.0)) {
#ifdef USE_NO_INFINITY
Trap0(RE_OVERFLOW);
#else
SET_DECIMAL(D_RET, (dval < 0) ? -INFINITY : INFINITY);
return R_RET;
#endif
}
SET_DECIMAL(D_RET, tan(dval));
return R_RET;
}
Expand Down

0 comments on commit f2d3cda

Please sign in to comment.