
(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 12 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 (sqrt (+ A (+ C (hypot (- A C) B_m)))))
(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 (* 2.0 (* F t_0))) (- t_1)) t_2)))
(if (<= t_3 -5e-157)
t_4
(if (<= t_3 0.0)
(/
(* t_1 (* (hypot B_m (sqrt (* -4.0 (* A C)))) (- (sqrt (* 2.0 F)))))
t_0)
(if (<= t_3 INFINITY)
t_4
(*
(* (sqrt (+ C (hypot C B_m))) (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 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = sqrt((A + (C + hypot((A - C), B_m))));
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((2.0 * (F * t_0))) * -t_1) / t_2;
double tmp;
if (t_3 <= -5e-157) {
tmp = t_4;
} else if (t_3 <= 0.0) {
tmp = (t_1 * (hypot(B_m, sqrt((-4.0 * (A * C)))) * -sqrt((2.0 * F)))) / t_0;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_4;
} else {
tmp = (sqrt((C + hypot(C, B_m))) * sqrt(F)) * -(sqrt(2.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))) t_1 = sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) 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(Float64(2.0 * Float64(F * t_0))) * Float64(-t_1)) / t_2) tmp = 0.0 if (t_3 <= -5e-157) tmp = t_4; elseif (t_3 <= 0.0) tmp = Float64(Float64(t_1 * Float64(hypot(B_m, sqrt(Float64(-4.0 * Float64(A * C)))) * Float64(-sqrt(Float64(2.0 * F))))) / t_0); elseif (t_3 <= Inf) tmp = t_4; else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B_m))) * 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[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $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[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-t$95$1)), $MachinePrecision] / t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-157], t$95$4, If[LessEqual[t$95$3, 0.0], N[(N[(t$95$1 * N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$4, N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 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 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B_m\right)\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{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-t_1\right)}{t_2}\\
\mathbf{if}\;t_3 \leq -5 \cdot 10^{-157}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;t_3 \leq 0:\\
\;\;\;\;\frac{t_1 \cdot \left(\mathsf{hypot}\left(B_m, \sqrt{-4 \cdot \left(A \cdot C\right)}\right) \cdot \left(-\sqrt{2 \cdot F}\right)\right)}{t_0}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_4\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B_m\right)} \cdot \sqrt{F}\right) \cdot \left(-\frac{\sqrt{2}}{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-157 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 46.6%
sqrt-prod53.6%
associate-*r*53.6%
associate-*l*53.6%
associate-+l+53.6%
unpow253.6%
unpow253.6%
hypot-def79.0%
Applied egg-rr79.0%
associate-*l*79.0%
*-commutative79.0%
unpow279.0%
fma-neg79.0%
distribute-lft-neg-in79.0%
metadata-eval79.0%
*-commutative79.0%
associate-*l*79.0%
Simplified79.0%
if -5.0000000000000002e-157 < (/.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 16.8%
Simplified19.4%
sqrt-prod23.4%
sqrt-prod41.9%
fma-udef41.9%
add-sqr-sqrt41.7%
hypot-def41.6%
associate-*r*41.6%
*-commutative41.6%
hypot-udef41.6%
unpow241.6%
unpow241.6%
+-commutative41.6%
unpow241.6%
unpow241.6%
hypot-def41.6%
Applied egg-rr41.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 A around 0 1.9%
mul-1-neg1.9%
*-commutative1.9%
distribute-rgt-neg-in1.9%
unpow21.9%
unpow21.9%
hypot-def15.9%
Simplified15.9%
pow1/216.0%
*-commutative16.0%
unpow-prod-down24.4%
pow1/224.4%
hypot-udef1.9%
unpow21.9%
+-commutative1.9%
unpow21.9%
hypot-def24.4%
pow1/224.4%
Applied egg-rr24.4%
Final simplification50.3%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 8.2e+49)
(/
(*
(sqrt (* 2.0 (* F (fma B_m B_m (* A (* C -4.0))))))
(- (sqrt (+ A (+ C (hypot (- A C) B_m))))))
(- (pow B_m 2.0) (* (* 4.0 A) C)))
(* (* (sqrt (+ C (hypot C B_m))) (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 (B_m <= 8.2e+49) {
tmp = (sqrt((2.0 * (F * fma(B_m, B_m, (A * (C * -4.0)))))) * -sqrt((A + (C + hypot((A - C), B_m))))) / (pow(B_m, 2.0) - ((4.0 * A) * C));
} else {
tmp = (sqrt((C + hypot(C, B_m))) * 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 <= 8.2e+49) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B_m, B_m, Float64(A * Float64(C * -4.0)))))) * Float64(-sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))))) / Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B_m))) * 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[B$95$m, 8.2e+49], N[(N[(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] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $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[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 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 \leq 8.2 \cdot 10^{+49}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B_m\right)\right)}\right)}{{B_m}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B_m\right)} \cdot \sqrt{F}\right) \cdot \left(-\frac{\sqrt{2}}{B_m}\right)\\
\end{array}
\end{array}
if B < 8.2e49Initial program 25.8%
sqrt-prod29.2%
associate-*r*29.2%
associate-*l*29.2%
associate-+l+29.6%
unpow229.6%
unpow229.6%
hypot-def41.3%
Applied egg-rr41.3%
associate-*l*41.3%
*-commutative41.3%
unpow241.3%
fma-neg41.3%
distribute-lft-neg-in41.3%
metadata-eval41.3%
*-commutative41.3%
associate-*l*41.3%
Simplified41.3%
if 8.2e49 < B Initial program 5.7%
Taylor expanded in A around 0 18.0%
mul-1-neg18.0%
*-commutative18.0%
distribute-rgt-neg-in18.0%
unpow218.0%
unpow218.0%
hypot-def55.1%
Simplified55.1%
pow1/255.2%
*-commutative55.2%
unpow-prod-down75.7%
pow1/275.7%
hypot-udef19.4%
unpow219.4%
+-commutative19.4%
unpow219.4%
hypot-def75.7%
pow1/275.7%
Applied egg-rr75.7%
Final simplification47.1%
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 (<= B_m 2.8e+49)
(/ (- (sqrt (* (* 2.0 t_0) (* F (+ A (+ C (hypot (- A C) B_m))))))) t_0)
(* (* (sqrt (+ C (hypot C B_m))) (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 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 2.8e+49) {
tmp = -sqrt(((2.0 * t_0) * (F * (A + (C + hypot((A - C), B_m)))))) / t_0;
} else {
tmp = (sqrt((C + hypot(C, B_m))) * sqrt(F)) * (-sqrt(2.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.8e+49) 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(sqrt(Float64(C + hypot(C, B_m))) * 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[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 2.8e+49], 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[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 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 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B_m \leq 2.8 \cdot 10^{+49}:\\
\;\;\;\;\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}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B_m\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B_m}\\
\end{array}
\end{array}
if B < 2.7999999999999998e49Initial program 25.8%
neg-sub025.8%
div-sub25.8%
associate-*l*25.8%
Applied egg-rr34.1%
div034.1%
neg-sub034.1%
distribute-neg-frac34.1%
Simplified34.2%
if 2.7999999999999998e49 < B Initial program 5.7%
Taylor expanded in A around 0 18.0%
mul-1-neg18.0%
*-commutative18.0%
distribute-rgt-neg-in18.0%
unpow218.0%
unpow218.0%
hypot-def55.1%
Simplified55.1%
pow1/255.2%
*-commutative55.2%
unpow-prod-down75.7%
pow1/275.7%
hypot-udef19.4%
unpow219.4%
+-commutative19.4%
unpow219.4%
hypot-def75.7%
pow1/275.7%
Applied egg-rr75.7%
Final simplification41.2%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (/ (sqrt 2.0) B_m)))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2 (- (pow B_m 2.0) (* (* 4.0 A) C))))
(if (<= A -1.85e+109)
(/ (- (sqrt (* (* 2.0 (* t_2 F)) (* 2.0 C)))) t_2)
(if (<= A 4.5e+23)
(* (* (sqrt (+ C (hypot C B_m))) (sqrt F)) t_0)
(if (<= A 5.4e+238)
(/ (- (sqrt (* (* t_1 (* 2.0 F)) (+ A A)))) t_1)
(* t_0 (sqrt (* F (* (/ (pow B_m 2.0) C) -0.5)))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = -(sqrt(2.0) / B_m);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = pow(B_m, 2.0) - ((4.0 * A) * C);
double tmp;
if (A <= -1.85e+109) {
tmp = -sqrt(((2.0 * (t_2 * F)) * (2.0 * C))) / t_2;
} else if (A <= 4.5e+23) {
tmp = (sqrt((C + hypot(C, B_m))) * sqrt(F)) * t_0;
} else if (A <= 5.4e+238) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + A))) / t_1;
} else {
tmp = t_0 * sqrt((F * ((pow(B_m, 2.0) / C) * -0.5)));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(-Float64(sqrt(2.0) / B_m)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) tmp = 0.0 if (A <= -1.85e+109) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(2.0 * C)))) / t_2); elseif (A <= 4.5e+23) tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B_m))) * sqrt(F)) * t_0); elseif (A <= 5.4e+238) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + A)))) / t_1); else tmp = Float64(t_0 * sqrt(Float64(F * Float64(Float64((B_m ^ 2.0) / C) * -0.5)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $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[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -1.85e+109], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[A, 4.5e+23], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[A, 5.4e+238], N[((-N[Sqrt[N[(N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(t$95$0 * N[Sqrt[N[(F * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := -\frac{\sqrt{2}}{B_m}\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;A \leq -1.85 \cdot 10^{+109}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_2}\\
\mathbf{elif}\;A \leq 4.5 \cdot 10^{+23}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B_m\right)} \cdot \sqrt{F}\right) \cdot t_0\\
\mathbf{elif}\;A \leq 5.4 \cdot 10^{+238}:\\
\;\;\;\;\frac{-\sqrt{\left(t_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \left(\frac{{B_m}^{2}}{C} \cdot -0.5\right)}\\
\end{array}
\end{array}
if A < -1.8500000000000001e109Initial program 3.0%
Taylor expanded in A around -inf 34.4%
if -1.8500000000000001e109 < A < 4.49999999999999979e23Initial program 28.2%
Taylor expanded in A around 0 13.6%
mul-1-neg13.6%
*-commutative13.6%
distribute-rgt-neg-in13.6%
unpow213.6%
unpow213.6%
hypot-def23.9%
Simplified23.9%
pow1/223.9%
*-commutative23.9%
unpow-prod-down30.8%
pow1/230.8%
hypot-udef14.4%
unpow214.4%
+-commutative14.4%
unpow214.4%
hypot-def30.8%
pow1/230.8%
Applied egg-rr30.8%
if 4.49999999999999979e23 < A < 5.40000000000000044e238Initial program 31.9%
Simplified48.4%
Taylor expanded in A around inf 48.3%
distribute-rgt1-in48.3%
metadata-eval48.3%
mul0-lft48.3%
Simplified48.3%
if 5.40000000000000044e238 < A Initial program 0.9%
Taylor expanded in A around 0 3.5%
mul-1-neg3.5%
*-commutative3.5%
distribute-rgt-neg-in3.5%
unpow23.5%
unpow23.5%
hypot-def4.8%
Simplified4.8%
Taylor expanded in C around -inf 23.2%
*-commutative23.2%
Simplified23.2%
Final simplification33.9%
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 (- (/ (sqrt 2.0) B_m)))
(t_2 (- (pow B_m 2.0) (* (* 4.0 A) C))))
(if (<= A -6.4e+65)
(/ (- (sqrt (* (* 2.0 (* t_2 F)) (* 2.0 C)))) t_2)
(if (<= A 8.8e-36)
(* t_1 (sqrt (* F (+ C (hypot B_m C)))))
(if (<= A 1.05e+238)
(/ (- (sqrt (* (* t_0 (* 2.0 F)) (+ A A)))) t_0)
(* t_1 (sqrt (* F (* (/ (pow B_m 2.0) C) -0.5)))))))))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 = -(sqrt(2.0) / B_m);
double t_2 = pow(B_m, 2.0) - ((4.0 * A) * C);
double tmp;
if (A <= -6.4e+65) {
tmp = -sqrt(((2.0 * (t_2 * F)) * (2.0 * C))) / t_2;
} else if (A <= 8.8e-36) {
tmp = t_1 * sqrt((F * (C + hypot(B_m, C))));
} else if (A <= 1.05e+238) {
tmp = -sqrt(((t_0 * (2.0 * F)) * (A + A))) / t_0;
} else {
tmp = t_1 * sqrt((F * ((pow(B_m, 2.0) / C) * -0.5)));
}
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(-Float64(sqrt(2.0) / B_m)) t_2 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) tmp = 0.0 if (A <= -6.4e+65) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(2.0 * C)))) / t_2); elseif (A <= 8.8e-36) tmp = Float64(t_1 * sqrt(Float64(F * Float64(C + hypot(B_m, C))))); elseif (A <= 1.05e+238) tmp = Float64(Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(A + A)))) / t_0); else tmp = Float64(t_1 * sqrt(Float64(F * Float64(Float64((B_m ^ 2.0) / C) * -0.5)))); 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[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision])}, Block[{t$95$2 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -6.4e+65], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[A, 8.8e-36], N[(t$95$1 * N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 1.05e+238], N[((-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(F * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision] * -0.5), $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)\\
t_1 := -\frac{\sqrt{2}}{B_m}\\
t_2 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;A \leq -6.4 \cdot 10^{+65}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_2}\\
\mathbf{elif}\;A \leq 8.8 \cdot 10^{-36}:\\
\;\;\;\;t_1 \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(B_m, C\right)\right)}\\
\mathbf{elif}\;A \leq 1.05 \cdot 10^{+238}:\\
\;\;\;\;\frac{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{F \cdot \left(\frac{{B_m}^{2}}{C} \cdot -0.5\right)}\\
\end{array}
\end{array}
if A < -6.40000000000000014e65Initial program 2.8%
Taylor expanded in A around -inf 33.3%
if -6.40000000000000014e65 < A < 8.7999999999999997e-36Initial program 28.7%
Taylor expanded in A around 0 15.1%
mul-1-neg15.1%
*-commutative15.1%
distribute-rgt-neg-in15.1%
unpow215.1%
unpow215.1%
hypot-def25.9%
Simplified25.9%
if 8.7999999999999997e-36 < A < 1.05000000000000004e238Initial program 34.1%
Simplified47.7%
Taylor expanded in A around inf 45.9%
distribute-rgt1-in45.9%
metadata-eval45.9%
mul0-lft45.9%
Simplified45.9%
if 1.05000000000000004e238 < A Initial program 0.9%
Taylor expanded in A around 0 3.5%
mul-1-neg3.5%
*-commutative3.5%
distribute-rgt-neg-in3.5%
unpow23.5%
unpow23.5%
hypot-def4.8%
Simplified4.8%
Taylor expanded in C around -inf 23.2%
*-commutative23.2%
Simplified23.2%
Final simplification31.4%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (+ C (hypot B_m C))))
(if (<= F -1.55e-295)
(/
(- (sqrt (* t_0 (* 2.0 (* -4.0 (* A (* C F)))))))
(- (pow B_m 2.0) (* (* 4.0 A) C)))
(if (<= F 3.6e+62)
(* (- (/ (sqrt 2.0) B_m)) (sqrt (* F t_0)))
(* (sqrt 2.0) (- (sqrt (/ F B_m))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = C + hypot(B_m, C);
double tmp;
if (F <= -1.55e-295) {
tmp = -sqrt((t_0 * (2.0 * (-4.0 * (A * (C * F)))))) / (pow(B_m, 2.0) - ((4.0 * A) * C));
} else if (F <= 3.6e+62) {
tmp = -(sqrt(2.0) / B_m) * sqrt((F * t_0));
} else {
tmp = sqrt(2.0) * -sqrt((F / B_m));
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = C + Math.hypot(B_m, C);
double tmp;
if (F <= -1.55e-295) {
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 <= 3.6e+62) {
tmp = -(Math.sqrt(2.0) / B_m) * Math.sqrt((F * t_0));
} 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): t_0 = C + math.hypot(B_m, C) tmp = 0 if F <= -1.55e-295: tmp = -math.sqrt((t_0 * (2.0 * (-4.0 * (A * (C * F)))))) / (math.pow(B_m, 2.0) - ((4.0 * A) * C)) elif F <= 3.6e+62: tmp = -(math.sqrt(2.0) / B_m) * math.sqrt((F * t_0)) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B_m)) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(C + hypot(B_m, C)) tmp = 0.0 if (F <= -1.55e-295) 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 <= 3.6e+62) tmp = Float64(Float64(-Float64(sqrt(2.0) / B_m)) * sqrt(Float64(F * t_0))); 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) t_0 = C + hypot(B_m, C); tmp = 0.0; if (F <= -1.55e-295) tmp = -sqrt((t_0 * (2.0 * (-4.0 * (A * (C * F)))))) / ((B_m ^ 2.0) - ((4.0 * A) * C)); elseif (F <= 3.6e+62) tmp = -(sqrt(2.0) / B_m) * sqrt((F * t_0)); 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_] := Block[{t$95$0 = N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.55e-295], 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, 3.6e+62], N[((-N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]) * N[Sqrt[N[(F * t$95$0), $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}
t_0 := C + \mathsf{hypot}\left(B_m, C\right)\\
\mathbf{if}\;F \leq -1.55 \cdot 10^{-295}:\\
\;\;\;\;\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 3.6 \cdot 10^{+62}:\\
\;\;\;\;\left(-\frac{\sqrt{2}}{B_m}\right) \cdot \sqrt{F \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\end{array}
\end{array}
if F < -1.5500000000000001e-295Initial program 35.5%
Taylor expanded in A around 0 19.4%
unpow219.4%
unpow219.4%
hypot-def32.6%
Simplified32.6%
Taylor expanded in B around 0 32.6%
if -1.5500000000000001e-295 < F < 3.6e62Initial program 22.5%
Taylor expanded in A around 0 12.6%
mul-1-neg12.6%
*-commutative12.6%
distribute-rgt-neg-in12.6%
unpow212.6%
unpow212.6%
hypot-def25.6%
Simplified25.6%
if 3.6e62 < F Initial program 17.8%
Taylor expanded in A around 0 7.1%
mul-1-neg7.1%
*-commutative7.1%
distribute-rgt-neg-in7.1%
unpow27.1%
unpow27.1%
hypot-def8.7%
Simplified8.7%
Taylor expanded in C around 0 14.6%
mul-1-neg14.6%
Simplified14.6%
Final simplification22.6%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 3.6e+62) (* (- (/ (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 <= 3.6e+62) {
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 = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 3.6e+62) {
tmp = -(Math.sqrt(2.0) / B_m) * Math.sqrt((F * (C + Math.hypot(B_m, C))));
} 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 <= 3.6e+62: tmp = -(math.sqrt(2.0) / B_m) * math.sqrt((F * (C + math.hypot(B_m, C)))) 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 <= 3.6e+62) tmp = Float64(Float64(-Float64(sqrt(2.0) / B_m)) * 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 = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= 3.6e+62) tmp = -(sqrt(2.0) / B_m) * sqrt((F * (C + hypot(B_m, C)))); 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, 3.6e+62], 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 3.6 \cdot 10^{+62}:\\
\;\;\;\;\left(-\frac{\sqrt{2}}{B_m}\right) \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(B_m, C\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\end{array}
\end{array}
if F < 3.6e62Initial program 24.8%
Taylor expanded in A around 0 10.5%
mul-1-neg10.5%
*-commutative10.5%
distribute-rgt-neg-in10.5%
unpow210.5%
unpow210.5%
hypot-def21.2%
Simplified21.2%
if 3.6e62 < F Initial program 17.8%
Taylor expanded in A around 0 7.1%
mul-1-neg7.1%
*-commutative7.1%
distribute-rgt-neg-in7.1%
unpow27.1%
unpow27.1%
hypot-def8.7%
Simplified8.7%
Taylor expanded in C around 0 14.6%
mul-1-neg14.6%
Simplified14.6%
Final simplification18.9%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 8.5e-60) (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ 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 <= 8.5e-60) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (B_m + C)));
} 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 <= 8.5d-60) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((f * (b_m + c)))
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 <= 8.5e-60) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (B_m + C)));
} 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 <= 8.5e-60: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (B_m + C))) 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 <= 8.5e-60) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(B_m + C))))); 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 <= 8.5e-60) tmp = (sqrt(2.0) / B_m) * -sqrt((F * (B_m + C))); 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, 8.5e-60], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(B$95$m + C), $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 8.5 \cdot 10^{-60}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(B_m + C\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\end{array}
\end{array}
if F < 8.50000000000000044e-60Initial program 24.6%
Taylor expanded in A around 0 11.1%
mul-1-neg11.1%
*-commutative11.1%
distribute-rgt-neg-in11.1%
unpow211.1%
unpow211.1%
hypot-def21.4%
Simplified21.4%
Taylor expanded in C around 0 18.1%
if 8.50000000000000044e-60 < F Initial program 20.0%
Taylor expanded in A around 0 7.3%
mul-1-neg7.3%
*-commutative7.3%
distribute-rgt-neg-in7.3%
unpow27.3%
unpow27.3%
hypot-def12.1%
Simplified12.1%
Taylor expanded in C around 0 15.1%
mul-1-neg15.1%
Simplified15.1%
Final simplification16.6%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 9e-60) (* (- (/ (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 <= 9e-60) {
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 <= 9d-60) 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 <= 9e-60) {
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 <= 9e-60: 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 <= 9e-60) 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 <= 9e-60) 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, 9e-60], 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 9 \cdot 10^{-60}:\\
\;\;\;\;\left(-\frac{\sqrt{2}}{B_m}\right) \cdot \sqrt{B_m \cdot F}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\end{array}
\end{array}
if F < 9.00000000000000001e-60Initial program 24.6%
Taylor expanded in A around 0 11.1%
mul-1-neg11.1%
*-commutative11.1%
distribute-rgt-neg-in11.1%
unpow211.1%
unpow211.1%
hypot-def21.4%
Simplified21.4%
Taylor expanded in C around 0 19.0%
if 9.00000000000000001e-60 < F Initial program 20.0%
Taylor expanded in A around 0 7.3%
mul-1-neg7.3%
*-commutative7.3%
distribute-rgt-neg-in7.3%
unpow27.3%
unpow27.3%
hypot-def12.1%
Simplified12.1%
Taylor expanded in C around 0 15.1%
mul-1-neg15.1%
Simplified15.1%
Final simplification17.1%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= C 3.8e+102) (* (sqrt 2.0) (- (sqrt (/ 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 <= 3.8e+102) {
tmp = sqrt(2.0) * -sqrt((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 <= 3.8d+102) then
tmp = sqrt(2.0d0) * -sqrt((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 <= 3.8e+102) {
tmp = Math.sqrt(2.0) * -Math.sqrt((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 <= 3.8e+102: tmp = math.sqrt(2.0) * -math.sqrt((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 <= 3.8e+102) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))); else tmp = Float64(sqrt(Float64(C * F)) * Float64(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 <= 3.8e+102) tmp = sqrt(2.0) * -sqrt((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, 3.8e+102], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $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 3.8 \cdot 10^{+102}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{C \cdot F} \cdot \frac{-2}{B_m}\\
\end{array}
\end{array}
if C < 3.79999999999999979e102Initial program 22.6%
Taylor expanded in A around 0 10.5%
mul-1-neg10.5%
*-commutative10.5%
distribute-rgt-neg-in10.5%
unpow210.5%
unpow210.5%
hypot-def17.4%
Simplified17.4%
Taylor expanded in C around 0 16.4%
mul-1-neg16.4%
Simplified16.4%
if 3.79999999999999979e102 < C Initial program 21.6%
Taylor expanded in A around 0 3.6%
mul-1-neg3.6%
*-commutative3.6%
distribute-rgt-neg-in3.6%
unpow23.6%
unpow23.6%
hypot-def14.4%
Simplified14.4%
Taylor expanded in B around 0 12.3%
mul-1-neg12.3%
*-commutative12.3%
*-commutative12.3%
unpow212.3%
rem-square-sqrt12.4%
Simplified12.4%
Final simplification15.7%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= A 4.5e-65) (* (sqrt (* C F)) (/ (- 2.0) B_m)) (* (/ 2.0 B_m) (- (sqrt (* A F))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (A <= 4.5e-65) {
tmp = sqrt((C * F)) * (-2.0 / B_m);
} else {
tmp = (2.0 / B_m) * -sqrt((A * F));
}
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 (a <= 4.5d-65) then
tmp = sqrt((c * f)) * (-2.0d0 / b_m)
else
tmp = (2.0d0 / b_m) * -sqrt((a * f))
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 (A <= 4.5e-65) {
tmp = Math.sqrt((C * F)) * (-2.0 / B_m);
} else {
tmp = (2.0 / B_m) * -Math.sqrt((A * F));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if A <= 4.5e-65: tmp = math.sqrt((C * F)) * (-2.0 / B_m) else: tmp = (2.0 / B_m) * -math.sqrt((A * F)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (A <= 4.5e-65) tmp = Float64(sqrt(Float64(C * F)) * Float64(Float64(-2.0) / B_m)); else tmp = Float64(Float64(2.0 / B_m) * Float64(-sqrt(Float64(A * F)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (A <= 4.5e-65) tmp = sqrt((C * F)) * (-2.0 / B_m); else tmp = (2.0 / B_m) * -sqrt((A * F)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[A, 4.5e-65], N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[((-2.0) / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;A \leq 4.5 \cdot 10^{-65}:\\
\;\;\;\;\sqrt{C \cdot F} \cdot \frac{-2}{B_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{B_m} \cdot \left(-\sqrt{A \cdot F}\right)\\
\end{array}
\end{array}
if A < 4.4999999999999998e-65Initial program 20.9%
Taylor expanded in A around 0 11.3%
mul-1-neg11.3%
*-commutative11.3%
distribute-rgt-neg-in11.3%
unpow211.3%
unpow211.3%
hypot-def21.1%
Simplified21.1%
Taylor expanded in B around 0 5.6%
mul-1-neg5.6%
*-commutative5.6%
*-commutative5.6%
unpow25.6%
rem-square-sqrt5.6%
Simplified5.6%
if 4.4999999999999998e-65 < A Initial program 26.2%
Taylor expanded in C around 0 5.4%
mul-1-neg5.4%
distribute-rgt-neg-in5.4%
+-commutative5.4%
unpow25.4%
unpow25.4%
hypot-def6.6%
Simplified6.6%
Taylor expanded in B around 0 3.6%
mul-1-neg3.6%
*-commutative3.6%
unpow23.6%
rem-square-sqrt3.6%
*-commutative3.6%
Simplified3.6%
Final simplification5.1%
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(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 22.4%
Taylor expanded in A around 0 9.3%
mul-1-neg9.3%
*-commutative9.3%
distribute-rgt-neg-in9.3%
unpow29.3%
unpow29.3%
hypot-def16.9%
Simplified16.9%
Taylor expanded in B around 0 4.3%
mul-1-neg4.3%
*-commutative4.3%
*-commutative4.3%
unpow24.3%
rem-square-sqrt4.3%
Simplified4.3%
Final simplification4.3%
herbie shell --seed 2024023
(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))))