Average Error: 52.7 → 0.1
Time: 22.0s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{c}{\left(-b\right) - \sqrt{\frac{\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(\left(3 \cdot a\right) \cdot c\right) \cdot \left(\left(3 \cdot a\right) \cdot c\right)}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 52.7

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
  5. Simplified0.5

    \[\leadsto \frac{\color{blue}{3 \cdot \left(c \cdot a\right)}}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\]
  6. Using strategy rm
  7. Applied associate-/r*0.4

    \[\leadsto \color{blue}{\frac{\frac{3 \cdot \left(c \cdot a\right)}{3 \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}\]
  8. Taylor expanded around -inf 0.1

    \[\leadsto \frac{\color{blue}{c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\]
  9. Using strategy rm
  10. Applied flip--0.1

    \[\leadsto \frac{c}{\left(-b\right) - \sqrt{\color{blue}{\frac{\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(\left(3 \cdot a\right) \cdot c\right) \cdot \left(\left(3 \cdot a\right) \cdot c\right)}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}}\]
  11. Final simplification0.1

    \[\leadsto \frac{c}{\left(-b\right) - \sqrt{\frac{\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(\left(3 \cdot a\right) \cdot c\right) \cdot \left(\left(3 \cdot a\right) \cdot c\right)}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}\]

Reproduce

herbie shell --seed 2019016 
(FPCore (a b c d)
  :name "Cubic critical, wide range"
  :pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))

Details

Time bar (total: 21.1s)Debug log

sample228.0ms

Algorithm
intervals
Results
500×(pre true 80)
244×(body nan 80)
109×(body real 320)
102×(body real 160)
31×(body real 80)
14×(body real 640)

simplify93.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
93.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))

prune21.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 51.5b

localize40.0ms

Local error

Found 4 expressions with local error:

27.8b
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
0.3b
(* (* 3 a) c)
0.2b
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))
0.1b
(- (* b b) (* (* 3 a) c))

rewrite54.0ms

Algorithm
rewrite-expression-head
Rules
12×*-un-lft-identity
add-log-exp
add-cube-cbrt
add-exp-log
add-cbrt-cube
add-sqr-sqrt
associate-/l*
times-frac
pow1
distribute-lft-out
associate-/l/
flip-+
associate-+l-
flip3-+
neg-sub0
flip--
div-inv
*-commutative
associate-*l*
div-exp
div-sub
diff-log
flip3--
frac-2neg
sub-neg
sum-log
associate-/r*
clear-num
+-commutative
cbrt-undiv
Counts
4 → 58
Calls
4 calls:
Slowest
30.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))
10.0ms
(- (* b b) (* (* 3 a) c))
10.0ms
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
4.0ms
(* (* 3 a) c)

series176.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
75.0ms
(+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))
61.0ms
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))
26.0ms
(- (* b b) (* (* 3 a) c))
15.0ms
(* (* 3 a) c)

simplify1.6s

Counts
30 → 70
Calls
30 calls:
Slowest
287.0ms
(+ (pow (- b) 3) (pow (sqrt (- (* b b) (* (* 3 a) c))) 3))
255.0ms
(- (* (- b) (- b)) (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))))
110.0ms
(/ (* (* (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))) (+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))) (* (* (* 3 a) (* 3 a)) (* 3 a)))
95.0ms
(- (log (+ (- b) (sqrt (- (* b b) (* (* 3 a) c))))) (log (* 3 a)))
74.0ms
(/ (exp (* b b)) (exp (* (* 3 a) c)))

prune916.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.2b

localize14.0ms

Local error

Found 4 expressions with local error:

0.4b
(/ (* 3 (* c a)) (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
0.3b
(* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
0.3b
(* (* 3 a) c)
0.3b
(* 3 (* c a))

rewrite28.0ms

Algorithm
rewrite-expression-head
Rules
11×add-exp-log
11×add-cbrt-cube
add-sqr-sqrt
associate-*r*
*-un-lft-identity
pow1
add-cube-cbrt
add-log-exp
associate-*r/
*-commutative
difference-of-squares
flip--
cbrt-unprod
associate-/r/
prod-exp
associate-*l*
div-exp
flip3--
distribute-lft-in
sub-neg
cbrt-undiv
distribute-rgt-in
distribute-lft-out--
associate-/l*
div-inv
sqrt-prod
pow-prod-down
times-frac
frac-2neg
associate-/r*
clear-num
Counts
4 → 61
Calls
4 calls:
Slowest
15.0ms
(* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
9.0ms
(/ (* 3 (* c a)) (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
2.0ms
(* (* 3 a) c)
1.0ms
(* 3 (* c a))

series241.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
125.0ms
(/ (* 3 (* c a)) (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
81.0ms
(* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
19.0ms
(* (* 3 a) c)
17.0ms
(* 3 (* c a))

simplify5.9s

Counts
36 → 73
Calls
36 calls:
Slowest
2.1s
(/ (* (* (* 3 (* c a)) (* 3 (* c a))) (* 3 (* c a))) (* (* (* (* 3 a) (* 3 a)) (* 3 a)) (* (* (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))))
1.7s
(/ (* (* (* 3 (* c a)) (* 3 (* c a))) (* 3 (* c a))) (* (* (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c))))) (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))) (* (* 3 a) (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))))
396.0ms
(+ (* (- b) (- b)) (+ (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))) (* (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
380.0ms
(+ (* (- b) (- b)) (+ (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))) (* (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
161.0ms
(- (log (* 3 (* c a))) (+ (log (* 3 a)) (log (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))))

prune862.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

localize13.0ms

Local error

Found 4 expressions with local error:

0.3b
(/ (* 3 (* c a)) (* 3 a))
0.3b
(* (* 3 a) c)
0.3b
(* 3 (* c a))
0.1b
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))

rewrite25.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-log-exp
add-exp-log
add-cbrt-cube
*-un-lft-identity
add-cube-cbrt
pow1
difference-of-squares
*-commutative
distribute-lft-out--
associate-/l*
flip--
div-inv
sqrt-prod
associate-*l*
associate-*r*
div-exp
diff-log
flip3--
times-frac
frac-2neg
sub-neg
associate-/r*
clear-num
cbrt-undiv
neg-sub0
associate--l-
Counts
4 → 49
Calls
4 calls:
Slowest
11.0ms
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))
7.0ms
(/ (* 3 (* c a)) (* 3 a))
4.0ms
(* (* 3 a) c)
2.0ms
(* 3 (* c a))

series114.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
71.0ms
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))
18.0ms
(* (* 3 a) c)
17.0ms
(* 3 (* c a))
7.0ms
(/ (* 3 (* c a)) (* 3 a))

simplify1.6s

Counts
22 → 61
Calls
22 calls:
Slowest
979.0ms
(/ (* (* (* 3 (* c a)) (* 3 (* c a))) (* 3 (* c a))) (* (* (* 3 a) (* 3 a)) (* 3 a)))
171.0ms
(- (log (* 3 (* c a))) (log (* 3 a)))
86.0ms
(- (* 3/2 (/ (* a c) b)) (* 2 b))
68.0ms
(* -3/2 (/ (* a c) b))
67.0ms
(/ (exp (- b)) (exp (sqrt (- (* b b) (* (* 3 a) c)))))

prune884.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0.0b

localize4.0ms

Local error

Found 4 expressions with local error:

0.3b
(* (* 3 a) c)
0.1b
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))
0.1b
(/ c (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
0.1b
(- (* b b) (* (* 3 a) c))

rewrite17.0ms

Algorithm
rewrite-expression-head
Rules
13×add-sqr-sqrt
*-un-lft-identity
add-log-exp
associate-/r*
add-cube-cbrt
difference-of-squares
add-exp-log
add-cbrt-cube
pow1
flip--
flip3--
distribute-lft-out--
sqrt-prod
associate-/r/
diff-log
sub-neg
div-inv
*-commutative
associate-*l*
frac-2neg
clear-num
neg-sub0
associate--l-
Counts
4 → 55
Calls
4 calls:
Slowest
5.0ms
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))
4.0ms
(* (* 3 a) c)
4.0ms
(/ c (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
2.0ms
(- (* b b) (* (* 3 a) c))

series260.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
127.0ms
(/ c (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
74.0ms
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))
42.0ms
(- (* b b) (* (* 3 a) c))
17.0ms
(* (* 3 a) c)

simplify1.3s

Counts
27 → 67
Calls
27 calls:
Slowest
426.0ms
(+ (* (- b) (- b)) (+ (* (sqrt (- (* b b) (* (* 3 a) c))) (sqrt (- (* b b) (* (* 3 a) c)))) (* (- b) (sqrt (- (* b b) (* (* 3 a) c))))))
79.0ms
(/ (exp (* b b)) (exp (* (* 3 a) c)))
75.0ms
(/ (exp (- b)) (exp (sqrt (- (* b b) (* (* 3 a) c)))))
51.0ms
(cbrt (- (- b) (sqrt (- (* b b) (* (* 3 a) c)))))
51.0ms
(- (- b) (sqrt (- (* b b) (* (* 3 a) c))))

prune720.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0b

regimes278.0ms

Accuracy

0% (0.1b remaining)

Error of 0.1b against oracle of 0.0b and baseline of 0.1b

bsearch4.0ms

end0.0ms

sample5.7s

Algorithm
intervals
Results
16163×(pre true 80)
8161×(body nan 80)
3597×(body real 320)
2974×(body real 160)
896×(body real 80)
535×(body real 640)