diff --git a/library/alloc/src/fmt.rs b/library/alloc/src/fmt.rs index fce2585cbf5..acff026b91b 100644 --- a/library/alloc/src/fmt.rs +++ b/library/alloc/src/fmt.rs @@ -278,6 +278,19 @@ //! Hello, ` 123` has 3 right-aligned characters //! ``` //! +//! When truncuating these values, Rust uses round-to-even, which may +//! cause concern when formatting for scientific notation. For example, +//! +//! ``` +//! print!("{0:.1$e}", 12345, 3); +//! ``` +//! +//! Would return: +//! +//! ```text +//! 1.234e4 +//! ``` +//! //! ## Localization //! //! In some programming languages, the behavior of string formatting functions