I want to define an operator $G$ such that
$$G(f):=\begin{cases}f(\{x\}),&\lfloor x\rfloor\text{ is even}\\\frac1{f(\{x\})},&\lfloor x\rfloor\text{ is odd}\end{cases}$$
for any function $f$, where $\{x\}$ means "fractional part of $x$". I dont have a clue about how to do this. I wanted to write something like
G[2 + Sin[x]]
that define the above over the function $f(x)=2+\sin x$.