From afaad2d9a86dbc8623808cd3a30af9e5d9c5660a Mon Sep 17 00:00:00 2001 From: Viktor Nikolaiev Date: Wed, 2 Oct 2024 00:52:27 +0300 Subject: [PATCH] Fix float64 rounding in the "weather" example (#39) --- example_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/example_test.go b/example_test.go index e2f15f6..015f97d 100644 --- a/example_test.go +++ b/example_test.go @@ -720,6 +720,7 @@ func getTemperature(city string, date time.Time) (float64, error) { // Simulate a temperature reading, by retuning a pseudo-random, but deterministic value temp := 15 - 10*math.Sin(cityHash+float64(date.Unix())) + temp = math.Round(temp*10) / 10 // Round to one decimal place return temp, nil }