Is it possible to detect in which way the player is facing at exactly and store it?

Solution 1:

Assuming 1.13.

To store player's rotation, use execute store:

execute store result score rot0 store run data get entity @p Rotation[0] 1000000
execute store result score rot1 store run data get entity @p Rotation[1] 1000000

which stores his rotation in multidegree