// Returns the cosine of a number.
// @param {Number} $x A number in rad or deg. Assuming unitless number to be in rad.
// @example
//     cos(0.7854) // 0.70711
//     cos(45deg)  // 0.70711
@use "sass:math";

@function cos ($x) {
    $x: unitless-rad($x) % ($PI * 2);
    $ret: 1;
    $i: 1;
    @for $n from 1 to 24 {
        $i: math.div(math.div($i * -1 * $x * $x, 2 * $n), 2 * $n - 1);
        $ret: $ret + $i;
    }
    @return $ret;
}
