Skip to content

Commit

Permalink
Fix the temperature rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
voegelas committed Aug 17, 2022
1 parent c62e9bb commit ddee193
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/MyApp/Weather/Plugin/Helpers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ sub register ($self, $app, $conf) {
return;
}

sub _make_round ($scale = 0) {
sub _make_round ($scale = -1) {
return sub ($num) { Math::BigFloat->new($num)->bfround($scale)->numify };
}

sub _make_format_temperature ($unit, $scale = 0) {
sub _make_format_temperature ($unit, $scale = -1) {
my $round = _make_round($scale);
return $unit eq 'F'
? sub ($celsius) { $round->(9.0 * $celsius / 5.0 + 32.0) }
Expand Down

0 comments on commit ddee193

Please sign in to comment.