получаем ошибку а получаем интересное число?
                  
                  
                  
                  
                  
                  var total float64
                  
                  
                  fmt.Println(int(math.Round(0.00 / total * 100)))
                  
                  
                  
                  
                  
                  UPD. 
                  
                  
                  Если вывести 
                  
                  
                  var total float64
                  
                  
                  fmt.Println(0.00 / total) - так получим NaN
                  
                  
                  fmt.Println(int(0.00 / total)) - Так -9223372036854775808
                  
                  
                  
                  
                  
                  Что происходит внутри, почему int(NaN) выдает такое число?
                  
                  
                
The spec says (https://golang.org/ref/spec#Conversions) In all non-constant conversions involving floating-point or complex values, if the result type cannot represent the value the conversion succeeds but the result value is implementation-dependent
Обсуждают сегодня