Document current behaviour of difficulty_float

Improve rustdocs on the `Target::difficulty_float` function,
specifically the return value if self is zero.
This commit is contained in:
Tobin C. Harding 2024-02-22 08:07:28 +11:00
parent 3d01146374
commit c1ba496a07
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 4 additions and 0 deletions

View File

@ -245,6 +245,10 @@ impl Target {
///
/// See [`difficulty`] for details.
///
/// # Returns
///
/// Returns [`f64::INFINITY`] if `self` is zero (caused by divide by zero).
///
/// [`difficulty`]: Target::difficulty
#[cfg_attr(all(test, mutate), mutate)]
pub fn difficulty_float(&self) -> f64 { TARGET_MAX_F64 / self.0.to_f64() }