translation problem

I drew a 3D rect with length from -x to x. and on top of this rect ( in the middle) i drew a smaller rect of length -(x-w)/2 to (x-w)/2 where w < or equal to x. I want to translate this smaller rect to the left till it reach the edge whereby the edges of both rect are aligned properly so i translate by

glTranslatef ((-x-w)/2,0.0f,0.0f);

but when w=x, by right there should be no small rect showing but i get one face at the edge. Other than that it is okie, can someone point out my mistake?

I don’t understand the question. A screenshot would help.

(-x-w) != -(x-w)

Try this:
glTranslatef(-(x-w)/2,0.0f,0.0f);