mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Fix nan sign bug in cformat
This commit is contained in:
@@ -294,11 +294,12 @@ impl CFormatSpec {
|
||||
}
|
||||
|
||||
pub(crate) fn format_float(&self, num: f64) -> String {
|
||||
let sign_string = if num.is_sign_positive() {
|
||||
self.flags.sign_string()
|
||||
} else {
|
||||
let sign_string = if num.is_sign_negative() && !num.is_nan() {
|
||||
"-"
|
||||
} else {
|
||||
self.flags.sign_string()
|
||||
};
|
||||
|
||||
let precision = match self.precision {
|
||||
Some(CFormatQuantity::Amount(p)) => p,
|
||||
_ => 6,
|
||||
|
||||
Reference in New Issue
Block a user