|
14 | 14 | void |
15 | 15 | ca_tribonacci_constant(ca_t res, ca_ctx_t ctx) |
16 | 16 | { |
17 | | - /* Subexpressions */ |
18 | | - ca_t third, r33, r33p, r33m; |
| 17 | + qqbar_t tc; |
| 18 | + qqbar_init(tc); |
| 19 | + qqbar_tribonacci_constant(tc); |
19 | 20 |
|
20 | | - /* Init */ |
21 | | - ca_init(third, ctx); |
22 | | - ca_init(r33, ctx); |
23 | | - ca_init(r33p, ctx); |
24 | | - ca_init(r33m, ctx); |
| 21 | + ca_set_qqbar(res, tc, ctx); |
25 | 22 |
|
26 | | - /* third := 1/3 */ |
27 | | - ca_one(third, ctx); |
28 | | - ca_div_ui(third, third, 3, ctx); |
29 | | - |
30 | | - /* r33 := 3*sqrt(33) */ |
31 | | - ca_sqrt_ui(r33, 33, ctx); |
32 | | - ca_mul_ui(r33, r33, 3, ctx); |
33 | | - |
34 | | - /* r33p := cbrt(19 + r33) */ |
35 | | - ca_add_ui(r33p, r33, 19, ctx); |
36 | | - /* Todo: now suitable root function in calcium yet */ |
37 | | - /* ca_root_ui(r33p, r33p, 3, ctx); */ |
38 | | - ca_pow(r33p, r33p, third, ctx); |
39 | | - |
40 | | - /* r33m := cbrt(19 - r33) */ |
41 | | - ca_sub_si(r33m, r33, 19, ctx); |
42 | | - ca_neg(r33m, r33m, ctx); |
43 | | - /* Todo: now suitable root function in calcium yet */ |
44 | | - /* ca_root_ui(r33m, r33m, 3, ctx); */ |
45 | | - ca_pow(r33m, r33m, third, ctx); |
46 | | - |
47 | | - /* res := 1 */ |
48 | | - ca_one(res, ctx); |
49 | | - /* res += r33p */ |
50 | | - ca_add(res, res, r33p, ctx); |
51 | | - /* res += r33m */ |
52 | | - ca_add(res, res, r33m, ctx); |
53 | | - /* res /= 3 */ |
54 | | - ca_div_ui(res, res, 3, ctx); |
55 | | - |
56 | | - /* Free */ |
57 | | - ca_clear(third, ctx); |
58 | | - ca_clear(r33, ctx); |
59 | | - ca_clear(r33p, ctx); |
60 | | - ca_clear(r33m, ctx); |
| 23 | + qqbar_clear(tc); |
61 | 24 | } |
0 commit comments