Skip to content

Trigonometric functions

acos function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> acos(const T1 &x)

Returns the arc cosine of x. The returned angle is in the range 0 through \(\pi\).

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_INTRINSIC flt_type<T1> acos(const T1& x)
{
    return intrinsics::acos(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/asin_acos.hpp#L47

asin function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> asin(const T1 &x)

Returns the arc sine of x. The returned angle is in the range \(-\pi/2\) through \(\pi/2\).

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_INTRINSIC flt_type<T1> asin(const T1& x)
{
    return intrinsics::asin(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/asin_acos.hpp#L39

atan function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> atan(const T1 &x)

Returns the arc tangent of x. The returned angle is in the range \(-\pi/2\) through \(\pi/2\).

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> atan(const T1& x)
{
    return intrinsics::atan(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/atan.hpp#L40

atan2 function

template <typename T1, typename T2,
          KFR_ENABLE_IF(is_numeric_args<T1, T2>)>
std::common_type_t<T1, T2> atan2(const T1 &x, const T2 &y)

Returns the arc tangent of y/x using the signs of arguments to determine the correct quadrant.

Source code
template <typename T1, typename T2, KFR_ENABLE_IF(is_numeric_args<T1, T2>)>
KFR_FUNCTION std::common_type_t<T1, T2> atan2(const T1& x, const T2& y)
{
    return intrinsics::atan2(x, y);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/atan.hpp#L59

atan2deg function

template <typename T1, typename T2,
          KFR_ENABLE_IF(is_numeric_args<T1, T2>)>
std::common_type_t<T1, T2> atan2deg(const T1 &x,
                                    const T2 &y)

Returns the arc tangent of y/x (expressed in degrees) using the signs of arguments to determine the correct quadrant.

Source code
template <typename T1, typename T2, KFR_ENABLE_IF(is_numeric_args<T1, T2>)>
KFR_FUNCTION std::common_type_t<T1, T2> atan2deg(const T1& x, const T2& y)
{
    return intrinsics::atan2deg(x, y);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/atan.hpp#L69

atandeg function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> atandeg(const T1 &x)

Returns the arc tangent of the x, expressed in degrees. The returned angle is in the range -90 through 90.

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> atandeg(const T1& x)
{
    return intrinsics::atandeg(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/atan.hpp#L50

cos function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> cos(const T1 &x)

Returns the trigonometric cosine of x.

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> cos(const T1& x)
{
    return intrinsics::cos(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L48

cos2x function

template <typename T> T cos2x(const T &sinx, const T &cosx)

Returns the trigonometric cosine of the angle 2x using already computed sin(x) and cos(x).

Source code
template <typename T>
KFR_INTRINSIC T cos2x(const T& sinx, const T& cosx)
{
    return sqr(cosx) - sqr(sinx);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L181

cos3x function

template <typename T> T cos3x(const T &sinx, const T &cosx)

Returns the trigonometric cosine of the angle 3x using already computed sin(x) and cos(x).

Source code
template <typename T>
KFR_INTRINSIC T cos3x(const T& sinx, const T& cosx)
{
    return cosx * (1 - 4 * sqr(sinx));
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L190

cosdeg function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> cosdeg(const T1 &x)

Returns the trigonometric cosine of the x (expressed in degrees).

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> cosdeg(const T1& x)
{
    return intrinsics::cosdeg(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L104

cossin function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> cossin(const T1 &x)

Returns the trigonometric cosine of the even elements of the x and sine of the odd elements. x must be a vector.

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> cossin(const T1& x)
{
    return intrinsics::cossin(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L86

cossindeg function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> cossindeg(const T1 &x)

Returns the trigonometric cosine of the even elements of the x and sine of the odd elements. x must be a vector and expressed in degrees.

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> cossindeg(const T1& x)
{
    return intrinsics::cossindeg(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L142

fastcos function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> fastcos(const T1 &x)

Returns an approximation of the trigonometric cosine of x.

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> fastcos(const T1& x)
{
    return intrinsics::fastcos(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L66

fastcosdeg function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> fastcosdeg(const T1 &x)

Returns an approximation of the trigonometric cosine of the x (expressed in degrees).

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> fastcosdeg(const T1& x)
{
    return intrinsics::fastcosdeg(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L122

fastsin function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> fastsin(const T1 &x)

Returns an approximation of the trigonometric sine of x.

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> fastsin(const T1& x)
{
    return intrinsics::fastsin(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L57

fastsindeg function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> fastsindeg(const T1 &x)

Returns an approximation of the trigonometric sine of the x (expressed in degrees).

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> fastsindeg(const T1& x)
{
    return intrinsics::fastsindeg(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L113

sin function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> sin(const T1 &x)

Returns the trigonometric sine of x.

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> sin(const T1& x)
{
    return intrinsics::sin(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L39

sin2x function

template <typename T> T sin2x(const T &sinx, const T &cosx)

Returns the trigonometric sine of the angle 2x using sin(x) and cos(x).

Source code
template <typename T>
KFR_INTRINSIC T sin2x(const T& sinx, const T& cosx)
{
    return 2 * sinx * cosx;
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L163

sin3x function

template <typename T> T sin3x(const T &sinx, const T &cosx)

Returns the trigonometric sine of the angle 3x using already computed sin(x) and cos(x).

Source code
template <typename T>
KFR_INTRINSIC T sin3x(const T& sinx, const T& cosx)
{
    return sinx * (-1 + 4 * sqr(cosx));
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L172

sinc function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> sinc(const T1 &x)

Returns the sinc function of x.

\[ sinc(x) = \frac{sin(x)}{x} \]
Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> sinc(const T1& x)
{
    return intrinsics::sinc(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L154

sincos function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> sincos(const T1 &x)

Returns the trigonometric sine of the even elements of the x and cosine of the odd elements. x must be a vector.

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> sincos(const T1& x)
{
    return intrinsics::sincos(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L76

sincosdeg function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> sincosdeg(const T1 &x)

Returns the trigonometric sine of the even elements of the x and cosine of the odd elements. x must be a vector and expressed in degrees.

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> sincosdeg(const T1& x)
{
    return intrinsics::sincosdeg(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L132

sindeg function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> sindeg(const T1 &x)

Returns the trigonometric sine of the x (expressed in degrees).

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> sindeg(const T1& x)
{
    return intrinsics::sindeg(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/sin_cos.hpp#L95


Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/