
(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 13 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
(if (<= (pow B_m 2.0) 5e+157)
(/
(-
(*
(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) (* C (* A 4.0))))
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ A (hypot B_m A))) (- (sqrt F))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 5e+157) {
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) - (C * (A * 4.0)));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((A + hypot(B_m, A))) * -sqrt(F));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 5e+157) tmp = Float64(Float64(-Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * sqrt(Float64(2.0 * Float64(F * fma(B_m, B_m, Float64(A * Float64(C * -4.0)))))))) / Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(A + hypot(B_m, A))) * Float64(-sqrt(F)))); 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], 5e+157], 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[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;{B_m}^{2} \leq 5 \cdot 10^{+157}:\\
\;\;\;\;\frac{-\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B_m\right)\right)} \cdot \sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\right)}}{{B_m}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B_m, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999976e157Initial program 26.1%
sqrt-prod27.5%
associate-*r*27.5%
associate-*l*27.5%
associate-+l+27.8%
unpow227.8%
unpow227.8%
hypot-def40.2%
Applied egg-rr40.2%
*-commutative40.2%
associate-*l*40.2%
*-commutative40.2%
unpow240.2%
fma-neg40.2%
distribute-lft-neg-in40.2%
metadata-eval40.2%
*-commutative40.2%
associate-*l*40.2%
Simplified40.2%
if 4.99999999999999976e157 < (pow.f64 B 2) Initial program 6.5%
Taylor expanded in C around 0 4.4%
mul-1-neg4.4%
distribute-rgt-neg-in4.4%
+-commutative4.4%
unpow24.4%
unpow24.4%
hypot-def22.7%
Simplified22.7%
pow1/222.7%
*-commutative22.7%
metadata-eval22.7%
unpow-prod-down33.1%
metadata-eval33.1%
pow1/233.1%
metadata-eval33.1%
pow1/233.1%
Applied egg-rr33.1%
Final simplification37.9%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 5e+157)
(/
(*
(sqrt (* F (* 2.0 (fma B_m B_m (* A (* C -4.0))))))
(- (sqrt (+ (hypot (- A C) B_m) (+ A C)))))
(fma B_m B_m (* -4.0 (* A C))))
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ A (hypot B_m A))) (- (sqrt F))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 5e+157) {
tmp = (sqrt((F * (2.0 * fma(B_m, B_m, (A * (C * -4.0)))))) * -sqrt((hypot((A - C), B_m) + (A + C)))) / fma(B_m, B_m, (-4.0 * (A * C)));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((A + hypot(B_m, A))) * -sqrt(F));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 5e+157) tmp = Float64(Float64(sqrt(Float64(F * Float64(2.0 * fma(B_m, B_m, Float64(A * Float64(C * -4.0)))))) * Float64(-sqrt(Float64(hypot(Float64(A - C), B_m) + Float64(A + C))))) / fma(B_m, B_m, Float64(-4.0 * Float64(A * C)))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(A + hypot(B_m, A))) * Float64(-sqrt(F)))); 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], 5e+157], N[(N[(N[Sqrt[N[(F * N[(2.0 * N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;{B_m}^{2} \leq 5 \cdot 10^{+157}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(2 \cdot \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\right)} \cdot \left(-\sqrt{\mathsf{hypot}\left(A - C, B_m\right) + \left(A + C\right)}\right)}{\mathsf{fma}\left(B_m, B_m, -4 \cdot \left(A \cdot C\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B_m, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999976e157Initial program 26.1%
neg-sub026.1%
div-sub26.1%
associate-*l*26.1%
Applied egg-rr33.1%
div033.1%
neg-sub033.1%
distribute-neg-frac33.1%
Simplified31.8%
Applied egg-rr39.5%
if 4.99999999999999976e157 < (pow.f64 B 2) Initial program 6.5%
Taylor expanded in C around 0 4.4%
mul-1-neg4.4%
distribute-rgt-neg-in4.4%
+-commutative4.4%
unpow24.4%
unpow24.4%
hypot-def22.7%
Simplified22.7%
pow1/222.7%
*-commutative22.7%
metadata-eval22.7%
unpow-prod-down33.1%
metadata-eval33.1%
pow1/233.1%
metadata-eval33.1%
pow1/233.1%
Applied egg-rr33.1%
Final simplification37.4%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* -4.0 (* A C)))))
(if (<= (pow B_m 2.0) 1e+121)
(/ (- (sqrt (* (* 2.0 t_0) (* F (+ (hypot (- A C) B_m) (+ A 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 = fma(B_m, B_m, (-4.0 * (A * C)));
double tmp;
if (pow(B_m, 2.0) <= 1e+121) {
tmp = -sqrt(((2.0 * t_0) * (F * (hypot((A - C), B_m) + (A + 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 = fma(B_m, B_m, Float64(-4.0 * Float64(A * C))) tmp = 0.0 if ((B_m ^ 2.0) <= 1e+121) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * t_0) * Float64(F * Float64(hypot(Float64(A - C), B_m) + Float64(A + 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[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+121], N[((-N[Sqrt[N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(F * N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / 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, -4 \cdot \left(A \cdot C\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 10^{+121}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot t_0\right) \cdot \left(F \cdot \left(\mathsf{hypot}\left(A - C, B_m\right) + \left(A + C\right)\right)\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 (pow.f64 B 2) < 1.00000000000000004e121Initial program 26.7%
neg-sub026.7%
div-sub26.7%
associate-*l*26.7%
Applied egg-rr33.8%
div033.8%
neg-sub033.8%
distribute-neg-frac33.8%
Simplified32.4%
if 1.00000000000000004e121 < (pow.f64 B 2) Initial program 8.7%
Taylor expanded in C around 0 5.1%
mul-1-neg5.1%
distribute-rgt-neg-in5.1%
+-commutative5.1%
unpow25.1%
unpow25.1%
hypot-def20.6%
Simplified20.6%
pow1/220.6%
*-commutative20.6%
metadata-eval20.6%
unpow-prod-down29.4%
metadata-eval29.4%
pow1/229.4%
metadata-eval29.4%
pow1/229.4%
Applied egg-rr29.4%
Final simplification31.2%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 5e-225)
(/
(- (pow (* (pow (* -16.0 (* C F)) 0.25) (sqrt A)) 2.0))
(fma B_m B_m (* A (* C -4.0))))
(* (* (sqrt (+ A (hypot B_m A))) (sqrt F)) (/ (- (sqrt 2.0)) B_m))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 5e-225) {
tmp = -pow((pow((-16.0 * (C * F)), 0.25) * sqrt(A)), 2.0) / fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-225) tmp = Float64(Float64(-(Float64((Float64(-16.0 * Float64(C * F)) ^ 0.25) * sqrt(A)) ^ 2.0)) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-225], N[((-N[Power[N[(N[Power[N[(-16.0 * N[(C * F), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision] * N[Sqrt[A], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]) / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;{B_m}^{2} \leq 5 \cdot 10^{-225}:\\
\;\;\;\;\frac{-{\left({\left(-16 \cdot \left(C \cdot F\right)\right)}^{0.25} \cdot \sqrt{A}\right)}^{2}}{\mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B_m}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.0000000000000001e-225Initial program 24.7%
Simplified34.3%
add-sqr-sqrt34.1%
pow234.1%
Applied egg-rr34.2%
Taylor expanded in B around 0 28.6%
if 5.0000000000000001e-225 < (pow.f64 B 2) Initial program 17.2%
Taylor expanded in C around 0 9.4%
mul-1-neg9.4%
distribute-rgt-neg-in9.4%
+-commutative9.4%
unpow29.4%
unpow29.4%
hypot-def18.8%
Simplified18.8%
pow1/218.8%
*-commutative18.8%
metadata-eval18.8%
unpow-prod-down23.9%
metadata-eval23.9%
pow1/223.9%
metadata-eval23.9%
pow1/223.9%
Applied egg-rr23.9%
Final simplification25.5%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* -4.0 (* A C)))))
(if (<= (pow B_m 2.0) 2e-241)
(/ (- (sqrt (* (* 2.0 t_0) (* F (+ (* C 0.0) (* 2.0 A)))))) 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 = fma(B_m, B_m, (-4.0 * (A * C)));
double tmp;
if (pow(B_m, 2.0) <= 2e-241) {
tmp = -sqrt(((2.0 * t_0) * (F * ((C * 0.0) + (2.0 * A))))) / 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 = fma(B_m, B_m, Float64(-4.0 * Float64(A * C))) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-241) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * t_0) * Float64(F * Float64(Float64(C * 0.0) + Float64(2.0 * A)))))) / 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[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-241], N[((-N[Sqrt[N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(F * N[(N[(C * 0.0), $MachinePrecision] + N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / 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, -4 \cdot \left(A \cdot C\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-241}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot t_0\right) \cdot \left(F \cdot \left(C \cdot 0 + 2 \cdot A\right)\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 (pow.f64 B 2) < 1.9999999999999999e-241Initial program 26.3%
neg-sub026.3%
div-sub26.3%
associate-*l*26.3%
Applied egg-rr36.5%
div036.5%
neg-sub036.5%
distribute-neg-frac36.5%
Simplified34.0%
Taylor expanded in A around inf 21.5%
associate-+r+29.0%
distribute-rgt1-in29.0%
metadata-eval29.0%
Simplified29.0%
if 1.9999999999999999e-241 < (pow.f64 B 2) Initial program 16.7%
Taylor expanded in C around 0 9.1%
mul-1-neg9.1%
distribute-rgt-neg-in9.1%
+-commutative9.1%
unpow29.1%
unpow29.1%
hypot-def18.2%
Simplified18.2%
pow1/218.3%
*-commutative18.3%
metadata-eval18.3%
unpow-prod-down23.2%
metadata-eval23.2%
pow1/223.2%
metadata-eval23.2%
pow1/223.2%
Applied egg-rr23.2%
Final simplification25.0%
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.6e+60)
(/
(-
(sqrt
(*
(* t_0 (* 2.0 F))
(+ A (- (+ C (hypot B_m C)) (* (* A C) (/ -1.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 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 2.6e+60) {
tmp = -sqrt(((t_0 * (2.0 * F)) * (A + ((C + hypot(B_m, C)) - ((A * C) * (-1.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 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 2.6e+60) tmp = Float64(Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(A + Float64(Float64(C + hypot(B_m, C)) - Float64(Float64(A * C) * Float64(-1.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[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 2.6e+60], N[((-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + N[(N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * N[(-1.0 / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / 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.6 \cdot 10^{+60}:\\
\;\;\;\;\frac{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + \left(\left(C + \mathsf{hypot}\left(B_m, C\right)\right) - \left(A \cdot C\right) \cdot \frac{-1}{C}\right)\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 < 2.60000000000000008e60Initial program 23.1%
Simplified28.9%
Taylor expanded in A around 0 18.8%
associate-+r+20.3%
mul-1-neg20.3%
unsub-neg20.3%
unpow220.3%
unpow220.3%
hypot-def23.6%
*-commutative23.6%
Simplified23.6%
Taylor expanded in C around -inf 31.0%
if 2.60000000000000008e60 < B Initial program 4.9%
Taylor expanded in C around 0 9.3%
mul-1-neg9.3%
distribute-rgt-neg-in9.3%
+-commutative9.3%
unpow29.3%
unpow29.3%
hypot-def40.4%
Simplified40.4%
pow1/240.4%
*-commutative40.4%
metadata-eval40.4%
unpow-prod-down58.3%
metadata-eval58.3%
pow1/258.3%
metadata-eval58.3%
pow1/258.3%
Applied egg-rr58.3%
Final simplification36.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.6e+60)
(/ (- (sqrt (* (* t_0 (* 2.0 F)) (+ A (+ C (hypot B_m (- A 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 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 2.6e+60) {
tmp = -sqrt(((t_0 * (2.0 * F)) * (A + (C + hypot(B_m, (A - 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 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 2.6e+60) 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(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[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 2.6e+60], 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[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 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B_m \leq 2.6 \cdot 10^{+60}:\\
\;\;\;\;\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}:\\
\;\;\;\;\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 < 2.60000000000000008e60Initial program 23.1%
Simplified28.9%
if 2.60000000000000008e60 < B Initial program 4.9%
Taylor expanded in C around 0 9.3%
mul-1-neg9.3%
distribute-rgt-neg-in9.3%
+-commutative9.3%
unpow29.3%
unpow29.3%
hypot-def40.4%
Simplified40.4%
pow1/240.4%
*-commutative40.4%
metadata-eval40.4%
unpow-prod-down58.3%
metadata-eval58.3%
pow1/258.3%
metadata-eval58.3%
pow1/258.3%
Applied egg-rr58.3%
Final simplification34.4%
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 (<= F -2e-310)
(/ (- (sqrt (* (* t_0 (* 2.0 F)) (+ A A)))) t_0)
(if (<= F 5.4e+37)
(/ (* (sqrt 2.0) (- (sqrt (* F (+ A (hypot B_m A)))))) B_m)
(* (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 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (F <= -2e-310) {
tmp = -sqrt(((t_0 * (2.0 * F)) * (A + A))) / t_0;
} else if (F <= 5.4e+37) {
tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(B_m, A))))) / B_m;
} else {
tmp = sqrt(2.0) * -sqrt((F / 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 (F <= -2e-310) tmp = Float64(Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(A + A)))) / t_0); elseif (F <= 5.4e+37) tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A + hypot(B_m, A)))))) / B_m); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2e-310], N[((-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 5.4e+37], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B$95$m), $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 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;F \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t_0}\\
\mathbf{elif}\;F \leq 5.4 \cdot 10^{+37}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B_m, A\right)\right)}\right)}{B_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\end{array}
\end{array}
if F < -1.999999999999994e-310Initial program 23.6%
Simplified36.1%
Taylor expanded in A around inf 24.2%
distribute-rgt1-in24.2%
metadata-eval24.2%
mul0-lft24.2%
Simplified24.2%
if -1.999999999999994e-310 < F < 5.39999999999999973e37Initial program 18.1%
Taylor expanded in C around 0 6.2%
mul-1-neg6.2%
distribute-rgt-neg-in6.2%
+-commutative6.2%
unpow26.2%
unpow26.2%
hypot-def18.5%
Simplified18.5%
associate-*l/18.5%
Applied egg-rr18.5%
if 5.39999999999999973e37 < F Initial program 20.6%
Taylor expanded in C around 0 13.6%
mul-1-neg13.6%
distribute-rgt-neg-in13.6%
+-commutative13.6%
unpow213.6%
unpow213.6%
hypot-def13.8%
Simplified13.8%
Taylor expanded in A around 0 16.6%
mul-1-neg16.6%
Simplified16.6%
Final simplification18.5%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F -2e-310)
(/
(- (sqrt (* (* C F) (* -16.0 (pow A 2.0)))))
(fma B_m B_m (* -4.0 (* A C))))
(if (<= F 2.3e+36)
(/ (* (sqrt 2.0) (- (sqrt (* F (+ A (hypot B_m A)))))) B_m)
(* (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 <= -2e-310) {
tmp = -sqrt(((C * F) * (-16.0 * pow(A, 2.0)))) / fma(B_m, B_m, (-4.0 * (A * C)));
} else if (F <= 2.3e+36) {
tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(B_m, A))))) / B_m;
} else {
tmp = sqrt(2.0) * -sqrt((F / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -2e-310) tmp = Float64(Float64(-sqrt(Float64(Float64(C * F) * Float64(-16.0 * (A ^ 2.0))))) / fma(B_m, B_m, Float64(-4.0 * Float64(A * C)))); elseif (F <= 2.3e+36) tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A + hypot(B_m, A)))))) / B_m); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -2e-310], N[((-N[Sqrt[N[(N[(C * F), $MachinePrecision] * N[(-16.0 * N[Power[A, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.3e+36], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B$95$m), $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 -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{\left(C \cdot F\right) \cdot \left(-16 \cdot {A}^{2}\right)}}{\mathsf{fma}\left(B_m, B_m, -4 \cdot \left(A \cdot C\right)\right)}\\
\mathbf{elif}\;F \leq 2.3 \cdot 10^{+36}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B_m, A\right)\right)}\right)}{B_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\end{array}
\end{array}
if F < -1.999999999999994e-310Initial program 23.6%
neg-sub023.6%
div-sub23.6%
associate-*l*23.6%
Applied egg-rr36.1%
div036.1%
neg-sub036.1%
distribute-neg-frac36.1%
Simplified33.1%
Taylor expanded in B around 0 17.3%
associate-*r*17.7%
Simplified17.7%
if -1.999999999999994e-310 < F < 2.29999999999999996e36Initial program 18.1%
Taylor expanded in C around 0 6.2%
mul-1-neg6.2%
distribute-rgt-neg-in6.2%
+-commutative6.2%
unpow26.2%
unpow26.2%
hypot-def18.5%
Simplified18.5%
associate-*l/18.5%
Applied egg-rr18.5%
if 2.29999999999999996e36 < F Initial program 20.6%
Taylor expanded in C around 0 13.6%
mul-1-neg13.6%
distribute-rgt-neg-in13.6%
+-commutative13.6%
unpow213.6%
unpow213.6%
hypot-def13.8%
Simplified13.8%
Taylor expanded in A around 0 16.6%
mul-1-neg16.6%
Simplified16.6%
Final simplification17.7%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 4.2e+35) (* (sqrt (* F (+ A (hypot B_m A)))) (/ (- (sqrt 2.0)) B_m)) (* (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 <= 4.2e+35) {
tmp = sqrt((F * (A + hypot(B_m, A)))) * (-sqrt(2.0) / B_m);
} 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 <= 4.2e+35) {
tmp = Math.sqrt((F * (A + Math.hypot(B_m, A)))) * (-Math.sqrt(2.0) / B_m);
} 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 <= 4.2e+35: tmp = math.sqrt((F * (A + math.hypot(B_m, A)))) * (-math.sqrt(2.0) / B_m) 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 <= 4.2e+35) tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(Float64(-sqrt(2.0)) / B_m)); 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 <= 4.2e+35) tmp = sqrt((F * (A + hypot(B_m, A)))) * (-sqrt(2.0) / B_m); 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, 4.2e+35], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $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 4.2 \cdot 10^{+35}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B_m, A\right)\right)} \cdot \frac{-\sqrt{2}}{B_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\end{array}
\end{array}
if F < 4.1999999999999998e35Initial program 19.2%
Taylor expanded in C around 0 5.0%
mul-1-neg5.0%
distribute-rgt-neg-in5.0%
+-commutative5.0%
unpow25.0%
unpow25.0%
hypot-def15.0%
Simplified15.0%
if 4.1999999999999998e35 < F Initial program 20.6%
Taylor expanded in C around 0 13.6%
mul-1-neg13.6%
distribute-rgt-neg-in13.6%
+-commutative13.6%
unpow213.6%
unpow213.6%
hypot-def13.8%
Simplified13.8%
Taylor expanded in A around 0 16.6%
mul-1-neg16.6%
Simplified16.6%
Final simplification15.5%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 1.7e+38) (/ (* (sqrt 2.0) (- (sqrt (* F (+ A (hypot B_m A)))))) B_m) (* (sqrt 2.0) (- (sqrt (/ F B_m))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.7e+38) {
tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(B_m, A))))) / B_m;
} 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 <= 1.7e+38) {
tmp = (Math.sqrt(2.0) * -Math.sqrt((F * (A + Math.hypot(B_m, A))))) / B_m;
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B_m));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= 1.7e+38: tmp = (math.sqrt(2.0) * -math.sqrt((F * (A + math.hypot(B_m, A))))) / B_m else: tmp = math.sqrt(2.0) * -math.sqrt((F / B_m)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= 1.7e+38) tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A + hypot(B_m, A)))))) / B_m); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= 1.7e+38) tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(B_m, A))))) / B_m; else tmp = sqrt(2.0) * -sqrt((F / B_m)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 1.7e+38], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B$95$m), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.7 \cdot 10^{+38}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B_m, A\right)\right)}\right)}{B_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\end{array}
\end{array}
if F < 1.69999999999999998e38Initial program 19.2%
Taylor expanded in C around 0 5.0%
mul-1-neg5.0%
distribute-rgt-neg-in5.0%
+-commutative5.0%
unpow25.0%
unpow25.0%
hypot-def15.0%
Simplified15.0%
associate-*l/15.0%
Applied egg-rr15.0%
if 1.69999999999999998e38 < F Initial program 20.6%
Taylor expanded in C around 0 13.6%
mul-1-neg13.6%
distribute-rgt-neg-in13.6%
+-commutative13.6%
unpow213.6%
unpow213.6%
hypot-def13.8%
Simplified13.8%
Taylor expanded in A around 0 16.6%
mul-1-neg16.6%
Simplified16.6%
Final simplification15.5%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 1e-12) (* (/ (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 <= 1e-12) {
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 <= 1d-12) 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 <= 1e-12) {
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 <= 1e-12: 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 <= 1e-12) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-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 <= 1e-12) 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, 1e-12], 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 10^{-12}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{B_m \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\end{array}
\end{array}
if F < 9.9999999999999998e-13Initial program 20.5%
Taylor expanded in C around 0 4.1%
mul-1-neg4.1%
distribute-rgt-neg-in4.1%
+-commutative4.1%
unpow24.1%
unpow24.1%
hypot-def12.1%
Simplified12.1%
Taylor expanded in A around 0 10.7%
if 9.9999999999999998e-13 < F Initial program 18.7%
Taylor expanded in C around 0 13.0%
mul-1-neg13.0%
distribute-rgt-neg-in13.0%
+-commutative13.0%
unpow213.0%
unpow213.0%
hypot-def17.6%
Simplified17.6%
Taylor expanded in A around 0 19.4%
mul-1-neg19.4%
Simplified19.4%
Final simplification14.6%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (* (sqrt 2.0) (- (sqrt (/ F B_m)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return sqrt(2.0) * -sqrt((F / B_m));
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt(2.0d0) * -sqrt((f / b_m))
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt(2.0) * -Math.sqrt((F / B_m));
}
B_m = math.fabs(B) def code(A, B_m, C, F): return math.sqrt(2.0) * -math.sqrt((F / B_m))
B_m = abs(B) function code(A, B_m, C, F) return Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = sqrt(2.0) * -sqrt((F / B_m)); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)
\end{array}
Initial program 19.7%
Taylor expanded in C around 0 8.1%
mul-1-neg8.1%
distribute-rgt-neg-in8.1%
+-commutative8.1%
unpow28.1%
unpow28.1%
hypot-def14.5%
Simplified14.5%
Taylor expanded in A around 0 11.5%
mul-1-neg11.5%
Simplified11.5%
Final simplification11.5%
herbie shell --seed 2024024
(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))))