Fix NaN*10^(-9223372036854775808) glitch

This commit is contained in:
MassiveBox 2023-06-23 13:43:03 +02:00
parent 22ed86d6f3
commit 068aae82c3
No known key found for this signature in database
GPG Key ID: 9B74D3A59181947D
1 changed files with 1 additions and 1 deletions

View File

@ -18,7 +18,7 @@ func TemplateDivide(num1, num2 float32) template.HTML {
division := float64(num1 / num2)
powerOfTen := int(math.Floor(math.Log10(division)))
if powerOfTen >= -2 && powerOfTen <= 2 {
if (powerOfTen >= -2 && powerOfTen <= 2) || division == 0 {
// #nosec G203 // We're only printing floats
return template.HTML(strconv.FormatFloat(math.Round(division*100)/100, 'f', -1, 64))
}