Given a decimal integer n as input, output the smallest (in terms of absolute value) decimal integer m such that the absolute value of n-m is a binary integer (composed only of 1s and 0s).
n and m can be any integer, positive or negative.
Example
Let n = 702. The closest binary integer is 1000 = |702 - (-298)|, so m = -298.
Let n = -82. The closest binary integer in absolute value is 100 = |-82 - 18|, so m = 18.
Test Cases
Input n Output m
0 0
1 0
4 3
-4 -3
6 -4
15 4
55 44
56 -44
-82 18
702 -298
-1000 0
Scoring
This is code-golf, so the shortest answer in bytes wins.
mand notn, correct me if I'm wrong \$\endgroup\$