0.6.0 #1

Merged
pogmommy merged 89 commits from 0.6.0 into main 2025-07-04 20:29:26 -07:00
3 changed files with 10 additions and 0 deletions
Showing only changes of commit 593a4f4666 - Show all commits

View file

@ -31,6 +31,7 @@ All notable changes to eww will be listed here, starting at changes since versio
- Add `transform-origin-x`/`transform-origin-y` properties to transform widget (By: mario-kr)
- Add keyboard support for button presses (By: julianschuler)
- Support empty string for safe access operator (By: ModProg)
- Add `log` function calls to simplexpr (By: topongo)
## [0.6.0] (21.04.2024)

View file

@ -500,6 +500,14 @@ fn call_expr_function(name: &str, args: Vec<DynVal>) -> Result<DynVal, EvalError
})),
_ => Err(EvalError::WrongArgCount(name.to_string())),
},
"log" => match args.as_slice() {
[num, n] => {
let num = num.as_f64()?;
let n = n.as_f64()?;
Ok(DynVal::from(f64::log(num, n)))
}
_ => Err(EvalError::WrongArgCount(name.to_string())),
},
_ => Err(EvalError::UnknownFunction(name.to_string())),
}

View file

@ -44,6 +44,7 @@ Supported currently are the following features:
- `sin(number)`, `cos(number)`, `tan(number)`, `cot(number)`: Calculate the trigonometric value of a given number in **radians**
- `min(a, b)`, `max(a, b)`: Get the smaller or bigger number out of two given numbers
- `powi(num, n)`, `powf(num, n)`: Raise number `num` to power `n`. `powi` expects `n` to be of type `i32`
- `log(num, n)`: Calculate the base `n` logarithm of `num`. `num`, `n` and return type are `f64`
- `degtorad(number)`: Converts a number from degrees to radians
- `radtodeg(number)`: Converts a number from radians to degrees
- `replace(string, regex, replacement)`: Replace matches of a given regex in a string