That's not how these inertial navigation units work. They measure the acceleration of the device in six axes. Forward/back, up/down, left/right, yaw, pitch, and roll. Then they integrate these accelerations to determine current velocity. Then they integrate velocity to determine position. Really the above calculation is a bit of a spitball, because it will vary depending on the motion of the submarine.
In the inertial reference frame of Earth, the only celestial body you really need to worry about are tidal forces from the moon. Every other body is too far away for tidal forces to be a problem. They average out across the entire inertial reference frame.
Typically such systems need to be aligned every so often. This means you set the "Initial Conditions" of your integration. Typically position can be aligned easily using reference points to re-align your INS. The SR-71 did this using celestial points. Submarines can use sonar beacons and low frequency radio to passively align position. Planes and GPS/INS guided munitions now mostly use GPS to maintain alignment.
Old school ring laser gyros were unfortunately only good for about a couple hours before realign was necessary. Which is perfect for a fighter jet, missile, or bomb which will only fly that long occasionally. This new system can align every couple weeks or even months. Especially if the sub is stationary for long periods of time.
1 degree of latitude is 60 nautical miles
1 millionth of a degree is 0.1 meters
So they lose about 2.4 meters of accuracy per day or about 0.9km per year. Which is pretty good for nautical navigation purposes.