Note that format rat may not give you the answer you expect once the numerator and denominator get too large.
N = 1e8;
format rat
X = (N-2^20)/N
X =
1038/1049
format longg
X
X =
0.98951424
y = 1038/1049
y =
0.989513822688275
Close, but not quite right.
If you wanted more control you could use the rat function to compute the numerator and denominator (perhaps with a tolerance) or use Symbolic Math Toolbox.