Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7587915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:47:37+00:00 2026-05-30T19:47:37+00:00

After discovering that Sass doesn’t have exponential abilities, I decided to make my own

  • 0

After discovering that Sass doesn’t have exponential abilities, I decided to make my own pow() function. This is my unsuccessful attempt:

@function pow($x,$p) {
  $u: unit($x);
  $x: $x / 1#{$u};
  $p: round($p);
  @if $p == 0 {
    @return 0;
  } @else if $p == 1 {
    @return $x;
  } @else {
    @for $i from 1 through abs($p) {
      $x: $x * $x;
    }
  }
  @if $p < 0 {
    $x: 1 / $x;
  }

  @return $x + $u;
}

The part I’m stuck with is stripping off units. I know that 12px / 1px = 12, but in my case the unit is unknown, and 12px / 1#{unit(12px)} doesn’t work because it equals to "12px/1px" (yes, with quotes). The unquote function doesn’t seem to work for me, I don’t know why.

In case you’re wondering, the reason why I want to strip units (and return them in the end) is because 12px * 12px = 144px*px.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:47:38+00:00Added an answer on May 30, 2026 at 7:47 pm

    Instead writing pow in Sass use Ruby http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After discovering on superuser that there is no current way to add syntax highlighting
After I thought that I've understood how they work, I tried this: NSString *str1
I have this procedure in the database: CREATE OR REPLACE FUNCTION replacePageRelevance(id INT, value
After repeated searching I have not found an elegant solution to this issue: how
I am just learning how to use Terracotta after discovering it about a month
After recently discovering how insanely long the .net 3.5 framework was to install I
After loosing much sleep I still cannot figure this out: The code below (its
After discovering lambda expressions, and their use as anonymous functions, I've found myself writing
I solved this myself, but I spent so long discovering such a simple solution,
I have three UITableViews that should look identical. Each is placed inside a different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.