



Bits error versus re




Bits error versus im
| Original | 37.9 |
|---|---|
| Target | 32.7 |
| Herbie | 13.6 |
Initial program 37.9
Simplified13.6
Final simplification13.6
herbie shell --seed 2019022 +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: 9.2s)Debug log
| 24.0ms | 180× | body | 80 | valid |
| 19.0ms | 22× | body | 2560 | valid |
| 17.0ms | 25× | body | 1280 | valid |
| 8.0ms | 7× | body | 5120 | valid |
| 5.0ms | 9× | body | 640 | valid |
| 2.0ms | 7× | body | 320 | valid |
| 2.0ms | 6× | body | 160 | valid |
| 13.0ms | (* 0.5 (sqrt (* 2.0 (+ (sqrt (+ (* re re) (* im im))) re)))) |
2 alts after pruning (2 fresh and 0 done)
Merged error: 16.7b
Found 3 expressions with local error:
| 1.8b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.1b | (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) |
| 151.0ms | (sqrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 51.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 34.0ms | (hypot re im) |
| 12.0ms | (sqrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 11.0ms | (+ (* 2.0 re) (* 2.0 im)) |
| 9.0ms | (sqrt (* (cbrt (fma (hypot re im) 2.0 (* re 2.0))) (cbrt (fma (hypot re im) 2.0 (* re 2.0))))) |
| 8.0ms | (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0)))) |
| 3.0ms | (* -1 re) |
7 alts after pruning (6 fresh and 1 done)
Merged error: 16.4b
Found 4 expressions with local error:
| 1.8b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 1.8b | (fma (hypot re im) 2.0 (* re 2.0)) |
| 0.3b | (* (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0)))) (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0))))) |
| 0.1b | (sqrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 21× | sqrt-prod |
| 12× | add-sqr-sqrt |
| 11× | add-cube-cbrt |
| 11× | *-un-lft-identity |
| 9× | associate-*l* |
| 9× | associate-*r* |
| 9× | pow1 |
| 6× | add-exp-log |
| 6× | add-cbrt-cube |
| 5× | pow1/2 |
| 4× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | expm1-log1p-u |
| 2× | fma-udef |
| 2× | pow-prod-up |
| 2× | pow-prod-down |
| 1× | cbrt-unprod |
| 1× | *-commutative |
| 1× | prod-exp |
| 1× | sqrt-unprod |
| 1× | pow-plus |
| 1× | rem-square-sqrt |
| 1× | rem-sqrt-square |
| 1× | pow2 |
| 12.0ms | (* (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0)))) (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0))))) |
| 2.0ms | (sqrt (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)) |
| 149.0ms | (sqrt (fma (hypot re im) 2.0 (* re 2.0))) |
| 149.0ms | (* (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0)))) (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0))))) |
| 59.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 52.0ms | (fma (hypot re im) 2.0 (* re 2.0)) |
| 69.0ms | (* (* (* (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0)))) (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0))))) (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0))))) (* (* (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0)))) (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0))))) (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0)))))) |
| 20.0ms | (+ (log (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0))))) (log (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0)))))) |
| 17.0ms | (* (cbrt (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0))))) (cbrt (sqrt (sqrt (fma (hypot re im) 2.0 (* re 2.0)))))) |
| 17.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 (fma (hypot re im) 2.0 (* re 2.0))) (sqrt (fma (hypot re im) 2.0 (* re 2.0)))) |
7 alts after pruning (5 fresh and 2 done)
Merged error: 16.4b
Found 4 expressions with local error:
| 9.6b | (fma (* (sqrt (hypot re im)) (sqrt (hypot re im))) 2.0 (* re 2.0)) |
| 0.5b | (* (sqrt (hypot re im)) (sqrt (hypot re im))) |
| 0.1b | (sqrt (fma (* (sqrt (hypot re im)) (sqrt (hypot re im))) 2.0 (* re 2.0))) |
| 0.0b | (hypot re im) |
| 10× | add-sqr-sqrt |
| 9× | sqrt-prod |
| 9× | add-cube-cbrt |
| 9× | *-un-lft-identity |
| 9× | pow1 |
| 6× | add-exp-log |
| 6× | associate-*l* |
| 6× | associate-*r* |
| 6× | add-cbrt-cube |
| 5× | pow1/2 |
| 4× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | expm1-log1p-u |
| 2× | pow-prod-up |
| 2× | pow-prod-down |
| 1× | fma-udef |
| 1× | cbrt-unprod |
| 1× | *-commutative |
| 1× | prod-exp |
| 1× | sqrt-unprod |
| 1× | pow-plus |
| 1× | rem-square-sqrt |
| 1× | hypot-udef |
| 1× | rem-sqrt-square |
| 1× | pow2 |
| 14.0ms | (* (sqrt (hypot re im)) (sqrt (hypot re im))) |
| 1.0ms | (sqrt (fma (* (sqrt (hypot re im)) (sqrt (hypot re im))) 2.0 (* re 2.0))) |
| 0.0ms | (fma (* (sqrt (hypot re im)) (sqrt (hypot re im))) 2.0 (* re 2.0)) |
| 0.0ms | (hypot re im) |
| 137.0ms | (sqrt (fma (* (sqrt (hypot re im)) (sqrt (hypot re im))) 2.0 (* re 2.0))) |
| 46.0ms | (fma (* (sqrt (hypot re im)) (sqrt (hypot re im))) 2.0 (* re 2.0)) |
| 39.0ms | (* (sqrt (hypot re im)) (sqrt (hypot re im))) |
| 25.0ms | (hypot re im) |
| 34.0ms | (* (* (* (sqrt (hypot re im)) (sqrt (hypot re im))) (sqrt (hypot re im))) (* (* (sqrt (hypot re im)) (sqrt (hypot re im))) (sqrt (hypot re im)))) |
| 29.0ms | (sqrt (* (cbrt (fma (* (sqrt (hypot re im)) (sqrt (hypot re im))) 2.0 (* re 2.0))) (cbrt (fma (* (sqrt (hypot re im)) (sqrt (hypot re im))) 2.0 (* re 2.0))))) |
| 26.0ms | (sqrt (fma (* (sqrt (hypot re im)) (sqrt (hypot re im))) 2.0 (* re 2.0))) |
| 26.0ms | (sqrt (sqrt (fma (* (sqrt (hypot re im)) (sqrt (hypot re im))) 2.0 (* re 2.0)))) |
| 11.0ms | (+ (* 2.0 re) (* 2.0 im)) |
14 alts after pruning (13 fresh and 1 done)
Merged error: 16.4b
Found 4 expressions with local error:
| 9.3b | (fma (* (* (sqrt (hypot re im)) (sqrt (* (cbrt (hypot re im)) (cbrt (hypot re im))))) (sqrt (cbrt (hypot re im)))) 2.0 (* re 2.0)) |
| 0.5b | (* (cbrt (hypot re im)) (cbrt (hypot re im))) |
| 0.5b | (cbrt (hypot re im)) |
| 0.5b | (cbrt (hypot re im)) |
| 12× | cbrt-prod |
| 10× | add-cube-cbrt |
| 10× | *-un-lft-identity |
| 10× | add-sqr-sqrt |
| 9× | pow1 |
| 6× | add-exp-log |
| 6× | associate-*l* |
| 6× | associate-*r* |
| 6× | pow1/3 |
| 4× | add-log-exp |
| 4× | log1p-expm1-u |
| 4× | add-cbrt-cube |
| 4× | expm1-log1p-u |
| 2× | pow-prod-up |
| 2× | pow-prod-down |
| 1× | fma-udef |
| 1× | cbrt-unprod |
| 1× | *-commutative |
| 1× | prod-exp |
| 1× | pow-plus |
| 1× | pow2 |
| 5.0ms | (* (cbrt (hypot re im)) (cbrt (hypot re im))) |
| 1.0ms | (cbrt (hypot re im)) |
| 1.0ms | (cbrt (hypot re im)) |
| 0.0ms | (fma (* (* (sqrt (hypot re im)) (sqrt (* (cbrt (hypot re im)) (cbrt (hypot re im))))) (sqrt (cbrt (hypot re im)))) 2.0 (* re 2.0)) |
| 148.0ms | (* (cbrt (hypot re im)) (cbrt (hypot re im))) |
| 141.0ms | (cbrt (hypot re im)) |
| 122.0ms | (cbrt (hypot re im)) |
| 47.0ms | (fma (* (* (sqrt (hypot re im)) (sqrt (* (cbrt (hypot re im)) (cbrt (hypot re im))))) (sqrt (cbrt (hypot re im)))) 2.0 (* re 2.0)) |
| 43.0ms | (+ (* 1/6 (* (pow re 2) (pow (/ 1 (pow im 5)) 1/3))) (pow im 1/3)) |
| 41.0ms | (+ (pow im 2/3) (* 1/3 (* (pow re 2) (pow (/ 1 (pow im 4)) 1/3)))) |
| 31.0ms | (+ (* 1/6 (* (pow re 2) (pow (/ 1 (pow im 5)) 1/3))) (pow im 1/3)) |
| 5.0ms | (+ (* 2.0 re) (* 2.0 im)) |
| 4.0ms | (pow (/ 1 re) -1/3) |
17 alts after pruning (16 fresh and 1 done)
Merged error: 16.4b
0% (0.2b remaining)
Error of 13.6b against oracle of 13.4b and baseline of 13.6b
| 1.2s | 5985× | body | 80 | valid |
| 467.0ms | 657× | body | 2560 | valid |
| 330.0ms | 486× | body | 1280 | valid |
| 285.0ms | 310× | body | 5120 | valid |
| 191.0ms | 315× | body | 640 | valid |
| 73.0ms | 153× | body | 320 | valid |
| 21.0ms | 94× | body | 160 | valid |