aboutsummaryrefslogtreecommitdiff
path: root/ic-reals-6.3/math-lib/acos_R.c
blob: 0f62f4160d626a9d142a2c4034d7d09df4f38aa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Copyright (C) 2000, Imperial College
 *
 * This file is part of the Imperial College Exact Real Arithmetic Library.
 * See the copyright notice included in the distribution for conditions
 * of use.
 */

#include <stdio.h>
#include "real.h"

/*
 * acos(x) = atan((sqrt(1-x^2))/x)
 */
Real
acos_R(Real x)
{
  Real r;

	r = mul_R_R(x, x);
	r = sub_Int_R(1, r);
	r = sqrt_R(r);
	r = div_R_R(r, x);
	r = atan_R(r);
	return r;
}