reflect(I, N) functions returns inverted vector

I notice today, that the reflect function of the VectorMath node, uses the Normal as if it was a surface Tangent.
In mathematical terms, the reflected vector is supposed to be R = 2*dot(I, N) - I;;

But I quickly discovered that the fuctions reflect_v3_v3v3()(blenlib/intern/math_vector.c), reflect()(cycles/util/util_math_float3.c) and reflect()(cycles/kernel/shaders/stdosl.h), they all output R = I - 2*dot(I, N); :open_mouth:

In math_vector.c, it was even added an ascii graphic and a note that for “bouncing” we should negate the result…

Going further, since stdosl.h should be very similar to the one from ImageWorks, I found out that they did the same thing (and also a clarification in the specs).

I wonder why this choice? Is there any reason to output the inverted vector (instead of the real ‘reflected’ one)?

It depends what you mean by reflection exactly.
http://mathworld.wolfram.com/Reflection.html

The operation of exchanging all points of a mathematical object with their mirror images (i.e., reflections in a mirror).

The term reflection can also refer to the reflection of a ball, ray of light, etc. off a flat surface.

That example from Wolfram is what I’d expect…

The question still is what do we mean by Normal in our functions?

See formula (3) on the Wolfram page and the image above it, the direction of v (and so I) is reversed, like an incoming ray direction.

But is there a reason to do it like this?
I find it a bit strange to use vectors that don’t start in the origin… Formula (3) explicitly says X1' - X0.

It just the convention in shading languages and graphics math libraries. It doesn’t seem strange to me to work with ray direction vectors.

Ok… Thanks for the answer.
I can keep using -I (or -reflect(I, N)) for calling the function, thought it seems that is just one extra step to get a more usefull vector.