By 1938 the United States Navy had developed an electromechanical analog computer small enough to use aboard a submarine.
This was the Torpedo Data Computer, which used trigonometry to solve the problem of firing a torpedo at a moving target. During World War II similar devices were developed in other countries as well.