Fix NaN*10^(-9223372036854775808) glitch
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
22ed86d6f3
commit
068aae82c3
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue