Skip to content

Commit

Permalink
Use W(1)=Omega as an example instead of pi
Browse files Browse the repository at this point in the history
  • Loading branch information
JSorngard committed Jul 29, 2024
1 parent 281e58d commit fdce39a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 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.5

- Correct the domain bounds in the function documentation strings.

## 0.2.2, 0.2.3, and 0.2.4

- Documentation improvements.
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,26 @@ This method uses a piecewise minimax rational function approximation.

## Examples

Evaluate the principal branch of the Lambert W function to 50 bits of accuracy:
Evaluate the Omega constant with the principal branch of the Lambert W function to 50 bits of accuracy:
```rust
use lambert_w::accurate::lambert_w_0;

use core::f64::consts::PI;
use approx::assert_abs_diff_eq;

let w = lambert_w_0(PI).unwrap();
let w = lambert_w_0(1.0).unwrap();

assert_abs_diff_eq!(w, 1.0736581947961492);
assert_abs_diff_eq!(w, 0.5671432904097838);
```

or to only 24 bits of accuracy, but with faster execution time:
```rust
use lambert_w::fast::lambert_w_0;

use core::f64::consts::PI;
use approx::assert_abs_diff_eq;

let w = lambert_w_0(PI).unwrap();
let w = lambert_w_0(1.0).unwrap();

assert_abs_diff_eq!(w, 1.0736581947961492, epsilon = 1e-7);
assert_abs_diff_eq!(w, 0.5671432904097838, epsilon = 1e-7);
```

## Speed-accuracy trade-off
Expand Down
12 changes: 5 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@
//!
//! ## Examples
//!
//! Evaluate the principal branch of the Lambert W function to 50 bits of accuracy:
//! Evaluate the omega constant with the principal branch of the Lambert W function to 50 bits of accuracy:
#![cfg_attr(
feature = "50bits",
doc = r##"
```
use lambert_w::accurate::lambert_w_0;
use core::f64::consts::PI;
use approx::assert_abs_diff_eq;
let w = lambert_w_0(PI).unwrap();
let w = lambert_w_0(1.0).unwrap();
assert_abs_diff_eq!(w, 1.0736581947961492);
assert_abs_diff_eq!(w, 0.5671432904097838);
```
"##
)]
Expand All @@ -30,12 +29,11 @@ assert_abs_diff_eq!(w, 1.0736581947961492);
```
use lambert_w::fast::lambert_w_0;
use core::f64::consts::PI;
use approx::assert_abs_diff_eq;
let w = lambert_w_0(PI).unwrap();
let w = lambert_w_0(1.0).unwrap();
assert_abs_diff_eq!(w, 1.0736581947961492, epsilon = 1e-7);
assert_abs_diff_eq!(w, 0.5671432904097838, epsilon = 1e-7);
```
"##
)]
Expand Down

0 comments on commit fdce39a

Please sign in to comment.