



Bits error versus re




Bits error versus im
| Original | 37.8 |
|---|---|
| Target | 32.8 |
| Herbie | 13.4 |
Initial program 37.8
Simplified13.4
Final simplification13.4
herbie shell --seed 2019016 +o rules:numerics
(FPCore (re im)
:name "math.sqrt on complex, real part"
:herbie-target
(if (< re 0) (* 0.5 (* (sqrt 2) (sqrt (/ (* im im) (- (sqrt (+ (* re re) (* im im))) re))))) (* 0.5 (sqrt (* 2.0 (+ (sqrt (+ (* re re) (* im im))) re)))))
(* 0.5 (sqrt (* 2.0 (+ (sqrt (+ (* re re) (* im im))) re)))))
Time bar (total: 8.2s)Debug log
| 256× | (pre true 80) |
| 173× | (body real 80) |
| 22× | (body real 5120) |
| 21× | (body real 1280) |
| 20× | (body real 2560) |
| 10× | (body real 640) |
| 6× | (body real 160) |
| 4× | (body real 320) |
| 21.0ms | (* 0.5 (sqrt (* 2.0 (+ (sqrt (+ (* re re) (* im im))) re)))) |
2 alts after pruning (2 fresh and 0 done)
Merged error: 15.9b
Found 3 expressions with local error:
| 1.5b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.0b | (sqrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 0.0b | (hypot re im) |
| 5× | add-sqr-sqrt |
| 4× | add-cube-cbrt |
| 4× | *-un-lft-identity |
| 3× | add-log-exp |
| 3× | log1p-expm1-u |
| 3× | sqrt-prod |
| 3× | add-exp-log |
| 3× | add-cbrt-cube |
| 3× | pow1 |
| 3× | expm1-log1p-u |
| 1× | fma-udef |
| 1× | pow1/2 |
| 1× | hypot-udef |
| 1× | rem-sqrt-square |
| 1.0ms | (sqrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 0.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.0ms | (hypot re im) |
| 143.0ms | (sqrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 36.0ms | (hypot re im) |
| 36.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 18.0ms | (sqrt (* (cbrt (fma (hypot re im) 2.0 (* re 2.0))) (cbrt (fma (hypot re im) 2.0 (* re 2.0))))) |
| 17.0ms | (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0)))) |
| 10.0ms | (sqrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 6.0ms | (+ (* 2.0 re) (* 2.0 im)) |
| 2.0ms | (sqrt 1) |
8 alts after pruning (7 fresh and 1 done)
Merged error: 15.7b
Found 4 expressions with local error:
| 1.5b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 1.5b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 1.5b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.4b | (cbrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 5× | add-cube-cbrt |
| 5× | *-un-lft-identity |
| 5× | add-sqr-sqrt |
| 4× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | add-exp-log |
| 4× | add-cbrt-cube |
| 4× | pow1 |
| 4× | expm1-log1p-u |
| 3× | fma-udef |
| 3× | cbrt-prod |
| 1× | pow1/3 |
| 1.0ms | (cbrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 0.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 134.0ms | (cbrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 45.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 43.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 38.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 206.0ms | (+ (exp (* 1/3 (+ (log im) (log 2.0)))) (+ (* 0.3333333333333333 (* re (exp (* 1/3 (- (log 2.0) (* 2 (log im))))))) (* 0.05555555555555555 (* (pow re 2) (exp (* 1/3 (- (log 2.0) (* 5 (log im))))))))) |
| 147.0ms | (exp (* 1/3 (- (+ (log (/ -1 re)) (log 1.0)) (* 2 (log (/ -1 im)))))) |
| 66.0ms | (exp (* 1/3 (- (log 4.0) (log (/ 1 re))))) |
| 12.0ms | (+ (* 2.0 re) (* 2.0 im)) |
| 11.0ms | (+ (* 2.0 re) (* 2.0 im)) |
8 alts after pruning (7 fresh and 1 done)
Merged error: 15.7b
Found 4 expressions with local error:
| 1.5b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 1.5b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 1.5b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.4b | (cbrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 5× | add-cube-cbrt |
| 5× | *-un-lft-identity |
| 5× | add-sqr-sqrt |
| 4× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | add-exp-log |
| 4× | add-cbrt-cube |
| 4× | pow1 |
| 4× | expm1-log1p-u |
| 3× | fma-udef |
| 3× | cbrt-prod |
| 1× | pow1/3 |
| 1.0ms | (cbrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 0.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 163.0ms | (cbrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 47.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 44.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 43.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 223.0ms | (+ (exp (* 1/3 (+ (log im) (log 2.0)))) (+ (* 0.3333333333333333 (* re (exp (* 1/3 (- (log 2.0) (* 2 (log im))))))) (* 0.05555555555555555 (* (pow re 2) (exp (* 1/3 (- (log 2.0) (* 5 (log im))))))))) |
| 111.0ms | (exp (* 1/3 (- (+ (log (/ -1 re)) (log 1.0)) (* 2 (log (/ -1 im)))))) |
| 52.0ms | (exp (* 1/3 (- (log 4.0) (log (/ 1 re))))) |
| 21.0ms | (cbrt (* (cbrt (fma (hypot re im) 2.0 (* re 2.0))) (cbrt (fma (hypot re im) 2.0 (* re 2.0))))) |
| 10.0ms | (cbrt (sqrt (fma (hypot re im) 2.0 (* re 2.0)))) |
8 alts after pruning (6 fresh and 2 done)
Merged error: 15.7b
Found 4 expressions with local error:
| 1.5b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 1.5b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 1.5b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 1.5b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 4× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | fma-udef |
| 4× | add-cube-cbrt |
| 4× | add-exp-log |
| 4× | add-cbrt-cube |
| 4× | *-un-lft-identity |
| 4× | pow1 |
| 4× | expm1-log1p-u |
| 4× | add-sqr-sqrt |
| 0.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 58.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 52.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 38.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 34.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 6.0ms | (+ (* 2.0 re) (* 2.0 im)) |
| 6.0ms | (+ (* 2.0 re) (* 2.0 im)) |
| 6.0ms | (+ (* 2.0 re) (* 2.0 im)) |
| 6.0ms | (+ (* 2.0 re) (* 2.0 im)) |
| 1.0ms | (* 4.0 re) |
8 alts after pruning (6 fresh and 2 done)
Merged error: 15.7b
0% (0.2b remaining)
Error of 13.4b against oracle of 13.2b and baseline of 13.4b
| 8000× | (pre true 80) |
| 5986× | (body real 80) |
| 699× | (body real 2560) |
| 468× | (body real 1280) |
| 333× | (body real 5120) |
| 267× | (body real 640) |
| 159× | (body real 320) |
| 88× | (body real 160) |