Average Error: 33.6 → 7.0
Time: 18.1s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -6.786513207675167 \cdot 10^{+128}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.0897702928911005 \cdot 10^{-306}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 8.095749828230367 \cdot 10^{+95}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -6.786513207675167e+128

    1. Initial program 60.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 1.8

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]

    if -6.786513207675167e+128 < b_2 < -5.0897702928911005e-306

    1. Initial program 34.0

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--34.1

      \[\leadsto \frac{\color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    4. Applied associate-/l/38.1

      \[\leadsto \color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    5. Simplified20.5

      \[\leadsto \frac{\color{blue}{a \cdot c}}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    6. Using strategy rm
    7. Applied times-frac9.0

      \[\leadsto \color{blue}{\frac{a}{a} \cdot \frac{c}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    8. Simplified9.0

      \[\leadsto \color{blue}{1} \cdot \frac{c}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    9. Simplified9.0

      \[\leadsto 1 \cdot \color{blue}{\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\]

    if -5.0897702928911005e-306 < b_2 < 8.095749828230367e+95

    1. Initial program 9.6

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity9.6

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    4. Applied *-un-lft-identity9.6

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b_2\right)} - 1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    5. Applied distribute-lft-out--9.6

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{a}\]
    6. Applied associate-/l*9.7

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]

    if 8.095749828230367e+95 < b_2

    1. Initial program 42.8

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--61.2

      \[\leadsto \frac{\color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    4. Applied associate-/l/61.4

      \[\leadsto \color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    5. Simplified61.6

      \[\leadsto \frac{\color{blue}{a \cdot c}}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    6. Using strategy rm
    7. Applied div-inv61.6

      \[\leadsto \color{blue}{\left(a \cdot c\right) \cdot \frac{1}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    8. Taylor expanded around 0 3.9

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification7.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -6.786513207675167 \cdot 10^{+128}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.0897702928911005 \cdot 10^{-306}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 8.095749828230367 \cdot 10^{+95}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019005 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))

Details

Time bar (total: 17.3s)Debug log

sample93.0ms

Algorithm
intervals

simplify39.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

38.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 34.5b

localize36.0ms

Local error

Found 4 expressions with local error:

24.3b
(sqrt (- (* b_2 b_2) (* a c)))
1.1b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(- (* b_2 b_2) (* a c))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite42.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

29.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
6.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(- (* b_2 b_2) (* a c))

series222.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

78.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
62.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
46.0ms
(sqrt (- (* b_2 b_2) (* a c)))
36.0ms
(- (* b_2 b_2) (* a c))

simplify1.9s

Counts
32 → 73
Calls

32 calls. Slowest were:

571.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
276.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
241.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune776.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 6.4b

localize18.0ms

Local error

Found 4 expressions with local error:

24.3b
(sqrt (- (* b_2 b_2) (* a c)))
16.9b
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
0.9b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(- (* b_2 b_2) (* a c))

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
4 → 56
Calls

4 calls. Slowest were:

13.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
6.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series235.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

113.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
52.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
41.0ms
(sqrt (- (* b_2 b_2) (* a c)))
30.0ms
(- (* b_2 b_2) (* a c))

simplify2.1s

Counts
28 → 68
Calls

28 calls. Slowest were:

584.0ms
(- (log (* a c)) (log (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
319.0ms
(/ (* (* (* a c) (* a c)) (* a c)) (* (* (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
276.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune659.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 6.4b

localize11.0ms

Local error

Found 4 expressions with local error:

24.3b
(sqrt (- (* b_2 b_2) (* a c)))
0.9b
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
0.4b
(- (* b_2 b_2) (* a c))
0.1b
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
4 → 52
Calls

4 calls. Slowest were:

11.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
7.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
2.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series256.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

123.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
53.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
46.0ms
(sqrt (- (* b_2 b_2) (* a c)))
34.0ms
(- (* b_2 b_2) (* a c))

simplify1.1s

Counts
24 → 64
Calls

24 calls. Slowest were:

243.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
224.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
160.0ms
(+ (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (+ (* b_2 b_2) (* (sqrt (- (* b_2 b_2) (* a c))) b_2)))

prune676.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 6.4b

localize7.0ms

Local error

Found 4 expressions with local error:

24.3b
(sqrt (- (* b_2 b_2) (* a c)))
16.6b
(* (* a c) (/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
0.9b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

rewrite31.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

15.0ms
(* (* a c) (/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
6.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
5.0ms
(/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

series350.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

138.0ms
(/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
127.0ms
(* (* a c) (/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
43.0ms
(sqrt (- (* b_2 b_2) (* a c)))
41.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))

simplify3.0s

Counts
36 → 76
Calls

36 calls. Slowest were:

631.0ms
(+ (log (* a c)) (- (log (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))))
341.0ms
(* (* a c) (/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
325.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))

prune744.0ms

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 6.4b

regimes324.0ms

Accuracy

95.5% (1.0b remaining)

Error of 7.0b against oracle of 5.9b and baseline of 29.2b

bsearch453.0ms

end0.0ms

sample4.2s

Algorithm
intervals