1 // Test Gosper's example: find coth 1/2 via Newton's method.
10 static void *cot1_fn(cf_t cf
) {
22 for (i
= 0; i
< 6; i
++) mpz_init(a
[i
]);
29 x
= cf_new_const(cot1_fn
);
30 y
= cf_new_newton(x
, a
, a
[0]);
31 CF_EXPECT_DEC(y
, "2.16395341373865284877");
35 // Confirm sqrt(1-(sin 1)^2) = cos 1
45 cf_t bi
= cf_new_bihom(s1
[0], s1
[1], b
);
46 cf_t n
= cf_new_sqrt(bi
);
48 CF_EXPECT_DEC(n
, "0.54030230586813971740");
55 x
= cf_new_sqrt_int(355, 113);
56 CF_EXPECT_DEC(x
, "1.77245392615830279609");
60 for (i
= 0; i
< 6; i
++) mpz_clear(a
[i
]);