and computational techniques attained by these scholars". The first mathematical methods developed in the early 9th century were approximate solutions to the mathematical problem, usually using a flat map or two-dimensional geometry. Since in reality the earth is spherical, the directions found were inexact, but they were sufficient for locations relatively close to Mecca (including as far away as Egypt and Iran) because the errors were less than 2°. Exact solutions, based on three-dimensional geometry and spherical trigonometry, began to appear in the mid-9th century. Habash al-Hasib wrote an early example, using an orthographic projection. Another group of solutions uses trigonometric formulas, for example Al-Nayrizi's four-step application of Menelaus's theorem. Subsequent scholars, including Ibn Yunus, Abu al-Wafa, Ibn al-Haitham and Al-Biruni, proposed other methods which are confirmed to be accurate from the viewpoint of modern astronomy. Muslim astronomers subsequently used these methods to compile tables showing the qibla from a list of locations, grouped by their latitude and longitude differences from Mecca. The oldest known example, from Baghdad, contained entries for each degree and arc minute up to 20°. In the 14th century, Shams al-Din al-Khalili, an astronomer who served as a muwaqqit (timekeeper) in the Umayyad Mosque of Damascus, compiled a qibla table for 2,880 coordinates with longitude differences of up to 60° from Mecca, and with latitudes ranging from 10° to 50°. King opines that among the medieval qibla tables, al-Khalili's work is "the most impressive from the view of its scope and its accuracy". The accuracy of applying these methods to actual locations depend on the accuracy of its input parameters—the local latitude and the latitude of Mecca, and the longitude difference. At the time of the development of these methods, the latitude of a location could be determined to several arc minutes' accuracy, but there was no accurate method to determine a location's longitude. Common methods used to estimate the longitude difference included comparing the local timing of a lunar eclipse versus the timing in Mecca, or measuring the distance of caravan routes; the Central Asian scholar Al-Biruni made his estimate by averaging various approximate methods. Because of longitudinal inaccuracy, medieval qibla calculations (including those using mathematically accurate methods) differ from the modern values. For example, while the Al-Azhar Mosque in Cairo was built using the "qibla of the astronomers", but the mosque's qibla (127°) differs somewhat from the results of modern calculations (135°) because the