ABCF->ab-angle a

Percentage Accurate: 18.8% → 38.1%
Time: 29.5s
Alternatives: 7
Speedup: 6.0×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\ \frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0} \end{array} \end{array} \]
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
   (/
    (-
     (sqrt
      (*
       (* 2.0 (* t_0 F))
       (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
    t_0)))
double code(double A, double B, double C, double F) {
	double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
	return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: t_0
    t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
    code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
	double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
	return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F):
	t_0 = math.pow(B, 2.0) - ((4.0 * A) * C)
	return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F)
	t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))
	return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0)
end
function tmp = code(A, B, C, F)
	t_0 = (B ^ 2.0) - ((4.0 * A) * C);
	tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0;
end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\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 7 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: 18.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\ \frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0} \end{array} \end{array} \]
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
   (/
    (-
     (sqrt
      (*
       (* 2.0 (* t_0 F))
       (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
    t_0)))
double code(double A, double B, double C, double F) {
	double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
	return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: t_0
    t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
    code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
	double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
	return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F):
	t_0 = math.pow(B, 2.0) - ((4.0 * A) * C)
	return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F)
	t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))
	return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0)
end
function tmp = code(A, B, C, F)
	t_0 = (B ^ 2.0) - ((4.0 * A) * C);
	tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0;
end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}

Alternative 1: 38.1% accurate, 1.5× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{\frac{B\_m}{\sqrt{2}}} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (* (* (sqrt (+ A (hypot B_m A))) (sqrt F)) (/ -1.0 (/ B_m (sqrt 2.0)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	return (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-1.0 / (B_m / sqrt(2.0)));
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	return (Math.sqrt((A + Math.hypot(B_m, A))) * Math.sqrt(F)) * (-1.0 / (B_m / Math.sqrt(2.0)));
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	return (math.sqrt((A + math.hypot(B_m, A))) * math.sqrt(F)) * (-1.0 / (B_m / math.sqrt(2.0)))
B_m = abs(B)
function code(A, B_m, C, F)
	return Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(-1.0 / Float64(B_m / sqrt(2.0))))
end
B_m = abs(B);
function tmp = code(A, B_m, C, F)
	tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-1.0 / (B_m / sqrt(2.0)));
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(B$95$m / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|

\\
\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{\frac{B\_m}{\sqrt{2}}}
\end{array}
Derivation
  1. Initial program 19.3%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Simplified19.9%

    \[\leadsto \color{blue}{\frac{-\sqrt{2 \cdot \left(\left(\left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \]
  3. Add Preprocessing
  4. Taylor expanded in C around 0 12.4%

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
  5. Step-by-step derivation
    1. mul-1-neg12.4%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
    2. distribute-rgt-neg-in12.4%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    3. unpow212.4%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \sqrt{\color{blue}{A \cdot A} + {B}^{2}}\right)}\right) \]
    4. unpow212.4%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right)}\right) \]
    5. hypot-def17.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \color{blue}{\mathsf{hypot}\left(A, B\right)}\right)}\right) \]
  6. Simplified17.6%

    \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)}\right)} \]
  7. Step-by-step derivation
    1. pow1/217.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{{\left(F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}}\right) \]
    2. *-commutative17.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-{\color{blue}{\left(\left(A + \mathsf{hypot}\left(A, B\right)\right) \cdot F\right)}}^{0.5}\right) \]
    3. unpow-prod-down23.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{{\left(A + \mathsf{hypot}\left(A, B\right)\right)}^{0.5} \cdot {F}^{0.5}}\right) \]
    4. pow1/223.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{\sqrt{A + \mathsf{hypot}\left(A, B\right)}} \cdot {F}^{0.5}\right) \]
    5. pow1/223.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \color{blue}{\sqrt{F}}\right) \]
  8. Applied egg-rr23.6%

    \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \sqrt{F}}\right) \]
  9. Step-by-step derivation
    1. hypot-def12.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \color{blue}{\sqrt{A \cdot A + B \cdot B}}} \cdot \sqrt{F}\right) \]
    2. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{\color{blue}{{A}^{2}} + B \cdot B}} \cdot \sqrt{F}\right) \]
    3. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{{A}^{2} + \color{blue}{{B}^{2}}}} \cdot \sqrt{F}\right) \]
    4. +-commutative12.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}} \cdot \sqrt{F}\right) \]
    5. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}} \cdot \sqrt{F}\right) \]
    6. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}} \cdot \sqrt{F}\right) \]
    7. hypot-def23.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \color{blue}{\mathsf{hypot}\left(B, A\right)}} \cdot \sqrt{F}\right) \]
  10. Simplified23.6%

    \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}}\right) \]
  11. Step-by-step derivation
    1. clear-num23.6%

      \[\leadsto \color{blue}{\frac{1}{\frac{B}{\sqrt{2}}}} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}\right) \]
    2. inv-pow23.6%

      \[\leadsto \color{blue}{{\left(\frac{B}{\sqrt{2}}\right)}^{-1}} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}\right) \]
  12. Applied egg-rr23.6%

    \[\leadsto \color{blue}{{\left(\frac{B}{\sqrt{2}}\right)}^{-1}} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}\right) \]
  13. Step-by-step derivation
    1. unpow-123.6%

      \[\leadsto \color{blue}{\frac{1}{\frac{B}{\sqrt{2}}}} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}\right) \]
  14. Simplified23.6%

    \[\leadsto \color{blue}{\frac{1}{\frac{B}{\sqrt{2}}}} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}\right) \]
  15. Final simplification23.6%

    \[\leadsto \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{\frac{B}{\sqrt{2}}} \]
  16. Add Preprocessing

Alternative 2: 38.1% accurate, 1.5× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B\_m}\right) \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (* (* (sqrt (+ A (hypot B_m A))) (sqrt F)) (* (sqrt 2.0) (/ -1.0 B_m))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	return (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (sqrt(2.0) * (-1.0 / B_m));
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	return (Math.sqrt((A + Math.hypot(B_m, A))) * Math.sqrt(F)) * (Math.sqrt(2.0) * (-1.0 / B_m));
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	return (math.sqrt((A + math.hypot(B_m, A))) * math.sqrt(F)) * (math.sqrt(2.0) * (-1.0 / B_m))
B_m = abs(B)
function code(A, B_m, C, F)
	return Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(sqrt(2.0) * Float64(-1.0 / B_m)))
end
B_m = abs(B);
function tmp = code(A, B_m, C, F)
	tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (sqrt(2.0) * (-1.0 / B_m));
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|

\\
\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B\_m}\right)
\end{array}
Derivation
  1. Initial program 19.3%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Simplified19.9%

    \[\leadsto \color{blue}{\frac{-\sqrt{2 \cdot \left(\left(\left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \]
  3. Add Preprocessing
  4. Taylor expanded in C around 0 12.4%

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
  5. Step-by-step derivation
    1. mul-1-neg12.4%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
    2. distribute-rgt-neg-in12.4%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    3. unpow212.4%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \sqrt{\color{blue}{A \cdot A} + {B}^{2}}\right)}\right) \]
    4. unpow212.4%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right)}\right) \]
    5. hypot-def17.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \color{blue}{\mathsf{hypot}\left(A, B\right)}\right)}\right) \]
  6. Simplified17.6%

    \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)}\right)} \]
  7. Step-by-step derivation
    1. pow1/217.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{{\left(F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}}\right) \]
    2. *-commutative17.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-{\color{blue}{\left(\left(A + \mathsf{hypot}\left(A, B\right)\right) \cdot F\right)}}^{0.5}\right) \]
    3. unpow-prod-down23.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{{\left(A + \mathsf{hypot}\left(A, B\right)\right)}^{0.5} \cdot {F}^{0.5}}\right) \]
    4. pow1/223.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{\sqrt{A + \mathsf{hypot}\left(A, B\right)}} \cdot {F}^{0.5}\right) \]
    5. pow1/223.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \color{blue}{\sqrt{F}}\right) \]
  8. Applied egg-rr23.6%

    \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \sqrt{F}}\right) \]
  9. Step-by-step derivation
    1. hypot-def12.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \color{blue}{\sqrt{A \cdot A + B \cdot B}}} \cdot \sqrt{F}\right) \]
    2. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{\color{blue}{{A}^{2}} + B \cdot B}} \cdot \sqrt{F}\right) \]
    3. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{{A}^{2} + \color{blue}{{B}^{2}}}} \cdot \sqrt{F}\right) \]
    4. +-commutative12.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}} \cdot \sqrt{F}\right) \]
    5. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}} \cdot \sqrt{F}\right) \]
    6. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}} \cdot \sqrt{F}\right) \]
    7. hypot-def23.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \color{blue}{\mathsf{hypot}\left(B, A\right)}} \cdot \sqrt{F}\right) \]
  10. Simplified23.6%

    \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}}\right) \]
  11. Step-by-step derivation
    1. div-inv23.6%

      \[\leadsto \color{blue}{\left(\sqrt{2} \cdot \frac{1}{B}\right)} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}\right) \]
  12. Applied egg-rr23.6%

    \[\leadsto \color{blue}{\left(\sqrt{2} \cdot \frac{1}{B}\right)} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}\right) \]
  13. Final simplification23.6%

    \[\leadsto \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B}\right) \]
  14. Add Preprocessing

Alternative 3: 38.1% accurate, 1.5× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B\_m} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (* (* (sqrt (+ A (hypot B_m A))) (sqrt F)) (/ (- (sqrt 2.0)) B_m)))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	return (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	return (Math.sqrt((A + Math.hypot(B_m, A))) * Math.sqrt(F)) * (-Math.sqrt(2.0) / B_m);
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	return (math.sqrt((A + math.hypot(B_m, A))) * math.sqrt(F)) * (-math.sqrt(2.0) / B_m)
B_m = abs(B)
function code(A, B_m, C, F)
	return Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m))
end
B_m = abs(B);
function tmp = code(A, B_m, C, F)
	tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|

\\
\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B\_m}
\end{array}
Derivation
  1. Initial program 19.3%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Simplified19.9%

    \[\leadsto \color{blue}{\frac{-\sqrt{2 \cdot \left(\left(\left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \]
  3. Add Preprocessing
  4. Taylor expanded in C around 0 12.4%

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
  5. Step-by-step derivation
    1. mul-1-neg12.4%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
    2. distribute-rgt-neg-in12.4%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    3. unpow212.4%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \sqrt{\color{blue}{A \cdot A} + {B}^{2}}\right)}\right) \]
    4. unpow212.4%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \sqrt{A \cdot A + \color{blue}{B \cdot B}}\right)}\right) \]
    5. hypot-def17.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \color{blue}{\mathsf{hypot}\left(A, B\right)}\right)}\right) \]
  6. Simplified17.6%

    \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)}\right)} \]
  7. Step-by-step derivation
    1. pow1/217.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{{\left(F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)\right)}^{0.5}}\right) \]
    2. *-commutative17.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-{\color{blue}{\left(\left(A + \mathsf{hypot}\left(A, B\right)\right) \cdot F\right)}}^{0.5}\right) \]
    3. unpow-prod-down23.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{{\left(A + \mathsf{hypot}\left(A, B\right)\right)}^{0.5} \cdot {F}^{0.5}}\right) \]
    4. pow1/223.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{\sqrt{A + \mathsf{hypot}\left(A, B\right)}} \cdot {F}^{0.5}\right) \]
    5. pow1/223.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \color{blue}{\sqrt{F}}\right) \]
  8. Applied egg-rr23.6%

    \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \sqrt{F}}\right) \]
  9. Step-by-step derivation
    1. hypot-def12.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \color{blue}{\sqrt{A \cdot A + B \cdot B}}} \cdot \sqrt{F}\right) \]
    2. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{\color{blue}{{A}^{2}} + B \cdot B}} \cdot \sqrt{F}\right) \]
    3. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{{A}^{2} + \color{blue}{{B}^{2}}}} \cdot \sqrt{F}\right) \]
    4. +-commutative12.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}} \cdot \sqrt{F}\right) \]
    5. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}} \cdot \sqrt{F}\right) \]
    6. unpow212.8%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}} \cdot \sqrt{F}\right) \]
    7. hypot-def23.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{A + \color{blue}{\mathsf{hypot}\left(B, A\right)}} \cdot \sqrt{F}\right) \]
  10. Simplified23.6%

    \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}}\right) \]
  11. Final simplification23.6%

    \[\leadsto \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B} \]
  12. Add Preprocessing

Alternative 4: 34.1% accurate, 2.1× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \sqrt{2} \cdot \left(\sqrt{\frac{1}{B\_m}} \cdot \left(-\sqrt{F}\right)\right) \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (* (sqrt 2.0) (* (sqrt (/ 1.0 B_m)) (- (sqrt F)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	return sqrt(2.0) * (sqrt((1.0 / B_m)) * -sqrt(F));
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = sqrt(2.0d0) * (sqrt((1.0d0 / b_m)) * -sqrt(f))
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	return Math.sqrt(2.0) * (Math.sqrt((1.0 / B_m)) * -Math.sqrt(F));
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	return math.sqrt(2.0) * (math.sqrt((1.0 / B_m)) * -math.sqrt(F))
B_m = abs(B)
function code(A, B_m, C, F)
	return Float64(sqrt(2.0) * Float64(sqrt(Float64(1.0 / B_m)) * Float64(-sqrt(F))))
end
B_m = abs(B);
function tmp = code(A, B_m, C, F)
	tmp = sqrt(2.0) * (sqrt((1.0 / B_m)) * -sqrt(F));
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|

\\
\sqrt{2} \cdot \left(\sqrt{\frac{1}{B\_m}} \cdot \left(-\sqrt{F}\right)\right)
\end{array}
Derivation
  1. Initial program 19.3%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Simplified19.9%

    \[\leadsto \color{blue}{\frac{-\sqrt{2 \cdot \left(\left(\left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \]
  3. Add Preprocessing
  4. Taylor expanded in A around 0 11.6%

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
  5. Step-by-step derivation
    1. mul-1-neg11.6%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    2. distribute-rgt-neg-in11.6%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    3. +-commutative11.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}\right)}\right) \]
    4. unpow211.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{\color{blue}{C \cdot C} + {B}^{2}}\right)}\right) \]
    5. unpow211.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{C \cdot C + \color{blue}{B \cdot B}}\right)}\right) \]
    6. hypot-def17.1%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \color{blue}{\mathsf{hypot}\left(C, B\right)}\right)}\right) \]
  6. Simplified17.1%

    \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}\right)} \]
  7. Taylor expanded in C around 0 16.8%

    \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
  8. Step-by-step derivation
    1. mul-1-neg16.8%

      \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  9. Simplified16.8%

    \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  10. Step-by-step derivation
    1. pow1/217.0%

      \[\leadsto -\color{blue}{{\left(\frac{F}{B}\right)}^{0.5}} \cdot \sqrt{2} \]
    2. div-inv17.0%

      \[\leadsto -{\color{blue}{\left(F \cdot \frac{1}{B}\right)}}^{0.5} \cdot \sqrt{2} \]
    3. unpow-prod-down19.8%

      \[\leadsto -\color{blue}{\left({F}^{0.5} \cdot {\left(\frac{1}{B}\right)}^{0.5}\right)} \cdot \sqrt{2} \]
    4. pow1/219.8%

      \[\leadsto -\left(\color{blue}{\sqrt{F}} \cdot {\left(\frac{1}{B}\right)}^{0.5}\right) \cdot \sqrt{2} \]
  11. Applied egg-rr19.8%

    \[\leadsto -\color{blue}{\left(\sqrt{F} \cdot {\left(\frac{1}{B}\right)}^{0.5}\right)} \cdot \sqrt{2} \]
  12. Step-by-step derivation
    1. unpow1/219.8%

      \[\leadsto -\left(\sqrt{F} \cdot \color{blue}{\sqrt{\frac{1}{B}}}\right) \cdot \sqrt{2} \]
    2. *-commutative19.8%

      \[\leadsto -\color{blue}{\left(\sqrt{\frac{1}{B}} \cdot \sqrt{F}\right)} \cdot \sqrt{2} \]
  13. Simplified19.8%

    \[\leadsto -\color{blue}{\left(\sqrt{\frac{1}{B}} \cdot \sqrt{F}\right)} \cdot \sqrt{2} \]
  14. Final simplification19.8%

    \[\leadsto \sqrt{2} \cdot \left(\sqrt{\frac{1}{B}} \cdot \left(-\sqrt{F}\right)\right) \]
  15. Add Preprocessing

Alternative 5: 34.1% accurate, 2.1× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \sqrt{2} \cdot \left(-\frac{\sqrt{F}}{\sqrt{B\_m}}\right) \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (* (sqrt 2.0) (- (/ (sqrt F) (sqrt B_m)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	return sqrt(2.0) * -(sqrt(F) / sqrt(B_m));
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = sqrt(2.0d0) * -(sqrt(f) / sqrt(b_m))
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	return Math.sqrt(2.0) * -(Math.sqrt(F) / Math.sqrt(B_m));
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	return math.sqrt(2.0) * -(math.sqrt(F) / math.sqrt(B_m))
B_m = abs(B)
function code(A, B_m, C, F)
	return Float64(sqrt(2.0) * Float64(-Float64(sqrt(F) / sqrt(B_m))))
end
B_m = abs(B);
function tmp = code(A, B_m, C, F)
	tmp = sqrt(2.0) * -(sqrt(F) / sqrt(B_m));
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[2.0], $MachinePrecision] * (-N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|

\\
\sqrt{2} \cdot \left(-\frac{\sqrt{F}}{\sqrt{B\_m}}\right)
\end{array}
Derivation
  1. Initial program 19.3%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Simplified19.9%

    \[\leadsto \color{blue}{\frac{-\sqrt{2 \cdot \left(\left(\left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \]
  3. Add Preprocessing
  4. Taylor expanded in A around 0 11.6%

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
  5. Step-by-step derivation
    1. mul-1-neg11.6%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    2. distribute-rgt-neg-in11.6%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    3. +-commutative11.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}\right)}\right) \]
    4. unpow211.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{\color{blue}{C \cdot C} + {B}^{2}}\right)}\right) \]
    5. unpow211.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{C \cdot C + \color{blue}{B \cdot B}}\right)}\right) \]
    6. hypot-def17.1%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \color{blue}{\mathsf{hypot}\left(C, B\right)}\right)}\right) \]
  6. Simplified17.1%

    \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}\right)} \]
  7. Taylor expanded in C around 0 16.8%

    \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
  8. Step-by-step derivation
    1. mul-1-neg16.8%

      \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  9. Simplified16.8%

    \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  10. Step-by-step derivation
    1. sqrt-div19.8%

      \[\leadsto -\color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \cdot \sqrt{2} \]
  11. Applied egg-rr19.8%

    \[\leadsto -\color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \cdot \sqrt{2} \]
  12. Final simplification19.8%

    \[\leadsto \sqrt{2} \cdot \left(-\frac{\sqrt{F}}{\sqrt{B}}\right) \]
  13. Add Preprocessing

Alternative 6: 26.6% accurate, 5.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ -{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F) :precision binary64 (- (pow (* 2.0 (/ F B_m)) 0.5)))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	return -pow((2.0 * (F / B_m)), 0.5);
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = -((2.0d0 * (f / b_m)) ** 0.5d0)
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	return -Math.pow((2.0 * (F / B_m)), 0.5);
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	return -math.pow((2.0 * (F / B_m)), 0.5)
B_m = abs(B)
function code(A, B_m, C, F)
	return Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5))
end
B_m = abs(B);
function tmp = code(A, B_m, C, F)
	tmp = -((2.0 * (F / B_m)) ^ 0.5);
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|

\\
-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}
\end{array}
Derivation
  1. Initial program 19.3%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Simplified19.9%

    \[\leadsto \color{blue}{\frac{-\sqrt{2 \cdot \left(\left(\left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \]
  3. Add Preprocessing
  4. Taylor expanded in A around 0 11.6%

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
  5. Step-by-step derivation
    1. mul-1-neg11.6%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    2. distribute-rgt-neg-in11.6%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    3. +-commutative11.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}\right)}\right) \]
    4. unpow211.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{\color{blue}{C \cdot C} + {B}^{2}}\right)}\right) \]
    5. unpow211.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{C \cdot C + \color{blue}{B \cdot B}}\right)}\right) \]
    6. hypot-def17.1%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \color{blue}{\mathsf{hypot}\left(C, B\right)}\right)}\right) \]
  6. Simplified17.1%

    \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}\right)} \]
  7. Taylor expanded in C around 0 16.8%

    \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
  8. Step-by-step derivation
    1. mul-1-neg16.8%

      \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  9. Simplified16.8%

    \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  10. Step-by-step derivation
    1. sqrt-unprod16.9%

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
    2. pow1/217.0%

      \[\leadsto -\color{blue}{{\left(\frac{F}{B} \cdot 2\right)}^{0.5}} \]
  11. Applied egg-rr17.0%

    \[\leadsto -\color{blue}{{\left(\frac{F}{B} \cdot 2\right)}^{0.5}} \]
  12. Final simplification17.0%

    \[\leadsto -{\left(2 \cdot \frac{F}{B}\right)}^{0.5} \]
  13. Add Preprocessing

Alternative 7: 26.6% accurate, 6.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ -\sqrt{2 \cdot \frac{F}{B\_m}} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F) :precision binary64 (- (sqrt (* 2.0 (/ F B_m)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	return -sqrt((2.0 * (F / B_m)));
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = -sqrt((2.0d0 * (f / b_m)))
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	return -Math.sqrt((2.0 * (F / B_m)));
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	return -math.sqrt((2.0 * (F / B_m)))
B_m = abs(B)
function code(A, B_m, C, F)
	return Float64(-sqrt(Float64(2.0 * Float64(F / B_m))))
end
B_m = abs(B);
function tmp = code(A, B_m, C, F)
	tmp = -sqrt((2.0 * (F / B_m)));
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|

\\
-\sqrt{2 \cdot \frac{F}{B\_m}}
\end{array}
Derivation
  1. Initial program 19.3%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Simplified19.9%

    \[\leadsto \color{blue}{\frac{-\sqrt{2 \cdot \left(\left(\left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \]
  3. Add Preprocessing
  4. Taylor expanded in A around 0 11.6%

    \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
  5. Step-by-step derivation
    1. mul-1-neg11.6%

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
    2. distribute-rgt-neg-in11.6%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    3. +-commutative11.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}\right)}\right) \]
    4. unpow211.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{\color{blue}{C \cdot C} + {B}^{2}}\right)}\right) \]
    5. unpow211.6%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \sqrt{C \cdot C + \color{blue}{B \cdot B}}\right)}\right) \]
    6. hypot-def17.1%

      \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \color{blue}{\mathsf{hypot}\left(C, B\right)}\right)}\right) \]
  6. Simplified17.1%

    \[\leadsto \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}\right)} \]
  7. Taylor expanded in C around 0 16.8%

    \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
  8. Step-by-step derivation
    1. mul-1-neg16.8%

      \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  9. Simplified16.8%

    \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  10. Step-by-step derivation
    1. sqrt-unprod16.9%

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
  11. Applied egg-rr16.9%

    \[\leadsto -\color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
  12. Final simplification16.9%

    \[\leadsto -\sqrt{2 \cdot \frac{F}{B}} \]
  13. Add Preprocessing

Reproduce

?
herbie shell --seed 2024033 
(FPCore (A B C F)
  :name "ABCF->ab-angle a"
  :precision binary64
  (/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))