Skip to content

Commit

Permalink
Add example of when the functions are None
Browse files Browse the repository at this point in the history
Bump version number, add changes to log
  • Loading branch information
JSorngard committed Jul 28, 2024
1 parent 383df8c commit ac748f0
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.2.3

- Documentation improvements.

# 0.2.2

- Minor documentation improvements.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lambert_w"
version = "0.2.2"
version = "0.2.3"
edition = "2021"
authors = ["Johanna Sörngård <[email protected]>"]
categories = ["mathematics"]
Expand Down
17 changes: 15 additions & 2 deletions src/accurate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ use super::Z0;
///
/// Uses the piecewise minimax rational function approximation method of Toshio Fukushima.
///
/// # Example
/// # Examples
///
/// Basic usage:
/// ```
/// use lambert_w::accurate::lambert_w_0;
///
Expand All @@ -24,6 +25,11 @@ use super::Z0;
///
/// assert_abs_diff_eq!(w, 1.0736581947961492);
/// ```
/// Too small arguments result in `None`:
/// ```
/// # use lambert_w::accurate::lambert_w_0;
/// assert_eq!(lambert_w_0(-1.0), None);
/// ```
pub fn lambert_w_0(z: f64) -> Option<f64> {
dw0c(z - Z0)
}
Expand All @@ -32,8 +38,9 @@ pub fn lambert_w_0(z: f64) -> Option<f64> {
///
/// Uses the piecewise minimax rational function approximation method of Toshio Fukushima.
///
/// # Example
/// # Examples
///
/// Basic usage:
/// ```
/// use lambert_w::accurate::lambert_w_m1;
///
Expand All @@ -44,6 +51,12 @@ pub fn lambert_w_0(z: f64) -> Option<f64> {
///
/// assert_abs_diff_eq!(w, -1.6385284199703634);
/// ```
/// Too small or positive arguments result in `None`:
/// ```
/// # use lambert_w::accurate::lambert_w_m1;
/// assert_eq!(lambert_w_m1(-1.0), None);
/// assert_eq!(lambert_w_m1(1.0), None);
/// ```
pub fn lambert_w_m1(z: f64) -> Option<f64> {
dwm1c(z, z - Z0)
}
17 changes: 15 additions & 2 deletions src/fast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ use swm1::swm1;
///
/// Uses the piecewise minimax rational function approximation method of Toshio Fukushima.
///
/// # Example
/// # Examples
///
/// Basic usage:
/// ```
/// use lambert_w::fast::lambert_w_0;
///
Expand All @@ -22,6 +23,11 @@ use swm1::swm1;
///
/// assert_abs_diff_eq!(w, 1.0736581947961492, epsilon = 1e-7);
/// ```
/// Too small arguments result in `None`:
/// ```
/// # use lambert_w::fast::lambert_w_0;
/// assert_eq!(lambert_w_0(-1.0), None);
/// ```
pub fn lambert_w_0(z: f64) -> Option<f64> {
sw0(z)
}
Expand All @@ -30,8 +36,9 @@ pub fn lambert_w_0(z: f64) -> Option<f64> {
///
/// Uses the piecewise minimax rational function approximation method of Toshio Fukushima.
///
/// # Example
/// # Examples
///
/// Basic usage:
/// ```
/// use lambert_w::fast::lambert_w_m1;
///
Expand All @@ -42,6 +49,12 @@ pub fn lambert_w_0(z: f64) -> Option<f64> {
///
/// assert_abs_diff_eq!(w, -1.6385284199703634, epsilon = 1e-7);
/// ```
/// Too small or positive arguments result in `None`:
/// ```
/// # use lambert_w::fast::lambert_w_m1;
/// assert_eq!(lambert_w_m1(-1.0), None);
/// assert_eq!(lambert_w_m1(1.0), None);
/// ```
pub fn lambert_w_m1(z: f64) -> Option<f64> {
swm1(z)
}

0 comments on commit ac748f0

Please sign in to comment.