Sorry - I made a silly mistake in the code I posted. The case where X=1 shows my error.
However, the real code that was/is causing trouble was for a larger range of X and included '>=', '<='.
My poor attempt to simplify the real problem failed!
I'll tidy up the real code and post it soonest.
Thanks for your input.
Regards Bill legge
Bookmarks