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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
open Ctypes
open C.Type
open C.Function
module ARF = struct
type t = arf_t
module C = struct
let arf_t = C.Type.arf_t
let mk_arf () : arf_t =
allocate_n ~count:1 ~finalise:C.Function.arf_clear arf_struct
end
module External = struct
module CI = Cstubs_internals
type 'a fatptr = (Obj.t option, 'a) CI.fatptr
external flint_stubs_utils_to_string : arf fatptr -> string
= "arf_stubs_utils_to_string"
let to_string (CI.CPointer p : t) = flint_stubs_utils_to_string p
end
let pp fmt x = Format.pp_print_string fmt (External.to_string x)
let get_fmpz_fixed_si x n =
let z = Flint.FMPZ.C.mk_fmpz () in
ignore (arf_get_fmpz_fixed_si z x (Signed.Long.of_int n));
Flint.FMPZ.to_z z
end
module MAG = struct
type t = mag_t
module C = struct
let mag_t = C.Type.mag_t
let mk_mag () : mag_t =
allocate_n ~count:1 ~finalise:C.Function.mag_clear mag_struct
end
module External = struct
module CI = Cstubs_internals
type 'a fatptr = (Obj.t option, 'a) CI.fatptr
external flint_stubs_utils_to_string : mag fatptr -> string
= "mag_stubs_utils_to_string"
let to_string (CI.CPointer p : t) = flint_stubs_utils_to_string p
end
let pp fmt x = Format.pp_print_string fmt (External.to_string x)
end
module ARB = struct
type t = ARB.t
module C = struct
let arb_t = C.Type.ARB.t
let mk_arb () : ARB.t =
allocate_n ~count:1 ~finalise:C.Function.arb_clear ARB.s
end
module External = struct
module CI = Cstubs_internals
type 'a fatptr = (Obj.t option, 'a) CI.fatptr
external flint_stubs_utils_to_string : ARB.s fatptr -> string
= "arb_stubs_utils_to_string"
let to_string (CI.CPointer p : t) = flint_stubs_utils_to_string p
end
let pp fmt x = Format.pp_print_string fmt (External.to_string x)
let mid x = x |-> ARB.mid
let rad x = x |-> ARB.rad
end
module ACB = struct
type t = ACB.t
module C = struct
let acb_t = C.Type.ACB.t
let mk_acb () : ACB.t =
allocate_n ~count:1 ~finalise:C.Function.acb_clear ACB.s
end
module External = struct
module CI = Cstubs_internals
type 'a fatptr = (Obj.t option, 'a) CI.fatptr
external flint_stubs_utils_to_string : ACB.s fatptr -> string
= "acb_stubs_utils_to_string"
let to_string (CI.CPointer p : t) = flint_stubs_utils_to_string p
end
let pp fmt x = Format.pp_print_string fmt (External.to_string x)
let rel_accuracy_bits t = Signed.Long.to_int @@ acb_rel_accuracy_bits t
let real x = x |-> ACB.real
let imag x = x |-> ACB.imag
end