示例#1
0
文件: p_tan.c 项目: hongyunnchen/pal
/*
 * 0 <= x <= pi/2
 * x = x' + pi/4
 * tan x = tan(x' + pi/4) = (tan x' + 1) / (1 - tan x')
 */
static inline PTYPE __p_tan_pi_2(const PTYPE x)
{
    PTYPE x_, tanx_;
    if (x <= pi_4)
        return __p_tan_pi_4(x);
    x_ = x - pi_4;
    tanx_ = __p_tan_pi_4(x_);
    return (tanx_ + PCONST(1.0)) / (PCONST(1.0) - tanx_);
}
示例#2
0
文件: p_tan.c 项目: haneefmubarak/pal
/*
 * 0 <= x <= pi/2
 * x = x' + pi/4
 * tan x = tan(x' + pi/4) = (tan x' + 1) / (1 - tan x')
 */
static inline float __p_tan_pi_2(const float x)
{
    float x_, tanx_;
    if (x <= pi_4)
        return __p_tan_pi_4(x);
    x_ = x - pi_4;
    tanx_ = __p_tan_pi_4(x_);
    return (tanx_ + 1.f) / (1.f - tanx_);
}