Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
mathsass
Advanced tools
Readme
A Sass implementation of mathematical functions.
git clone git@github.com:terkel/mathsass.git && cd mathsass
bower install mathsass --save-dev
npm install mathsass --save-dev
Import dist/_math.scss
partial to the Sass document.
@import "path/to/dist/math";
.content {
height: 200px;
width: 200px / tan(60deg); // 115.47005px
}
If you installed via Npm the path will be: node_modules/mathsass/dist/math
If you installed via Bower the path will be: bower_components/mathsass/dist/math
$E
- Euler's constant (ネイピア数 [オイラー数])$PI
- π (円周率)$LN2
- The natural logarithm of 2 (2 の自然対数)$SQRT2
- The square root of 2 (2 の平方根)pow($base, $exp)
@debug pow(4, 2); // 16
@debug pow(4, -2); // 0.0625
@debug pow(4, 0.2); // 1.31951
fact($x)
@debug fact(4); // 24
@debug fact(8); // 40320
sqrt($x)
@debug sqrt(2); // 1.41421
@debug sqrt(3); // 1.73205
exp($x)
frexp($x)
ldexp($x, $exp)
@debug exp(-1); // 0.36788
@debug exp(0); // 1
@debug exp(1); // 2.71828
log($x, $b: null)
@debug log(2); // 0.69315
@debug log(10); // 2.30259
@debug log(2, 10); // 0.30103
sin($x)
- Sine (正弦)cos($x)
- Cosine (余弦)tan($x)
- Tangent (正接)csc($x)
- Cosecant (余割)sec($x)
- Secant (正割)cot($x)
- Cotangent (余接)If argument has deg
unit, converted to rad
.
@debug tan(0.5236); // 0.57735
@debug tan(30deg); // 0.57735
asin($x)
- Arcsine (逆正弦)acos($x)
- Arccosine (逆余弦)atan($x)
- Arctangent (逆正接)atan2($y, $x)
- Arctangent of the quotient of its arguments (引数の比率での逆正接)@debug atan2(0, 0); // 0
@debug atan2(0, -0.0); // 3.14159
@debug atan2(-0.0, 0); // 0
@debug atan2(-0.0, -0.0); // -3.14159
gcd($a, $b)
- Greatest common divisor (最大公約数)lcm($a, $b)
- Least common multiple (最小公倍数)@debug gcd(54, 24); // 6
@debug lcm(30, 42); // 210
strip-unit($number)
deg-to-rad($deg, $unit: true)
rad-to-deg($rad, $unit: true)
unitless-rad($angle)
@debug rad-to-deg(1.0472); // 60.00014deg
@debug deg-to-rad(60deg); // 1.0472rad
@debug deg-to-rad(60deg, false); // 1.0472
@debug unitless-rad(60deg); // 1.0472
@debug unitless-rad(1.0472rad); // 1.0472
…and Wikipedia articles:
Make sure you have node.js and grunt installed.
Clone Repository
git clone git@github.com:terkel/mathsass.git
Install Dependencies
npm install
Run Sass/Tests
grunt
Originally created with help from @kaminaly and @pilssalgi.
Copyright (c) 2013 Takeru Suzuki Licensed under the MIT license.
FAQs
A Sass implementation of mathematical functions.
The npm package mathsass receives a total of 4,547 weekly downloads. As such, mathsass popularity was classified as popular.
We found that mathsass demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.