
(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 17 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 (sqrt (+ A (+ C (hypot (- A C) B_m)))))
(t_1 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_2 (* 2.0 (* t_1 F)))
(t_3
(/
(-
(sqrt
(* t_2 (+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))))))
t_1))
(t_4 (fma B_m B_m (* A (* C -4.0))))
(t_5 (/ (* t_0 (- (sqrt (* 2.0 (* F t_4))))) t_1)))
(if (<= t_3 (- INFINITY))
(/
(* (* (sqrt (* 2.0 F)) (hypot B_m (sqrt (* (* A C) -4.0)))) (- t_0))
t_4)
(if (<= t_3 -5e-213)
t_5
(if (<= t_3 0.0)
(/ (- (sqrt (* t_2 (+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C))))) t_1)
(if (<= t_3 INFINITY)
t_5
(*
(* (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 t_0 = sqrt((A + (C + hypot((A - C), B_m))));
double t_1 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_2 = 2.0 * (t_1 * F);
double t_3 = -sqrt((t_2 * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_1;
double t_4 = fma(B_m, B_m, (A * (C * -4.0)));
double t_5 = (t_0 * -sqrt((2.0 * (F * t_4)))) / t_1;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = ((sqrt((2.0 * F)) * hypot(B_m, sqrt(((A * C) * -4.0)))) * -t_0) / t_4;
} else if (t_3 <= -5e-213) {
tmp = t_5;
} else if (t_3 <= 0.0) {
tmp = -sqrt((t_2 * ((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C)))) / t_1;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_5;
} 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) t_0 = sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) t_1 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_2 = Float64(2.0 * Float64(t_1 * F)) t_3 = Float64(Float64(-sqrt(Float64(t_2 * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_1) t_4 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_5 = Float64(Float64(t_0 * Float64(-sqrt(Float64(2.0 * Float64(F * t_4))))) / t_1) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(Float64(Float64(sqrt(Float64(2.0 * F)) * hypot(B_m, sqrt(Float64(Float64(A * C) * -4.0)))) * Float64(-t_0)) / t_4); elseif (t_3 <= -5e-213) tmp = t_5; elseif (t_3 <= 0.0) tmp = Float64(Float64(-sqrt(Float64(t_2 * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C))))) / t_1); elseif (t_3 <= Inf) tmp = t_5; 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_] := Block[{t$95$0 = N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(t$95$2 * 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$1), $MachinePrecision]}, Block[{t$95$4 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$0 * (-N[Sqrt[N[(2.0 * N[(F * t$95$4), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[B$95$m ^ 2 + N[Sqrt[N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * (-t$95$0)), $MachinePrecision] / t$95$4), $MachinePrecision], If[LessEqual[t$95$3, -5e-213], t$95$5, If[LessEqual[t$95$3, 0.0], N[((-N[Sqrt[N[(t$95$2 * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$5, 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}
t_0 := \sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B_m\right)\right)}\\
t_1 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_2 := 2 \cdot \left(t_1 \cdot F\right)\\
t_3 := \frac{-\sqrt{t_2 \cdot \left(\left(A + C\right) + \sqrt{{B_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_1}\\
t_4 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_5 := \frac{t_0 \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_4\right)}\right)}{t_1}\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;\frac{\left(\sqrt{2 \cdot F} \cdot \mathsf{hypot}\left(B_m, \sqrt{\left(A \cdot C\right) \cdot -4}\right)\right) \cdot \left(-t_0\right)}{t_4}\\
\mathbf{elif}\;t_3 \leq -5 \cdot 10^{-213}:\\
\;\;\;\;t_5\\
\mathbf{elif}\;t_3 \leq 0:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{A} + 2 \cdot C\right)}}{t_1}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_5\\
\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 (/.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 3.1%
Simplified27.5%
sqrt-prod47.7%
*-commutative47.7%
sqrt-prod62.8%
*-commutative62.8%
fma-udef62.8%
add-sqr-sqrt57.0%
hypot-def57.0%
associate-*r*57.0%
hypot-udef17.2%
unpow217.2%
unpow217.2%
+-commutative17.2%
unpow217.2%
unpow217.2%
Applied egg-rr57.0%
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))) < -4.99999999999999977e-213 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 75.9%
sqrt-prod80.1%
associate-*r*80.1%
associate-*l*80.1%
associate-+l+80.1%
unpow280.1%
unpow280.1%
hypot-def95.8%
Applied egg-rr95.8%
*-commutative95.8%
associate-*l*95.8%
*-commutative95.8%
unpow295.8%
fma-neg95.8%
distribute-lft-neg-in95.8%
metadata-eval95.8%
*-commutative95.8%
associate-*l*95.8%
Simplified95.8%
if -4.99999999999999977e-213 < (/.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.4%
Taylor expanded in A around -inf 35.6%
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%
Taylor expanded in C around 0 1.9%
mul-1-neg1.9%
*-commutative1.9%
distribute-rgt-neg-in1.9%
+-commutative1.9%
unpow21.9%
unpow21.9%
hypot-def14.7%
Simplified14.7%
pow1/214.7%
*-commutative14.7%
unpow-prod-down21.8%
pow1/221.8%
pow1/221.8%
Applied egg-rr21.8%
Final simplification48.5%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 1e+43)
(/
(*
(sqrt (+ A (+ C (hypot (- A C) B_m))))
(- (sqrt (* 2.0 (* F (fma B_m B_m (* A (* C -4.0))))))))
(- (pow B_m 2.0) (* (* 4.0 A) C)))
(* (/ (- (sqrt 2.0)) B_m) (* (sqrt F) (sqrt (+ C (hypot B_m C)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 1e+43) {
tmp = (sqrt((A + (C + hypot((A - C), B_m)))) * -sqrt((2.0 * (F * fma(B_m, B_m, (A * (C * -4.0))))))) / (pow(B_m, 2.0) - ((4.0 * A) * C));
} else {
tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt((C + hypot(B_m, C))));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 1e+43) tmp = Float64(Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * Float64(-sqrt(Float64(2.0 * Float64(F * fma(B_m, B_m, Float64(A * Float64(C * -4.0)))))))) / Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C))); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C))))); 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], 1e+43], N[(N[(N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;{B_m}^{2} \leq 10^{+43}:\\
\;\;\;\;\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B_m\right)\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\right)}\right)}{{B_m}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B_m} \cdot \left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B_m, C\right)}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.00000000000000001e43Initial program 21.9%
sqrt-prod24.3%
associate-*r*24.4%
associate-*l*24.4%
associate-+l+25.2%
unpow225.2%
unpow225.2%
hypot-def44.1%
Applied egg-rr44.1%
*-commutative44.1%
associate-*l*44.1%
*-commutative44.1%
unpow244.1%
fma-neg44.1%
distribute-lft-neg-in44.1%
metadata-eval44.1%
*-commutative44.1%
associate-*l*44.1%
Simplified44.1%
if 1.00000000000000001e43 < (pow.f64 B 2) Initial program 15.3%
Taylor expanded in A around 0 14.0%
mul-1-neg14.0%
*-commutative14.0%
distribute-rgt-neg-in14.0%
unpow214.0%
unpow214.0%
hypot-def25.0%
Simplified25.0%
pow1/225.0%
*-commutative25.0%
unpow-prod-down33.1%
pow1/233.1%
pow1/233.1%
Applied egg-rr33.1%
Final simplification39.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) 5e+25)
(/ (- (sqrt (* (* 2.0 t_0) (* F (+ A (+ C (hypot (- A C) B_m))))))) t_0)
(* (/ (- (sqrt 2.0)) B_m) (* (sqrt F) (sqrt (+ C (hypot B_m C))))))))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) <= 5e+25) {
tmp = -sqrt(((2.0 * t_0) * (F * (A + (C + hypot((A - C), B_m)))))) / t_0;
} else {
tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt((C + hypot(B_m, C))));
}
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) <= 5e+25) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * t_0) * Float64(F * Float64(A + Float64(C + hypot(Float64(A - C), B_m))))))) / t_0); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C))))); 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], 5e+25], N[((-N[Sqrt[N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(F * N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $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 5 \cdot 10^{+25}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot t_0\right) \cdot \left(F \cdot \left(A + \left(C + \mathsf{hypot}\left(A - C, B_m\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B_m} \cdot \left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B_m, C\right)}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.00000000000000024e25Initial program 22.3%
neg-sub022.3%
div-sub22.3%
associate-*l*22.3%
Applied egg-rr37.1%
div037.1%
neg-sub037.1%
distribute-neg-frac37.1%
Simplified36.5%
if 5.00000000000000024e25 < (pow.f64 B 2) Initial program 15.0%
Taylor expanded in A around 0 13.7%
mul-1-neg13.7%
*-commutative13.7%
distribute-rgt-neg-in13.7%
unpow213.7%
unpow213.7%
hypot-def24.3%
Simplified24.3%
pow1/224.3%
*-commutative24.3%
unpow-prod-down32.3%
pow1/232.3%
pow1/232.3%
Applied egg-rr32.3%
Final simplification34.6%
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) 5e+25)
(/ (- (sqrt (* (* t_0 (* 2.0 F)) (+ A (+ C (hypot B_m (- A C))))))) t_0)
(* (/ (- (sqrt 2.0)) B_m) (* (sqrt F) (sqrt (+ C (hypot B_m C))))))))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) <= 5e+25) {
tmp = -sqrt(((t_0 * (2.0 * F)) * (A + (C + hypot(B_m, (A - C)))))) / t_0;
} else {
tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt((C + hypot(B_m, C))));
}
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) <= 5e+25) tmp = Float64(Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(A + Float64(C + hypot(B_m, Float64(A - C))))))) / t_0); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C))))); 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], 5e+25], N[((-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $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 5 \cdot 10^{+25}:\\
\;\;\;\;\frac{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B_m, A - C\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B_m} \cdot \left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B_m, C\right)}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.00000000000000024e25Initial program 22.3%
Simplified37.1%
if 5.00000000000000024e25 < (pow.f64 B 2) Initial program 15.0%
Taylor expanded in A around 0 13.7%
mul-1-neg13.7%
*-commutative13.7%
distribute-rgt-neg-in13.7%
unpow213.7%
unpow213.7%
hypot-def24.3%
Simplified24.3%
pow1/224.3%
*-commutative24.3%
unpow-prod-down32.3%
pow1/232.3%
pow1/232.3%
Applied egg-rr32.3%
Final simplification35.0%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2 (* 2.0 (* t_0 F)))
(t_3 (/ (- (sqrt (* t_2 (* 2.0 C)))) t_0)))
(if (<= B_m 1.7e-239)
(/ (- (sqrt (* (* t_1 (* 2.0 F)) (+ A A)))) t_1)
(if (<= B_m 2.9e-111)
t_3
(if (<= B_m 1.7e-52)
(/ (- (sqrt (* t_2 (+ A (hypot B_m A))))) t_0)
(if (<= B_m 7.8e-24)
t_3
(*
(/ (- (sqrt 2.0)) B_m)
(* (sqrt F) (sqrt (+ C (hypot B_m C)))))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = 2.0 * (t_0 * F);
double t_3 = -sqrt((t_2 * (2.0 * C))) / t_0;
double tmp;
if (B_m <= 1.7e-239) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + A))) / t_1;
} else if (B_m <= 2.9e-111) {
tmp = t_3;
} else if (B_m <= 1.7e-52) {
tmp = -sqrt((t_2 * (A + hypot(B_m, A)))) / t_0;
} else if (B_m <= 7.8e-24) {
tmp = t_3;
} else {
tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt((C + hypot(B_m, C))));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(2.0 * Float64(t_0 * F)) t_3 = Float64(Float64(-sqrt(Float64(t_2 * Float64(2.0 * C)))) / t_0) tmp = 0.0 if (B_m <= 1.7e-239) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + A)))) / t_1); elseif (B_m <= 2.9e-111) tmp = t_3; elseif (B_m <= 1.7e-52) tmp = Float64(Float64(-sqrt(Float64(t_2 * Float64(A + hypot(B_m, A))))) / t_0); elseif (B_m <= 7.8e-24) tmp = t_3; else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(t$95$2 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B$95$m, 1.7e-239], N[((-N[Sqrt[N[(N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 2.9e-111], t$95$3, If[LessEqual[B$95$m, 1.7e-52], N[((-N[Sqrt[N[(t$95$2 * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 7.8e-24], t$95$3, N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := 2 \cdot \left(t_0 \cdot F\right)\\
t_3 := \frac{-\sqrt{t_2 \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{if}\;B_m \leq 1.7 \cdot 10^{-239}:\\
\;\;\;\;\frac{-\sqrt{\left(t_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{elif}\;B_m \leq 2.9 \cdot 10^{-111}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;B_m \leq 1.7 \cdot 10^{-52}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(A + \mathsf{hypot}\left(B_m, A\right)\right)}}{t_0}\\
\mathbf{elif}\;B_m \leq 7.8 \cdot 10^{-24}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B_m} \cdot \left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B_m, C\right)}\right)\\
\end{array}
\end{array}
if B < 1.7e-239Initial program 17.3%
Simplified25.7%
Taylor expanded in A around inf 14.5%
distribute-rgt1-in14.5%
metadata-eval14.5%
mul0-lft14.5%
Simplified14.5%
if 1.7e-239 < B < 2.90000000000000002e-111 or 1.70000000000000009e-52 < B < 7.8e-24Initial program 11.1%
Taylor expanded in A around -inf 35.2%
if 2.90000000000000002e-111 < B < 1.70000000000000009e-52Initial program 37.5%
Taylor expanded in C around 0 55.4%
+-commutative55.4%
unpow255.4%
unpow255.4%
hypot-def55.4%
Simplified55.4%
if 7.8e-24 < B Initial program 24.6%
Taylor expanded in A around 0 27.9%
mul-1-neg27.9%
*-commutative27.9%
distribute-rgt-neg-in27.9%
unpow227.9%
unpow227.9%
hypot-def45.5%
Simplified45.5%
pow1/245.5%
*-commutative45.5%
unpow-prod-down59.3%
pow1/259.3%
pow1/259.3%
Applied egg-rr59.3%
Final simplification30.1%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 3.7e-239)
(/ (- (sqrt (* (* t_1 (* 2.0 F)) (+ A A)))) t_1)
(if (<= B_m 4.4e-15)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_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 t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 3.7e-239) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + A))) / t_1;
} else if (B_m <= 4.4e-15) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_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) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 3.7e-239) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + A)))) / t_1); elseif (B_m <= 4.4e-15) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_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_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 3.7e-239], N[((-N[Sqrt[N[(N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 4.4e-15], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $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]) / B$95$m), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B_m \leq 3.7 \cdot 10^{-239}:\\
\;\;\;\;\frac{-\sqrt{\left(t_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{elif}\;B_m \leq 4.4 \cdot 10^{-15}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\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 B < 3.70000000000000015e-239Initial program 17.3%
Simplified25.7%
Taylor expanded in A around inf 14.5%
distribute-rgt1-in14.5%
metadata-eval14.5%
mul0-lft14.5%
Simplified14.5%
if 3.70000000000000015e-239 < B < 4.39999999999999971e-15Initial program 18.9%
Taylor expanded in A around -inf 30.5%
if 4.39999999999999971e-15 < B Initial program 23.7%
Taylor expanded in C around 0 29.5%
mul-1-neg29.5%
*-commutative29.5%
distribute-rgt-neg-in29.5%
+-commutative29.5%
unpow229.5%
unpow229.5%
hypot-def49.1%
Simplified49.1%
pow1/249.1%
*-commutative49.1%
unpow-prod-down62.0%
pow1/262.0%
pow1/262.0%
Applied egg-rr62.0%
Final simplification28.8%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 6.4e-239)
(/ (- (sqrt (* (* t_1 (* 2.0 F)) (+ A A)))) t_1)
(if (<= B_m 2.35e-23)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0)
(* (/ (- (sqrt 2.0)) B_m) (* (sqrt F) (sqrt (+ C (hypot B_m C)))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 6.4e-239) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + A))) / t_1;
} else if (B_m <= 2.35e-23) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else {
tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt((C + hypot(B_m, C))));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 6.4e-239) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + A)))) / t_1); elseif (B_m <= 2.35e-23) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 6.4e-239], N[((-N[Sqrt[N[(N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 2.35e-23], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B_m \leq 6.4 \cdot 10^{-239}:\\
\;\;\;\;\frac{-\sqrt{\left(t_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{elif}\;B_m \leq 2.35 \cdot 10^{-23}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B_m} \cdot \left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B_m, C\right)}\right)\\
\end{array}
\end{array}
if B < 6.3999999999999998e-239Initial program 17.3%
Simplified25.7%
Taylor expanded in A around inf 14.5%
distribute-rgt1-in14.5%
metadata-eval14.5%
mul0-lft14.5%
Simplified14.5%
if 6.3999999999999998e-239 < B < 2.35e-23Initial program 17.4%
Taylor expanded in A around -inf 29.6%
if 2.35e-23 < B Initial program 24.6%
Taylor expanded in A around 0 27.9%
mul-1-neg27.9%
*-commutative27.9%
distribute-rgt-neg-in27.9%
unpow227.9%
unpow227.9%
hypot-def45.5%
Simplified45.5%
pow1/245.5%
*-commutative45.5%
unpow-prod-down59.3%
pow1/259.3%
pow1/259.3%
Applied egg-rr59.3%
Final simplification28.2%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= C -1.15e+58)
(/ (- (sqrt (* (* t_1 (* 2.0 F)) (+ A A)))) t_1)
(if (<= C 1.05e+18)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ A (hypot B_m A))))))
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0)))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (C <= -1.15e+58) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + A))) / t_1;
} else if (C <= 1.05e+18) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A + hypot(B_m, A))));
} else {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (C <= -1.15e+58) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + A)))) / t_1); elseif (C <= 1.05e+18) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A + hypot(B_m, A)))))); else tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -1.15e+58], N[((-N[Sqrt[N[(N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[C, 1.05e+18], 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[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;C \leq -1.15 \cdot 10^{+58}:\\
\;\;\;\;\frac{-\sqrt{\left(t_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{elif}\;C \leq 1.05 \cdot 10^{+18}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B_m, A\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\end{array}
\end{array}
if C < -1.15000000000000001e58Initial program 1.9%
Simplified8.4%
Taylor expanded in A around inf 34.8%
distribute-rgt1-in34.8%
metadata-eval34.8%
mul0-lft34.8%
Simplified34.8%
if -1.15000000000000001e58 < C < 1.05e18Initial program 24.0%
Taylor expanded in C around 0 16.7%
mul-1-neg16.7%
*-commutative16.7%
distribute-rgt-neg-in16.7%
+-commutative16.7%
unpow216.7%
unpow216.7%
hypot-def25.8%
Simplified25.8%
if 1.05e18 < C Initial program 24.0%
Taylor expanded in A around -inf 45.9%
Final simplification32.6%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C))))
(if (<= B_m 4.5e-15)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ A (hypot B_m A)))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double tmp;
if (B_m <= 4.5e-15) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A + hypot(B_m, A))));
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = Math.pow(B_m, 2.0) - ((4.0 * A) * C);
double tmp;
if (B_m <= 4.5e-15) {
tmp = -Math.sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (A + Math.hypot(B_m, A))));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.pow(B_m, 2.0) - ((4.0 * A) * C) tmp = 0 if B_m <= 4.5e-15: tmp = -math.sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0 else: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (A + math.hypot(B_m, A)))) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) tmp = 0.0 if (B_m <= 4.5e-15) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A + hypot(B_m, A)))))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = (B_m ^ 2.0) - ((4.0 * A) * C); tmp = 0.0; if (B_m <= 4.5e-15) tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0; else tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A + hypot(B_m, A)))); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 4.5e-15], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], 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]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;B_m \leq 4.5 \cdot 10^{-15}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B_m, A\right)\right)}\right)\\
\end{array}
\end{array}
if B < 4.4999999999999998e-15Initial program 17.7%
Taylor expanded in A around -inf 22.7%
if 4.4999999999999998e-15 < B Initial program 23.7%
Taylor expanded in C around 0 29.5%
mul-1-neg29.5%
*-commutative29.5%
distribute-rgt-neg-in29.5%
+-commutative29.5%
unpow229.5%
unpow229.5%
hypot-def49.1%
Simplified49.1%
Final simplification29.0%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (+ A (hypot B_m A))))
(if (<= F -2e-310)
(/
(- (sqrt (* t_0 (* 2.0 (* -4.0 (* A (* C F)))))))
(- (pow B_m 2.0) (* (* 4.0 A) C)))
(if (<= F 1.35e+19)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F t_0))))
(* (sqrt (/ F B_m)) (- (sqrt 2.0)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = A + hypot(B_m, A);
double tmp;
if (F <= -2e-310) {
tmp = -sqrt((t_0 * (2.0 * (-4.0 * (A * (C * F)))))) / (pow(B_m, 2.0) - ((4.0 * A) * C));
} else if (F <= 1.35e+19) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * t_0));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = A + Math.hypot(B_m, A);
double tmp;
if (F <= -2e-310) {
tmp = -Math.sqrt((t_0 * (2.0 * (-4.0 * (A * (C * F)))))) / (Math.pow(B_m, 2.0) - ((4.0 * A) * C));
} else if (F <= 1.35e+19) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * t_0));
} else {
tmp = Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = A + math.hypot(B_m, A) tmp = 0 if F <= -2e-310: tmp = -math.sqrt((t_0 * (2.0 * (-4.0 * (A * (C * F)))))) / (math.pow(B_m, 2.0) - ((4.0 * A) * C)) elif F <= 1.35e+19: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * t_0)) else: tmp = math.sqrt((F / B_m)) * -math.sqrt(2.0) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(A + hypot(B_m, A)) tmp = 0.0 if (F <= -2e-310) tmp = Float64(Float64(-sqrt(Float64(t_0 * Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F))))))) / Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C))); elseif (F <= 1.35e+19) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * t_0)))); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = A + hypot(B_m, A); tmp = 0.0; if (F <= -2e-310) tmp = -sqrt((t_0 * (2.0 * (-4.0 * (A * (C * F)))))) / ((B_m ^ 2.0) - ((4.0 * A) * C)); elseif (F <= 1.35e+19) tmp = (sqrt(2.0) / B_m) * -sqrt((F * t_0)); else tmp = sqrt((F / B_m)) * -sqrt(2.0); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2e-310], N[((-N[Sqrt[N[(t$95$0 * N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.35e+19], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := A + \mathsf{hypot}\left(B_m, A\right)\\
\mathbf{if}\;F \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{{B_m}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{elif}\;F \leq 1.35 \cdot 10^{+19}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot t_0}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < -1.999999999999994e-310Initial program 33.7%
Taylor expanded in C around 0 17.3%
+-commutative17.3%
unpow217.3%
unpow217.3%
hypot-def23.3%
Simplified23.3%
Taylor expanded in B around 0 19.8%
*-commutative19.8%
Simplified19.8%
if -1.999999999999994e-310 < F < 1.35e19Initial program 17.0%
Taylor expanded in C around 0 13.1%
mul-1-neg13.1%
*-commutative13.1%
distribute-rgt-neg-in13.1%
+-commutative13.1%
unpow213.1%
unpow213.1%
hypot-def24.6%
Simplified24.6%
if 1.35e19 < F Initial program 17.1%
Taylor expanded in C around 0 10.3%
mul-1-neg10.3%
*-commutative10.3%
distribute-rgt-neg-in10.3%
+-commutative10.3%
unpow210.3%
unpow210.3%
hypot-def12.3%
Simplified12.3%
Taylor expanded in A around 0 16.1%
mul-1-neg16.1%
Simplified16.1%
Final simplification20.6%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 1.4e+19) (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ A (hypot B_m A)))))) (* (sqrt (/ F B_m)) (- (sqrt 2.0)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.4e+19) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A + hypot(B_m, A))));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.4e+19) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (A + Math.hypot(B_m, A))));
} else {
tmp = Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= 1.4e+19: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (A + math.hypot(B_m, A)))) else: tmp = math.sqrt((F / B_m)) * -math.sqrt(2.0) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= 1.4e+19) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A + hypot(B_m, A)))))); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= 1.4e+19) tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A + hypot(B_m, A)))); else tmp = sqrt((F / B_m)) * -sqrt(2.0); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 1.4e+19], 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[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.4 \cdot 10^{+19}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B_m, A\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < 1.4e19Initial program 20.5%
Taylor expanded in C around 0 10.4%
mul-1-neg10.4%
*-commutative10.4%
distribute-rgt-neg-in10.4%
+-commutative10.4%
unpow210.4%
unpow210.4%
hypot-def19.5%
Simplified19.5%
if 1.4e19 < F Initial program 17.1%
Taylor expanded in C around 0 10.3%
mul-1-neg10.3%
*-commutative10.3%
distribute-rgt-neg-in10.3%
+-commutative10.3%
unpow210.3%
unpow210.3%
hypot-def12.3%
Simplified12.3%
Taylor expanded in A around 0 16.1%
mul-1-neg16.1%
Simplified16.1%
Final simplification18.2%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 2.5e-21) (* (/ (sqrt 2.0) B_m) (- (sqrt (* B_m F)))) (* (sqrt (/ F B_m)) (- (sqrt 2.0)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 2.5e-21) {
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
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 <= 2.5d-21) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((b_m * f))
else
tmp = sqrt((f / b_m)) * -sqrt(2.0d0)
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 <= 2.5e-21) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((B_m * F));
} else {
tmp = Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= 2.5e-21: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((B_m * F)) else: tmp = math.sqrt((F / B_m)) * -math.sqrt(2.0) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= 2.5e-21) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(B_m * F)))); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= 2.5e-21) tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F)); else tmp = sqrt((F / B_m)) * -sqrt(2.0); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 2.5e-21], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq 2.5 \cdot 10^{-21}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{B_m \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < 2.49999999999999986e-21Initial program 22.2%
Taylor expanded in C around 0 10.2%
mul-1-neg10.2%
*-commutative10.2%
distribute-rgt-neg-in10.2%
+-commutative10.2%
unpow210.2%
unpow210.2%
hypot-def18.2%
Simplified18.2%
Taylor expanded in A around 0 15.7%
if 2.49999999999999986e-21 < F Initial program 15.8%
Taylor expanded in C around 0 10.6%
mul-1-neg10.6%
*-commutative10.6%
distribute-rgt-neg-in10.6%
+-commutative10.6%
unpow210.6%
unpow210.6%
hypot-def14.9%
Simplified14.9%
Taylor expanded in A around 0 16.7%
mul-1-neg16.7%
Simplified16.7%
Final simplification16.2%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (* (sqrt (/ F B_m)) (- (sqrt 2.0))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return sqrt((F / B_m)) * -sqrt(2.0);
}
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((f / b_m)) * -sqrt(2.0d0)
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
B_m = math.fabs(B) def code(A, B_m, C, F): return math.sqrt((F / B_m)) * -math.sqrt(2.0)
B_m = abs(B) function code(A, B_m, C, F) return Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = sqrt((F / B_m)) * -sqrt(2.0); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\sqrt{\frac{F}{B_m}} \cdot \left(-\sqrt{2}\right)
\end{array}
Initial program 19.1%
Taylor expanded in C around 0 10.4%
mul-1-neg10.4%
*-commutative10.4%
distribute-rgt-neg-in10.4%
+-commutative10.4%
unpow210.4%
unpow210.4%
hypot-def16.6%
Simplified16.6%
Taylor expanded in A around 0 13.6%
mul-1-neg13.6%
Simplified13.6%
Final simplification13.6%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= C 2.25e-42) (* (pow (* A F) 0.5) (/ (- 2.0) B_m)) (- (/ (* 2.0 (sqrt (* C F))) B_m))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 2.25e-42) {
tmp = pow((A * F), 0.5) * (-2.0 / B_m);
} else {
tmp = -((2.0 * sqrt((C * 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 (c <= 2.25d-42) then
tmp = ((a * f) ** 0.5d0) * (-2.0d0 / b_m)
else
tmp = -((2.0d0 * sqrt((c * 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 (C <= 2.25e-42) {
tmp = Math.pow((A * F), 0.5) * (-2.0 / B_m);
} else {
tmp = -((2.0 * Math.sqrt((C * F))) / B_m);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if C <= 2.25e-42: tmp = math.pow((A * F), 0.5) * (-2.0 / B_m) else: tmp = -((2.0 * math.sqrt((C * F))) / B_m) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (C <= 2.25e-42) tmp = Float64((Float64(A * F) ^ 0.5) * Float64(Float64(-2.0) / B_m)); else tmp = Float64(-Float64(Float64(2.0 * sqrt(Float64(C * F))) / B_m)); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (C <= 2.25e-42) tmp = ((A * F) ^ 0.5) * (-2.0 / B_m); else tmp = -((2.0 * sqrt((C * F))) / B_m); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 2.25e-42], N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] * N[((-2.0) / B$95$m), $MachinePrecision]), $MachinePrecision], (-N[(N[(2.0 * N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B$95$m), $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;C \leq 2.25 \cdot 10^{-42}:\\
\;\;\;\;{\left(A \cdot F\right)}^{0.5} \cdot \frac{-2}{B_m}\\
\mathbf{else}:\\
\;\;\;\;-\frac{2 \cdot \sqrt{C \cdot F}}{B_m}\\
\end{array}
\end{array}
if C < 2.25e-42Initial program 16.7%
Taylor expanded in C around 0 12.4%
mul-1-neg12.4%
*-commutative12.4%
distribute-rgt-neg-in12.4%
+-commutative12.4%
unpow212.4%
unpow212.4%
hypot-def19.5%
Simplified19.5%
Taylor expanded in B around 0 3.8%
mul-1-neg3.8%
*-commutative3.8%
unpow23.8%
rem-square-sqrt3.8%
Simplified3.8%
pow1/23.9%
Applied egg-rr3.9%
if 2.25e-42 < C Initial program 25.7%
Taylor expanded in A around 0 5.1%
mul-1-neg5.1%
*-commutative5.1%
distribute-rgt-neg-in5.1%
unpow25.1%
unpow25.1%
hypot-def11.0%
Simplified11.0%
Taylor expanded in B around 0 6.4%
mul-1-neg6.4%
associate-*l/6.4%
unpow26.4%
rem-square-sqrt6.5%
*-commutative6.5%
Simplified6.5%
Final simplification4.6%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= C 1.02e-44) (* 2.0 (/ (- (sqrt (* A F))) B_m)) (* (sqrt (* C F)) (/ -2.0 B_m))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 1.02e-44) {
tmp = 2.0 * (-sqrt((A * F)) / B_m);
} else {
tmp = sqrt((C * F)) * (-2.0 / 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 (c <= 1.02d-44) then
tmp = 2.0d0 * (-sqrt((a * f)) / b_m)
else
tmp = sqrt((c * f)) * ((-2.0d0) / 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 (C <= 1.02e-44) {
tmp = 2.0 * (-Math.sqrt((A * F)) / B_m);
} else {
tmp = Math.sqrt((C * F)) * (-2.0 / B_m);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if C <= 1.02e-44: tmp = 2.0 * (-math.sqrt((A * F)) / B_m) else: tmp = math.sqrt((C * F)) * (-2.0 / B_m) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (C <= 1.02e-44) tmp = Float64(2.0 * Float64(Float64(-sqrt(Float64(A * F))) / B_m)); else tmp = Float64(sqrt(Float64(C * F)) * Float64(-2.0 / B_m)); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (C <= 1.02e-44) tmp = 2.0 * (-sqrt((A * F)) / B_m); else tmp = sqrt((C * F)) * (-2.0 / B_m); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 1.02e-44], N[(2.0 * N[((-N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(-2.0 / B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;C \leq 1.02 \cdot 10^{-44}:\\
\;\;\;\;2 \cdot \frac{-\sqrt{A \cdot F}}{B_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{C \cdot F} \cdot \frac{-2}{B_m}\\
\end{array}
\end{array}
if C < 1.0199999999999999e-44Initial program 16.7%
Taylor expanded in C around 0 12.4%
mul-1-neg12.4%
*-commutative12.4%
distribute-rgt-neg-in12.4%
+-commutative12.4%
unpow212.4%
unpow212.4%
hypot-def19.5%
Simplified19.5%
Taylor expanded in B around 0 3.8%
mul-1-neg3.8%
*-commutative3.8%
unpow23.8%
rem-square-sqrt3.8%
Simplified3.8%
Taylor expanded in B around 0 3.8%
associate-*r/3.8%
*-commutative3.8%
*-rgt-identity3.8%
Simplified3.8%
if 1.0199999999999999e-44 < C Initial program 25.7%
Taylor expanded in A around 0 5.1%
mul-1-neg5.1%
*-commutative5.1%
distribute-rgt-neg-in5.1%
unpow25.1%
unpow25.1%
hypot-def11.0%
Simplified11.0%
pow1/211.1%
*-commutative11.1%
unpow-prod-down15.1%
pow1/215.1%
pow1/215.1%
Applied egg-rr15.1%
Taylor expanded in B around 0 6.4%
mul-1-neg6.4%
*-commutative6.4%
distribute-rgt-neg-in6.4%
*-commutative6.4%
mul-1-neg6.4%
unpow26.4%
rem-square-sqrt6.5%
associate-*r/6.5%
metadata-eval6.5%
Simplified6.5%
Final simplification4.5%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= C 2.1e-42) (* 2.0 (/ (- (sqrt (* A F))) B_m)) (- (/ (* 2.0 (sqrt (* C F))) B_m))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 2.1e-42) {
tmp = 2.0 * (-sqrt((A * F)) / B_m);
} else {
tmp = -((2.0 * sqrt((C * 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 (c <= 2.1d-42) then
tmp = 2.0d0 * (-sqrt((a * f)) / b_m)
else
tmp = -((2.0d0 * sqrt((c * 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 (C <= 2.1e-42) {
tmp = 2.0 * (-Math.sqrt((A * F)) / B_m);
} else {
tmp = -((2.0 * Math.sqrt((C * F))) / B_m);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if C <= 2.1e-42: tmp = 2.0 * (-math.sqrt((A * F)) / B_m) else: tmp = -((2.0 * math.sqrt((C * F))) / B_m) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (C <= 2.1e-42) tmp = Float64(2.0 * Float64(Float64(-sqrt(Float64(A * F))) / B_m)); else tmp = Float64(-Float64(Float64(2.0 * sqrt(Float64(C * F))) / B_m)); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (C <= 2.1e-42) tmp = 2.0 * (-sqrt((A * F)) / B_m); else tmp = -((2.0 * sqrt((C * F))) / B_m); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 2.1e-42], N[(2.0 * N[((-N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision], (-N[(N[(2.0 * N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B$95$m), $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;C \leq 2.1 \cdot 10^{-42}:\\
\;\;\;\;2 \cdot \frac{-\sqrt{A \cdot F}}{B_m}\\
\mathbf{else}:\\
\;\;\;\;-\frac{2 \cdot \sqrt{C \cdot F}}{B_m}\\
\end{array}
\end{array}
if C < 2.10000000000000006e-42Initial program 16.7%
Taylor expanded in C around 0 12.4%
mul-1-neg12.4%
*-commutative12.4%
distribute-rgt-neg-in12.4%
+-commutative12.4%
unpow212.4%
unpow212.4%
hypot-def19.5%
Simplified19.5%
Taylor expanded in B around 0 3.8%
mul-1-neg3.8%
*-commutative3.8%
unpow23.8%
rem-square-sqrt3.8%
Simplified3.8%
Taylor expanded in B around 0 3.8%
associate-*r/3.8%
*-commutative3.8%
*-rgt-identity3.8%
Simplified3.8%
if 2.10000000000000006e-42 < C Initial program 25.7%
Taylor expanded in A around 0 5.1%
mul-1-neg5.1%
*-commutative5.1%
distribute-rgt-neg-in5.1%
unpow25.1%
unpow25.1%
hypot-def11.0%
Simplified11.0%
Taylor expanded in B around 0 6.4%
mul-1-neg6.4%
associate-*l/6.4%
unpow26.4%
rem-square-sqrt6.5%
*-commutative6.5%
Simplified6.5%
Final simplification4.5%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (* (sqrt (* C F)) (/ -2.0 B_m)))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return sqrt((C * F)) * (-2.0 / 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((c * f)) * ((-2.0d0) / 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((C * F)) * (-2.0 / B_m);
}
B_m = math.fabs(B) def code(A, B_m, C, F): return math.sqrt((C * F)) * (-2.0 / B_m)
B_m = abs(B) function code(A, B_m, C, F) return Float64(sqrt(Float64(C * F)) * Float64(-2.0 / B_m)) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = sqrt((C * F)) * (-2.0 / B_m); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(-2.0 / B$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\sqrt{C \cdot F} \cdot \frac{-2}{B_m}
\end{array}
Initial program 19.1%
Taylor expanded in A around 0 9.8%
mul-1-neg9.8%
*-commutative9.8%
distribute-rgt-neg-in9.8%
unpow29.8%
unpow29.8%
hypot-def15.3%
Simplified15.3%
pow1/215.3%
*-commutative15.3%
unpow-prod-down18.7%
pow1/218.7%
pow1/218.7%
Applied egg-rr18.7%
Taylor expanded in B around 0 2.7%
mul-1-neg2.7%
*-commutative2.7%
distribute-rgt-neg-in2.7%
*-commutative2.7%
mul-1-neg2.7%
unpow22.7%
rem-square-sqrt2.7%
associate-*r/2.7%
metadata-eval2.7%
Simplified2.7%
Final simplification2.7%
herbie shell --seed 2023333
(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))))