|
69 | 69 | [(bfinfinite? hi) (mpfr-exp lo)] |
70 | 70 | [else (min (mpfr-exp lo) (mpfr-exp hi))])])) |
71 | 71 |
|
72 | | -; Returns (list x (minlog x) (maxlog x) (logspan x) (crosses-zero? x)) |
| 72 | +; Returns (list (minlog x) (maxlog x) (logspan x) (crosses-zero? x) (bfzero? (ival-lo x)) (any-negative? x)) |
73 | 73 | (define (ival-info x) |
74 | 74 | (define slack (get-slack)) |
75 | 75 | (define lo (ival-lo x)) |
76 | 76 | (define hi (ival-hi x)) |
77 | 77 | (match (and (boolean? lo) (boolean? hi)) |
78 | | - [#t (list x #f #f #f #f)] |
| 78 | + [#t (list #f #f #f #f #f #f)] |
79 | 79 | [#f |
80 | 80 | (define lo-exp (mpfr-exp lo)) |
81 | 81 | (define hi-exp (mpfr-exp hi)) |
| 82 | + (define lo-sgn (mpfr-sign lo)) |
| 83 | + (define hi-sgn (mpfr-sign hi)) |
| 84 | + |
| 85 | + (define any-negative? (or (equal? lo-sgn -1) (equal? hi-sgn -1))) |
82 | 86 | (define-values (zero-lo? inf-lo? zero-hi? inf-hi? crosses-0?) |
83 | 87 | (values (bfzero? lo) |
84 | 88 | (bfinfinite? lo) |
85 | 89 | (bfzero? hi) |
86 | 90 | (bfinfinite? hi) |
87 | | - (not (equal? (mpfr-sign lo) (mpfr-sign hi))))) |
| 91 | + (not (equal? lo-sgn hi-sgn)))) |
88 | 92 | ; logspan |
89 | 93 | (define lg |
90 | 94 | (match (*bumps-activated*) |
|
122 | 126 | [inf-hi? (values lo-exp (+ (max lo-exp 0) slack))] ; [+..., +inf] |
123 | 127 | [else (values (min lo-exp hi-exp) (+ (max lo-exp hi-exp) 1))])])) |
124 | 128 | ; output |
125 | | - (list x mn mx lg crosses-0?)])) |
| 129 | + (list mn mx lg crosses-0? zero-lo? any-negative?)])) |
126 | 130 |
|
127 | 131 | (define (logspan x) |
128 | 132 | (match (*bumps-activated*) |
|
149 | 153 | ; Γ[*]'y = 1 |
150 | 154 | ; ↑ampl[*]'y = logspan(x) |
151 | 155 | ; ↓ampl[*]'y = 0 |
152 | | - (match-define (list _ _ _ lg-x _) (first srcs)) |
153 | | - (match-define (list _ _ _ lg-y _) (second srcs)) |
| 156 | + (match-define (list _ _ lg-x _ _ _) (first srcs)) |
| 157 | + (match-define (list _ _ lg-y _ _ _) (second srcs)) |
154 | 158 | (list (cons lg-x 0) ; bounds per x |
155 | 159 | (cons lg-y 0))] ; bounds per y |
156 | 160 |
|
|
162 | 166 | ; Γ[/]'y = 1 |
163 | 167 | ; ↑ampl[/]'y = logspan(x) + 2 * logspan(y) |
164 | 168 | ; ↓ampl[/]'y = 0 |
165 | | - (match-define (list _ _ _ lg-x _) (first srcs)) |
166 | | - (match-define (list _ _ _ lg-y _) (second srcs)) |
| 169 | + (match-define (list _ _ lg-x _ _ _) (first srcs)) |
| 170 | + (match-define (list _ _ lg-y _ _ _) (second srcs)) |
167 | 171 | (list (cons lg-y 0) ; bounds per x |
168 | 172 | (cons (+ lg-x (* 2 lg-y)) 0))] ; bounds per y |
169 | 173 |
|
|
175 | 179 | ; Γ[cbrt]'x = 1/3 |
176 | 180 | ; ↑ampl[cbrt]'x = logspan(x)*2/3 - 1 |
177 | 181 | ; ↓ampl[cbrt]'x = 0 |
178 | | - (match-define (list _ _ _ lg-x _) (first srcs)) |
| 182 | + (match-define (list _ _ lg-x _ _ _) (first srcs)) |
179 | 183 | (list (cons (quotient lg-x 2) 0))] |
180 | 184 |
|
181 | 185 | [(ival-add ival-sub ival-add! ival-sub!) |
|
186 | 190 | ; Γ[+ & -]'y = |y/(x+y)| & |-y/(x-y)| |
187 | 191 | ; ↑ampl[+ & -]'y = maxlog(y) - minlog(z) |
188 | 192 | ; ↓ampl[+ & -]'y = minlog(y) - maxlog(z) |
189 | | - (match-define (list x _ mx-x _ _) (first srcs)) |
190 | | - (match-define (list y _ mx-y _ _) (second srcs)) |
191 | | - (match-define (list z mn-z _ _ _) output) |
| 193 | + (match-define (list _ mx-x _ _ _ _) (first srcs)) |
| 194 | + (match-define (list _ mx-y _ _ _ _) (second srcs)) |
| 195 | + (match-define (list mn-z _ _ _ _ _) output) |
192 | 196 |
|
193 | 197 | (if (*lower-bound-early-stopping*) |
194 | 198 | (list (cons (- mx-x mn-z) |
195 | | - (- (minlog x #:less-slack #t) (maxlog z #:less-slack #t))) ; bounds per x |
| 199 | + 0 |
| 200 | + #;(- (minlog x #:less-slack #t) (maxlog z #:less-slack #t))) ; bounds per x |
196 | 201 | (cons (- mx-y mn-z) |
197 | | - (- (minlog y #:less-slack #t) (maxlog z #:less-slack #t)))) ; bounds per y |
| 202 | + 0 |
| 203 | + #;(- (minlog y #:less-slack #t) (maxlog z #:less-slack #t)))) ; bounds per y |
198 | 204 | (list (cons (- mx-x mn-z) 0) ; bounds per x |
199 | 205 | (cons (- mx-y mn-z) 0)))] ; bounds per y |
200 | 206 |
|
|
206 | 212 | ; Γ[pow]'y = |y*ln(x)| |
207 | 213 | ; ↑ampl[pow]'y = maxlog(y) + max(|minlog(x)|,|maxlog(x)|) + logspan(z) |
208 | 214 | ; ↓ampl[pow]'y = minlog(y) |
209 | | - (match-define (list x mn-x mx-x lg-x _) (first srcs)) |
210 | | - (match-define (list y _ mx-y _ _) (second srcs)) |
211 | | - (match-define (list z _ _ lg-z cr-z) output) |
| 215 | + (match-define (list mn-x mx-x lg-x _ _ an-x) (first srcs)) |
| 216 | + (match-define (list _ mx-y _ _ _ _) (second srcs)) |
| 217 | + (match-define (list _ _ lg-z cr-z zl-z _) output) |
212 | 218 |
|
213 | 219 | ; when output crosses zero and x is negative - means that y was fractional and not fixed (specific of Rival) |
214 | 220 | ; solution - add more slack for y to converge |
215 | 221 | (define y-slack |
216 | | - (if (and cr-z (bfnegative? (ival-lo x))) |
| 222 | + (if (and cr-z an-x) |
217 | 223 | (get-slack) |
218 | 224 | 0)) |
219 | 225 |
|
220 | 226 | ; when output is (ival 0.bf ...) - it means that x was close to 1 or 0 but not narrow enough |
221 | 227 | (define x-slack |
222 | | - (if (bfzero? (ival-lo z)) |
| 228 | + (if zl-z |
223 | 229 | (get-slack) |
224 | 230 | 0)) |
225 | 231 |
|
226 | 232 | (if (*lower-bound-early-stopping*) |
227 | 233 | (list (cons (max (+ mx-y lg-x lg-z x-slack) x-slack) |
228 | | - (minlog y #:less-slack #t)) ; bounds per x |
| 234 | + 0 |
| 235 | + #;(minlog y #:less-slack #t)) ; bounds per x |
229 | 236 | (cons (max (+ mx-y (max (abs mx-x) (abs mn-x)) lg-z y-slack) y-slack) |
230 | | - (cond |
231 | | - [(zero? (min (abs mx-x) (abs mn-x))) 0] |
232 | | - [else (minlog y #:less-slack #t)]))) ; bounds per y |
| 237 | + 0 |
| 238 | + #;(cond |
| 239 | + [(zero? (min (abs mx-x) (abs mn-x))) 0] |
| 240 | + [else (minlog y #:less-slack #t)]))) ; bounds per y |
233 | 241 | (list (cons (max (+ mx-y lg-x lg-z x-slack) x-slack) 0) ; bounds per x |
234 | 242 | (cons (max (+ mx-y (max (abs mx-x) (abs mn-x)) lg-z y-slack) y-slack) |
235 | 243 | 0)))] ; bounds per y |
|
238 | 246 | ; Γ[exp & exp2]'x = |x| & |x*ln(2)| |
239 | 247 | ; ↑ampl[exp & exp2]'x = maxlog(x) + logspan(z) |
240 | 248 | ; ↓ampl[exp & exp2]'x = minlog(x) |
241 | | - (match-define (list x _ mx-x _ _) (first srcs)) |
242 | | - (match-define (list _ _ _ lg-z _) output) |
| 249 | + (match-define (list _ mx-x _ _ _ _) (first srcs)) |
| 250 | + (match-define (list _ _ lg-z _ _ _) output) |
243 | 251 |
|
244 | 252 | (if (*lower-bound-early-stopping*) |
245 | | - (list (cons (+ mx-x lg-z) (minlog x #:less-slack #t))) |
| 253 | + (list (cons (+ mx-x lg-z) 0 #;(minlog x #:less-slack #t))) |
246 | 254 | (list (cons (+ mx-x lg-z) 0)))] |
247 | 255 |
|
248 | 256 | [(ival-tan) |
249 | 257 | ; Γ[tan]'x = |x / (cos(x) * sin(x))| |
250 | 258 | ; ↑ampl[tan]'x = maxlog(x) + max(|minlog(z)|,|maxlog(z)|) + logspan(z) + 1 |
251 | 259 | ; ↓ampl[tan]'x = minlog(x) + min(|minlog(z)|,|maxlog(z)|) - 1 |
252 | | - (match-define (list x _ mx-x _ _) (first srcs)) |
253 | | - (match-define (list z mn-z mx-z lg-z _) output) |
| 260 | + (match-define (list _ mx-x _ _ _ _) (first srcs)) |
| 261 | + (match-define (list mn-z mx-z lg-z _ _ _) output) |
254 | 262 |
|
255 | 263 | (if (*lower-bound-early-stopping*) |
256 | 264 | (list (cons (+ mx-x (max (abs mx-z) (abs mn-z)) lg-z 1) |
257 | | - (- (+ (minlog x #:less-slack #t) |
258 | | - (min (abs (maxlog z #:less-slack #t)) (abs (minlog z #:less-slack #t)))) |
259 | | - 1))) |
| 265 | + 0 |
| 266 | + #;(- (+ (minlog x #:less-slack #t) |
| 267 | + (min (abs (maxlog z #:less-slack #t)) (abs (minlog z #:less-slack #t)))) |
| 268 | + 1))) |
260 | 269 | (list (cons (+ mx-x (max (abs mx-z) (abs mn-z)) lg-z 1) 0)))] |
261 | 270 |
|
262 | 271 | [(ival-sin) |
263 | 272 | ; Γ[sin]'x = |x * cos(x) / sin(x)| |
264 | 273 | ; ↑ampl[sin]'x = maxlog(x) - minlog(z) |
265 | 274 | ; ↓ampl[sin]'x = | - maxlog(z) - 1, if maxlog(x) > 1 |
266 | 275 | ; | 0 else |
267 | | - (match-define (list _ _ mx-x _ _) (first srcs)) |
268 | | - (match-define (list z mn-z _ _ _) output) |
| 276 | + (match-define (list _ mx-x _ _ _ _) (first srcs)) |
| 277 | + (match-define (list mn-z _ _ _ _ _) output) |
269 | 278 |
|
270 | 279 | (if (*lower-bound-early-stopping*) |
271 | 280 | (list (cons (- mx-x mn-z) |
272 | | - (if (>= mx-x 1) |
273 | | - (- -1 (maxlog z #:less-slack #t)) |
274 | | - 0))) |
| 281 | + 0 |
| 282 | + #;(if (>= mx-x 1) |
| 283 | + (- -1 (maxlog z #:less-slack #t)) |
| 284 | + 0))) |
275 | 285 | (list (cons (- mx-x mn-z) 0)))] |
276 | 286 |
|
277 | 287 | [(ival-cos) |
278 | 288 | ; Γ[cos]'x = |x * sin(x) / cos(x)| |
279 | 289 | ; ↑ampl[cos]'x = maxlog(x) - minlog(z) + min(maxlog(x), 0) |
280 | 290 | ; ↓ampl[cos]'x = - maxlog(x) - 2 |
281 | | - (match-define (list _ _ mx-x _ _) (first srcs)) |
282 | | - (match-define (list z mn-z _ _ _) output) |
| 291 | + (match-define (list _ mx-x _ _ _ _) (first srcs)) |
| 292 | + (match-define (list mn-z _ _ _ _ _) output) |
283 | 293 |
|
284 | 294 | (if (*lower-bound-early-stopping*) |
285 | | - (list (cons (+ (- mx-x mn-z) (min mx-x 0)) (- (- 2) (maxlog z #:less-slack #t)))) |
| 295 | + (list (cons (+ (- mx-x mn-z) (min mx-x 0)) 0 #;(- (- 2) (maxlog z #:less-slack #t)))) |
286 | 296 | (list (cons (+ (- mx-x mn-z) (min mx-x 0)) 0)))] |
287 | 297 |
|
288 | 298 | [(ival-sinh) |
289 | 299 | ; Γ[sinh]'x = |x * cosh(x) / sinh(x)| |
290 | 300 | ; ↑ampl[sinh]'x = maxlog(x) + logspan(z) - min(minlog(x), 0) |
291 | 301 | ; ↓ampl[sinh]'x = max(0, minlog(x)) |
292 | | - (match-define (list x mn-x mx-x _ _) (first srcs)) |
293 | | - (match-define (list _ _ _ lg-z _) output) |
| 302 | + (match-define (list mn-x mx-x _ _ _ _) (first srcs)) |
| 303 | + (match-define (list _ _ lg-z _ _ _) output) |
294 | 304 |
|
295 | 305 | (if (*lower-bound-early-stopping*) |
296 | | - (list (cons (- (+ mx-x lg-z) (min mn-x 0)) (max 0 (minlog x #:less-slack #t)))) |
| 306 | + (list (cons (- (+ mx-x lg-z) (min mn-x 0)) 0 #;(max 0 (minlog x #:less-slack #t)))) |
297 | 307 | (list (cons (- (+ mx-x lg-z) (min mn-x 0)) 0)))] |
298 | 308 |
|
299 | 309 | [(ival-cosh) |
300 | 310 | ; Γ[cosh]'x = |x * sinh(x) / cosh(x)| |
301 | 311 | ; ↑ampl[cosh]'x = maxlog(x) + logspan(z) + min(maxlog(x), 0) |
302 | 312 | ; ↓ampl[cosh]'x = max(0, minlog(x) - 1) |
303 | | - (match-define (list x _ mx-x lg-x _) (first srcs)) |
304 | | - (match-define (list _ _ _ lg-z _) output) |
| 313 | + (match-define (list _ mx-x lg-x _ _ _) (first srcs)) |
| 314 | + (match-define (list _ _ lg-z _ _ _) output) |
305 | 315 |
|
306 | 316 | (if (*lower-bound-early-stopping*) |
307 | | - (list (cons (+ mx-x lg-z (min mx-x 0)) (max 0 (- (minlog x #:less-slack #t) 1)))) |
| 317 | + (list (cons (+ mx-x lg-z (min mx-x 0)) 0 #;(max 0 (- (minlog x #:less-slack #t) 1)))) |
308 | 318 | (list (cons (+ mx-x lg-z (min mx-x 0)) 0)))] |
309 | 319 |
|
310 | 320 | [(ival-log ival-log2 ival-log10) |
311 | 321 | ; Γ[log & log2 & log10]'x = |1 / ln(x)| & |ln(2) / ln(x)| & |ln(10) / ln(x)| |
312 | 322 | ; ↑ampl[log & log2 & log10]'x = logspan(x) - minlog(z) + 1 |
313 | 323 | ; ↓ampl[log & log2 & log10]'x = - maxlog(z) |
314 | | - (match-define (list _ _ _ lg-x _) (first srcs)) |
315 | | - (match-define (list z mn-z _ _ _) output) |
| 324 | + (match-define (list _ _ lg-x _ _ _) (first srcs)) |
| 325 | + (match-define (list mn-z _ _ _ _ _) output) |
316 | 326 |
|
317 | 327 | (if (*lower-bound-early-stopping*) |
318 | | - (list (cons (+ (- lg-x mn-z) 1) (- (maxlog z #:less-slack #t)))) |
| 328 | + (list (cons (+ (- lg-x mn-z) 1) 0 #;(- (maxlog z #:less-slack #t)))) |
319 | 329 | (list (cons (+ (- lg-x mn-z) 1) 0)))] |
320 | 330 |
|
321 | 331 | [(ival-asin) |
322 | 332 | ; Γ[asin]'x = |x / (sqrt(1-x^2) * arcsin(x))| |
323 | 333 | ; ↑ampl[asin]'x = | slack, if maxlog(z) > 1 |
324 | 334 | ; | 1 else |
325 | 335 | ; ↓ampl[asin]'x = 0 |
326 | | - (match-define (list _ _ mx-z _ _) output) |
| 336 | + (match-define (list _ mx-z _ _ _ _) output) |
327 | 337 |
|
328 | 338 | (list (if (>= mx-z 1) |
329 | 339 | (cons (get-slack) 0) ; assumes that log[1-x^2]/2 is equal to slack |
|
334 | 344 | ; ↑ampl[acos]'x = | slack, if maxlog(x) >= 0 |
335 | 345 | ; | 0 else |
336 | 346 | ; ↓ampl[acos]'x = 0 |
337 | | - (match-define (list _ _ mx-x _ _) (first srcs)) |
| 347 | + (match-define (list _ mx-x _ _ _ _) (first srcs)) |
338 | 348 |
|
339 | 349 | (list (if (>= mx-x 0) |
340 | 350 | (cons (get-slack) 0) ; assumes that log[1-x^2]/2 is equal to slack |
|
344 | 354 | ; Γ[atan]'x = | x / ((1+x^2) * arctan(x))| |
345 | 355 | ; ↑ampl[atan]'x = - min(|minlog(x)|, |maxlog(x)|) - minlog(z) + logspan(x) |
346 | 356 | ; ↓ampl[atan]'x = - max(|minlog(x)|, |maxlog(x)|) - maxlog(z) - 2 |
347 | | - (match-define (list x mn-x mx-x lg-x _) (first srcs)) |
348 | | - (match-define (list z mn-z _ _ _) output) |
| 357 | + (match-define (list mn-x mx-x lg-x _ _ _) (first srcs)) |
| 358 | + (match-define (list mn-z _ _ _ _ _) output) |
349 | 359 |
|
350 | 360 | (if (*lower-bound-early-stopping*) |
351 | 361 | (list (cons (- lg-x (min (abs mn-x) (abs mx-x)) mn-z) |
352 | | - (- (- (max (abs (minlog x #:less-slack #t)) (abs (maxlog x #:less-slack #t)))) |
353 | | - (maxlog z #:less-slack #t) |
354 | | - 2))) |
| 362 | + 0 |
| 363 | + #;(- (- (max (abs (minlog x #:less-slack #t)) (abs (maxlog x #:less-slack #t)))) |
| 364 | + (maxlog z #:less-slack #t) |
| 365 | + 2))) |
355 | 366 | (list (cons (- lg-x (min (abs mn-x) (abs mx-x)) mn-z) 0)))] |
356 | 367 |
|
357 | 368 | [(ival-fmod ival-remainder) |
|
363 | 374 | ; Γ[mod]'y ` |y/mod(x,y)| |
364 | 375 | ; ↑ampl[mod]'y = maxlog(y) - minlog(z) |
365 | 376 | ; ↓ampl[mod]'y = minlog(y) - maxlog(z) or just 0 |
366 | | - (match-define (list _ _ mx-x _ _) (first srcs)) |
367 | | - (match-define (list y _ _ _ cr-y) (second srcs)) |
368 | | - (match-define (list _ mn-z _ _ _) output) |
| 377 | + (match-define (list _ mx-x _ _ _ _) (first srcs)) |
| 378 | + (match-define (list _ _ _ cr-y _ _) (second srcs)) |
| 379 | + (match-define (list mn-z _ _ _ _ _) output) |
369 | 380 |
|
370 | 381 | (define slack |
371 | 382 | (if cr-y |
|
381 | 392 | ; ↑ampl[log1p]'x = | maxlog(x) - minlog(z) + slack, if x is negative |
382 | 393 | ; | maxlog(x) - minlog(z), else |
383 | 394 | ; ↓ampl[log1p]'x = 0 |
384 | | - (match-define (list x _ mx-x _ _) (first srcs)) |
385 | | - (match-define (list _ mn-z _ _ _) output) |
386 | | - |
387 | | - (define xhi (ival-hi x)) |
388 | | - (define xlo (ival-lo x)) |
| 395 | + (match-define (list _ mx-x _ _ _ an-x) (first srcs)) |
| 396 | + (match-define (list mn-z _ _ _ _ _) output) |
389 | 397 |
|
390 | | - (list (if (or (equal? (mpfr-sign xlo) -1) (equal? (mpfr-sign xhi) -1)) |
| 398 | + (list (if an-x |
391 | 399 | (cons (+ (- mx-x mn-z) (get-slack)) 0) |
392 | 400 | (cons (- mx-x mn-z) 0)))] |
393 | 401 |
|
|
396 | 404 | ; Γ[expm1]'x = |x * e^x / expm1| |
397 | 405 | ; ↑ampl[expm1]'x = max(1 + maxlog(x), 1 + maxlog(x) - minlog(z)) |
398 | 406 | ; ↓ampl[expm1]'x = 0 |
399 | | - (match-define (list _ _ mx-x _ _) (first srcs)) |
400 | | - (match-define (list _ mn-z _ _ _) output) |
| 407 | + (match-define (list _ mx-x _ _ _ _) (first srcs)) |
| 408 | + (match-define (list mn-z _ _ _ _ _) output) |
401 | 409 |
|
402 | 410 | (list (cons (max (+ 1 mx-x) (+ 1 (- mx-x mn-z))) 0))] |
403 | 411 |
|
404 | 412 | [(ival-atan2) |
405 | 413 | ; Γ[atan2]'x = Γ[atan2]'y = |xy / ((x^2 + y^2)*arctan(y/x))| |
406 | 414 | ; ↑ampl[expm1]'x = maxlog(x) + maxlog(y) - 2*min(minlog(x), minlog(y)) - minlog(z) |
407 | 415 | ; ↓ampl[expm1]'x = minlog(x) + minlog(y) - 2*max(maxlog(x), maxlog(y)) - maxlog(z) |
408 | | - (match-define (list x mn-x mx-x _ _) (first srcs)) |
409 | | - (match-define (list y mn-y mx-y _ _) (second srcs)) |
410 | | - (match-define (list z mn-z _ _ _) output) |
| 416 | + (match-define (list mn-x mx-x _ _ _ _) (first srcs)) |
| 417 | + (match-define (list mn-y mx-y _ _ _ _) (second srcs)) |
| 418 | + (match-define (list mn-z _ _ _ _ _) output) |
411 | 419 |
|
412 | 420 | (if (*lower-bound-early-stopping*) |
413 | 421 | (make-list 2 |
414 | 422 | (cons (- (+ mx-x mx-y) (* 2 (min mn-x mn-y)) mn-z) |
415 | | - (- (+ (minlog x #:less-slack #t) (minlog y #:less-slack #t)) |
416 | | - (* 2 (max (maxlog x #:less-slack #t) (maxlog y #:less-slack #t))) |
417 | | - (maxlog z #:less-slack #t)))) |
| 423 | + 0 |
| 424 | + #;(- (+ (minlog x #:less-slack #t) (minlog y #:less-slack #t)) |
| 425 | + (* 2 (max (maxlog x #:less-slack #t) (maxlog y #:less-slack #t))) |
| 426 | + (maxlog z #:less-slack #t)))) |
418 | 427 | (make-list 2 (cons (- (+ mx-x mx-y) (* 2 (min mn-x mn-y)) mn-z) 0)))] |
419 | 428 |
|
420 | 429 | [(ival-tanh) |
421 | 430 | ; Γ[tanh]'x = |x / (sinh(x) * cosh(x))| |
422 | 431 | ; ↑ampl[tanh]'x = logspan(z) + logspan(x) |
423 | 432 | ; ↓ampl[tanh]'x = 0 |
424 | | - (match-define (list _ _ _ lg-x _) (first srcs)) |
425 | | - (match-define (list _ _ _ lg-z _) output) |
| 433 | + (match-define (list _ _ lg-x _ _ _) (first srcs)) |
| 434 | + (match-define (list _ _ lg-z _ _ _) output) |
426 | 435 |
|
427 | 436 | (list (cons (+ lg-z lg-x) 0))] |
428 | 437 |
|
|
431 | 440 | ; ↑ampl[atanh]'x = | 1, if x < 0.5 |
432 | 441 | ; | slack |
433 | 442 | ; ↓ampl[atanh]'x = 0 |
434 | | - (match-define (list _ _ mx-x _ _) (first srcs)) |
| 443 | + (match-define (list _ mx-x _ _ _ _) (first srcs)) |
435 | 444 | (list (if (>= mx-x 1) |
436 | 445 | (cons (get-slack) 0) |
437 | 446 | (cons 1 0)))] |
|
441 | 450 | ; ↑ampl[acosh]'x = | -minlog(z) + slack, if minlog(z) < 2 |
442 | 451 | ; | 0 |
443 | 452 | ; ↓ampl[acosh]'x = 0 |
444 | | - (match-define (list _ mn-z _ _ _) output) |
| 453 | + (match-define (list mn-z _ _ _ _ _) output) |
445 | 454 | (list (if (< mn-z 2) ; when acosh(x) < 1 |
446 | 455 | (cons (- (get-slack) mn-z) 0) |
447 | 456 | (cons 0 0)))] |
|
450 | 459 | ; Γ[acosh]'x = |2 x x* / x^2| |
451 | 460 | ; ↑ampl[pow2]'x = logspan(x) + 1 |
452 | 461 | ; ↓ampl[pow2]'x = 0 |
453 | | - (match-define (list _ _ _ lg-x _) (first srcs)) |
| 462 | + (match-define (list _ _ lg-x _ _ _) (first srcs)) |
454 | 463 | (list (cons (+ lg-x 1) 0))] |
455 | 464 |
|
456 | 465 | ; TODO |
|
0 commit comments