// =============================================================================
// =ALEKSI - POW
// =============================================================================
////
//// @group aleksi-math
//// @author [Yoannis Jamar](http://yoannis.me)
//// @author [Hugo Giraudel]((http://hugogiraudel.com)

// =power( $x, $n )
// -----------------------------------------------------------------------------
/// Power function
///
/// @param {number} $x - number
/// @param {number} $n - power
///
/// @return {number} $x ^ $n
///
/// @access public
/// @since 0.6.0
///
/// @author [Hugo Giraudel]((http://hugogiraudel.com)
///
/// @todo unit test `power` function

@function power($x, $n)
{
  $res: 1;

  @if $n >= 0 {
    @for $i from 1 through $n {
      $res: ($res * $x);
    }
  } @else {
    @for $i from $n to 0 {
      $res: ($res / $x);
    }
  }

  @return $res;
}

// =pow( $x, $n )
// -----------------------------------------------------------------------------
/// @alias power
///
/// @access public
/// @since 0.6.0

@function pow($x, $n)
{
  @return power($x, $n);
}