Average Error: 33.6 → 7.0
Time: 23.9s
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{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{a}\]
    4. 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 +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: 23.1s)Debug log

sample129.0ms

Algorithm
intervals

simplify26.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

26.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

localize24.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)

rewrite53.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

39.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
7.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
3.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series185.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

60.0ms
(sqrt (- (* b_2 b_2) (* a c)))
54.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
43.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
28.0ms
(- (* b_2 b_2) (* a c))

simplify3.7s

Counts
84 → 111
Calls

84 calls. Slowest were:

511.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
297.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
252.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))

prune1.2s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 6.4b

localize16.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))

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 70
Calls

4 calls. Slowest were:

7.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
6.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
3.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series262.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

110.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
65.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
54.0ms
(sqrt (- (* b_2 b_2) (* a c)))
33.0ms
(- (* b_2 b_2) (* a c))

simplify2.7s

Counts
32 → 82
Calls

32 calls. Slowest were:

565.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))))))
500.0ms
(- (log (* a c)) (log (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
493.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune997.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 6.4b

localize8.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 → 68
Calls

4 calls. Slowest were:

12.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
5.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
3.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series318.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

156.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
70.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
57.0ms
(sqrt (- (* b_2 b_2) (* a c)))
35.0ms
(- (* b_2 b_2) (* a c))

simplify1.6s

Counts
31 → 80
Calls

31 calls. Slowest were:

470.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
329.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
225.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)))

prune809.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 6.4b

localize16.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))))))

rewrite56.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
Calls

4 calls. Slowest were:

26.0ms
(* (* a c) (/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
11.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
11.0ms
(/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))

series374.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

128.0ms
(/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
119.0ms
(* (* a c) (/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
67.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
59.0ms
(sqrt (- (* b_2 b_2) (* a c)))

simplify4.3s

Counts
38 → 88
Calls

38 calls. Slowest were:

737.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))))))
684.0ms
(+ (log (* a c)) (- (log (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))))
611.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))))))

prune895.0ms

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 6.4b

regimes386.0ms

Accuracy

95.5% (1.0b remaining)

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

bsearch466.0ms

end0.0ms

sample4.4s

Algorithm
intervals