Actually, for 540 degrees of rotation of encoder in any one direction, my servo should rotate 30 degrees, in that direction. That's why i have used float.
In other words, when the encoder is twisted, the servo rotates. For 18 degrees rotation of the encoder, the servo rotates 1 degree. I'd suggest you simplify the whole idea to this: Keep track of the absolute position of the rotary encoder. You can count steps. 540 degrees is 1½ revolutions, right? If one revolution is 24 steps, you have 36 steps for your 30 degrees of servo movement. Have a routine (an interrupt routine would be the best) count the steps your rotary encoder does. You will have an "absolute" position of 9 revolutions corresponding to an "absolute" position of 180 degrees of the servo. 9 revolutions times 24 steps per revolution is 216 steps. Your rotary encoder routine should count from 0 to 215 when rotating. Have the counter stop at 215, even though the rotation continues. Likewise when rotating in the other direction, have it stop at 0. Then map the 0 - 215 range to 0 - 180 degrees, which will be your command to the servo.
There's no need for separate TurnLeft() and TurnRight() routines. Just get the rotary encoder position, map it to an angle between 0 and 180 and write to servo.