I think I kinda understand... but I might be wrong... your return is not a right angle and you want to know how to cut the top rail?
If so, you will need to fall back on trigonometry. These days you don't need to know trigonometry. You can find websites that will help to do the calculations for you.
You have the long area, and then the return. Run a spare bit of timber along the angled return posts, mark it off (at the return to the longer length) and use a cheap school kid's protractor to work out the angle. If your other half is uncomfortable with you abducting a school kid and their 50p tool, draw a picture with the dimensions, and if you want, one of use will (hopefully) help you. Try to be as precise as possible and include the width of the posts.
Ultimately, when the angles are calculated, you will still need a protractor.
BTW I am not advocating kidnapping kids.