github.com/egonelbre/exp@v0.0.0-20240430123955-ed1d3aa93911/coder/arith/prob.go (about) 1 package arith 2 3 const ( 4 probBits = 12 5 MaxP = 1 << probBits 6 ) 7 8 // efficient representation of probability 9 type P uint32 10 11 func Prob(p float64) P { return P(float64(p) * float64(MaxP)) }