Transforming an angle into [-Pi, Pi)

I have a strange problem with the Mod-function when used for transforming any angle \[Omega] into the half-open interval [-\[Pi], \[Pi]). This is done by Mod[\[Omega], 2 \[Pi], -\[Pi]]:

Plot[Mod[\[Omega], 2 \[Pi], -\[Pi]], {\[Omega], -3 \[Pi], 3 \[Pi]}]

This transformation does not work without error at the bounds [Omega] = …, -360°, -180°, 180°, 360°, …
Instead, we have to use:

If[ [Omega] == [Pi] Floor[N[ [Omega] / [Pi] ]], -[Pi], Mod[ [Omega] ,2 [Pi] , -[Pi] ] ]

For details, see this attached notebook “220109 Transforming an Angle.nb”.

Note: This was done with Wolfram desktop version 13.0.0, but happens as well with version 12.3.1 and version 12.0.0 on Windows 10 Pro (64 bit).

220109 Transforming an Angle.nb (110 KB)

BTW: How can I write or copy special characters like Pi into the community editor?

It is mentioned in READ FIRST . Example:

Evaluate TexForm with the expression as argument

TeXForm[\[Omega] == \[Pi] Floor[N[\[Omega]/\[Pi]]] // HoldForm]
(* \omega =\pi  \left\lfloor N\left[\frac{\omega }{\pi }\right]\right\rfloor *)

Copy the output and paste it in the editor, bracketed between $

\omega =\pi \left\lfloor N\left[\frac{\omega }{\pi }\right]\right\rfloor

Thanks Hans. I didn’t remember that.

Sorry, I had a minor error within my code. The correction must read:
\text{If}[\omega \neq 0\land \omega =\pi Floor[ N[\omega/\pi] ] ,-\pi ,\text{Mod}[\omega ,2 \pi ,-\pi]]

I had forgotten the case \omega =0.

For details, see the attached slightly changed notebook “220109b Transforming an Angle.nb”.

220109b Transforming an Angle.nb (114 KB)

Hi Werner,
You can also use this tool for special characters