Ternary arithmetic implemented in Go