Sha256: 0128245abc0261675c16677ecb02fbb067e65c3ccae26f903450d491884bb625

Contents?: true

Size: 659 Bytes

Versions: 31

Compression:

Stored size: 659 Bytes

Contents

// Returns base to the exponent power.
// @param {Number} $base The base number
// @param {Number} $exp The exponent to which to raise base
// @return {Number}
// @example
//     pow(4, 2)   // 16
//     pow(4, -2)  // 0.0625
//     pow(4, 0.2) // 1.31951
@use "sass:math";

@function pow ($base, $exp){
  @if $exp == floor($exp){
    $r: 1;
    $s: 0;

    @if $exp < 0{
      $exp: $exp * -1;
      $s: 1;
    }

    @while $exp > 0{
      @if $exp % 2 == 1{
        $r: $r * $base;
      }
      $exp: floor($exp * .5);
      $base: $base * $base;
    }

    @return if($s != 0, math.div(1, $r), $r);
  }
  @else{
    @return exp(log($base) * $exp);
  }
}

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
decidim-admin-0.27.9 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.27.8 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.27.7 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.27.6 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.26.10 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.26.9 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.27.5 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.26.8 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.27.4 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.27.3 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.26.7 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.26.5 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.27.2 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.27.1 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.26.4 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.27.0 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.26.3 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.27.0.rc2 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.27.0.rc1 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss
decidim-admin-0.26.2 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss