Average Error: 33.7 → 6.0
Time: 26.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 -1.1691367897364362 \cdot 10^{+152}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.677263518060922 \cdot 10^{-271}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 7.532875008454864 \cdot 10^{+126}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \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 < -1.1691367897364362e+152

    1. Initial program 62.8

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

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

    if -1.1691367897364362e+152 < b_2 < -5.677263518060922e-271

    1. Initial program 36.3

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

      \[\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/40.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)}}\]
    5. Simplified19.4

      \[\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-frac6.9

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

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

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

    if -5.677263518060922e-271 < b_2 < 7.532875008454864e+126

    1. Initial program 8.9

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

    if 7.532875008454864e+126 < b_2

    1. Initial program 50.7

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

      \[\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/62.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. Simplified62.3

      \[\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. Taylor expanded around 0 2.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.1691367897364362 \cdot 10^{+152}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -5.677263518060922 \cdot 10^{-271}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 7.532875008454864 \cdot 10^{+126}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \end{array}\]

Reproduce

herbie shell --seed 323378853 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))

Details

Time bar (total: 25.4s)Debug log

sample199.0ms

Algorithm
intervals
Results
47.0ms39×body2560valid
34.0ms21×body640valid
34.0ms36×body1280valid
32.0ms168×body80valid
14.0ms84×body80nan
4.0msbody320valid
3.0msbody5120valid
1.0msbody160valid

simplify44.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
43.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

prune14.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 35.5b

localize51.0ms

Local error

Found 4 expressions with local error:

24.4b
(sqrt (- (* b_2 b_2) (* a c)))
1.4b
(- (* b_2 b_2) (* a c))
0.6b
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
0.1b
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)

rewrite66.0ms

Algorithm
rewrite-expression-head
Rules
15×add-sqr-sqrt
10×*-un-lft-identity
add-log-exp
associate-/l*
add-cube-cbrt
sqrt-prod
difference-of-squares
flip--
add-exp-log
add-cbrt-cube
flip3--
pow1
associate-/l/
distribute-lft-out--
diff-log
sqrt-div
sub-neg
div-inv
div-sub
pow1/2
frac-2neg
clear-num
rem-sqrt-square
neg-sub0
associate--l-
Counts
4 → 61
Calls
4 calls:
Slowest
42.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
14.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))
4.0ms
(- (* b_2 b_2) (* a c))

series293.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
97.0ms
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
82.0ms
(- (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
71.0ms
(sqrt (- (* b_2 b_2) (* a c)))
42.0ms
(- (* b_2 b_2) (* a c))

simplify2.4s

Counts
32 → 73
Calls
32 calls:
Slowest
424.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
398.0ms
(- (pow (- b_2) 3) (pow (sqrt (- (* b_2 b_2) (* a c))) 3))
366.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
293.0ms
(- (* (- b_2) (- b_2)) (* (sqrt (- (* b_2 b_2) (* a c))) (sqrt (- (* b_2 b_2) (* a c)))))
204.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))

prune1.3s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 4.8b

localize23.0ms

Local error

Found 4 expressions with local error:

24.4b
(sqrt (- (* b_2 b_2) (* a c)))
16.6b
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
1.8b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
1.4b
(- (* b_2 b_2) (* a c))

rewrite41.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
*-un-lft-identity
add-exp-log
add-cbrt-cube
add-sqr-sqrt
add-cube-cbrt
pow1
sqrt-prod
flip--
flip-+
associate-/r/
associate-*r/
sqrt-div
flip3--
flip3-+
associate-/l*
distribute-lft-out
div-inv
associate-+l-
div-exp
diff-log
pow1/2
times-frac
frac-2neg
sub-neg
sum-log
associate-/r*
clear-num
rem-sqrt-square
+-commutative
cbrt-undiv
neg-sub0
Counts
4 → 56
Calls
4 calls:
Slowest
17.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
13.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
5.0ms
(- (* b_2 b_2) (* a c))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))

series386.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
186.0ms
(/ (* a c) (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))
83.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
74.0ms
(sqrt (- (* b_2 b_2) (* a c)))
42.0ms
(- (* b_2 b_2) (* a c))

simplify3.2s

Counts
28 → 68
Calls
28 calls:
Slowest
778.0ms
(- (log (* a c)) (log (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
505.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
489.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))))))
383.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)))))))
361.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))

prune1.1s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 4.7b

localize23.0ms

Local error

Found 4 expressions with local error:

24.4b
(sqrt (- (* b_2 b_2) (* a c)))
1.8b
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
1.4b
(- (* b_2 b_2) (* a c))
0.1b
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))

rewrite49.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-log-exp
add-cube-cbrt
*-un-lft-identity
flip--
add-exp-log
add-cbrt-cube
flip3--
pow1
sqrt-prod
associate-/r*
associate-/r/
sqrt-div
sub-neg
div-inv
diff-log
pow1/2
frac-2neg
clear-num
rem-sqrt-square
Counts
4 → 52
Calls
4 calls:
Slowest
26.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
13.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))
5.0ms
(- (* b_2 b_2) (* a c))

series413.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
216.0ms
(/ c (- (sqrt (- (* b_2 b_2) (* a c))) b_2))
80.0ms
(- (sqrt (- (* b_2 b_2) (* a c))) b_2)
75.0ms
(sqrt (- (* b_2 b_2) (* a c)))
42.0ms
(- (* b_2 b_2) (* a c))

simplify1.7s

Counts
24 → 64
Calls
24 calls:
Slowest
406.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
353.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
233.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)))
217.0ms
(- b_2 (* 1/2 (/ (* a c) b_2)))
103.0ms
(- (* 1/2 (/ (* a c) b_2)) (* 2 b_2))

prune1.1s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 4.7b

localize17.0ms

Local error

Found 4 expressions with local error:

24.4b
(sqrt (- (* b_2 b_2) (* a c)))
16.9b
(* (* a c) (/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
1.8b
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
1.4b
(- (* b_2 b_2) (* a c))

rewrite59.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
add-exp-log
*-un-lft-identity
add-sqr-sqrt
add-cube-cbrt
associate-*r*
add-cbrt-cube
pow1
sqrt-prod
associate-*r/
flip--
flip-+
associate-/r/
prod-exp
sqrt-div
flip3--
flip3-+
distribute-lft-out
div-inv
cbrt-unprod
associate-+l-
*-commutative
un-div-inv
pow-prod-down
associate-*l*
diff-log
pow1/2
sub-neg
sum-log
rec-exp
rem-sqrt-square
+-commutative
neg-sub0
Counts
4 → 60
Calls
4 calls:
Slowest
32.0ms
(* (* a c) (/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
14.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
5.0ms
(sqrt (- (* b_2 b_2) (* a c)))
5.0ms
(- (* b_2 b_2) (* a c))

series435.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
200.0ms
(* (* a c) (/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
101.0ms
(+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))
80.0ms
(sqrt (- (* b_2 b_2) (* a c)))
54.0ms
(- (* b_2 b_2) (* a c))

simplify3.7s

Counts
33 → 72
Calls
33 calls:
Slowest
775.0ms
(+ (log (* a c)) (- (log (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c))))))))
471.0ms
(* (* a c) (/ 1 (* a (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))))))
399.0ms
(sqrt (- (pow (* b_2 b_2) 3) (pow (* a c) 3)))
354.0ms
(sqrt (- (* (* b_2 b_2) (* b_2 b_2)) (* (* a c) (* a c))))
351.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))))))

prune1.2s

Pruning

7 alts after pruning (4 fresh and 3 done)

Merged error: 4.7b

regimes524.0ms

Accuracy

96.5% (0.8b remaining)

Error of 6.0b against oracle of 5.2b and baseline of 29.1b

bsearch681.0ms

end0.0ms

sample6.3s

Algorithm
intervals
Results
1.6s1081×body2560valid
1.3s5760×body80valid
1.1s925×body1280valid
836.0ms489×body640valid
811.0ms2968×body80nan
217.0ms245×body320valid
184.0ms116×body5120valid
50.0ms124×body160valid