Average Error: 32.7 → 6.4
Time: 27.2s
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 -2.8211790457242957 \cdot 10^{+131}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.3637169296967385 \cdot 10^{-222}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 1.5697271662513251 \cdot 10^{+75}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -2.8211790457242957e+131

    1. Initial program 60.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification60.9

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

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

    if -2.8211790457242957e+131 < b_2 < 1.3637169296967385e-222

    1. Initial program 30.4

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification30.4

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

      \[\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}\]
    5. Applied associate-/l/35.2

      \[\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)}}\]
    6. Simplified20.2

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

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

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

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

    if 1.3637169296967385e-222 < b_2 < 1.5697271662513251e+75

    1. Initial program 7.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification7.1

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-inv7.3

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    5. Using strategy rm
    6. Applied un-div-inv7.1

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

    if 1.5697271662513251e+75 < b_2

    1. Initial program 40.0

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification40.0

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
    4. Simplified5.2

      \[\leadsto \color{blue}{(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.8211790457242957 \cdot 10^{+131}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.3637169296967385 \cdot 10^{-222}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 1.5697271662513251 \cdot 10^{+75}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \end{array}\]

Reproduce

herbie shell --seed 2018362 +o rules:numerics
(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: 21.2s)Debug log

start177.0ms

Algorithm
intervals

setup59.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.7b

localize37.0ms

Local error

Found 4 expressions with local error:

21.0b
(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))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite41.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

17.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
16.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
4.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series194.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

81.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
43.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
36.0ms
(sqrt (- (* b_2 b_2) (* a c)))
34.0ms
(- (* b_2 b_2) (* a c))

simplify3.6s

Counts
84 → 111
Calls

84 calls. Slowest were:

444.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
316.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
224.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))

prune1.3s

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 4.1b

localize17.0ms

Local error

Found 4 expressions with local error:

21.0b
(sqrt (- (* b_2 b_2) (* a c)))
13.2b
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
1.8b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.4b
(- (* b_2 b_2) (* a c))

rewrite36.0ms

Algorithm
rewrite-expression-head
Counts
4 → 70
Calls

4 calls. Slowest were:

14.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
11.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series302.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

142.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
68.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
58.0ms
(sqrt (- (* b_2 b_2) (* a c)))
34.0ms
(- (* b_2 b_2) (* a c))

simplify2.9s

Counts
32 → 82
Calls

32 calls. Slowest were:

623.0ms
(+ (* (- b_2) (- b_2)) (- (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))) (* (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
501.0ms
(- (log (* a c)) (log (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
435.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune837.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 4.1b

localize8.0ms

Local error

Found 4 expressions with local error:

21.0b
(sqrt (- (* b_2 b_2) (* a c)))
1.8b
(- (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))

rewrite42.0ms

Algorithm
rewrite-expression-head
Counts
4 → 68
Calls

4 calls. Slowest were:

22.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
11.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
4.0ms
(- (* b_2 b_2) (* a c))

series298.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

152.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
58.0ms
(sqrt (- (* b_2 b_2) (* a c)))
54.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
34.0ms
(- (* b_2 b_2) (* a c))

simplify1.7s

Counts
31 → 80
Calls

31 calls. Slowest were:

494.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
407.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
286.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)))

prune982.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 4.1b

localize13.0ms

Local error

Found 4 expressions with local error:

21.0b
(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))
0.2b
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))

rewrite36.0ms

Algorithm
rewrite-expression-head
Counts
4 → 107
Calls

4 calls. Slowest were:

13.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
10.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
10.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series231.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

78.0ms
(* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (/ 1 a))
68.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
51.0ms
(sqrt (- (* b_2 b_2) (* a c)))
33.0ms
(- (* b_2 b_2) (* a c))

simplify6.2s

Counts
94 → 119
Calls

94 calls. Slowest were:

581.0ms
(* (* (* (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))) (- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))) (* (* (/ 1 a) (/ 1 a)) (/ 1 a)))
559.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
557.0ms
(* (- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3)) 1)

prune1.4s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 4.1b

regimes319.0ms

Accuracy

95.2% (1.1b remaining)

Error of 6.4b against oracle of 5.3b and baseline of 28.9b

bsearch452.0ms