FIX: Value of SEC at 0 was incorrect

Also fixed imported errors of trigonometrical functions

Fixes #531
This commit is contained in:
Nicolás Hatcher
2025-11-11 22:06:56 +01:00
committed by Nicolás Hatcher Andrés
parent 3111a74530
commit 4b93174261
2 changed files with 20 additions and 23 deletions

View File

@@ -1250,11 +1250,8 @@ impl Model {
} else {
Ok((f * PI).sqrt())
});
single_number_fn!(fn_acot, |f| if f == 0.0 {
Err(Error::DIV)
} else {
Ok(f64::atan(1.0 / f))
});
single_number_fn!(fn_acot, |f| Ok(f64::atan(1.0 / f)));
single_number_fn!(fn_acoth, |f: f64| if f.abs() == 1.0 {
Err(Error::DIV)
} else {
@@ -1280,16 +1277,8 @@ impl Model {
} else {
Ok(1.0 / f64::sinh(f))
});
single_number_fn!(fn_sec, |f| if f == 0.0 {
Err(Error::DIV)
} else {
Ok(1.0 / f64::cos(f))
});
single_number_fn!(fn_sech, |f| if f == 0.0 {
Err(Error::DIV)
} else {
Ok(1.0 / f64::cosh(f))
});
single_number_fn!(fn_sec, |f| Ok(1.0 / f64::cos(f)));
single_number_fn!(fn_sech, |f| Ok(1.0 / f64::cosh(f)));
single_number_fn!(fn_exp, |f: f64| Ok(f64::exp(f)));
single_number_fn!(fn_fact, |x: f64| {
let x = x.floor();