-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change neutral element of <fNN as iter::Sum> to neg_zero
The neutral element used to be positive zero, but +0 + -0 = +0 so -0 seems better indicated.
- Loading branch information
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#[test] | ||
fn f32_ref() { | ||
let x: f32 = -0.0; | ||
let still_x: f32 = [x].iter().sum(); | ||
assert_eq!(1. / x, 1. / still_x) | ||
} | ||
|
||
#[test] | ||
fn f32_own() { | ||
let x: f32 = -0.0; | ||
let still_x: f32 = [x].into_iter().sum(); | ||
assert_eq!(1. / x, 1. / still_x) | ||
} | ||
|
||
#[test] | ||
fn f64_ref() { | ||
let x: f64 = -0.0; | ||
let still_x: f64 = [x].iter().sum(); | ||
assert_eq!(1. / x, 1. / still_x) | ||
} | ||
|
||
#[test] | ||
fn f64_own() { | ||
let x: f64 = -0.0; | ||
let still_x: f64 = [x].into_iter().sum(); | ||
assert_eq!(1. / x, 1. / still_x) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ mod int_log; | |
mod ops; | ||
mod wrapping; | ||
|
||
mod float_iter_sum_identity; | ||
mod ieee754; | ||
mod nan; | ||
|
||
|