Debian Codegraph @

staticcheck/sa4026/testdata/go1.0/CheckNegativeZeroFloat/CheckNegativeZeroFloat.go

raw
1 package pkg
2
3 const x = 0.0
4
5 func fn() {
6 _ = -0.0 //@ diag(`in Go, the floating-point literal '-0.0' is the same as '0.0', it does not produce a negative zero`)
7 _ = float32(-0.0) //@ diag(`in Go, the floating-point literal '-0.0' is the same as '0.0', it does not produce a negative zero`)
8 _ = float64(-0.0) //@ diag(`in Go, the floating-point literal '-0.0' is the same as '0.0', it does not produce a negative zero`)
9 _ = -float32(0) //@ diag(`in Go, the floating-point expression '-float32(0)' is the same as 'float32(0)', it does not produce a negative zero`)
10 _ = -float64(0) //@ diag(`in Go, the floating-point expression '-float64(0)' is the same as 'float64(0)', it does not produce a negative zero`)
11 _ = -float32(0.0) //@ diag(`in Go, the floating-point expression '-float32(0.0)' is the same as 'float32(0.0)', it does not produce a negative zero`)
12 _ = -float64(0.0) //@ diag(`in Go, the floating-point expression '-float64(0.0)' is the same as 'float64(0.0)', it does not produce a negative zero`)
13
14 // intentionally not flagged
15 _ = -x
16 }