Sampler Problem

Hello:
I want to check the nearby pixel color to process some things.
At begin,i want to get the offset ,to describe the direction of fragment location relative to the pixel(texture pixel) center.Then check the left,top,right pixel color by the offset.
However,I find the problem happened at the left and right check.

//pixel coordinate
float2 PixleUVs = float2(correctUV.x*_MainTex_TexelSize.z, correctUV.y*_MainTex_TexelSize.w);
//the sampler step of one pixel
float2 PixleStep = 1/float2(_MainTex_TexelSize.z,_MainTex_TexelSize.w) * float2(1,1);
float2 centerPoint = floor(PixleUVs)+0.
![异常|581x500](upload://1wGUuo7TkqCQmMPHp8I3p2rVuvE.jpeg)
5;
//sampler uv of pixel center
float2 centerSamplerPosition = float2(centerPoint.x/_MainTex_TexelSize.z,centerPoint.y/_MainTex_TexelSize.w);
//UV location relative to pixel center
float2 interPosition = PixleUVs - centerPoint;
fixed4 col = tex2D(_MainTex, centerSamplerPosition);
bool isup = (abs(interPosition.y)>abs(interPosition.x))&&(interPosition.y>0);
bool isdown = (abs(interPosition.y)>abs(interPosition.x))&&(interPosition.y<0);
offset += isup*float2(-PixleStep.x,0)+isdown*float2(PixleStep.x,0);

    
fixed4 left_Color = tex2D(_MainTex, centerSamplerPosition+offset);
bool exist_leftBorder = step(0.001,length(left_Color-col));
if(exist_leftBorder)
{
return float4(0,0,0,1);
}
return col;

picture1-error

When I don’t use the offset,it will be normal

...
bool exist_leftBorder = false;
if(isup)
{
//don't use offset
fixed4 left_Color = tex2D(_MainTex, centerSamplerPosition+float2(-PixleStep.x,0));
exist_leftBorder = step(0.001,length(left_Color-col));
}
if(isdown)
{
fixed4 left_Color = tex2D(_MainTex, centerSamplerPosition+float2(PixleStep.x,0));
exist_leftBorder = step(0.001,length(left_Color-col));
}
...

Why it is so strange,the two codes are much as the same.

this is the normal result