mirror of
https://github.com/Xevion/glance.git
synced 2025-12-13 00:11:47 -06:00
Return NaN instead of 0 when dividing by 0
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -191,7 +192,7 @@ var customAPITemplateFuncs = func() template.FuncMap {
|
|||||||
},
|
},
|
||||||
"div": func(a, b float64) float64 {
|
"div": func(a, b float64) float64 {
|
||||||
if b == 0 {
|
if b == 0 {
|
||||||
return 0
|
return math.NaN()
|
||||||
}
|
}
|
||||||
|
|
||||||
return a / b
|
return a / b
|
||||||
|
|||||||
Reference in New Issue
Block a user