
(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:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
(t_1 (* t_0 (* 2.0 F)))
(t_2 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_3
(/
(-
(sqrt
(*
(* 2.0 (* t_2 F))
(+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))))))
t_2))
(t_4
(/ (* (sqrt t_1) (- (sqrt (+ A (+ C (hypot B_m (- A C))))))) t_0)))
(if (<= t_3 -5e-194)
t_4
(if (<= t_3 0.0)
(/ (- (sqrt (* t_1 (+ (* -0.5 (/ (pow B_m 2.0) C)) (* 2.0 A))))) t_0)
(if (<= t_3 INFINITY)
t_4
(*
(* (sqrt (+ A (hypot B_m A))) (sqrt F))
(* (pow 2.0 0.25) (/ (- (pow 2.0 0.25)) B_m))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = t_0 * (2.0 * F);
double t_2 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_3 = -sqrt(((2.0 * (t_2 * F)) * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_2;
double t_4 = (sqrt(t_1) * -sqrt((A + (C + hypot(B_m, (A - C)))))) / t_0;
double tmp;
if (t_3 <= -5e-194) {
tmp = t_4;
} else if (t_3 <= 0.0) {
tmp = -sqrt((t_1 * ((-0.5 * (pow(B_m, 2.0) / C)) + (2.0 * A)))) / t_0;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_4;
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (pow(2.0, 0.25) * (-pow(2.0, 0.25) / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = Float64(t_0 * Float64(2.0 * F)) t_2 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_3 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_2) t_4 = Float64(Float64(sqrt(t_1) * Float64(-sqrt(Float64(A + Float64(C + hypot(B_m, Float64(A - C))))))) / t_0) tmp = 0.0 if (t_3 <= -5e-194) tmp = t_4; elseif (t_3 <= 0.0) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / C)) + Float64(2.0 * A))))) / t_0); elseif (t_3 <= Inf) tmp = t_4; else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64((2.0 ^ 0.25) * Float64(Float64(-(2.0 ^ 0.25)) / B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Sqrt[t$95$1], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-194], t$95$4, If[LessEqual[t$95$3, 0.0], N[((-N[Sqrt[N[(t$95$1 * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision] + N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$4, N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(N[Power[2.0, 0.25], $MachinePrecision] * N[((-N[Power[2.0, 0.25], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := t\_0 \cdot \left(2 \cdot F\right)\\
t_2 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_3 := \frac{-\sqrt{\left(2 \cdot \left(t\_2 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_2}\\
t_4 := \frac{\sqrt{t\_1} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}\right)}{t\_0}\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-194}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{C} + 2 \cdot A\right)}}{t\_0}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \left({2}^{0.25} \cdot \frac{-{2}^{0.25}}{B\_m}\right)\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -5.0000000000000002e-194 or -0.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0Initial program 45.9%
Simplified54.1%
pow1/254.1%
*-commutative54.1%
unpow-prod-down67.0%
pow1/267.0%
pow1/267.0%
*-commutative67.0%
Applied egg-rr67.0%
if -5.0000000000000002e-194 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -0.0Initial program 3.3%
Simplified9.4%
Taylor expanded in C around -inf 55.2%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 0.0%
Simplified1.5%
Taylor expanded in C around 0 2.0%
mul-1-neg2.0%
*-commutative2.0%
distribute-rgt-neg-in2.0%
+-commutative2.0%
unpow22.0%
unpow22.0%
hypot-define21.2%
Simplified21.2%
pow1/221.3%
*-commutative21.3%
unpow-prod-down31.8%
pow1/231.8%
pow1/231.8%
Applied egg-rr31.8%
add-sqr-sqrt31.8%
*-un-lft-identity31.8%
times-frac31.8%
pow1/231.8%
sqrt-pow131.8%
metadata-eval31.8%
pow1/231.8%
sqrt-pow131.8%
metadata-eval31.8%
Applied egg-rr31.8%
Final simplification48.5%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 2e+49)
(/ (- (sqrt (* (+ A (+ C (hypot B_m (- A C)))) (* t_0 (* 2.0 F))))) t_0)
(*
(* (sqrt (+ A (hypot B_m A))) (sqrt F))
(* (pow 2.0 0.25) (/ (- (pow 2.0 0.25)) B_m))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 2e+49) {
tmp = -sqrt(((A + (C + hypot(B_m, (A - C)))) * (t_0 * (2.0 * F)))) / t_0;
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (pow(2.0, 0.25) * (-pow(2.0, 0.25) / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 2e+49) tmp = Float64(Float64(-sqrt(Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) * Float64(t_0 * Float64(2.0 * F))))) / t_0); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64((2.0 ^ 0.25) * Float64(Float64(-(2.0 ^ 0.25)) / B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+49], N[((-N[Sqrt[N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(N[Power[2.0, 0.25], $MachinePrecision] * N[((-N[Power[2.0, 0.25], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{+49}:\\
\;\;\;\;\frac{-\sqrt{\left(A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right) \cdot \left(t\_0 \cdot \left(2 \cdot F\right)\right)}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \left({2}^{0.25} \cdot \frac{-{2}^{0.25}}{B\_m}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.99999999999999989e49Initial program 26.8%
Simplified35.1%
if 1.99999999999999989e49 < (pow.f64 B 2) Initial program 11.5%
Simplified12.5%
Taylor expanded in C around 0 11.1%
mul-1-neg11.1%
*-commutative11.1%
distribute-rgt-neg-in11.1%
+-commutative11.1%
unpow211.1%
unpow211.1%
hypot-define28.9%
Simplified28.9%
pow1/228.9%
*-commutative28.9%
unpow-prod-down42.2%
pow1/242.2%
pow1/242.2%
Applied egg-rr42.2%
add-sqr-sqrt42.2%
*-un-lft-identity42.2%
times-frac42.1%
pow1/242.1%
sqrt-pow142.1%
metadata-eval42.1%
pow1/242.1%
sqrt-pow142.1%
metadata-eval42.1%
Applied egg-rr42.1%
Final simplification38.7%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 2e+49)
(/ (- (sqrt (* 2.0 (* F (* (+ A (+ C (hypot B_m (- A C)))) t_0))))) t_0)
(* (* (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) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 2e+49) {
tmp = -sqrt((2.0 * (F * ((A + (C + hypot(B_m, (A - C)))) * t_0)))) / t_0;
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (sqrt(2.0) * (-1.0 / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 2e+49) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) * t_0))))) / t_0); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(sqrt(2.0) * Float64(-1.0 / B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+49], N[((-N[Sqrt[N[(2.0 * N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], 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|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{+49}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(F \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right) \cdot t\_0\right)\right)}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\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}
\end{array}
if (pow.f64 B 2) < 1.99999999999999989e49Initial program 26.8%
div-inv26.7%
Applied egg-rr35.1%
associate-*r/35.1%
Simplified33.4%
if 1.99999999999999989e49 < (pow.f64 B 2) Initial program 11.5%
Simplified12.5%
Taylor expanded in C around 0 11.1%
mul-1-neg11.1%
*-commutative11.1%
distribute-rgt-neg-in11.1%
+-commutative11.1%
unpow211.1%
unpow211.1%
hypot-define28.9%
Simplified28.9%
pow1/228.9%
*-commutative28.9%
unpow-prod-down42.2%
pow1/242.2%
pow1/242.2%
Applied egg-rr42.2%
div-inv42.1%
Applied egg-rr42.1%
Final simplification37.8%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 2e+49)
(/ (- (sqrt (* (+ A (+ C (hypot B_m (- A C)))) (* t_0 (* 2.0 F))))) t_0)
(* (* (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) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 2e+49) {
tmp = -sqrt(((A + (C + hypot(B_m, (A - C)))) * (t_0 * (2.0 * F)))) / t_0;
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (sqrt(2.0) * (-1.0 / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 2e+49) tmp = Float64(Float64(-sqrt(Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) * Float64(t_0 * Float64(2.0 * F))))) / t_0); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(sqrt(2.0) * Float64(-1.0 / B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+49], N[((-N[Sqrt[N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], 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|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{+49}:\\
\;\;\;\;\frac{-\sqrt{\left(A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right) \cdot \left(t\_0 \cdot \left(2 \cdot F\right)\right)}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\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}
\end{array}
if (pow.f64 B 2) < 1.99999999999999989e49Initial program 26.8%
Simplified35.1%
if 1.99999999999999989e49 < (pow.f64 B 2) Initial program 11.5%
Simplified12.5%
Taylor expanded in C around 0 11.1%
mul-1-neg11.1%
*-commutative11.1%
distribute-rgt-neg-in11.1%
+-commutative11.1%
unpow211.1%
unpow211.1%
hypot-define28.9%
Simplified28.9%
pow1/228.9%
*-commutative28.9%
unpow-prod-down42.2%
pow1/242.2%
pow1/242.2%
Applied egg-rr42.2%
div-inv42.1%
Applied egg-rr42.1%
Final simplification38.7%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 2e+17)
(/
(- (sqrt (* 4.0 (* A (* F (+ (pow B_m 2.0) (* -4.0 (* A C))))))))
(fma B_m B_m (* A (* C -4.0))))
(* (* (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) {
double tmp;
if (pow(B_m, 2.0) <= 2e+17) {
tmp = -sqrt((4.0 * (A * (F * (pow(B_m, 2.0) + (-4.0 * (A * C))))))) / fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (sqrt(2.0) * (-1.0 / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 2e+17) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(A * Float64(F * Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(sqrt(2.0) * Float64(-1.0 / B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+17], N[((-N[Sqrt[N[(4.0 * N[(A * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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|
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{+17}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(A \cdot \left(F \cdot \left({B\_m}^{2} + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\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}
\end{array}
if (pow.f64 B 2) < 2e17Initial program 24.9%
Simplified32.9%
Taylor expanded in C around -inf 30.4%
Taylor expanded in F around 0 30.4%
if 2e17 < (pow.f64 B 2) Initial program 13.9%
Simplified15.6%
Taylor expanded in C around 0 10.7%
mul-1-neg10.7%
*-commutative10.7%
distribute-rgt-neg-in10.7%
+-commutative10.7%
unpow210.7%
unpow210.7%
hypot-define27.5%
Simplified27.5%
pow1/227.6%
*-commutative27.6%
unpow-prod-down40.9%
pow1/240.9%
pow1/240.9%
Applied egg-rr40.9%
div-inv40.8%
Applied egg-rr40.8%
Final simplification36.0%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 2e+17)
(/
(- (sqrt (* 4.0 (* A (* F (+ (pow B_m 2.0) (* -4.0 (* A C))))))))
(fma B_m B_m (* A (* C -4.0))))
(* (* (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) {
double tmp;
if (pow(B_m, 2.0) <= 2e+17) {
tmp = -sqrt((4.0 * (A * (F * (pow(B_m, 2.0) + (-4.0 * (A * C))))))) / fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 2e+17) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(A * Float64(F * Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+17], N[((-N[Sqrt[N[(4.0 * N[(A * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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|
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{+17}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(A \cdot \left(F \cdot \left({B\_m}^{2} + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B\_m}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 2e17Initial program 24.9%
Simplified32.9%
Taylor expanded in C around -inf 30.4%
Taylor expanded in F around 0 30.4%
if 2e17 < (pow.f64 B 2) Initial program 13.9%
Simplified15.6%
Taylor expanded in C around 0 10.7%
mul-1-neg10.7%
*-commutative10.7%
distribute-rgt-neg-in10.7%
+-commutative10.7%
unpow210.7%
unpow210.7%
hypot-define27.5%
Simplified27.5%
pow1/227.6%
*-commutative27.6%
unpow-prod-down40.9%
pow1/240.9%
pow1/240.9%
Applied egg-rr40.9%
Final simplification36.0%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F 9.5e-294)
(/
(- (sqrt (* 4.0 (* A (* F (+ (pow B_m 2.0) (* -4.0 (* A C))))))))
(fma B_m B_m (* A (* C -4.0))))
(if (<= F 8.8e+43)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot B_m C))))))
(* (sqrt 2.0) (- (sqrt (/ F B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 9.5e-294) {
tmp = -sqrt((4.0 * (A * (F * (pow(B_m, 2.0) + (-4.0 * (A * C))))))) / fma(B_m, B_m, (A * (C * -4.0)));
} else if (F <= 8.8e+43) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C))));
} else {
tmp = sqrt(2.0) * -sqrt((F / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= 9.5e-294) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(A * Float64(F * Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))); elseif (F <= 8.8e+43) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 9.5e-294], N[((-N[Sqrt[N[(4.0 * N[(A * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 8.8e+43], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq 9.5 \cdot 10^{-294}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(A \cdot \left(F \cdot \left({B\_m}^{2} + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;F \leq 8.8 \cdot 10^{+43}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B\_m}}\right)\\
\end{array}
\end{array}
if F < 9.499999999999999e-294Initial program 39.1%
Simplified59.6%
Taylor expanded in C around -inf 39.5%
Taylor expanded in F around 0 39.6%
if 9.499999999999999e-294 < F < 8.80000000000000002e43Initial program 20.8%
Simplified24.6%
Taylor expanded in A around 0 12.6%
mul-1-neg12.6%
distribute-rgt-neg-in12.6%
unpow212.6%
unpow212.6%
hypot-define32.1%
Simplified32.1%
if 8.80000000000000002e43 < F Initial program 11.5%
Simplified12.9%
Taylor expanded in C around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
+-commutative5.8%
unpow25.8%
unpow25.8%
hypot-define8.8%
Simplified8.8%
Taylor expanded in A around 0 19.6%
mul-1-neg19.6%
Simplified19.6%
Final simplification27.7%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F -5e-310)
(/
(- (sqrt (* (* -8.0 (* A (* C F))) (+ A A))))
(fma B_m B_m (* A (* C -4.0))))
(if (<= F 1.52e+17)
(* (/ (- (sqrt 2.0)) B_m) (sqrt (* F (+ A (hypot B_m A)))))
(* (sqrt 2.0) (- (sqrt (/ F B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -5e-310) {
tmp = -sqrt(((-8.0 * (A * (C * F))) * (A + A))) / fma(B_m, B_m, (A * (C * -4.0)));
} else if (F <= 1.52e+17) {
tmp = (-sqrt(2.0) / B_m) * sqrt((F * (A + hypot(B_m, A))));
} else {
tmp = sqrt(2.0) * -sqrt((F / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -5e-310) tmp = Float64(Float64(-sqrt(Float64(Float64(-8.0 * Float64(A * Float64(C * F))) * Float64(A + A)))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))); elseif (F <= 1.52e+17) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * sqrt(Float64(F * Float64(A + hypot(B_m, A))))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -5e-310], N[((-N[Sqrt[N[(N[(-8.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.52e+17], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{\left(-8 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right) \cdot \left(A + A\right)}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;F \leq 1.52 \cdot 10^{+17}:\\
\;\;\;\;\frac{-\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B\_m}}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 38.3%
Simplified59.5%
Taylor expanded in C around -inf 38.5%
Taylor expanded in B around 0 35.5%
if -4.999999999999985e-310 < F < 1.52e17Initial program 20.2%
Simplified24.5%
Taylor expanded in C around 0 9.9%
mul-1-neg9.9%
*-commutative9.9%
distribute-rgt-neg-in9.9%
+-commutative9.9%
unpow29.9%
unpow29.9%
hypot-define30.5%
Simplified30.5%
if 1.52e17 < F Initial program 13.6%
Simplified14.9%
Taylor expanded in C around 0 7.1%
mul-1-neg7.1%
*-commutative7.1%
distribute-rgt-neg-in7.1%
+-commutative7.1%
unpow27.1%
unpow27.1%
hypot-define9.8%
Simplified9.8%
Taylor expanded in A around 0 19.3%
mul-1-neg19.3%
Simplified19.3%
Final simplification25.8%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F -5e-310)
(/
(- (sqrt (* (* -8.0 (* A (* C F))) (+ A A))))
(fma B_m B_m (* A (* C -4.0))))
(if (<= F 1.4e+43)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot B_m C))))))
(* (sqrt 2.0) (- (sqrt (/ F B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -5e-310) {
tmp = -sqrt(((-8.0 * (A * (C * F))) * (A + A))) / fma(B_m, B_m, (A * (C * -4.0)));
} else if (F <= 1.4e+43) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C))));
} else {
tmp = sqrt(2.0) * -sqrt((F / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -5e-310) tmp = Float64(Float64(-sqrt(Float64(Float64(-8.0 * Float64(A * Float64(C * F))) * Float64(A + A)))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))); elseif (F <= 1.4e+43) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -5e-310], N[((-N[Sqrt[N[(N[(-8.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.4e+43], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{\left(-8 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right) \cdot \left(A + A\right)}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;F \leq 1.4 \cdot 10^{+43}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B\_m}}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 38.3%
Simplified59.5%
Taylor expanded in C around -inf 38.5%
Taylor expanded in B around 0 35.5%
if -4.999999999999985e-310 < F < 1.40000000000000009e43Initial program 21.2%
Simplified25.2%
Taylor expanded in A around 0 13.2%
mul-1-neg13.2%
distribute-rgt-neg-in13.2%
unpow213.2%
unpow213.2%
hypot-define32.4%
Simplified32.4%
if 1.40000000000000009e43 < F Initial program 11.5%
Simplified12.9%
Taylor expanded in C around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
+-commutative5.8%
unpow25.8%
unpow25.8%
hypot-define8.8%
Simplified8.8%
Taylor expanded in A around 0 19.6%
mul-1-neg19.6%
Simplified19.6%
Final simplification27.4%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F -5e-310)
(/
(- (sqrt (* (* -8.0 (* A (* C F))) (+ A A))))
(fma B_m B_m (* A (* C -4.0))))
(if (<= F 1.95e+95)
(* (/ (- (sqrt 2.0)) B_m) (sqrt (* B_m F)))
(* (sqrt 2.0) (- (sqrt (/ F B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -5e-310) {
tmp = -sqrt(((-8.0 * (A * (C * F))) * (A + A))) / fma(B_m, B_m, (A * (C * -4.0)));
} else if (F <= 1.95e+95) {
tmp = (-sqrt(2.0) / B_m) * sqrt((B_m * F));
} else {
tmp = sqrt(2.0) * -sqrt((F / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -5e-310) tmp = Float64(Float64(-sqrt(Float64(Float64(-8.0 * Float64(A * Float64(C * F))) * Float64(A + A)))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))); elseif (F <= 1.95e+95) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * sqrt(Float64(B_m * F))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -5e-310], N[((-N[Sqrt[N[(N[(-8.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.95e+95], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{\left(-8 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right) \cdot \left(A + A\right)}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;F \leq 1.95 \cdot 10^{+95}:\\
\;\;\;\;\frac{-\sqrt{2}}{B\_m} \cdot \sqrt{B\_m \cdot F}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B\_m}}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 38.3%
Simplified59.5%
Taylor expanded in C around -inf 38.5%
Taylor expanded in B around 0 35.5%
if -4.999999999999985e-310 < F < 1.9499999999999999e95Initial program 21.9%
Simplified25.5%
Taylor expanded in C around 0 10.5%
mul-1-neg10.5%
*-commutative10.5%
distribute-rgt-neg-in10.5%
+-commutative10.5%
unpow210.5%
unpow210.5%
hypot-define28.4%
Simplified28.4%
Taylor expanded in A around 0 26.5%
if 1.9499999999999999e95 < F Initial program 8.9%
Simplified10.4%
Taylor expanded in C around 0 5.3%
mul-1-neg5.3%
*-commutative5.3%
distribute-rgt-neg-in5.3%
+-commutative5.3%
unpow25.3%
unpow25.3%
hypot-define6.5%
Simplified6.5%
Taylor expanded in A around 0 19.0%
mul-1-neg19.0%
Simplified19.0%
Final simplification24.8%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 1.95e+95) (* (/ (- (sqrt 2.0)) B_m) (sqrt (* B_m F))) (* (sqrt 2.0) (- (sqrt (/ F B_m))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.95e+95) {
tmp = (-sqrt(2.0) / B_m) * sqrt((B_m * F));
} else {
tmp = sqrt(2.0) * -sqrt((F / B_m));
}
return tmp;
}
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
real(8) :: tmp
if (f <= 1.95d+95) then
tmp = (-sqrt(2.0d0) / b_m) * sqrt((b_m * f))
else
tmp = sqrt(2.0d0) * -sqrt((f / b_m))
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.95e+95) {
tmp = (-Math.sqrt(2.0) / B_m) * Math.sqrt((B_m * F));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B_m));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= 1.95e+95: tmp = (-math.sqrt(2.0) / B_m) * math.sqrt((B_m * F)) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B_m)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= 1.95e+95) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * sqrt(Float64(B_m * F))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= 1.95e+95) tmp = (-sqrt(2.0) / B_m) * sqrt((B_m * F)); else tmp = sqrt(2.0) * -sqrt((F / B_m)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 1.95e+95], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.95 \cdot 10^{+95}:\\
\;\;\;\;\frac{-\sqrt{2}}{B\_m} \cdot \sqrt{B\_m \cdot F}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B\_m}}\right)\\
\end{array}
\end{array}
if F < 1.9499999999999999e95Initial program 24.6%
Simplified31.1%
Taylor expanded in C around 0 8.8%
mul-1-neg8.8%
*-commutative8.8%
distribute-rgt-neg-in8.8%
+-commutative8.8%
unpow28.8%
unpow28.8%
hypot-define23.7%
Simplified23.7%
Taylor expanded in A around 0 22.9%
if 1.9499999999999999e95 < F Initial program 8.9%
Simplified10.4%
Taylor expanded in C around 0 5.3%
mul-1-neg5.3%
*-commutative5.3%
distribute-rgt-neg-in5.3%
+-commutative5.3%
unpow25.3%
unpow25.3%
hypot-define6.5%
Simplified6.5%
Taylor expanded in A around 0 19.0%
mul-1-neg19.0%
Simplified19.0%
Final simplification21.5%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (* (sqrt 2.0) (- (sqrt (/ F B_m)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return sqrt(2.0) * -sqrt((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) * -sqrt((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) * -Math.sqrt((F / B_m));
}
B_m = math.fabs(B) def code(A, B_m, C, F): return math.sqrt(2.0) * -math.sqrt((F / B_m))
B_m = abs(B) function code(A, B_m, C, F) return Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = sqrt(2.0) * -sqrt((F / B_m)); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B\_m}}\right)
\end{array}
Initial program 19.0%
Simplified23.7%
Taylor expanded in C around 0 7.5%
mul-1-neg7.5%
*-commutative7.5%
distribute-rgt-neg-in7.5%
+-commutative7.5%
unpow27.5%
unpow27.5%
hypot-define17.5%
Simplified17.5%
Taylor expanded in A around 0 16.4%
mul-1-neg16.4%
Simplified16.4%
Final simplification16.4%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (* -2.0 (* (/ 1.0 B_m) (pow (* A F) 0.5))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return -2.0 * ((1.0 / B_m) * pow((A * F), 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) * ((1.0d0 / b_m) * ((a * f) ** 0.5d0))
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return -2.0 * ((1.0 / B_m) * Math.pow((A * F), 0.5));
}
B_m = math.fabs(B) def code(A, B_m, C, F): return -2.0 * ((1.0 / B_m) * math.pow((A * F), 0.5))
B_m = abs(B) function code(A, B_m, C, F) return Float64(-2.0 * Float64(Float64(1.0 / B_m) * (Float64(A * F) ^ 0.5))) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = -2.0 * ((1.0 / B_m) * ((A * F) ^ 0.5)); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[(-2.0 * N[(N[(1.0 / B$95$m), $MachinePrecision] * N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
-2 \cdot \left(\frac{1}{B\_m} \cdot {\left(A \cdot F\right)}^{0.5}\right)
\end{array}
Initial program 19.0%
Simplified23.7%
Taylor expanded in C around -inf 16.2%
Taylor expanded in B around inf 2.5%
pow1/22.7%
Applied egg-rr2.7%
Final simplification2.7%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (/ -2.0 (/ B_m (sqrt (* A F)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return -2.0 / (B_m / sqrt((A * 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 = (-2.0d0) / (b_m / sqrt((a * f)))
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return -2.0 / (B_m / Math.sqrt((A * F)));
}
B_m = math.fabs(B) def code(A, B_m, C, F): return -2.0 / (B_m / math.sqrt((A * F)))
B_m = abs(B) function code(A, B_m, C, F) return Float64(-2.0 / Float64(B_m / sqrt(Float64(A * F)))) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = -2.0 / (B_m / sqrt((A * F))); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[(-2.0 / N[(B$95$m / N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\frac{-2}{\frac{B\_m}{\sqrt{A \cdot F}}}
\end{array}
Initial program 19.0%
Simplified23.7%
Taylor expanded in C around -inf 16.2%
Taylor expanded in B around inf 2.5%
associate-*r*2.5%
un-div-inv2.5%
Applied egg-rr2.5%
associate-/l*2.5%
*-commutative2.5%
Simplified2.5%
Final simplification2.5%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (/ (* -2.0 (sqrt (* A F))) B_m))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return (-2.0 * sqrt((A * 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 = ((-2.0d0) * sqrt((a * f))) / b_m
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return (-2.0 * Math.sqrt((A * F))) / B_m;
}
B_m = math.fabs(B) def code(A, B_m, C, F): return (-2.0 * math.sqrt((A * F))) / B_m
B_m = abs(B) function code(A, B_m, C, F) return Float64(Float64(-2.0 * sqrt(Float64(A * F))) / B_m) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = (-2.0 * sqrt((A * F))) / B_m; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[(N[(-2.0 * N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B$95$m), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\frac{-2 \cdot \sqrt{A \cdot F}}{B\_m}
\end{array}
Initial program 19.0%
Simplified23.7%
Taylor expanded in C around -inf 16.2%
Taylor expanded in B around inf 2.5%
associate-*r*2.5%
un-div-inv2.5%
Applied egg-rr2.5%
Final simplification2.5%
herbie shell --seed 2024039
(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))))