
(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
(if (<= (pow B_m 2.0) 5e+131)
(/
(*
(sqrt (* 2.0 (* (fma B_m B_m (* C (* A -4.0))) F)))
(- (sqrt (+ A (+ C (hypot B_m (- A C)))))))
(fma B_m B_m (* A (* C -4.0))))
(* (* (sqrt (+ C (hypot B_m C))) (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+131) {
tmp = (sqrt((2.0 * (fma(B_m, B_m, (C * (A * -4.0))) * F))) * -sqrt((A + (C + hypot(B_m, (A - C)))))) / fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = (sqrt((C + hypot(B_m, C))) * 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+131) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(fma(B_m, B_m, Float64(C * Float64(A * -4.0))) * F))) * Float64(-sqrt(Float64(A + Float64(C + hypot(B_m, Float64(A - C))))))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B_m, C))) * 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+131], N[(N[(N[Sqrt[N[(2.0 * N[(N[(B$95$m * B$95$m + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 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^{+131}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\mathsf{fma}\left(B_m, B_m, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(B_m, A - C\right)\right)}\right)}{\mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B_m}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999995e131Initial program 23.6%
neg-sub023.6%
div-sub23.6%
associate-*l*23.6%
Applied egg-rr30.1%
div030.1%
neg-sub030.1%
distribute-neg-frac30.1%
Simplified30.1%
pow1/230.1%
associate-*r*30.1%
unpow-prod-down42.2%
associate-*r*42.2%
*-commutative42.2%
associate-*l*41.6%
pow1/241.6%
associate-+r+40.4%
+-commutative40.4%
+-commutative40.4%
Applied egg-rr40.4%
unpow1/240.4%
associate-*l*40.4%
+-commutative40.4%
+-commutative40.4%
hypot-def27.4%
unpow227.4%
unpow227.4%
+-commutative27.4%
associate-+r+27.8%
unpow227.8%
unpow227.8%
hypot-def41.6%
Simplified41.6%
if 4.99999999999999995e131 < (pow.f64 B 2) Initial program 6.8%
Taylor expanded in A around 0 10.6%
mul-1-neg10.6%
*-commutative10.6%
distribute-rgt-neg-in10.6%
unpow210.6%
unpow210.6%
hypot-def23.7%
Simplified23.7%
pow1/223.7%
*-commutative23.7%
unpow-prod-down40.1%
pow1/240.1%
pow1/240.1%
Applied egg-rr40.1%
Final simplification40.9%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 1e-98)
(/
(*
(sqrt (* 2.0 (* 2.0 (* F (+ (pow B_m 2.0) (* -4.0 (* C A)))))))
(- (sqrt C)))
(- (pow B_m 2.0) (* C (* A 4.0))))
(* (* (sqrt (+ C (hypot B_m C))) (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) <= 1e-98) {
tmp = (sqrt((2.0 * (2.0 * (F * (pow(B_m, 2.0) + (-4.0 * (C * A))))))) * -sqrt(C)) / (pow(B_m, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-sqrt(2.0) / 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 (Math.pow(B_m, 2.0) <= 1e-98) {
tmp = (Math.sqrt((2.0 * (2.0 * (F * (Math.pow(B_m, 2.0) + (-4.0 * (C * A))))))) * -Math.sqrt(C)) / (Math.pow(B_m, 2.0) - (C * (A * 4.0)));
} else {
tmp = (Math.sqrt((C + Math.hypot(B_m, C))) * Math.sqrt(F)) * (-Math.sqrt(2.0) / B_m);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if math.pow(B_m, 2.0) <= 1e-98: tmp = (math.sqrt((2.0 * (2.0 * (F * (math.pow(B_m, 2.0) + (-4.0 * (C * A))))))) * -math.sqrt(C)) / (math.pow(B_m, 2.0) - (C * (A * 4.0))) else: tmp = (math.sqrt((C + math.hypot(B_m, C))) * math.sqrt(F)) * (-math.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) <= 1e-98) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(2.0 * Float64(F * Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(C * A))))))) * Float64(-sqrt(C))) / Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B_m, C))) * sqrt(F)) * Float64(Float64(-sqrt(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 ((B_m ^ 2.0) <= 1e-98) tmp = (sqrt((2.0 * (2.0 * (F * ((B_m ^ 2.0) + (-4.0 * (C * A))))))) * -sqrt(C)) / ((B_m ^ 2.0) - (C * (A * 4.0))); else tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-sqrt(2.0) / B_m); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-98], N[(N[(N[Sqrt[N[(2.0 * N[(2.0 * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[C], $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[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 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 10^{-98}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(2 \cdot \left(F \cdot \left({B_m}^{2} + -4 \cdot \left(C \cdot A\right)\right)\right)\right)} \cdot \left(-\sqrt{C}\right)}{{B_m}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B_m}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.99999999999999939e-99Initial program 14.0%
Taylor expanded in A around -inf 28.3%
pow1/228.4%
associate-*r*28.4%
unpow-prod-down29.1%
*-commutative29.1%
associate-*l*29.2%
*-commutative29.2%
pow1/229.2%
Applied egg-rr29.2%
unpow1/229.2%
associate-*l*29.2%
cancel-sign-sub-inv29.2%
metadata-eval29.2%
Simplified29.2%
if 9.99999999999999939e-99 < (pow.f64 B 2) Initial program 17.5%
Taylor expanded in A around 0 15.9%
mul-1-neg15.9%
*-commutative15.9%
distribute-rgt-neg-in15.9%
unpow215.9%
unpow215.9%
hypot-def25.6%
Simplified25.6%
pow1/225.6%
*-commutative25.6%
unpow-prod-down37.6%
pow1/237.6%
pow1/237.6%
Applied egg-rr37.6%
Final simplification34.3%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (+ (pow B_m 2.0) (* -4.0 (* C A)))))
(if (<= (pow B_m 2.0) 1e-98)
(/ 1.0 (/ t_0 (- (sqrt (* (* t_0 (* 2.0 F)) (* 2.0 C))))))
(* (* (sqrt (+ C (hypot B_m C))) (sqrt F)) (/ (- (sqrt 2.0)) B_m)))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) + (-4.0 * (C * A));
double tmp;
if (pow(B_m, 2.0) <= 1e-98) {
tmp = 1.0 / (t_0 / -sqrt(((t_0 * (2.0 * F)) * (2.0 * C))));
} else {
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-sqrt(2.0) / 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 = Math.pow(B_m, 2.0) + (-4.0 * (C * A));
double tmp;
if (Math.pow(B_m, 2.0) <= 1e-98) {
tmp = 1.0 / (t_0 / -Math.sqrt(((t_0 * (2.0 * F)) * (2.0 * C))));
} else {
tmp = (Math.sqrt((C + Math.hypot(B_m, C))) * Math.sqrt(F)) * (-Math.sqrt(2.0) / B_m);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.pow(B_m, 2.0) + (-4.0 * (C * A)) tmp = 0 if math.pow(B_m, 2.0) <= 1e-98: tmp = 1.0 / (t_0 / -math.sqrt(((t_0 * (2.0 * F)) * (2.0 * C)))) else: tmp = (math.sqrt((C + math.hypot(B_m, C))) * math.sqrt(F)) * (-math.sqrt(2.0) / B_m) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(C * A))) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-98) tmp = Float64(1.0 / Float64(t_0 / Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(2.0 * C)))))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B_m, C))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m)); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = (B_m ^ 2.0) + (-4.0 * (C * A)); tmp = 0.0; if ((B_m ^ 2.0) <= 1e-98) tmp = 1.0 / (t_0 / -sqrt(((t_0 * (2.0 * F)) * (2.0 * C)))); else tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-sqrt(2.0) / 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[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-98], N[(1.0 / N[(t$95$0 / (-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} + -4 \cdot \left(C \cdot A\right)\\
\mathbf{if}\;{B_m}^{2} \leq 10^{-98}:\\
\;\;\;\;\frac{1}{\frac{t_0}{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B_m}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.99999999999999939e-99Initial program 14.0%
Taylor expanded in A around -inf 28.3%
clear-num28.3%
inv-pow28.3%
Applied egg-rr28.3%
unpow-128.3%
cancel-sign-sub-inv28.3%
metadata-eval28.3%
associate-*r*28.4%
associate-*r*28.4%
cancel-sign-sub-inv28.4%
metadata-eval28.4%
Simplified28.4%
if 9.99999999999999939e-99 < (pow.f64 B 2) Initial program 17.5%
Taylor expanded in A around 0 15.9%
mul-1-neg15.9%
*-commutative15.9%
distribute-rgt-neg-in15.9%
unpow215.9%
unpow215.9%
hypot-def25.6%
Simplified25.6%
pow1/225.6%
*-commutative25.6%
unpow-prod-down37.6%
pow1/237.6%
pow1/237.6%
Applied egg-rr37.6%
Final simplification34.0%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (+ (pow B_m 2.0) (* -4.0 (* C A)))))
(if (<= B_m 7.5e-49)
(/ 1.0 (/ t_0 (- (sqrt (* (* t_0 (* 2.0 F)) (* 2.0 C))))))
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) (- (sqrt F)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) + (-4.0 * (C * A));
double tmp;
if (B_m <= 7.5e-49) {
tmp = 1.0 / (t_0 / -sqrt(((t_0 * (2.0 * F)) * (2.0 * C))));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * -sqrt(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) :: t_0
real(8) :: tmp
t_0 = (b_m ** 2.0d0) + ((-4.0d0) * (c * a))
if (b_m <= 7.5d-49) then
tmp = 1.0d0 / (t_0 / -sqrt(((t_0 * (2.0d0 * f)) * (2.0d0 * c))))
else
tmp = (sqrt(2.0d0) / b_m) * (sqrt((b_m + c)) * -sqrt(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 t_0 = Math.pow(B_m, 2.0) + (-4.0 * (C * A));
double tmp;
if (B_m <= 7.5e-49) {
tmp = 1.0 / (t_0 / -Math.sqrt(((t_0 * (2.0 * F)) * (2.0 * C))));
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt((B_m + C)) * -Math.sqrt(F));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.pow(B_m, 2.0) + (-4.0 * (C * A)) tmp = 0 if B_m <= 7.5e-49: tmp = 1.0 / (t_0 / -math.sqrt(((t_0 * (2.0 * F)) * (2.0 * C)))) else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt((B_m + C)) * -math.sqrt(F)) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(C * A))) tmp = 0.0 if (B_m <= 7.5e-49) tmp = Float64(1.0 / Float64(t_0 / Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(2.0 * C)))))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * Float64(-sqrt(F)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = (B_m ^ 2.0) + (-4.0 * (C * A)); tmp = 0.0; if (B_m <= 7.5e-49) tmp = 1.0 / (t_0 / -sqrt(((t_0 * (2.0 * F)) * (2.0 * C)))); else tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * -sqrt(F)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 7.5e-49], N[(1.0 / N[(t$95$0 / (-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} + -4 \cdot \left(C \cdot A\right)\\
\mathbf{if}\;B_m \leq 7.5 \cdot 10^{-49}:\\
\;\;\;\;\frac{1}{\frac{t_0}{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 7.4999999999999998e-49Initial program 12.1%
Taylor expanded in A around -inf 18.8%
clear-num18.8%
inv-pow18.8%
Applied egg-rr18.8%
unpow-118.8%
cancel-sign-sub-inv18.8%
metadata-eval18.8%
associate-*r*18.8%
associate-*r*18.8%
cancel-sign-sub-inv18.8%
metadata-eval18.8%
Simplified18.8%
if 7.4999999999999998e-49 < B Initial program 24.1%
Taylor expanded in A around 0 28.2%
mul-1-neg28.2%
*-commutative28.2%
distribute-rgt-neg-in28.2%
unpow228.2%
unpow228.2%
hypot-def45.0%
Simplified45.0%
pow1/245.0%
*-commutative45.0%
unpow-prod-down66.9%
pow1/266.9%
pow1/266.9%
Applied egg-rr66.9%
Taylor expanded in C around 0 60.4%
Final simplification32.6%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* C (* A 4.0)))))
(if (<= B_m 1.9e-49)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 C)))) t_0)
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) (- (sqrt F)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - (C * (A * 4.0));
double tmp;
if (B_m <= 1.9e-49) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * -sqrt(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) :: t_0
real(8) :: tmp
t_0 = (b_m ** 2.0d0) - (c * (a * 4.0d0))
if (b_m <= 1.9d-49) then
tmp = -sqrt(((2.0d0 * (f * t_0)) * (2.0d0 * c))) / t_0
else
tmp = (sqrt(2.0d0) / b_m) * (sqrt((b_m + c)) * -sqrt(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 t_0 = Math.pow(B_m, 2.0) - (C * (A * 4.0));
double tmp;
if (B_m <= 1.9e-49) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt((B_m + C)) * -Math.sqrt(F));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.pow(B_m, 2.0) - (C * (A * 4.0)) tmp = 0 if B_m <= 1.9e-49: tmp = -math.sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0 else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt((B_m + C)) * -math.sqrt(F)) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0))) tmp = 0.0 if (B_m <= 1.9e-49) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * C)))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * Float64(-sqrt(F)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = (B_m ^ 2.0) - (C * (A * 4.0)); tmp = 0.0; if (B_m <= 1.9e-49) tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0; else tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * -sqrt(F)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 1.9e-49], 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[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;B_m \leq 1.9 \cdot 10^{-49}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 1.8999999999999999e-49Initial program 12.1%
Taylor expanded in A around -inf 18.8%
if 1.8999999999999999e-49 < B Initial program 24.1%
Taylor expanded in A around 0 28.2%
mul-1-neg28.2%
*-commutative28.2%
distribute-rgt-neg-in28.2%
unpow228.2%
unpow228.2%
hypot-def45.0%
Simplified45.0%
pow1/245.0%
*-commutative45.0%
unpow-prod-down66.9%
pow1/266.9%
pow1/266.9%
Applied egg-rr66.9%
Taylor expanded in C around 0 60.4%
Final simplification32.6%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 4.8e-49)
(/
(- (sqrt (* 4.0 (* C (* F (- (pow B_m 2.0) (* 4.0 (* C A))))))))
(- (pow B_m 2.0) (* C (* A 4.0))))
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) (- (sqrt F))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 4.8e-49) {
tmp = -sqrt((4.0 * (C * (F * (pow(B_m, 2.0) - (4.0 * (C * A))))))) / (pow(B_m, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * -sqrt(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 (b_m <= 4.8d-49) then
tmp = -sqrt((4.0d0 * (c * (f * ((b_m ** 2.0d0) - (4.0d0 * (c * a))))))) / ((b_m ** 2.0d0) - (c * (a * 4.0d0)))
else
tmp = (sqrt(2.0d0) / b_m) * (sqrt((b_m + c)) * -sqrt(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 (B_m <= 4.8e-49) {
tmp = -Math.sqrt((4.0 * (C * (F * (Math.pow(B_m, 2.0) - (4.0 * (C * A))))))) / (Math.pow(B_m, 2.0) - (C * (A * 4.0)));
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt((B_m + C)) * -Math.sqrt(F));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if B_m <= 4.8e-49: tmp = -math.sqrt((4.0 * (C * (F * (math.pow(B_m, 2.0) - (4.0 * (C * A))))))) / (math.pow(B_m, 2.0) - (C * (A * 4.0))) else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt((B_m + C)) * -math.sqrt(F)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 4.8e-49) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64((B_m ^ 2.0) - Float64(4.0 * Float64(C * A)))))))) / Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * Float64(-sqrt(F)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (B_m <= 4.8e-49) tmp = -sqrt((4.0 * (C * (F * ((B_m ^ 2.0) - (4.0 * (C * A))))))) / ((B_m ^ 2.0) - (C * (A * 4.0))); else tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * -sqrt(F)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 4.8e-49], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(C * A), $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[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;B_m \leq 4.8 \cdot 10^{-49}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left({B_m}^{2} - 4 \cdot \left(C \cdot A\right)\right)\right)\right)}}{{B_m}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 4.79999999999999985e-49Initial program 12.1%
Taylor expanded in A around -inf 18.8%
Taylor expanded in F around 0 18.7%
if 4.79999999999999985e-49 < B Initial program 24.1%
Taylor expanded in A around 0 28.2%
mul-1-neg28.2%
*-commutative28.2%
distribute-rgt-neg-in28.2%
unpow228.2%
unpow228.2%
hypot-def45.0%
Simplified45.0%
pow1/245.0%
*-commutative45.0%
unpow-prod-down66.9%
pow1/266.9%
pow1/266.9%
Applied egg-rr66.9%
Taylor expanded in C around 0 60.4%
Final simplification32.6%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 1.05e-49)
(/
(- (sqrt (* (* 2.0 C) (* 2.0 (* -4.0 (* A (* C F)))))))
(- (pow B_m 2.0) (* C (* A 4.0))))
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) (- (sqrt F))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.05e-49) {
tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (pow(B_m, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * -sqrt(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 (b_m <= 1.05d-49) then
tmp = -sqrt(((2.0d0 * c) * (2.0d0 * ((-4.0d0) * (a * (c * f)))))) / ((b_m ** 2.0d0) - (c * (a * 4.0d0)))
else
tmp = (sqrt(2.0d0) / b_m) * (sqrt((b_m + c)) * -sqrt(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 (B_m <= 1.05e-49) {
tmp = -Math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (Math.pow(B_m, 2.0) - (C * (A * 4.0)));
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt((B_m + C)) * -Math.sqrt(F));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.05e-49: tmp = -math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (math.pow(B_m, 2.0) - (C * (A * 4.0))) else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt((B_m + C)) * -math.sqrt(F)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.05e-49) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * C) * Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F))))))) / Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * Float64(-sqrt(F)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (B_m <= 1.05e-49) tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / ((B_m ^ 2.0) - (C * (A * 4.0))); else tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * -sqrt(F)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.05e-49], N[((-N[Sqrt[N[(N[(2.0 * C), $MachinePrecision] * 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[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;B_m \leq 1.05 \cdot 10^{-49}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot C\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{{B_m}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 1.0499999999999999e-49Initial program 12.1%
Taylor expanded in A around -inf 18.8%
Taylor expanded in B around 0 16.8%
if 1.0499999999999999e-49 < B Initial program 24.1%
Taylor expanded in A around 0 28.2%
mul-1-neg28.2%
*-commutative28.2%
distribute-rgt-neg-in28.2%
unpow228.2%
unpow228.2%
hypot-def45.0%
Simplified45.0%
pow1/245.0%
*-commutative45.0%
unpow-prod-down66.9%
pow1/266.9%
pow1/266.9%
Applied egg-rr66.9%
Taylor expanded in C around 0 60.4%
Final simplification31.2%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 7.8e-50)
(/
(- (sqrt (* (* 2.0 C) (* 2.0 (* -4.0 (* A (* C F)))))))
(- (pow B_m 2.0) (* C (* A 4.0))))
(* (/ (- (sqrt 2.0)) B_m) (* (sqrt F) (sqrt B_m)))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 7.8e-50) {
tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (pow(B_m, 2.0) - (C * (A * 4.0)));
} else {
tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt(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 (b_m <= 7.8d-50) then
tmp = -sqrt(((2.0d0 * c) * (2.0d0 * ((-4.0d0) * (a * (c * f)))))) / ((b_m ** 2.0d0) - (c * (a * 4.0d0)))
else
tmp = (-sqrt(2.0d0) / b_m) * (sqrt(f) * sqrt(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 (B_m <= 7.8e-50) {
tmp = -Math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (Math.pow(B_m, 2.0) - (C * (A * 4.0)));
} else {
tmp = (-Math.sqrt(2.0) / B_m) * (Math.sqrt(F) * Math.sqrt(B_m));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if B_m <= 7.8e-50: tmp = -math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (math.pow(B_m, 2.0) - (C * (A * 4.0))) else: tmp = (-math.sqrt(2.0) / B_m) * (math.sqrt(F) * math.sqrt(B_m)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 7.8e-50) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * C) * Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F))))))) / Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * Float64(sqrt(F) * sqrt(B_m))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (B_m <= 7.8e-50) tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / ((B_m ^ 2.0) - (C * (A * 4.0))); else tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt(B_m)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 7.8e-50], N[((-N[Sqrt[N[(N[(2.0 * C), $MachinePrecision] * 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[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;B_m \leq 7.8 \cdot 10^{-50}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot C\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{{B_m}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B_m} \cdot \left(\sqrt{F} \cdot \sqrt{B_m}\right)\\
\end{array}
\end{array}
if B < 7.80000000000000042e-50Initial program 12.1%
Taylor expanded in A around -inf 18.8%
Taylor expanded in B around 0 16.8%
if 7.80000000000000042e-50 < B Initial program 24.1%
Taylor expanded in A around 0 28.2%
mul-1-neg28.2%
*-commutative28.2%
distribute-rgt-neg-in28.2%
unpow228.2%
unpow228.2%
hypot-def45.0%
Simplified45.0%
pow1/245.0%
*-commutative45.0%
unpow-prod-down66.9%
pow1/266.9%
pow1/266.9%
Applied egg-rr66.9%
Taylor expanded in C around 0 60.0%
Final simplification31.1%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F -3.2e-283)
(sqrt (/ (- F) C))
(if (<= F 2.6e-69)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* B_m F))))
(* (sqrt (/ F B_m)) (- (sqrt 2.0))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -3.2e-283) {
tmp = sqrt((-F / C));
} else if (F <= 2.6e-69) {
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= (-3.2d-283)) then
tmp = sqrt((-f / c))
else if (f <= 2.6d-69) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((b_m * f))
else
tmp = sqrt((f / b_m)) * -sqrt(2.0d0)
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -3.2e-283) {
tmp = Math.sqrt((-F / C));
} else if (F <= 2.6e-69) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((B_m * F));
} else {
tmp = Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= -3.2e-283: tmp = math.sqrt((-F / C)) elif F <= 2.6e-69: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((B_m * F)) else: tmp = math.sqrt((F / B_m)) * -math.sqrt(2.0) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -3.2e-283) tmp = sqrt(Float64(Float64(-F) / C)); elseif (F <= 2.6e-69) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(B_m * F)))); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= -3.2e-283) tmp = sqrt((-F / C)); elseif (F <= 2.6e-69) tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F)); else tmp = sqrt((F / B_m)) * -sqrt(2.0); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -3.2e-283], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], If[LessEqual[F, 2.6e-69], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.2 \cdot 10^{-283}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\
\mathbf{elif}\;F \leq 2.6 \cdot 10^{-69}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{B_m \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < -3.20000000000000012e-283Initial program 13.1%
add-sqr-sqrt13.1%
sqrt-unprod9.8%
frac-times8.5%
Applied egg-rr19.0%
associate-/l*19.5%
associate-*l*19.5%
*-commutative19.5%
unpow219.5%
fma-neg19.5%
distribute-lft-neg-in19.5%
metadata-eval19.5%
*-commutative19.5%
*-commutative19.5%
Simplified19.5%
Taylor expanded in B around 0 55.7%
mul-1-neg55.7%
Simplified55.7%
if -3.20000000000000012e-283 < F < 2.6000000000000002e-69Initial program 19.8%
Taylor expanded in A around 0 15.4%
mul-1-neg15.4%
*-commutative15.4%
distribute-rgt-neg-in15.4%
unpow215.4%
unpow215.4%
hypot-def25.9%
Simplified25.9%
Taylor expanded in C around 0 23.1%
if 2.6000000000000002e-69 < F Initial program 14.5%
Taylor expanded in A around 0 11.1%
mul-1-neg11.1%
*-commutative11.1%
distribute-rgt-neg-in11.1%
unpow211.1%
unpow211.1%
hypot-def15.8%
Simplified15.8%
Taylor expanded in C around 0 23.6%
mul-1-neg23.6%
Simplified23.6%
Final simplification26.9%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F -2e-310) (sqrt (/ (- F) C)) (* (sqrt (/ F B_m)) (- (sqrt 2.0)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -2e-310) {
tmp = sqrt((-F / C));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= (-2d-310)) then
tmp = sqrt((-f / c))
else
tmp = sqrt((f / b_m)) * -sqrt(2.0d0)
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -2e-310) {
tmp = Math.sqrt((-F / C));
} else {
tmp = Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= -2e-310: tmp = math.sqrt((-F / C)) else: tmp = math.sqrt((F / B_m)) * -math.sqrt(2.0) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -2e-310) tmp = sqrt(Float64(Float64(-F) / C)); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= -2e-310) tmp = sqrt((-F / C)); else tmp = sqrt((F / B_m)) * -sqrt(2.0); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -2e-310], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < -1.999999999999994e-310Initial program 15.6%
add-sqr-sqrt15.6%
sqrt-unprod12.2%
frac-times11.0%
Applied egg-rr20.8%
associate-/l*21.3%
associate-*l*21.3%
*-commutative21.3%
unpow221.3%
fma-neg21.3%
distribute-lft-neg-in21.3%
metadata-eval21.3%
*-commutative21.3%
*-commutative21.3%
Simplified21.3%
Taylor expanded in B around 0 52.3%
mul-1-neg52.3%
Simplified52.3%
if -1.999999999999994e-310 < F Initial program 16.2%
Taylor expanded in A around 0 12.8%
mul-1-neg12.8%
*-commutative12.8%
distribute-rgt-neg-in12.8%
unpow212.8%
unpow212.8%
hypot-def19.8%
Simplified19.8%
Taylor expanded in C around 0 21.0%
mul-1-neg21.0%
Simplified21.0%
Final simplification24.6%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= C 6e+74) (sqrt (/ (- F) C)) (sqrt (/ (- F) A))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 6e+74) {
tmp = sqrt((-F / C));
} else {
tmp = sqrt((-F / A));
}
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 <= 6d+74) then
tmp = sqrt((-f / c))
else
tmp = sqrt((-f / a))
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 <= 6e+74) {
tmp = Math.sqrt((-F / C));
} else {
tmp = Math.sqrt((-F / A));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if C <= 6e+74: tmp = math.sqrt((-F / C)) else: tmp = math.sqrt((-F / A)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (C <= 6e+74) tmp = sqrt(Float64(Float64(-F) / C)); else tmp = sqrt(Float64(Float64(-F) / A)); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (C <= 6e+74) tmp = sqrt((-F / C)); else tmp = sqrt((-F / A)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 6e+74], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[((-F) / A), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;C \leq 6 \cdot 10^{+74}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-F}{A}}\\
\end{array}
\end{array}
if C < 6e74Initial program 17.1%
add-sqr-sqrt1.2%
sqrt-unprod1.3%
frac-times0.9%
Applied egg-rr2.2%
associate-/l*2.4%
associate-*l*2.4%
*-commutative2.4%
unpow22.4%
fma-neg2.4%
distribute-lft-neg-in2.4%
metadata-eval2.4%
*-commutative2.4%
*-commutative2.4%
Simplified2.2%
Taylor expanded in B around 0 13.8%
mul-1-neg13.8%
Simplified13.8%
if 6e74 < C Initial program 12.5%
add-sqr-sqrt6.0%
sqrt-unprod6.0%
frac-times5.7%
Applied egg-rr9.5%
associate-/l*9.6%
associate-*l*9.6%
*-commutative9.6%
unpow29.6%
fma-neg9.6%
distribute-lft-neg-in9.6%
metadata-eval9.6%
*-commutative9.6%
*-commutative9.6%
Simplified9.6%
Taylor expanded in C around inf 19.8%
mul-1-neg19.8%
Simplified19.8%
Final simplification15.1%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (sqrt (/ (- F) A)))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return sqrt((-F / A));
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((-f / a))
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((-F / A));
}
B_m = math.fabs(B) def code(A, B_m, C, F): return math.sqrt((-F / A))
B_m = abs(B) function code(A, B_m, C, F) return sqrt(Float64(Float64(-F) / A)) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = sqrt((-F / A)); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[Sqrt[N[((-F) / A), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\sqrt{\frac{-F}{A}}
\end{array}
Initial program 16.1%
add-sqr-sqrt2.2%
sqrt-unprod2.3%
frac-times1.9%
Applied egg-rr3.7%
associate-/l*3.9%
associate-*l*3.9%
*-commutative3.9%
unpow23.9%
fma-neg3.9%
distribute-lft-neg-in3.9%
metadata-eval3.9%
*-commutative3.9%
*-commutative3.9%
Simplified3.7%
Taylor expanded in C around inf 8.7%
mul-1-neg8.7%
Simplified8.7%
Final simplification8.7%
herbie shell --seed 2024017
(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))))