In a nutshell, Al-Battani had the equipment, but did not formulate the law.
He works in astronomical, not geometric terms. It is true
that to go from one of his formulas to the law of cosines you only have to
write the length of the day in terms of the latitude and the
height of the Ecliptic; this he certainly could have done, but he did not.
Here are the details, as explained by Anton von Braunmühl in his
Vorlesungen über Geschichte der Trigonometrie {Lectures on the History of Trigonometry} (Leipzig, 1900).
This image is adapted from Braunmühl's Fig. 15. It is based on Al-Battani and presumably shows the calculation of the height $h = \overline{SC}$ of the sun at a given time $t$.
As represented, the celestial sphere intersects the plane of the figure in the great circle containing the poles $P,P'$ and the mid-day position $D$ of the Sun. The Sun rises at $A$. The surface angle $\widehat{APD}$ = $t_0$ is $\frac{1}{2}$ the length of the day. The surface angle $\widehat{SPD}$ gives the time $t$ of the observation, measured from noon. The other quantities entering into the calculation are the colatitude $\overline{H'P} = \varphi$ and the (complement of the) angle of the Earth's axis with the Ecliptic, measured by $\overline{ED} = \delta$. Al-Battani's formula is given in terms of the sinvers function, equal to 1 minus our cosine: $ {\rm sinvers} (\alpha) = 1 - \cos(\alpha)$, and reads as follows: $$ ~{\rm sinvers}~t = ~{\rm sinvers}~t_0 -\frac{\displaystyle ~{\rm sinvers}~t_0 \sin h}{\displaystyle \sin(90^o - (\varphi - \delta))}.$$ This is described by Braunmühl, footnote 1 on page 53. He goes on to say that this is not quite the spherical law of cosines. The statement that Al-Battani "knew" the law of cosines he quotes from H. Hankel: "Vor den trigonometrischen Fundamentalsätzen kennt Al-Battáni außer denen des Almagest bereits die Formel $$\cos a = \cos b \cos c + \sin b \sin c \cos\alpha$$ für schiefwinklige Dreiecke, die er daher nicht immer in zwei rechtwinklige Dreiecke zerlegen muß, und weiß dieselbe, um eine Multiplikation zu ersparen, in die Form zu setzen $$ ~{\rm sinvers}~\alpha = \frac{\displaystyle \cos(b-c)-\cos a}{\displaystyle \sin b \sin c}.\mbox{"}$$
{"Of the fundamental trigonometrical identities Al-Battani knows, besides those in the Almagest, the formula ... for acute-angled [spherical] triangles, which he therefore does not need to split into two right triangles, and he also knows how to avoid an extra multiplication by putting it in the form ... ."}
Braunmühl continues: "Aber weder die erste, noch die zweite dieser Formel kommt bei ihm irgendwo vor. Hankel's Irrtum scheint mir aus Delambre's Hist. de l'Astr. du moyen age p. 20 zu stammen, denn dieser führt dort in die bei Al-Battáni vorkommende Gleichung $$ ~{\rm sinvers}~t = ~{\rm sinvers}~t_0 -\frac{\displaystyle ~{\rm sinvers}~t_0 \sin h}{\displaystyle \sin(90^o - (\varphi - \delta))}$$ statt $~{\rm sinvers}~t_0$ den Wert $\frac{\displaystyle \cos(\varphi - \delta)} {\displaystyle \cos \varphi \cos \delta}$ ein, wodurch sie dann allerdings in $~{\rm sinvers}~t = \frac{\displaystyle \cos(\varphi - \delta)-\cos h}{\displaystyle \cos \varphi \cos \delta}$ übergeht. Aber diese Substitution hat Delambre, nicht Al-Battáni ausgeführt, der überhaupt nirgends mit Gleichungen rechnet, sodaß bei ihm von einem Zusammenhang dieser Formeln, oder besser Regeln, untereinander nirgends eine Spur vorhanden ist.
{"But neither the first nor the second of these formulas can be found anywhere in his [al-Battani's] work. It seems to me that Hankel's error comes from Delambre's Histoire de l'Astronomie du Moyen Age [History of Medieval Astronomy], p. 20, since the latter substitutes in al-Battani's equation .... instead of $~{\rm sinvers}~t_0$ the expression $\frac{\displaystyle \cos(\varphi - \delta)} {\displaystyle \cos \varphi \cos \delta}$, whereby the equation becomes ... ."}
Braunmühl also makes the important remark (page 54) that there is no mention of the spherical triangle $PZS$ in Al-Battáni. (... ohne irgendwelche Beziehung auf das sphärische Dreieck $PZ\Sigma$.)
In his section on Regiomontanus (pp. 130-133) Braunmühl gives evidence that R. was well acquainted with Al-Battáni's work, and states "kein Zweifel mehr bestehen kann, daß er beim Studium des Albategnius zu diesem Lehrsatze geführt wurde.
{"I'm left with no possible doubt that he was led to this formula by his study of Al-Battani."}
But he also says (still about the law of cosines) "Dieses Verdienst muß nach unserer Ansicht Regiomontan ganz allein zugesprochen werden."
{"This result must in our view be attributed to Regiomontanus strictly alone"}.
Tony Phillips 2006-12-02