Sha256: 01b5ba8254c2cb050ebf40c274044ad87afc771e8a7473c178dcfbcce66af549

Contents?: true

Size: 612 Bytes

Versions: 106

Compression:

Stored size: 612 Bytes

Contents

// Returns the arctangent of a number.
// @param {Number} $x
// @example
//     atan(0.1) // 0.09967
//     atan(-1)  // -0.7854
@function atan ($x) {
    $i:  24;
    $sgn: 0;
    $a:   0;
    @if $x > 1 {
        $sgn:  1;
        $x:    1 / $x;
    } @else if $x < -1 {
        $sgn: -1;
        $x:    1 / $x;
    }
    @while $i > 0 {
        $a: ($i * $i * $x * $x) / (2 * $i + 1 + $a);
        $i: $i - 1;
    }
    @if $sgn > 0 {
        @return  $PI / 2 - $x / (1 + $a);
    } @else if $sgn < 0 {
        @return -$PI / 2 - $x / (1 + $a);
    } @else {
        @return            $x / (1 + $a);
    }
}

Version data entries

106 entries across 106 versions & 3 rubygems

Version Path
decidim-admin-0.24.3 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.23.6 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.24.2 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.23.5 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.24.1 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.24.0 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.24.0.rc2 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.23.4 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.24.0.rc1 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.23.3 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.23.2 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.23.1 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.23.1.rc1 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.23.0 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.22.0 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.21.0 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.20.1 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.20.0 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.19.1 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss
decidim-admin-0.18.1 app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss