Return NaN instead of 0 when dividing by 0
This commit is contained in:
parent
827171e206
commit
5a06f4788b
1 changed files with 2 additions and 1 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
"html/template"
|
||||
"io"
|
||||
"log/slog"
|
||||
"math"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -191,7 +192,7 @@ var customAPITemplateFuncs = func() template.FuncMap {
|
|||
},
|
||||
"div": func(a, b float64) float64 {
|
||||
if b == 0 {
|
||||
return 0
|
||||
return math.NaN()
|
||||
}
|
||||
|
||||
return a / b
|
||||
|
|
Loading…
Add table
Reference in a new issue