Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In #174 the gnp random functions were extended to support values of 0 and 1 for the probability representing either empty of full graphs. In that change comparisons between the value of probability and 1 were used to check if it's a full graph and we should just fast path adding an edge between every node. However, when running 'cargo clippy' on this it rightfully points out that we should probably check for equality to 1 within an error margin (given that floating point is never exact). Clippy suggested replacing using std::f64::EPSILON as the error value, which is ~2.2e-16 [1] and replacing the comparison with: (probability - 1.0).abs() < error This commit just makes that change. While this is unlikely to cause any issues in practice, because probability is a parameter and if someone is going to want a full graph they'll likely call the function with probability=1 in python. It's better to be safe just in case someone is computing the probability value and could have some error on the value. [1] https://doc.rust-lang.org/std/f64/constant.EPSILON.html
- Loading branch information