From 463e10ad1d98f7a9113a042a6a2d5cde5cc19a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= <44257381+JSorngard@users.noreply.github.com> Date: Fri, 4 Oct 2024 19:52:29 +0200 Subject: [PATCH 1/4] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 3b379e5..e03b222 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,14 @@ assert_relative_eq!(big, 703.2270331047702, max_relative = 4e-16); assert_relative_eq!(tiny, -715.7695669234213, max_relative = 4e-16); ``` +Importing the `LambertW` trait lets you call the functions with postfix notations: +```rust +use lambert_w::LambertW; + +let z = 2.0 * f64::ln(2.0); +assert_abs_diff_eq!(z.lambert_w0(), f64::ln(2.0)); +``` + ## License Licensed under either of From 072392aa855d27930512903ae3646f2877067d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= <44257381+JSorngard@users.noreply.github.com> Date: Fri, 4 Oct 2024 19:52:56 +0200 Subject: [PATCH 2/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e03b222..0aa4221 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ Importing the `LambertW` trait lets you call the functions with postfix notation use lambert_w::LambertW; let z = 2.0 * f64::ln(2.0); + assert_abs_diff_eq!(z.lambert_w0(), f64::ln(2.0)); ``` From 70dcc8e70d341e7b2c3e78891c35535f3e18d4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= <44257381+JSorngard@users.noreply.github.com> Date: Fri, 4 Oct 2024 19:54:32 +0200 Subject: [PATCH 3/4] Update lib.rs --- src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 83a8522..07dbb78 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,6 +89,15 @@ assert_relative_eq!(tiny, -715.7695669234213, max_relative = 4e-16); "# )] //! +//! Importing the [`LambertW`] trait lets you call the functions with postfix notations: +#![cfg_attr(feature = "50bits"), doc = r#" +use lambert_w::LambertW; + +let z = 2.0 * f64::ln(2.0); + +assert_abs_diff_eq!(z.lambert_w0(), f64::ln(2.0)); +"#] +//! //! The macros are from the [`approx`](https://docs.rs/approx/latest/approx/) crate, and are used in the documentation examples of this crate. //! The assertion passes if the two supplied values are the same to within floating point error, or within an optional epsilon or relative difference. //! From f0521b609f992e6bd597af20928371395c7732e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= Date: Fri, 4 Oct 2024 19:56:46 +0200 Subject: [PATCH 4/4] Fix trait example --- src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 07dbb78..55c4503 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -90,13 +90,16 @@ assert_relative_eq!(tiny, -715.7695669234213, max_relative = 4e-16); )] //! //! Importing the [`LambertW`] trait lets you call the functions with postfix notations: -#![cfg_attr(feature = "50bits"), doc = r#" +#![cfg_attr( + feature = "50bits", + doc = r#" use lambert_w::LambertW; let z = 2.0 * f64::ln(2.0); assert_abs_diff_eq!(z.lambert_w0(), f64::ln(2.0)); -"#] +"# +)] //! //! The macros are from the [`approx`](https://docs.rs/approx/latest/approx/) crate, and are used in the documentation examples of this crate. //! The assertion passes if the two supplied values are the same to within floating point error, or within an optional epsilon or relative difference.