I was getting wrong answers with Sage. It came down to this:
\documentclass[12pt]{article}%
\usepackage{sagetex}
\begin{document}
\begin{sagesilent}
c = randint(14,20)
d = randint(5,10)
\end{sagesilent}
$\frac{\sage{c}}{\sage{d}}-\frac{\sage{c-3}}{\sage{d+1}}=$ \\
%$\sage{c/d-((c-3)/(d+1))}$\\
$\sage{c/d}$\\
$\sage{((c-3)/(d+1))}$\\
$\sage{c/d-((c-3)/(d+1))}$
\end{document}
When I compiled with the commented out line I got the wrong answer, so I commented it out and broke it down into the 3 calculations below it. Output is below: for 20/7 - 17/8, Sage calculates 20/7 as 2 (rounding down) but 17/8 as 17/8 (not rounding down) to get a final answer of 2-17/8=-1/8. Image of output below. Why does it round (down) in one case and not in the others? What is the proper way to get the correct fractional answer?