Trigonometry!
You know the actual location and target, in X Y coordinates; eg east-west for X and north-south for Y.
Decide on and use some fixed unit scale that gives adequate positional accuracy, like 0.01 arc seconds or 0.0001 arc minutes
You will need 32 bit maths, or possibly double precision floats for really high precision.
Take the difference in X and the difference in Y
Call those dX and dY
Calculate straight-line radial distance; Pythagoras theorem: R = Square root ((dX * dX) + (dY * dY))
Divide the X & Y differences by the radial distance:
SX = dX / R
CY = dY / R
That should give two fractions which are the sine and cosine of the absolute bearing angle.
Arcsin(SX) & Arccos(CY) should both give that angle; if they are within a few percent of each other average them as the final result. If they are very different, ignore that calculation and try the next set up values.
If!! I've got all that correct, from memory..