Why +2 the expected value is 0 instead of 2

It's because, according to the documentation, starting from the first nonwhitespace character, an optional initial plus or minus sign (in this case, '+') followed by as many base10 digits as possible (in this case, '2'). The string can contain additional characters after those that form the integral number, which are ignored and have no effect on the behavior of this function.
Obviously, "2" is not a string of "base10 digits", so it is interpreted as "additional characters", which are simply ignored.