I'm using Physics2D.BoxCast in Unity(2019.4.19f1).
I have a collider2D at position==(0,0) with scale==(1,1)
Then I call a Physics2D.BoxCast:
var hit = Physics2D.BoxCast(new Vector2(0, 2), new Vector2(1, 1), 0, new Vector2(0, -1));
It is a Box Ray Cast like the following pic:

I have a hit returned.
But hit.distance == 0.9950001, which is supposed to be 1.
I guess there may be some inaccuracy in Physics2D.BoxCast. But I have no idea how much the inaccuracy can be.
Then I do some searching and find "Default Contact Offset" may be related to my problem.
I change "Project Setting → Physics2D → Default Contact Offset" to 0.001(default is 0.01).
Run the code again. But now I get hit.collider == null.
Now I'm more confused about Physics2D.BoxCast.
It may be helpful to learn something about how Physics2D.BoxCast work. But I do not know where to find them.
Added 2021.3.1
I did several experiments about "DefaultContactOffset".(link)
The experiment results show that:
I actually don't know Physics2D.BoxCast but from what i understand it just moves a box to your target at a "speed". Now I done similar calculations in opengl and any collision like this using a speed over time will result this behavior. You can't expect to get a result %100 accurate. imagine every frame you move the red box 5 points instead of a small scale. You red box would just jump over the white box and you would not get a hit result..
Now internet says " Reducing Default Contact Offset can mean that collisions don't have enough of a buffer to work correctly. " so i guess Physics2D.BoxCast just check if 2 objects is going to collide and not if they are colliding which would explain why you get a null hit when you make the ofset so small.
Edit:This was a comment but was too long.