Cubic critical, medium range

Percentage Accurate: 31.5% → 99.3%
Time: 15.1s
Alternatives: 9
Speedup: 23.2×

Specification

?
\[\left(\left(1.1102230246251565 \cdot 10^{-16} < a \land a < 9007199254740992\right) \land \left(1.1102230246251565 \cdot 10^{-16} < b \land b < 9007199254740992\right)\right) \land \left(1.1102230246251565 \cdot 10^{-16} < c \land c < 9007199254740992\right)\]
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 31.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}

Alternative 1: 99.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(c \cdot a\right)}}}{a \cdot 3} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/
  (/
   (+ (- (pow (- b) 2.0) (pow b 2.0)) (* c (* a 3.0)))
   (- (- b) (sqrt (+ (pow b 2.0) (* -3.0 (* c a))))))
  (* a 3.0)))
double code(double a, double b, double c) {
	return (((pow(-b, 2.0) - pow(b, 2.0)) + (c * (a * 3.0))) / (-b - sqrt((pow(b, 2.0) + (-3.0 * (c * a)))))) / (a * 3.0);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = ((((-b ** 2.0d0) - (b ** 2.0d0)) + (c * (a * 3.0d0))) / (-b - sqrt(((b ** 2.0d0) + ((-3.0d0) * (c * a)))))) / (a * 3.0d0)
end function
public static double code(double a, double b, double c) {
	return (((Math.pow(-b, 2.0) - Math.pow(b, 2.0)) + (c * (a * 3.0))) / (-b - Math.sqrt((Math.pow(b, 2.0) + (-3.0 * (c * a)))))) / (a * 3.0);
}
def code(a, b, c):
	return (((math.pow(-b, 2.0) - math.pow(b, 2.0)) + (c * (a * 3.0))) / (-b - math.sqrt((math.pow(b, 2.0) + (-3.0 * (c * a)))))) / (a * 3.0)
function code(a, b, c)
	return Float64(Float64(Float64(Float64((Float64(-b) ^ 2.0) - (b ^ 2.0)) + Float64(c * Float64(a * 3.0))) / Float64(Float64(-b) - sqrt(Float64((b ^ 2.0) + Float64(-3.0 * Float64(c * a)))))) / Float64(a * 3.0))
end
function tmp = code(a, b, c)
	tmp = ((((-b ^ 2.0) - (b ^ 2.0)) + (c * (a * 3.0))) / (-b - sqrt(((b ^ 2.0) + (-3.0 * (c * a)))))) / (a * 3.0);
end
code[a_, b_, c_] := N[(N[(N[(N[(N[Power[(-b), 2.0], $MachinePrecision] - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[((-b) - N[Sqrt[N[(N[Power[b, 2.0], $MachinePrecision] + N[(-3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(c \cdot a\right)}}}{a \cdot 3}
\end{array}
Derivation
  1. Initial program 35.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. log1p-expm1-u21.4%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    2. log1p-udef15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    3. associate-*l*15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(\color{blue}{3 \cdot \left(a \cdot c\right)}\right)\right)}}{3 \cdot a} \]
  4. Applied egg-rr15.1%

    \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
  5. Step-by-step derivation
    1. flip-+14.9%

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)} \cdot \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}}{3 \cdot a} \]
    2. pow214.9%

      \[\leadsto \frac{\frac{\color{blue}{{\left(-b\right)}^{2}} - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)} \cdot \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    3. add-sqr-sqrt15.2%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \color{blue}{\left(b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)\right)}}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    4. pow215.2%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left(\color{blue}{{b}^{2}} - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    5. log1p-def19.1%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}\right)}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    6. log1p-expm1-u19.1%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{3 \cdot \left(a \cdot c\right)}\right)}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    7. pow219.1%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{2}} - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    8. log1p-def21.9%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}}{3 \cdot a} \]
    9. log1p-expm1-u35.9%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
  6. Applied egg-rr35.9%

    \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
  7. Step-by-step derivation
    1. associate--r-99.1%

      \[\leadsto \frac{\frac{\color{blue}{\left({\left(-b\right)}^{2} - {b}^{2}\right) + 3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    2. associate-*r*99.3%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{\left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. *-commutative99.3%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{\left(a \cdot 3\right)} \cdot c}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. associate-*l*99.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{a \cdot \left(3 \cdot c\right)}}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    5. cancel-sign-sub-inv99.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(3 \cdot c\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{2} + \left(-3\right) \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
    6. metadata-eval99.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(3 \cdot c\right)}{\left(-b\right) - \sqrt{{b}^{2} + \color{blue}{-3} \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  8. Simplified99.1%

    \[\leadsto \frac{\color{blue}{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(3 \cdot c\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
  9. Step-by-step derivation
    1. associate-*r*99.3%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{\left(a \cdot 3\right) \cdot c}}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    2. *-commutative99.3%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{\left(3 \cdot a\right)} \cdot c}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. associate-*r*99.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. add-log-exp39.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{\log \left(e^{3 \cdot \left(a \cdot c\right)}\right)}}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    5. associate-*r*39.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \log \left(e^{\color{blue}{\left(3 \cdot a\right) \cdot c}}\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    6. exp-prod24.2%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \log \color{blue}{\left({\left(e^{3 \cdot a}\right)}^{c}\right)}}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    7. exp-prod24.2%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \log \left({\color{blue}{\left({\left(e^{3}\right)}^{a}\right)}}^{c}\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  10. Applied egg-rr24.2%

    \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{\log \left({\left({\left(e^{3}\right)}^{a}\right)}^{c}\right)}}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  11. Step-by-step derivation
    1. log-pow46.7%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{c \cdot \log \left({\left(e^{3}\right)}^{a}\right)}}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    2. log-pow99.3%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + c \cdot \color{blue}{\left(a \cdot \log \left(e^{3}\right)\right)}}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. rem-log-exp99.3%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + c \cdot \left(a \cdot \color{blue}{3}\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  12. Simplified99.3%

    \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{c \cdot \left(a \cdot 3\right)}}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  13. Final simplification99.3%

    \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(c \cdot a\right)}}}{a \cdot 3} \]
  14. Add Preprocessing

Alternative 2: 99.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + 3 \cdot \left(c \cdot a\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(c \cdot a\right)}}}{a \cdot 3} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/
  (/
   (+ (- (pow (- b) 2.0) (pow b 2.0)) (* 3.0 (* c a)))
   (- (- b) (sqrt (+ (pow b 2.0) (* -3.0 (* c a))))))
  (* a 3.0)))
double code(double a, double b, double c) {
	return (((pow(-b, 2.0) - pow(b, 2.0)) + (3.0 * (c * a))) / (-b - sqrt((pow(b, 2.0) + (-3.0 * (c * a)))))) / (a * 3.0);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = ((((-b ** 2.0d0) - (b ** 2.0d0)) + (3.0d0 * (c * a))) / (-b - sqrt(((b ** 2.0d0) + ((-3.0d0) * (c * a)))))) / (a * 3.0d0)
end function
public static double code(double a, double b, double c) {
	return (((Math.pow(-b, 2.0) - Math.pow(b, 2.0)) + (3.0 * (c * a))) / (-b - Math.sqrt((Math.pow(b, 2.0) + (-3.0 * (c * a)))))) / (a * 3.0);
}
def code(a, b, c):
	return (((math.pow(-b, 2.0) - math.pow(b, 2.0)) + (3.0 * (c * a))) / (-b - math.sqrt((math.pow(b, 2.0) + (-3.0 * (c * a)))))) / (a * 3.0)
function code(a, b, c)
	return Float64(Float64(Float64(Float64((Float64(-b) ^ 2.0) - (b ^ 2.0)) + Float64(3.0 * Float64(c * a))) / Float64(Float64(-b) - sqrt(Float64((b ^ 2.0) + Float64(-3.0 * Float64(c * a)))))) / Float64(a * 3.0))
end
function tmp = code(a, b, c)
	tmp = ((((-b ^ 2.0) - (b ^ 2.0)) + (3.0 * (c * a))) / (-b - sqrt(((b ^ 2.0) + (-3.0 * (c * a)))))) / (a * 3.0);
end
code[a_, b_, c_] := N[(N[(N[(N[(N[Power[(-b), 2.0], $MachinePrecision] - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[((-b) - N[Sqrt[N[(N[Power[b, 2.0], $MachinePrecision] + N[(-3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + 3 \cdot \left(c \cdot a\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(c \cdot a\right)}}}{a \cdot 3}
\end{array}
Derivation
  1. Initial program 35.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. log1p-expm1-u21.4%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    2. log1p-udef15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    3. associate-*l*15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(\color{blue}{3 \cdot \left(a \cdot c\right)}\right)\right)}}{3 \cdot a} \]
  4. Applied egg-rr15.1%

    \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
  5. Step-by-step derivation
    1. flip-+14.9%

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)} \cdot \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}}{3 \cdot a} \]
    2. pow214.9%

      \[\leadsto \frac{\frac{\color{blue}{{\left(-b\right)}^{2}} - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)} \cdot \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    3. add-sqr-sqrt15.2%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \color{blue}{\left(b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)\right)}}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    4. pow215.2%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left(\color{blue}{{b}^{2}} - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    5. log1p-def19.1%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}\right)}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    6. log1p-expm1-u19.1%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{3 \cdot \left(a \cdot c\right)}\right)}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    7. pow219.1%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{2}} - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    8. log1p-def21.9%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}}{3 \cdot a} \]
    9. log1p-expm1-u35.9%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
  6. Applied egg-rr35.9%

    \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
  7. Step-by-step derivation
    1. associate--r-99.1%

      \[\leadsto \frac{\frac{\color{blue}{\left({\left(-b\right)}^{2} - {b}^{2}\right) + 3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    2. associate-*r*99.3%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{\left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. *-commutative99.3%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{\left(a \cdot 3\right)} \cdot c}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. associate-*l*99.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{a \cdot \left(3 \cdot c\right)}}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    5. cancel-sign-sub-inv99.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(3 \cdot c\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{2} + \left(-3\right) \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
    6. metadata-eval99.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(3 \cdot c\right)}{\left(-b\right) - \sqrt{{b}^{2} + \color{blue}{-3} \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  8. Simplified99.1%

    \[\leadsto \frac{\color{blue}{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(3 \cdot c\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
  9. Taylor expanded in a around 0 99.1%

    \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  10. Step-by-step derivation
    1. *-commutative99.1%

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

    \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{3 \cdot \left(c \cdot a\right)}}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  12. Final simplification99.1%

    \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + 3 \cdot \left(c \cdot a\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(c \cdot a\right)}}}{a \cdot 3} \]
  13. Add Preprocessing

Alternative 3: 99.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(c \cdot 3\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(c \cdot a\right)}}}{a \cdot 3} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/
  (/
   (+ (- (pow (- b) 2.0) (pow b 2.0)) (* a (* c 3.0)))
   (- (- b) (sqrt (+ (pow b 2.0) (* -3.0 (* c a))))))
  (* a 3.0)))
double code(double a, double b, double c) {
	return (((pow(-b, 2.0) - pow(b, 2.0)) + (a * (c * 3.0))) / (-b - sqrt((pow(b, 2.0) + (-3.0 * (c * a)))))) / (a * 3.0);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = ((((-b ** 2.0d0) - (b ** 2.0d0)) + (a * (c * 3.0d0))) / (-b - sqrt(((b ** 2.0d0) + ((-3.0d0) * (c * a)))))) / (a * 3.0d0)
end function
public static double code(double a, double b, double c) {
	return (((Math.pow(-b, 2.0) - Math.pow(b, 2.0)) + (a * (c * 3.0))) / (-b - Math.sqrt((Math.pow(b, 2.0) + (-3.0 * (c * a)))))) / (a * 3.0);
}
def code(a, b, c):
	return (((math.pow(-b, 2.0) - math.pow(b, 2.0)) + (a * (c * 3.0))) / (-b - math.sqrt((math.pow(b, 2.0) + (-3.0 * (c * a)))))) / (a * 3.0)
function code(a, b, c)
	return Float64(Float64(Float64(Float64((Float64(-b) ^ 2.0) - (b ^ 2.0)) + Float64(a * Float64(c * 3.0))) / Float64(Float64(-b) - sqrt(Float64((b ^ 2.0) + Float64(-3.0 * Float64(c * a)))))) / Float64(a * 3.0))
end
function tmp = code(a, b, c)
	tmp = ((((-b ^ 2.0) - (b ^ 2.0)) + (a * (c * 3.0))) / (-b - sqrt(((b ^ 2.0) + (-3.0 * (c * a)))))) / (a * 3.0);
end
code[a_, b_, c_] := N[(N[(N[(N[(N[Power[(-b), 2.0], $MachinePrecision] - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(a * N[(c * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[((-b) - N[Sqrt[N[(N[Power[b, 2.0], $MachinePrecision] + N[(-3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(c \cdot 3\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(c \cdot a\right)}}}{a \cdot 3}
\end{array}
Derivation
  1. Initial program 35.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. log1p-expm1-u21.4%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    2. log1p-udef15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    3. associate-*l*15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(\color{blue}{3 \cdot \left(a \cdot c\right)}\right)\right)}}{3 \cdot a} \]
  4. Applied egg-rr15.1%

    \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
  5. Step-by-step derivation
    1. flip-+14.9%

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)} \cdot \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}}{3 \cdot a} \]
    2. pow214.9%

      \[\leadsto \frac{\frac{\color{blue}{{\left(-b\right)}^{2}} - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)} \cdot \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    3. add-sqr-sqrt15.2%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \color{blue}{\left(b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)\right)}}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    4. pow215.2%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left(\color{blue}{{b}^{2}} - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    5. log1p-def19.1%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}\right)}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    6. log1p-expm1-u19.1%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{3 \cdot \left(a \cdot c\right)}\right)}{\left(-b\right) - \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    7. pow219.1%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{2}} - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
    8. log1p-def21.9%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}}{3 \cdot a} \]
    9. log1p-expm1-u35.9%

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
  6. Applied egg-rr35.9%

    \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
  7. Step-by-step derivation
    1. associate--r-99.1%

      \[\leadsto \frac{\frac{\color{blue}{\left({\left(-b\right)}^{2} - {b}^{2}\right) + 3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    2. associate-*r*99.3%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{\left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. *-commutative99.3%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{\left(a \cdot 3\right)} \cdot c}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. associate-*l*99.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + \color{blue}{a \cdot \left(3 \cdot c\right)}}{\left(-b\right) - \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    5. cancel-sign-sub-inv99.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(3 \cdot c\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{2} + \left(-3\right) \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
    6. metadata-eval99.1%

      \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(3 \cdot c\right)}{\left(-b\right) - \sqrt{{b}^{2} + \color{blue}{-3} \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  8. Simplified99.1%

    \[\leadsto \frac{\color{blue}{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(3 \cdot c\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a} \]
  9. Final simplification99.1%

    \[\leadsto \frac{\frac{\left({\left(-b\right)}^{2} - {b}^{2}\right) + a \cdot \left(c \cdot 3\right)}{\left(-b\right) - \sqrt{{b}^{2} + -3 \cdot \left(c \cdot a\right)}}}{a \cdot 3} \]
  10. Add Preprocessing

Alternative 4: 90.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ {\left(-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}\right)}^{-1} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (pow (+ (* -2.0 (/ b c)) (* 1.5 (/ a b))) -1.0))
double code(double a, double b, double c) {
	return pow(((-2.0 * (b / c)) + (1.5 * (a / b))), -1.0);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (((-2.0d0) * (b / c)) + (1.5d0 * (a / b))) ** (-1.0d0)
end function
public static double code(double a, double b, double c) {
	return Math.pow(((-2.0 * (b / c)) + (1.5 * (a / b))), -1.0);
}
def code(a, b, c):
	return math.pow(((-2.0 * (b / c)) + (1.5 * (a / b))), -1.0)
function code(a, b, c)
	return Float64(Float64(-2.0 * Float64(b / c)) + Float64(1.5 * Float64(a / b))) ^ -1.0
end
function tmp = code(a, b, c)
	tmp = ((-2.0 * (b / c)) + (1.5 * (a / b))) ^ -1.0;
end
code[a_, b_, c_] := N[Power[N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]
\begin{array}{l}

\\
{\left(-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}\right)}^{-1}
\end{array}
Derivation
  1. Initial program 35.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. log1p-expm1-u21.4%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    2. log1p-udef15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    3. associate-*l*15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(\color{blue}{3 \cdot \left(a \cdot c\right)}\right)\right)}}{3 \cdot a} \]
  4. Applied egg-rr15.1%

    \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
  5. Step-by-step derivation
    1. clear-num15.1%

      \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}} \]
    2. inv-pow15.1%

      \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}^{-1}} \]
    3. *-commutative15.1%

      \[\leadsto {\left(\frac{\color{blue}{a \cdot 3}}{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}^{-1} \]
    4. neg-mul-115.1%

      \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{-1 \cdot b} + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}^{-1} \]
    5. fma-def15.1%

      \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}\right)}}\right)}^{-1} \]
    6. pow215.1%

      \[\leadsto {\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{\color{blue}{{b}^{2}} - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}\right)}\right)}^{-1} \]
    7. log1p-def21.4%

      \[\leadsto {\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{{b}^{2} - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}\right)}^{-1} \]
    8. log1p-expm1-u35.2%

      \[\leadsto {\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{{b}^{2} - \color{blue}{3 \cdot \left(a \cdot c\right)}}\right)}\right)}^{-1} \]
  6. Applied egg-rr35.2%

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}\right)}\right)}^{-1}} \]
  7. Taylor expanded in b around inf 88.5%

    \[\leadsto {\color{blue}{\left(-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}\right)}}^{-1} \]
  8. Final simplification88.5%

    \[\leadsto {\left(-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}\right)}^{-1} \]
  9. Add Preprocessing

Alternative 5: 90.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 1.5}{b}\right)} \end{array} \]
(FPCore (a b c) :precision binary64 (/ 1.0 (fma -2.0 (/ b c) (/ (* a 1.5) b))))
double code(double a, double b, double c) {
	return 1.0 / fma(-2.0, (b / c), ((a * 1.5) / b));
}
function code(a, b, c)
	return Float64(1.0 / fma(-2.0, Float64(b / c), Float64(Float64(a * 1.5) / b)))
end
code[a_, b_, c_] := N[(1.0 / N[(-2.0 * N[(b / c), $MachinePrecision] + N[(N[(a * 1.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 1.5}{b}\right)}
\end{array}
Derivation
  1. Initial program 35.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. log1p-expm1-u21.4%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    2. log1p-udef15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    3. associate-*l*15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(\color{blue}{3 \cdot \left(a \cdot c\right)}\right)\right)}}{3 \cdot a} \]
  4. Applied egg-rr15.1%

    \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
  5. Step-by-step derivation
    1. clear-num15.1%

      \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}} \]
    2. inv-pow15.1%

      \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}^{-1}} \]
    3. *-commutative15.1%

      \[\leadsto {\left(\frac{\color{blue}{a \cdot 3}}{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}^{-1} \]
    4. neg-mul-115.1%

      \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{-1 \cdot b} + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}^{-1} \]
    5. fma-def15.1%

      \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}\right)}}\right)}^{-1} \]
    6. pow215.1%

      \[\leadsto {\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{\color{blue}{{b}^{2}} - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}\right)}\right)}^{-1} \]
    7. log1p-def21.4%

      \[\leadsto {\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{{b}^{2} - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}\right)}^{-1} \]
    8. log1p-expm1-u35.2%

      \[\leadsto {\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{{b}^{2} - \color{blue}{3 \cdot \left(a \cdot c\right)}}\right)}\right)}^{-1} \]
  6. Applied egg-rr35.2%

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}\right)}\right)}^{-1}} \]
  7. Taylor expanded in b around inf 88.5%

    \[\leadsto {\color{blue}{\left(-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}\right)}}^{-1} \]
  8. Step-by-step derivation
    1. expm1-log1p-u78.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}\right)}^{-1}\right)\right)} \]
    2. expm1-udef37.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}\right)}^{-1}\right)} - 1} \]
    3. unpow-137.7%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}}\right)} - 1 \]
    4. fma-def37.7%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\color{blue}{\mathsf{fma}\left(-2, \frac{b}{c}, 1.5 \cdot \frac{a}{b}\right)}}\right)} - 1 \]
    5. associate-*r/37.7%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \color{blue}{\frac{1.5 \cdot a}{b}}\right)}\right)} - 1 \]
  9. Applied egg-rr37.7%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{1.5 \cdot a}{b}\right)}\right)} - 1} \]
  10. Step-by-step derivation
    1. expm1-def78.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{1.5 \cdot a}{b}\right)}\right)\right)} \]
    2. expm1-log1p88.5%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{1.5 \cdot a}{b}\right)}} \]
    3. *-commutative88.5%

      \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{\color{blue}{a \cdot 1.5}}{b}\right)} \]
  11. Simplified88.5%

    \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 1.5}{b}\right)}} \]
  12. Final simplification88.5%

    \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 1.5}{b}\right)} \]
  13. Add Preprocessing

Alternative 6: 81.0% accurate, 23.2× speedup?

\[\begin{array}{l} \\ c \cdot \frac{-0.5}{b} \end{array} \]
(FPCore (a b c) :precision binary64 (* c (/ -0.5 b)))
double code(double a, double b, double c) {
	return c * (-0.5 / b);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = c * ((-0.5d0) / b)
end function
public static double code(double a, double b, double c) {
	return c * (-0.5 / b);
}
def code(a, b, c):
	return c * (-0.5 / b)
function code(a, b, c)
	return Float64(c * Float64(-0.5 / b))
end
function tmp = code(a, b, c)
	tmp = c * (-0.5 / b);
end
code[a_, b_, c_] := N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
c \cdot \frac{-0.5}{b}
\end{array}
Derivation
  1. Initial program 35.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Taylor expanded in b around inf 78.1%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
  4. Step-by-step derivation
    1. associate-*r/78.1%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    2. associate-/l*77.9%

      \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
  5. Simplified77.9%

    \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
  6. Step-by-step derivation
    1. associate-/r/77.9%

      \[\leadsto \color{blue}{\frac{-0.5}{b} \cdot c} \]
  7. Applied egg-rr77.9%

    \[\leadsto \color{blue}{\frac{-0.5}{b} \cdot c} \]
  8. Final simplification77.9%

    \[\leadsto c \cdot \frac{-0.5}{b} \]
  9. Add Preprocessing

Alternative 7: 81.0% accurate, 23.2× speedup?

\[\begin{array}{l} \\ \frac{-0.5}{\frac{b}{c}} \end{array} \]
(FPCore (a b c) :precision binary64 (/ -0.5 (/ b c)))
double code(double a, double b, double c) {
	return -0.5 / (b / c);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-0.5d0) / (b / c)
end function
public static double code(double a, double b, double c) {
	return -0.5 / (b / c);
}
def code(a, b, c):
	return -0.5 / (b / c)
function code(a, b, c)
	return Float64(-0.5 / Float64(b / c))
end
function tmp = code(a, b, c)
	tmp = -0.5 / (b / c);
end
code[a_, b_, c_] := N[(-0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{-0.5}{\frac{b}{c}}
\end{array}
Derivation
  1. Initial program 35.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Taylor expanded in b around inf 78.1%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
  4. Step-by-step derivation
    1. associate-*r/78.1%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    2. associate-/l*77.9%

      \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
  5. Simplified77.9%

    \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
  6. Final simplification77.9%

    \[\leadsto \frac{-0.5}{\frac{b}{c}} \]
  7. Add Preprocessing

Alternative 8: 81.2% accurate, 23.2× speedup?

\[\begin{array}{l} \\ \frac{c \cdot -0.5}{b} \end{array} \]
(FPCore (a b c) :precision binary64 (/ (* c -0.5) b))
double code(double a, double b, double c) {
	return (c * -0.5) / b;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (c * (-0.5d0)) / b
end function
public static double code(double a, double b, double c) {
	return (c * -0.5) / b;
}
def code(a, b, c):
	return (c * -0.5) / b
function code(a, b, c)
	return Float64(Float64(c * -0.5) / b)
end
function tmp = code(a, b, c)
	tmp = (c * -0.5) / b;
end
code[a_, b_, c_] := N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}

\\
\frac{c \cdot -0.5}{b}
\end{array}
Derivation
  1. Initial program 35.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Taylor expanded in b around inf 78.1%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
  4. Step-by-step derivation
    1. associate-*r/78.1%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
  5. Simplified78.1%

    \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
  6. Final simplification78.1%

    \[\leadsto \frac{c \cdot -0.5}{b} \]
  7. Add Preprocessing

Alternative 9: 3.2% accurate, 38.7× speedup?

\[\begin{array}{l} \\ \frac{0}{a} \end{array} \]
(FPCore (a b c) :precision binary64 (/ 0.0 a))
double code(double a, double b, double c) {
	return 0.0 / a;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = 0.0d0 / a
end function
public static double code(double a, double b, double c) {
	return 0.0 / a;
}
def code(a, b, c):
	return 0.0 / a
function code(a, b, c)
	return Float64(0.0 / a)
end
function tmp = code(a, b, c)
	tmp = 0.0 / a;
end
code[a_, b_, c_] := N[(0.0 / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{0}{a}
\end{array}
Derivation
  1. Initial program 35.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. log1p-expm1-u21.4%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    2. log1p-udef15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(\left(3 \cdot a\right) \cdot c\right)\right)}}}{3 \cdot a} \]
    3. associate-*l*15.1%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(\color{blue}{3 \cdot \left(a \cdot c\right)}\right)\right)}}{3 \cdot a} \]
  4. Applied egg-rr15.1%

    \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}{3 \cdot a} \]
  5. Step-by-step derivation
    1. clear-num15.1%

      \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}}} \]
    2. inv-pow15.1%

      \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}^{-1}} \]
    3. *-commutative15.1%

      \[\leadsto {\left(\frac{\color{blue}{a \cdot 3}}{\left(-b\right) + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}^{-1} \]
    4. neg-mul-115.1%

      \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{-1 \cdot b} + \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}^{-1} \]
    5. fma-def15.1%

      \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}\right)}}\right)}^{-1} \]
    6. pow215.1%

      \[\leadsto {\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{\color{blue}{{b}^{2}} - \log \left(1 + \mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}\right)}\right)}^{-1} \]
    7. log1p-def21.4%

      \[\leadsto {\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{{b}^{2} - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(3 \cdot \left(a \cdot c\right)\right)\right)}}\right)}\right)}^{-1} \]
    8. log1p-expm1-u35.2%

      \[\leadsto {\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{{b}^{2} - \color{blue}{3 \cdot \left(a \cdot c\right)}}\right)}\right)}^{-1} \]
  6. Applied egg-rr35.2%

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 3}{\mathsf{fma}\left(-1, b, \sqrt{{b}^{2} - 3 \cdot \left(a \cdot c\right)}\right)}\right)}^{-1}} \]
  7. Taylor expanded in a around 0 3.2%

    \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{b + -1 \cdot b}{a}} \]
  8. Step-by-step derivation
    1. associate-*r/3.2%

      \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \left(b + -1 \cdot b\right)}{a}} \]
    2. distribute-rgt1-in3.2%

      \[\leadsto \frac{0.3333333333333333 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot b\right)}}{a} \]
    3. metadata-eval3.2%

      \[\leadsto \frac{0.3333333333333333 \cdot \left(\color{blue}{0} \cdot b\right)}{a} \]
    4. mul0-lft3.2%

      \[\leadsto \frac{0.3333333333333333 \cdot \color{blue}{0}}{a} \]
    5. metadata-eval3.2%

      \[\leadsto \frac{\color{blue}{0}}{a} \]
  9. Simplified3.2%

    \[\leadsto \color{blue}{\frac{0}{a}} \]
  10. Final simplification3.2%

    \[\leadsto \frac{0}{a} \]
  11. Add Preprocessing

Reproduce

?
herbie shell --seed 2024024 
(FPCore (a b c)
  :name "Cubic critical, medium range"
  :precision binary64
  :pre (and (and (and (< 1.1102230246251565e-16 a) (< a 9007199254740992.0)) (and (< 1.1102230246251565e-16 b) (< b 9007199254740992.0))) (and (< 1.1102230246251565e-16 c) (< c 9007199254740992.0)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))