Hlsl Atan2

Does anyone know what the differences are if any between Hlsl atan2(x,y) and our c# Math.Atan2(x,y)
Im getting some weird results in a shader.

It seems like i get results in the negative -Pi / 2 to Pi / 2 range which sort of makes no sense but the hlsl page is a little crypic on the return value when it states the following…

The signs of the x and y parameters are used to determine the quadrant of the return values within the range of -? to ?.

I might as well ask another question when you are writing the depth to a rendertarget does the depth buffer internally use just the z value of the position or is the w coming into play as well ?

Not sure if it helps, but isn’t Math.Atan2(y, x) instead of (x, y)? I’ve tripped over this quite a lot and it’s very annoying. Not sure if the HLSL one is the same…

Ya never mind i just tested it.

    float radsAsUnits = (atan2(input.TexureCoordinateA.x - 0.5f, input.TexureCoordinateA.y - 0.5f) / 3.14159265f) * 0.5f + 0.5f;
    col.g = radsAsUnits;
    col.a = 1.0f;

trying to do something really complicated just messing something else up.

Just so you know

atan2 -Pi to Pi
atan -Pi/2 to Pi/2