GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use #[expect] with reason for float_cmp suppression · RustPython/RustPython@f039f28

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • crates/common/src
    • float_ops.rs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎crates/common/src/float_ops.rs‎

Copy file name to clipboardExpand all lines: crates/common/src/float_ops.rs
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,10 @@ pub fn round_float_digits(x: f64, ndigits: i32) -> Option<f64> {
241241
let pow1 = 10.0f64.powi(-ndigits);
242242
let y = x / pow1;
243243
let z = y.round();
244-
#[allow(clippy::float_cmp)]
244+
#[expect(
245+
clippy::float_cmp,
246+
reason = "exact half-tie detection for banker's rounding correction"
247+
)]
245248
let z = if (y - z).abs() == 0.5 {
246249
2.0 * (y / 2.0).round()
247250
} else {

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.