void coshrat(PRAT* px, uint32_t radix, int32_t precision) { PRAT tmpx = nullptr; (*px)->pp->sign = 1; (*px)->pq->sign = 1; if (rat_ge(*px, rat_one, precision)) { DUPRAT(tmpx, *px); exprat(px, radix, precision); tmpx->pp->sign *= -1; exprat(&tmpx, radix, precision); addrat(px, tmpx, precision); divrat(px, rat_two, precision); destroyrat(tmpx); } else { _coshrat(px, radix, precision); } // Since *px might be epsilon below 1 due to TRIMIT // we need this trick here. if (rat_lt(*px, rat_one, precision)) { DUPRAT(*px, rat_one); } }
void asinrat( PRAT *px, uint32_t radix, int32_t precision) { long sgn; PRAT pret= nullptr; PRAT phack= nullptr; sgn = (*px)->pp->sign* (*px)->pq->sign; (*px)->pp->sign = 1; (*px)->pq->sign = 1; // Avoid the really bad part of the asin curve near +/-1. DUPRAT(phack,*px); subrat(&phack, rat_one, precision); // Since *px might be epsilon near zero we must set it to zero. if ( rat_le(phack, rat_smallest, precision) && rat_ge(phack, rat_negsmallest, precision) ) { destroyrat(phack); DUPRAT( *px, pi_over_two ); } else { destroyrat(phack); if ( rat_gt( *px, pt_eight_five, precision) ) { if ( rat_gt( *px, rat_one, precision) ) { subrat( px, rat_one, precision); if ( rat_gt( *px, rat_smallest, precision) ) { throw( CALC_E_DOMAIN ); } else { DUPRAT(*px,rat_one); } } DUPRAT(pret,*px); mulrat( px, pret, precision); (*px)->pp->sign *= -1; addrat( px, rat_one, precision); rootrat( px, rat_two, radix, precision); _asinrat( px, precision); (*px)->pp->sign *= -1; addrat( px, pi_over_two, precision); destroyrat(pret); } else { _asinrat( px, precision); } } (*px)->pp->sign = sgn; (*px)->pq->sign = 1; }
void sinhrat(PRAT* px, uint32_t radix, int32_t precision) { PRAT tmpx = nullptr; if (rat_ge(*px, rat_one, precision)) { DUPRAT(tmpx, *px); exprat(px, radix, precision); tmpx->pp->sign *= -1; exprat(&tmpx, radix, precision); subrat(px, tmpx, precision); divrat(px, rat_two, precision); destroyrat(tmpx); } else { _sinhrat(px, precision); } }