-
Notifications
You must be signed in to change notification settings - Fork 0
/
real.wrap.go
218 lines (199 loc) · 4.78 KB
/
real.wrap.go
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
// Generated by genwrap.go. DO NOT EDIT
package z3
import "runtime"
/*
#cgo LDFLAGS: -lz3
#include <z3.h>
#include <stdlib.h>
*/
import "C"
// Eq returns a Value that is true if l and r are equal.
func (l Real) Eq(r Real) Bool {
ctx := l.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_eq(ctx.c, l.c, r.c)
})
runtime.KeepAlive(l)
runtime.KeepAlive(r)
return Bool(val)
}
// NE returns a Value that is true if l and r are not equal.
func (l Real) NE(r Real) Bool {
return l.ctx.Distinct(l, r)
}
// Div returns l / r.
//
// If r is 0, the result is unconstrained.
func (l Real) Div(r Real) Real {
// Generated from real.go:124.
ctx := l.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_div(ctx.c, l.c, r.c)
})
runtime.KeepAlive(l)
runtime.KeepAlive(r)
return Real(val)
}
// ToInt returns the floor of l as sort Int.
//
// Note that this is not truncation. For example, ToInt(-1.3) is -2.
func (l Real) ToInt() Int {
// Generated from real.go:130.
ctx := l.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_real2int(ctx.c, l.c)
})
runtime.KeepAlive(l)
return Int(val)
}
// IsInt returns a Value that is true if l has no fractional part.
func (l Real) IsInt() Bool {
// Generated from real.go:134.
ctx := l.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_is_int(ctx.c, l.c)
})
runtime.KeepAlive(l)
return Bool(val)
}
// ToFloat converts l into a floating-point number.
//
// If necessary, the result will be rounded according to the current
// rounding mode.
func (l Real) ToFloat(s Sort) Float {
// Generated from real.go:141.
ctx := l.ctx
rm := ctx.rm()
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_fpa_to_fp_real(ctx.c, rm.c, l.c, s.c)
})
runtime.KeepAlive(l)
runtime.KeepAlive(s)
return Float(val)
}
// ToFloatExp converts l into a floating-point number l*2^exp.
//
// If necessary, the result will be rounded according to the current
// rounding mode.
func (l Real) ToFloatExp(exp Int, s Sort) Float {
// Generated from real.go:148.
ctx := l.ctx
rm := ctx.rm()
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_fpa_to_fp_int_real(ctx.c, rm.c, exp.c, l.c, s.c)
})
runtime.KeepAlive(l)
runtime.KeepAlive(exp)
runtime.KeepAlive(s)
return Float(val)
}
// Add returns the sum l + r[0] + r[1] + ...
func (l Real) Add(r ...Real) Real {
// Generated from intreal.go:12.
ctx := l.ctx
cargs := make([]C.Z3_ast, len(r)+1)
cargs[0] = l.c
for i, arg := range r {
cargs[i+1] = arg.c
}
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_add(ctx.c, C.uint(len(cargs)), &cargs[0])
})
runtime.KeepAlive(&cargs[0])
return Real(val)
}
// Mul returns the product l * r[0] * r[1] * ...
func (l Real) Mul(r ...Real) Real {
// Generated from intreal.go:16.
ctx := l.ctx
cargs := make([]C.Z3_ast, len(r)+1)
cargs[0] = l.c
for i, arg := range r {
cargs[i+1] = arg.c
}
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_mul(ctx.c, C.uint(len(cargs)), &cargs[0])
})
runtime.KeepAlive(&cargs[0])
return Real(val)
}
// Sub returns l - r[0] - r[1] - ...
func (l Real) Sub(r ...Real) Real {
// Generated from intreal.go:20.
ctx := l.ctx
cargs := make([]C.Z3_ast, len(r)+1)
cargs[0] = l.c
for i, arg := range r {
cargs[i+1] = arg.c
}
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_sub(ctx.c, C.uint(len(cargs)), &cargs[0])
})
runtime.KeepAlive(&cargs[0])
return Real(val)
}
// Neg returns -l.
func (l Real) Neg() Real {
// Generated from intreal.go:24.
ctx := l.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_unary_minus(ctx.c, l.c)
})
runtime.KeepAlive(l)
return Real(val)
}
// Exp returns lᶠ.
func (l Real) Exp(r Real) Real {
// Generated from intreal.go:28.
ctx := l.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_power(ctx.c, l.c, r.c)
})
runtime.KeepAlive(l)
runtime.KeepAlive(r)
return Real(val)
}
// LT returns l < r.
func (l Real) LT(r Real) Bool {
// Generated from intreal.go:32.
ctx := l.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_lt(ctx.c, l.c, r.c)
})
runtime.KeepAlive(l)
runtime.KeepAlive(r)
return Bool(val)
}
// LE returns l <= r.
func (l Real) LE(r Real) Bool {
// Generated from intreal.go:36.
ctx := l.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_le(ctx.c, l.c, r.c)
})
runtime.KeepAlive(l)
runtime.KeepAlive(r)
return Bool(val)
}
// GT returns l > r.
func (l Real) GT(r Real) Bool {
// Generated from intreal.go:40.
ctx := l.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_gt(ctx.c, l.c, r.c)
})
runtime.KeepAlive(l)
runtime.KeepAlive(r)
return Bool(val)
}
// GE returns l >= r.
func (l Real) GE(r Real) Bool {
// Generated from intreal.go:44.
ctx := l.ctx
val := wrapValue(ctx, func() C.Z3_ast {
return C.Z3_mk_ge(ctx.c, l.c, r.c)
})
runtime.KeepAlive(l)
runtime.KeepAlive(r)
return Bool(val)
}