Wikipedia describes a rather bulletproof approach to coding it, so I assume you are confused about the implementation logic. You are embarrassed by this, right?

If you look at the image next to it, you will see why:

Each channel function is a piecewise function consisting of five linear segments. The cases take into account each range of each distribution, namely the shaded areas of the above image.
source share