1 + cos(x - pi floor(x / pi)) - floor(x / pi)