I think sin(angle*4) will be converted to an integer once multiplied by distance in this example - assuming 'distance' is defined as an integer, hence the incorrect x & y
try
x = 164 + sin(angle*4) * float( distance )
try
x = 164 + sin(angle*4) * float( distance )