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.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.