
(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}
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= (pow B 2.0) 1e+181)
(/
(*
(sqrt (* 2.0 (* F (fma B B (* (* A C) -4.0)))))
(- (sqrt (+ A (+ C (hypot (- A C) B))))))
(fma B B (* A (* C -4.0))))
(* (* (sqrt (+ C (hypot B C))) (sqrt F)) (/ (- (sqrt 2.0)) B))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 1e+181) {
tmp = (sqrt((2.0 * (F * fma(B, B, ((A * C) * -4.0))))) * -sqrt((A + (C + hypot((A - C), B))))) / fma(B, B, (A * (C * -4.0)));
} else {
tmp = (sqrt((C + hypot(B, C))) * sqrt(F)) * (-sqrt(2.0) / B);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 1e+181) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B, B, Float64(Float64(A * C) * -4.0))))) * Float64(-sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B)))))) / fma(B, B, Float64(A * Float64(C * -4.0)))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B, C))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+181], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B * B + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 10^{+181}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\right)\right)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.9999999999999992e180Initial program 23.8%
Simplified34.2%
associate-*r*34.2%
associate-+r+32.7%
hypot-udef23.8%
unpow223.8%
unpow223.8%
+-commutative23.8%
sqrt-prod27.1%
*-commutative27.1%
associate-*r*27.1%
associate-+l+27.4%
Applied egg-rr41.2%
if 9.9999999999999992e180 < (pow.f64 B 2) Initial program 5.8%
Taylor expanded in A around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
unpow25.8%
unpow25.8%
hypot-def26.0%
Simplified26.0%
pow1/226.0%
*-commutative26.0%
unpow-prod-down36.1%
pow1/236.1%
pow1/236.1%
Applied egg-rr36.1%
Final simplification39.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))) (t_1 (- (pow B 2.0) (* C (* A 4.0)))))
(if (<= (pow B 2.0) 1.5e-139)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A A))))) t_0)
(if (<= (pow B 2.0) 1e-18)
(/ (- (sqrt (* (* 2.0 (* F t_1)) (* 2.0 C)))) t_1)
(* (* (sqrt F) (sqrt (/ 1.0 B))) (- (sqrt 2.0)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double t_1 = pow(B, 2.0) - (C * (A * 4.0));
double tmp;
if (pow(B, 2.0) <= 1.5e-139) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + A)))) / t_0;
} else if (pow(B, 2.0) <= 1e-18) {
tmp = -sqrt(((2.0 * (F * t_1)) * (2.0 * C))) / t_1;
} else {
tmp = (sqrt(F) * sqrt((1.0 / B))) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0))) tmp = 0.0 if ((B ^ 2.0) <= 1.5e-139) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + A))))) / t_0); elseif ((B ^ 2.0) <= 1e-18) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(2.0 * C)))) / t_1); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(1.0 / B))) * Float64(-sqrt(2.0))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1.5e-139], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e-18], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(1.0 / B), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := {B}^{2} - C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;{B}^{2} \leq 1.5 \cdot 10^{-139}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 10^{-18}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(2 \cdot C\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{\frac{1}{B}}\right) \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.5e-139Initial program 15.9%
Simplified27.4%
Taylor expanded in A around inf 26.4%
distribute-rgt1-in26.4%
metadata-eval26.4%
mul0-lft26.4%
Simplified26.4%
if 1.5e-139 < (pow.f64 B 2) < 1.0000000000000001e-18Initial program 36.2%
Taylor expanded in A around -inf 43.7%
if 1.0000000000000001e-18 < (pow.f64 B 2) Initial program 13.2%
Taylor expanded in A around 0 7.3%
mul-1-neg7.3%
*-commutative7.3%
distribute-rgt-neg-in7.3%
unpow27.3%
unpow27.3%
hypot-def22.4%
Simplified22.4%
Taylor expanded in C around 0 19.1%
mul-1-neg19.1%
Simplified19.1%
pow1/219.1%
div-inv19.1%
unpow-prod-down26.5%
pow1/226.5%
Applied egg-rr26.5%
unpow1/226.5%
Simplified26.5%
Final simplification28.6%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 1e+181)
(/ (- (sqrt (* (* 2.0 t_0) (* F (+ A (+ C (hypot (- A C) B))))))) t_0)
(* (* (sqrt (+ C (hypot B C))) (sqrt F)) (/ (- (sqrt 2.0)) B)))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 1e+181) {
tmp = -sqrt(((2.0 * t_0) * (F * (A + (C + hypot((A - C), B)))))) / t_0;
} else {
tmp = (sqrt((C + hypot(B, C))) * sqrt(F)) * (-sqrt(2.0) / B);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 1e+181) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * t_0) * Float64(F * Float64(A + Float64(C + hypot(Float64(A - C), B))))))) / t_0); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B, C))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+181], 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 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 10^{+181}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot t_0\right) \cdot \left(F \cdot \left(A + \left(C + \mathsf{hypot}\left(A - C, B\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.9999999999999992e180Initial program 23.8%
neg-sub023.8%
div-sub23.8%
associate-*l*23.8%
Applied egg-rr34.1%
div034.1%
neg-sub034.1%
distribute-neg-frac34.1%
Simplified34.8%
if 9.9999999999999992e180 < (pow.f64 B 2) Initial program 5.8%
Taylor expanded in A around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
unpow25.8%
unpow25.8%
hypot-def26.0%
Simplified26.0%
pow1/226.0%
*-commutative26.0%
unpow-prod-down36.1%
pow1/236.1%
pow1/236.1%
Applied egg-rr36.1%
Final simplification35.3%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* C (* A 4.0)))) (t_1 (fma B B (* A (* C -4.0)))))
(if (<= B 3.9e-70)
(/ (- (sqrt (* (* F t_1) (* 2.0 (+ A A))))) t_1)
(if (<= B 3.1e-22)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 C)))) t_0)
(if (<= B 2e+29)
(/ (- (sqrt (* F (* t_1 (* 2.0 (+ (hypot (- A C) B) (+ A C))))))) t_1)
(* (* (sqrt (+ C (hypot B C))) (sqrt F)) (/ (- (sqrt 2.0)) B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - (C * (A * 4.0));
double t_1 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (B <= 3.9e-70) {
tmp = -sqrt(((F * t_1) * (2.0 * (A + A)))) / t_1;
} else if (B <= 3.1e-22) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else if (B <= 2e+29) {
tmp = -sqrt((F * (t_1 * (2.0 * (hypot((A - C), B) + (A + C)))))) / t_1;
} else {
tmp = (sqrt((C + hypot(B, C))) * sqrt(F)) * (-sqrt(2.0) / B);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0))) t_1 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B <= 3.9e-70) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_1) * Float64(2.0 * Float64(A + A))))) / t_1); elseif (B <= 3.1e-22) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * C)))) / t_0); elseif (B <= 2e+29) tmp = Float64(Float64(-sqrt(Float64(F * Float64(t_1 * Float64(2.0 * Float64(hypot(Float64(A - C), B) + Float64(A + C))))))) / t_1); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B, C))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 3.9e-70], N[((-N[Sqrt[N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 3.1e-22], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2e+29], N[((-N[Sqrt[N[(F * N[(t$95$1 * N[(2.0 * N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := {B}^{2} - C \cdot \left(A \cdot 4\right)\\
t_1 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B \leq 3.9 \cdot 10^{-70}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_1\right) \cdot \left(2 \cdot \left(A + A\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 3.1 \cdot 10^{-22}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2 \cdot 10^{+29}:\\
\;\;\;\;\frac{-\sqrt{F \cdot \left(t_1 \cdot \left(2 \cdot \left(\mathsf{hypot}\left(A - C, B\right) + \left(A + C\right)\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < 3.90000000000000019e-70Initial program 17.9%
Simplified25.2%
Taylor expanded in A around inf 18.2%
distribute-rgt1-in18.2%
metadata-eval18.2%
mul0-lft18.2%
Simplified18.2%
if 3.90000000000000019e-70 < B < 3.10000000000000013e-22Initial program 28.3%
Taylor expanded in A around -inf 41.4%
if 3.10000000000000013e-22 < B < 1.99999999999999983e29Initial program 21.9%
neg-sub021.9%
div-sub21.9%
associate-*l*21.9%
Applied egg-rr40.8%
Simplified41.3%
if 1.99999999999999983e29 < B Initial program 8.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-def50.1%
Simplified50.1%
pow1/250.1%
*-commutative50.1%
unpow-prod-down69.4%
pow1/269.4%
pow1/269.4%
Applied egg-rr69.4%
Final simplification30.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* C (* A 4.0)))) (t_1 (fma B B (* A (* C -4.0)))))
(if (<= B 3.9e-70)
(/ (- (sqrt (* (* F t_1) (* 2.0 (+ A A))))) t_1)
(if (<= B 8e-23)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 C)))) t_0)
(* (* (sqrt (+ C (hypot B C))) (sqrt F)) (/ (- (sqrt 2.0)) B))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - (C * (A * 4.0));
double t_1 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (B <= 3.9e-70) {
tmp = -sqrt(((F * t_1) * (2.0 * (A + A)))) / t_1;
} else if (B <= 8e-23) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else {
tmp = (sqrt((C + hypot(B, C))) * sqrt(F)) * (-sqrt(2.0) / B);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0))) t_1 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B <= 3.9e-70) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_1) * Float64(2.0 * Float64(A + A))))) / t_1); elseif (B <= 8e-23) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * C)))) / t_0); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B, C))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 3.9e-70], N[((-N[Sqrt[N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 8e-23], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := {B}^{2} - C \cdot \left(A \cdot 4\right)\\
t_1 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B \leq 3.9 \cdot 10^{-70}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_1\right) \cdot \left(2 \cdot \left(A + A\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 8 \cdot 10^{-23}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < 3.90000000000000019e-70Initial program 17.9%
Simplified25.2%
Taylor expanded in A around inf 18.2%
distribute-rgt1-in18.2%
metadata-eval18.2%
mul0-lft18.2%
Simplified18.2%
if 3.90000000000000019e-70 < B < 7.99999999999999968e-23Initial program 28.3%
Taylor expanded in A around -inf 41.4%
if 7.99999999999999968e-23 < B Initial program 10.8%
Taylor expanded in A around 0 14.3%
mul-1-neg14.3%
*-commutative14.3%
distribute-rgt-neg-in14.3%
unpow214.3%
unpow214.3%
hypot-def47.2%
Simplified47.2%
pow1/247.2%
*-commutative47.2%
unpow-prod-down63.3%
pow1/263.3%
pow1/263.3%
Applied egg-rr63.3%
Final simplification30.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* C (* A 4.0))))
(t_1 (/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 C)))) t_0)))
(if (<= B 1.36e-155)
t_1
(if (<= B 3.5e-70)
(/ (- (sqrt (* (* 2.0 (* F (* C (* A -4.0)))) (+ A (hypot B A))))) t_0)
(if (<= B 4.8e-7)
t_1
(* (* (sqrt F) (sqrt (/ 1.0 B))) (- (sqrt 2.0))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - (C * (A * 4.0));
double t_1 = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
double tmp;
if (B <= 1.36e-155) {
tmp = t_1;
} else if (B <= 3.5e-70) {
tmp = -sqrt(((2.0 * (F * (C * (A * -4.0)))) * (A + hypot(B, A)))) / t_0;
} else if (B <= 4.8e-7) {
tmp = t_1;
} else {
tmp = (sqrt(F) * sqrt((1.0 / B))) * -sqrt(2.0);
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - (C * (A * 4.0));
double t_1 = -Math.sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
double tmp;
if (B <= 1.36e-155) {
tmp = t_1;
} else if (B <= 3.5e-70) {
tmp = -Math.sqrt(((2.0 * (F * (C * (A * -4.0)))) * (A + Math.hypot(B, A)))) / t_0;
} else if (B <= 4.8e-7) {
tmp = t_1;
} else {
tmp = (Math.sqrt(F) * Math.sqrt((1.0 / B))) * -Math.sqrt(2.0);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = math.pow(B, 2.0) - (C * (A * 4.0)) t_1 = -math.sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0 tmp = 0 if B <= 1.36e-155: tmp = t_1 elif B <= 3.5e-70: tmp = -math.sqrt(((2.0 * (F * (C * (A * -4.0)))) * (A + math.hypot(B, A)))) / t_0 elif B <= 4.8e-7: tmp = t_1 else: tmp = (math.sqrt(F) * math.sqrt((1.0 / B))) * -math.sqrt(2.0) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0))) t_1 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * C)))) / t_0) tmp = 0.0 if (B <= 1.36e-155) tmp = t_1; elseif (B <= 3.5e-70) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * Float64(C * Float64(A * -4.0)))) * Float64(A + hypot(B, A))))) / t_0); elseif (B <= 4.8e-7) tmp = t_1; else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(1.0 / B))) * Float64(-sqrt(2.0))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B ^ 2.0) - (C * (A * 4.0)); t_1 = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0; tmp = 0.0; if (B <= 1.36e-155) tmp = t_1; elseif (B <= 3.5e-70) tmp = -sqrt(((2.0 * (F * (C * (A * -4.0)))) * (A + hypot(B, A)))) / t_0; elseif (B <= 4.8e-7) tmp = t_1; else tmp = (sqrt(F) * sqrt((1.0 / B))) * -sqrt(2.0); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B, 1.36e-155], t$95$1, If[LessEqual[B, 3.5e-70], N[((-N[Sqrt[N[(N[(2.0 * N[(F * N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 4.8e-7], t$95$1, N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(1.0 / B), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := {B}^{2} - C \cdot \left(A \cdot 4\right)\\
t_1 := \frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{if}\;B \leq 1.36 \cdot 10^{-155}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 3.5 \cdot 10^{-70}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot \left(C \cdot \left(A \cdot -4\right)\right)\right)\right) \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 4.8 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{\frac{1}{B}}\right) \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < 1.35999999999999996e-155 or 3.49999999999999974e-70 < B < 4.79999999999999957e-7Initial program 19.1%
Taylor expanded in A around -inf 17.2%
if 1.35999999999999996e-155 < B < 3.49999999999999974e-70Initial program 14.0%
Taylor expanded in C around 0 25.6%
+-commutative25.6%
unpow225.6%
unpow225.6%
hypot-def31.2%
Simplified31.2%
Taylor expanded in B around 0 31.2%
*-commutative31.2%
metadata-eval31.2%
distribute-rgt-neg-in31.2%
*-commutative31.2%
associate-*r*31.2%
*-commutative31.2%
distribute-lft-neg-out31.2%
*-commutative31.2%
distribute-rgt-neg-in31.2%
metadata-eval31.2%
Simplified31.2%
if 4.79999999999999957e-7 < B Initial program 11.0%
Taylor expanded in A around 0 14.6%
mul-1-neg14.6%
*-commutative14.6%
distribute-rgt-neg-in14.6%
unpow214.6%
unpow214.6%
hypot-def47.0%
Simplified47.0%
Taylor expanded in C around 0 41.0%
mul-1-neg41.0%
Simplified41.0%
pow1/241.0%
div-inv41.0%
unpow-prod-down59.4%
pow1/259.4%
Applied egg-rr59.4%
unpow1/259.4%
Simplified59.4%
Final simplification27.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= F 1.9e-307)
(/
(- (sqrt (* (* 2.0 (* F (* C (* A -4.0)))) (+ A (hypot B A)))))
(- (pow B 2.0) (* C (* A 4.0))))
(if (<= F 2.65e+23)
(* (/ t_0 B) (sqrt (* F (+ C (hypot B C)))))
(* (* (sqrt F) (sqrt (/ 1.0 B))) t_0)))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (F <= 1.9e-307) {
tmp = -sqrt(((2.0 * (F * (C * (A * -4.0)))) * (A + hypot(B, A)))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else if (F <= 2.65e+23) {
tmp = (t_0 / B) * sqrt((F * (C + hypot(B, C))));
} else {
tmp = (sqrt(F) * sqrt((1.0 / B))) * t_0;
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double tmp;
if (F <= 1.9e-307) {
tmp = -Math.sqrt(((2.0 * (F * (C * (A * -4.0)))) * (A + Math.hypot(B, A)))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else if (F <= 2.65e+23) {
tmp = (t_0 / B) * Math.sqrt((F * (C + Math.hypot(B, C))));
} else {
tmp = (Math.sqrt(F) * Math.sqrt((1.0 / B))) * t_0;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if F <= 1.9e-307: tmp = -math.sqrt(((2.0 * (F * (C * (A * -4.0)))) * (A + math.hypot(B, A)))) / (math.pow(B, 2.0) - (C * (A * 4.0))) elif F <= 2.65e+23: tmp = (t_0 / B) * math.sqrt((F * (C + math.hypot(B, C)))) else: tmp = (math.sqrt(F) * math.sqrt((1.0 / B))) * t_0 return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (F <= 1.9e-307) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * Float64(C * Float64(A * -4.0)))) * Float64(A + hypot(B, A))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); elseif (F <= 2.65e+23) tmp = Float64(Float64(t_0 / B) * sqrt(Float64(F * Float64(C + hypot(B, C))))); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(1.0 / B))) * t_0); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = -sqrt(2.0); tmp = 0.0; if (F <= 1.9e-307) tmp = -sqrt(((2.0 * (F * (C * (A * -4.0)))) * (A + hypot(B, A)))) / ((B ^ 2.0) - (C * (A * 4.0))); elseif (F <= 2.65e+23) tmp = (t_0 / B) * sqrt((F * (C + hypot(B, C)))); else tmp = (sqrt(F) * sqrt((1.0 / B))) * t_0; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 1.9e-307], N[((-N[Sqrt[N[(N[(2.0 * N[(F * N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.65e+23], N[(N[(t$95$0 / B), $MachinePrecision] * N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(1.0 / B), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 1.9 \cdot 10^{-307}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot \left(C \cdot \left(A \cdot -4\right)\right)\right)\right) \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{elif}\;F \leq 2.65 \cdot 10^{+23}:\\
\;\;\;\;\frac{t_0}{B} \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{\frac{1}{B}}\right) \cdot t_0\\
\end{array}
\end{array}
if F < 1.89999999999999993e-307Initial program 26.8%
Taylor expanded in C around 0 20.1%
+-commutative20.1%
unpow220.1%
unpow220.1%
hypot-def29.5%
Simplified29.5%
Taylor expanded in B around 0 28.4%
*-commutative28.4%
metadata-eval28.4%
distribute-rgt-neg-in28.4%
*-commutative28.4%
associate-*r*28.4%
*-commutative28.4%
distribute-lft-neg-out28.4%
*-commutative28.4%
distribute-rgt-neg-in28.4%
metadata-eval28.4%
Simplified28.4%
if 1.89999999999999993e-307 < F < 2.6500000000000001e23Initial program 17.0%
Taylor expanded in A around 0 7.6%
mul-1-neg7.6%
*-commutative7.6%
distribute-rgt-neg-in7.6%
unpow27.6%
unpow27.6%
hypot-def25.3%
Simplified25.3%
if 2.6500000000000001e23 < F Initial program 12.7%
Taylor expanded in A around 0 5.9%
mul-1-neg5.9%
*-commutative5.9%
distribute-rgt-neg-in5.9%
unpow25.9%
unpow25.9%
hypot-def6.3%
Simplified6.3%
Taylor expanded in C around 0 14.7%
mul-1-neg14.7%
Simplified14.7%
pow1/215.3%
div-inv15.3%
unpow-prod-down14.8%
pow1/214.8%
Applied egg-rr14.8%
unpow1/214.8%
Simplified14.8%
Final simplification21.9%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= F 1.55e+25)
(* (/ t_0 B) (sqrt (* F (+ C (hypot B C)))))
(* (* (sqrt F) (sqrt (/ 1.0 B))) t_0))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (F <= 1.55e+25) {
tmp = (t_0 / B) * sqrt((F * (C + hypot(B, C))));
} else {
tmp = (sqrt(F) * sqrt((1.0 / B))) * t_0;
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double tmp;
if (F <= 1.55e+25) {
tmp = (t_0 / B) * Math.sqrt((F * (C + Math.hypot(B, C))));
} else {
tmp = (Math.sqrt(F) * Math.sqrt((1.0 / B))) * t_0;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if F <= 1.55e+25: tmp = (t_0 / B) * math.sqrt((F * (C + math.hypot(B, C)))) else: tmp = (math.sqrt(F) * math.sqrt((1.0 / B))) * t_0 return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (F <= 1.55e+25) tmp = Float64(Float64(t_0 / B) * sqrt(Float64(F * Float64(C + hypot(B, C))))); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(1.0 / B))) * t_0); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = -sqrt(2.0); tmp = 0.0; if (F <= 1.55e+25) tmp = (t_0 / B) * sqrt((F * (C + hypot(B, C)))); else tmp = (sqrt(F) * sqrt((1.0 / B))) * t_0; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 1.55e+25], N[(N[(t$95$0 / B), $MachinePrecision] * N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(1.0 / B), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 1.55 \cdot 10^{+25}:\\
\;\;\;\;\frac{t_0}{B} \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{\frac{1}{B}}\right) \cdot t_0\\
\end{array}
\end{array}
if F < 1.5499999999999999e25Initial program 19.5%
Taylor expanded in A around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
unpow25.8%
unpow25.8%
hypot-def18.9%
Simplified18.9%
if 1.5499999999999999e25 < F Initial program 12.7%
Taylor expanded in A around 0 5.9%
mul-1-neg5.9%
*-commutative5.9%
distribute-rgt-neg-in5.9%
unpow25.9%
unpow25.9%
hypot-def6.3%
Simplified6.3%
Taylor expanded in C around 0 14.7%
mul-1-neg14.7%
Simplified14.7%
pow1/215.3%
div-inv15.3%
unpow-prod-down14.8%
pow1/214.8%
Applied egg-rr14.8%
unpow1/214.8%
Simplified14.8%
Final simplification17.4%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= C 4.7e+190) (* (* (sqrt F) (sqrt (/ 1.0 B))) (- (sqrt 2.0))) (/ (* -2.0 (sqrt (* F C))) B)))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (C <= 4.7e+190) {
tmp = (sqrt(F) * sqrt((1.0 / B))) * -sqrt(2.0);
} else {
tmp = (-2.0 * sqrt((F * C))) / B;
}
return tmp;
}
NOTE: B should be positive before calling this function
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) :: tmp
if (c <= 4.7d+190) then
tmp = (sqrt(f) * sqrt((1.0d0 / b))) * -sqrt(2.0d0)
else
tmp = ((-2.0d0) * sqrt((f * c))) / b
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (C <= 4.7e+190) {
tmp = (Math.sqrt(F) * Math.sqrt((1.0 / B))) * -Math.sqrt(2.0);
} else {
tmp = (-2.0 * Math.sqrt((F * C))) / B;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if C <= 4.7e+190: tmp = (math.sqrt(F) * math.sqrt((1.0 / B))) * -math.sqrt(2.0) else: tmp = (-2.0 * math.sqrt((F * C))) / B return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (C <= 4.7e+190) tmp = Float64(Float64(sqrt(F) * sqrt(Float64(1.0 / B))) * Float64(-sqrt(2.0))); else tmp = Float64(Float64(-2.0 * sqrt(Float64(F * C))) / B); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (C <= 4.7e+190) tmp = (sqrt(F) * sqrt((1.0 / B))) * -sqrt(2.0); else tmp = (-2.0 * sqrt((F * C))) / B; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[C, 4.7e+190], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(1.0 / B), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[(-2.0 * N[Sqrt[N[(F * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 4.7 \cdot 10^{+190}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{\frac{1}{B}}\right) \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \sqrt{F \cdot C}}{B}\\
\end{array}
\end{array}
if C < 4.6999999999999998e190Initial program 18.9%
Taylor expanded in A around 0 6.5%
mul-1-neg6.5%
*-commutative6.5%
distribute-rgt-neg-in6.5%
unpow26.5%
unpow26.5%
hypot-def14.1%
Simplified14.1%
Taylor expanded in C around 0 12.1%
mul-1-neg12.1%
Simplified12.1%
pow1/212.4%
div-inv12.4%
unpow-prod-down16.3%
pow1/216.3%
Applied egg-rr16.3%
unpow1/216.3%
Simplified16.3%
if 4.6999999999999998e190 < C Initial program 1.8%
Taylor expanded in A around 0 0.9%
mul-1-neg0.9%
*-commutative0.9%
distribute-rgt-neg-in0.9%
unpow20.9%
unpow20.9%
hypot-def14.7%
Simplified14.7%
pow1/215.6%
*-commutative15.6%
unpow-prod-down14.7%
pow1/214.7%
pow1/214.7%
Applied egg-rr14.7%
Taylor expanded in B around 0 11.5%
mul-1-neg11.5%
associate-*l/11.5%
distribute-neg-frac11.5%
unpow211.5%
rem-square-sqrt11.7%
distribute-rgt-neg-out11.7%
neg-mul-111.7%
associate-*r*11.7%
metadata-eval11.7%
*-commutative11.7%
Simplified11.7%
Final simplification15.8%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= C 1.2e+192) (* (/ (sqrt F) (sqrt B)) (- (sqrt 2.0))) (/ (* -2.0 (sqrt (* F C))) B)))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (C <= 1.2e+192) {
tmp = (sqrt(F) / sqrt(B)) * -sqrt(2.0);
} else {
tmp = (-2.0 * sqrt((F * C))) / B;
}
return tmp;
}
NOTE: B should be positive before calling this function
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) :: tmp
if (c <= 1.2d+192) then
tmp = (sqrt(f) / sqrt(b)) * -sqrt(2.0d0)
else
tmp = ((-2.0d0) * sqrt((f * c))) / b
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (C <= 1.2e+192) {
tmp = (Math.sqrt(F) / Math.sqrt(B)) * -Math.sqrt(2.0);
} else {
tmp = (-2.0 * Math.sqrt((F * C))) / B;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if C <= 1.2e+192: tmp = (math.sqrt(F) / math.sqrt(B)) * -math.sqrt(2.0) else: tmp = (-2.0 * math.sqrt((F * C))) / B return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (C <= 1.2e+192) tmp = Float64(Float64(sqrt(F) / sqrt(B)) * Float64(-sqrt(2.0))); else tmp = Float64(Float64(-2.0 * sqrt(Float64(F * C))) / B); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (C <= 1.2e+192) tmp = (sqrt(F) / sqrt(B)) * -sqrt(2.0); else tmp = (-2.0 * sqrt((F * C))) / B; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[C, 1.2e+192], N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[(-2.0 * N[Sqrt[N[(F * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 1.2 \cdot 10^{+192}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{B}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \sqrt{F \cdot C}}{B}\\
\end{array}
\end{array}
if C < 1.1999999999999999e192Initial program 18.9%
Taylor expanded in A around 0 6.5%
mul-1-neg6.5%
*-commutative6.5%
distribute-rgt-neg-in6.5%
unpow26.5%
unpow26.5%
hypot-def14.1%
Simplified14.1%
Taylor expanded in C around 0 12.1%
mul-1-neg12.1%
Simplified12.1%
sqrt-div16.3%
Applied egg-rr16.3%
if 1.1999999999999999e192 < C Initial program 1.8%
Taylor expanded in A around 0 0.9%
mul-1-neg0.9%
*-commutative0.9%
distribute-rgt-neg-in0.9%
unpow20.9%
unpow20.9%
hypot-def14.7%
Simplified14.7%
pow1/215.6%
*-commutative15.6%
unpow-prod-down14.7%
pow1/214.7%
pow1/214.7%
Applied egg-rr14.7%
Taylor expanded in B around 0 11.5%
mul-1-neg11.5%
associate-*l/11.5%
distribute-neg-frac11.5%
unpow211.5%
rem-square-sqrt11.7%
distribute-rgt-neg-out11.7%
neg-mul-111.7%
associate-*r*11.7%
metadata-eval11.7%
*-commutative11.7%
Simplified11.7%
Final simplification15.8%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= F 400000.0) (* (/ (- (sqrt 2.0)) B) (sqrt (* B F))) (- (sqrt (/ (* 2.0 F) B)))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 400000.0) {
tmp = (-sqrt(2.0) / B) * sqrt((B * F));
} else {
tmp = -sqrt(((2.0 * F) / B));
}
return tmp;
}
NOTE: B should be positive before calling this function
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) :: tmp
if (f <= 400000.0d0) then
tmp = (-sqrt(2.0d0) / b) * sqrt((b * f))
else
tmp = -sqrt(((2.0d0 * f) / b))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 400000.0) {
tmp = (-Math.sqrt(2.0) / B) * Math.sqrt((B * F));
} else {
tmp = -Math.sqrt(((2.0 * F) / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 400000.0: tmp = (-math.sqrt(2.0) / B) * math.sqrt((B * F)) else: tmp = -math.sqrt(((2.0 * F) / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 400000.0) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(B * F))); else tmp = Float64(-sqrt(Float64(Float64(2.0 * F) / B))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 400000.0) tmp = (-sqrt(2.0) / B) * sqrt((B * F)); else tmp = -sqrt(((2.0 * F) / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 400000.0], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 400000:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{B \cdot F}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{\frac{2 \cdot F}{B}}\\
\end{array}
\end{array}
if F < 4e5Initial program 19.6%
Taylor expanded in A around 0 5.9%
mul-1-neg5.9%
*-commutative5.9%
distribute-rgt-neg-in5.9%
unpow25.9%
unpow25.9%
hypot-def18.2%
Simplified18.2%
Taylor expanded in C around 0 15.6%
if 4e5 < F Initial program 12.9%
Taylor expanded in A around 0 5.7%
mul-1-neg5.7%
*-commutative5.7%
distribute-rgt-neg-in5.7%
unpow25.7%
unpow25.7%
hypot-def8.2%
Simplified8.2%
Taylor expanded in C around 0 16.0%
mul-1-neg16.0%
Simplified16.0%
expm1-log1p-u15.7%
expm1-udef7.4%
pow1/28.0%
pow1/28.0%
metadata-eval8.0%
metadata-eval8.0%
sqrt-pow28.0%
pow-prod-down8.0%
pow1/27.4%
sqrt-pow27.4%
metadata-eval7.4%
metadata-eval7.4%
Applied egg-rr7.4%
expm1-def15.7%
expm1-log1p16.1%
associate-*l/16.1%
Simplified16.1%
Final simplification15.8%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= C 9.5e+188) (- (sqrt (/ (* 2.0 F) B))) (/ (* -2.0 (sqrt (* F C))) B)))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (C <= 9.5e+188) {
tmp = -sqrt(((2.0 * F) / B));
} else {
tmp = (-2.0 * sqrt((F * C))) / B;
}
return tmp;
}
NOTE: B should be positive before calling this function
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) :: tmp
if (c <= 9.5d+188) then
tmp = -sqrt(((2.0d0 * f) / b))
else
tmp = ((-2.0d0) * sqrt((f * c))) / b
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (C <= 9.5e+188) {
tmp = -Math.sqrt(((2.0 * F) / B));
} else {
tmp = (-2.0 * Math.sqrt((F * C))) / B;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if C <= 9.5e+188: tmp = -math.sqrt(((2.0 * F) / B)) else: tmp = (-2.0 * math.sqrt((F * C))) / B return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (C <= 9.5e+188) tmp = Float64(-sqrt(Float64(Float64(2.0 * F) / B))); else tmp = Float64(Float64(-2.0 * sqrt(Float64(F * C))) / B); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (C <= 9.5e+188) tmp = -sqrt(((2.0 * F) / B)); else tmp = (-2.0 * sqrt((F * C))) / B; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[C, 9.5e+188], (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision]), N[(N[(-2.0 * N[Sqrt[N[(F * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 9.5 \cdot 10^{+188}:\\
\;\;\;\;-\sqrt{\frac{2 \cdot F}{B}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \sqrt{F \cdot C}}{B}\\
\end{array}
\end{array}
if C < 9.4999999999999996e188Initial program 18.9%
Taylor expanded in A around 0 6.5%
mul-1-neg6.5%
*-commutative6.5%
distribute-rgt-neg-in6.5%
unpow26.5%
unpow26.5%
hypot-def14.1%
Simplified14.1%
Taylor expanded in C around 0 12.1%
mul-1-neg12.1%
Simplified12.1%
expm1-log1p-u11.9%
expm1-udef5.4%
pow1/25.6%
pow1/25.6%
metadata-eval5.6%
metadata-eval5.6%
sqrt-pow25.6%
pow-prod-down5.6%
pow1/25.4%
sqrt-pow25.4%
metadata-eval5.4%
metadata-eval5.4%
Applied egg-rr5.4%
expm1-def12.0%
expm1-log1p12.2%
associate-*l/12.2%
Simplified12.2%
if 9.4999999999999996e188 < C Initial program 1.8%
Taylor expanded in A around 0 0.9%
mul-1-neg0.9%
*-commutative0.9%
distribute-rgt-neg-in0.9%
unpow20.9%
unpow20.9%
hypot-def14.7%
Simplified14.7%
pow1/215.6%
*-commutative15.6%
unpow-prod-down14.7%
pow1/214.7%
pow1/214.7%
Applied egg-rr14.7%
Taylor expanded in B around 0 11.5%
mul-1-neg11.5%
associate-*l/11.5%
distribute-neg-frac11.5%
unpow211.5%
rem-square-sqrt11.7%
distribute-rgt-neg-out11.7%
neg-mul-111.7%
associate-*r*11.7%
metadata-eval11.7%
*-commutative11.7%
Simplified11.7%
Final simplification12.2%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (- (sqrt (/ (* 2.0 F) B))))
B = abs(B);
double code(double A, double B, double C, double F) {
return -sqrt(((2.0 * F) / B));
}
NOTE: B should be positive before calling this function
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
code = -sqrt(((2.0d0 * f) / b))
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return -Math.sqrt(((2.0 * F) / B));
}
B = abs(B) def code(A, B, C, F): return -math.sqrt(((2.0 * F) / B))
B = abs(B) function code(A, B, C, F) return Float64(-sqrt(Float64(Float64(2.0 * F) / B))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = -sqrt(((2.0 * F) / B)); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B = |B|\\
\\
-\sqrt{\frac{2 \cdot F}{B}}
\end{array}
Initial program 17.0%
Taylor expanded in A around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
unpow25.8%
unpow25.8%
hypot-def14.2%
Simplified14.2%
Taylor expanded in C around 0 11.3%
mul-1-neg11.3%
Simplified11.3%
expm1-log1p-u11.2%
expm1-udef4.9%
pow1/25.2%
pow1/25.2%
metadata-eval5.2%
metadata-eval5.2%
sqrt-pow25.2%
pow-prod-down5.2%
pow1/24.9%
sqrt-pow24.9%
metadata-eval4.9%
metadata-eval4.9%
Applied egg-rr4.9%
expm1-def11.2%
expm1-log1p11.4%
associate-*l/11.4%
Simplified11.4%
Final simplification11.4%
herbie shell --seed 2023310
(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))))