Skip to content

Commit

Permalink
Move away from original number rounding convention
Browse files Browse the repository at this point in the history
As the number conversion for the original problem was somewhat weird + arguably somewhat Java-specific (see discussions at gunnarmorling/1brc#5), I've decided to move away from using that and use the sample results + run checks against my own base implementation instead.
  • Loading branch information
kahlstrm committed Apr 20, 2024
1 parent 009f173 commit 04a3057
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion samples/measurements-3.out
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{Bosaso=-15.0/1.3/20.0, Petropavlovsk-Kamchatsky=-9.5/0.0/9.5}
{Bosaso=-15.0/1.2/20.0, Petropavlovsk-Kamchatsky=-9.5/0.0/9.5}
2 changes: 1 addition & 1 deletion samples/measurements-rounding.out
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ham=14.6/25.5/33.6, jel=-9.0/18.0/46.5}
{ham=14.6/25.4/33.6, jel=-9.0/17.9/46.5}
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct WeatherStationStats {
}
impl WeatherStationStats {
fn mean(&self) -> f64 {
((self.sum) / (self.count as f64) * 10.0).ceil() / 10.0
self.sum / self.count as f64
}
}
fn parse_line(line: &str) -> (&str, f64) {
Expand Down

0 comments on commit 04a3057

Please sign in to comment.