Sha256: 979a6c501152e1231a0822a7d46dac57555f4044d90649546ce6ce19b75cc23b

Contents?: true

Size: 372 Bytes

Versions: 4

Compression:

Stored size: 372 Bytes

Contents

// 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
@function cos ($x) {
    $x: unitless-rad($x);
    $ret: 0;
    @for $n from 0 to 24 {
        $ret: $ret + pow(-1, $n) * pow($x, 2 * $n) / fact(2 * $n);
    }
    @return $ret;
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
MathSass-0.9.5 dist/functions/_cos.scss
MathSass-0.9.4 dist/functions/_cos.scss
MathSass-0.9.3 dist/functions/_cos.scss
MathSass-0.9.2 dist/functions/_cos.scss