refactor math.acos
implementation
Co-authored-by: Ivan Tham <pickfire@riseup.net>
This commit is contained in:
parent
717cdd9501
commit
f63b254367
@ -250,15 +250,17 @@ fn acos(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
let number = args.get_err(0, "number")?;
|
let number = args.get_err(0, "number")?;
|
||||||
|
|
||||||
Ok(match number {
|
Ok(match number {
|
||||||
Value::Dimension(Some(n), Unit::None, ..) => {
|
Value::Dimension(Some(n), Unit::None, ..) => Value::Dimension(
|
||||||
if n > Number::from(1) || n < Number::from(-1) {
|
if n > Number::from(1) || n < Number::from(-1) {
|
||||||
return Ok(Value::Dimension(None, Unit::Deg, true));
|
None
|
||||||
} else if n.is_one() {
|
} else if n.is_one() {
|
||||||
return Ok(Value::Dimension(Some(Number::zero()), Unit::Deg, true));
|
Some(Number::zero())
|
||||||
}
|
} else {
|
||||||
|
n.acos()
|
||||||
Value::Dimension(n.acos(), Unit::Deg, true)
|
},
|
||||||
}
|
Unit::Deg,
|
||||||
|
true,
|
||||||
|
),
|
||||||
v @ Value::Dimension(Some(..), ..) => {
|
v @ Value::Dimension(Some(..), ..) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user