
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 5e+151)
(/
(* (sqrt (+ (hypot (- A C) B_m) (+ A C))) (sqrt (* t_0 (* 2.0 F))))
(- t_0))
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ C (hypot C B_m))) (- (sqrt F)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 5e+151) {
tmp = (sqrt((hypot((A - C), B_m) + (A + C))) * sqrt((t_0 * (2.0 * F)))) / -t_0;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 5e+151) tmp = Float64(Float64(sqrt(Float64(hypot(Float64(A - C), B_m) + Float64(A + C))) * sqrt(Float64(t_0 * Float64(2.0 * F)))) / Float64(-t_0)); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(C + hypot(C, B_m))) * Float64(-sqrt(F)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+151], N[(N[(N[Sqrt[N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sqrt{\mathsf{hypot}\left(A - C, B\_m\right) + \left(A + C\right)} \cdot \sqrt{t\_0 \cdot \left(2 \cdot F\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.0000000000000002e151Initial program 31.6%
Simplified35.8%
pow1/235.8%
*-commutative35.8%
unpow-prod-down43.6%
pow1/243.6%
+-commutative43.6%
hypot-undefine35.4%
unpow235.4%
unpow235.4%
+-commutative35.4%
unpow235.4%
unpow235.4%
hypot-define43.6%
pow1/243.6%
*-commutative43.6%
Applied egg-rr43.6%
if 5.0000000000000002e151 < (pow.f64 B 2) Initial program 5.5%
Taylor expanded in A around 0 7.7%
mul-1-neg7.7%
Simplified7.7%
pow1/27.7%
*-commutative7.7%
unpow27.7%
unpow27.7%
hypot-undefine25.8%
unpow-prod-down41.3%
pow1/241.3%
hypot-undefine8.7%
unpow28.7%
unpow28.7%
+-commutative8.7%
unpow28.7%
unpow28.7%
hypot-define41.3%
pow1/241.3%
Applied egg-rr41.3%
Final simplification42.6%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* C (* A 4.0))))
(if (<= (pow B_m 2.0) 5e-68)
(/
(sqrt
(* 2.0 (* (- (pow B_m 2.0) t_0) (* F (+ (+ A C) (hypot B_m (- A C)))))))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 5e+172)
(/
(*
(sqrt (+ (hypot (- A C) B_m) (+ A C)))
(* (sqrt F) (* B_m (- (sqrt 2.0)))))
(fma B_m B_m (* A (* C -4.0))))
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ C (hypot C B_m))) (- (sqrt F))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = C * (A * 4.0);
double tmp;
if (pow(B_m, 2.0) <= 5e-68) {
tmp = sqrt((2.0 * ((pow(B_m, 2.0) - t_0) * (F * ((A + C) + hypot(B_m, (A - C))))))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 5e+172) {
tmp = (sqrt((hypot((A - C), B_m) + (A + C))) * (sqrt(F) * (B_m * -sqrt(2.0)))) / fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(C * Float64(A * 4.0)) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-68) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * Float64(F * Float64(Float64(A + C) + hypot(B_m, Float64(A - C))))))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 5e+172) tmp = Float64(Float64(sqrt(Float64(hypot(Float64(A - C), B_m) + Float64(A + C))) * Float64(sqrt(F) * Float64(B_m * Float64(-sqrt(2.0))))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(C + hypot(C, B_m))) * Float64(-sqrt(F)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-68], N[(N[Sqrt[N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * N[(F * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+172], N[(N[(N[Sqrt[N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[(B$95$m * (-N[Sqrt[2.0], $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[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-68}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+172}:\\
\;\;\;\;\frac{\sqrt{\mathsf{hypot}\left(A - C, B\_m\right) + \left(A + C\right)} \cdot \left(\sqrt{F} \cdot \left(B\_m \cdot \left(-\sqrt{2}\right)\right)\right)}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999971e-68Initial program 27.4%
*-un-lft-identity27.4%
Applied egg-rr33.5%
*-lft-identity33.5%
distribute-frac-neg33.5%
distribute-neg-frac233.5%
Simplified34.5%
if 4.99999999999999971e-68 < (pow.f64 B 2) < 5.0000000000000001e172Initial program 37.8%
Simplified38.3%
pow1/238.3%
*-commutative38.3%
unpow-prod-down51.6%
pow1/251.6%
+-commutative51.6%
hypot-undefine46.3%
unpow246.3%
unpow246.3%
+-commutative46.3%
unpow246.3%
unpow246.3%
hypot-define51.6%
pow1/251.6%
*-commutative51.6%
Applied egg-rr51.6%
Taylor expanded in B around inf 30.2%
*-commutative30.2%
Simplified30.2%
if 5.0000000000000001e172 < (pow.f64 B 2) Initial program 4.7%
Taylor expanded in A around 0 7.0%
mul-1-neg7.0%
Simplified7.0%
pow1/27.0%
*-commutative7.0%
unpow27.0%
unpow27.0%
hypot-undefine26.2%
unpow-prod-down42.7%
pow1/242.7%
hypot-undefine8.1%
unpow28.1%
unpow28.1%
+-commutative8.1%
unpow28.1%
unpow28.1%
hypot-define42.7%
pow1/242.7%
Applied egg-rr42.7%
Final simplification36.6%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* C (* A 4.0))))
(if (<= (pow B_m 2.0) 5e+39)
(/
(sqrt
(* 2.0 (* (- (pow B_m 2.0) t_0) (* F (+ (+ A C) (hypot B_m (- A C)))))))
(- t_0 (pow B_m 2.0)))
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ C (hypot C B_m))) (- (sqrt F)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = C * (A * 4.0);
double tmp;
if (pow(B_m, 2.0) <= 5e+39) {
tmp = sqrt((2.0 * ((pow(B_m, 2.0) - t_0) * (F * ((A + C) + hypot(B_m, (A - C))))))) / (t_0 - pow(B_m, 2.0));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = C * (A * 4.0);
double tmp;
if (Math.pow(B_m, 2.0) <= 5e+39) {
tmp = Math.sqrt((2.0 * ((Math.pow(B_m, 2.0) - t_0) * (F * ((A + C) + Math.hypot(B_m, (A - C))))))) / (t_0 - Math.pow(B_m, 2.0));
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt((C + Math.hypot(C, B_m))) * -Math.sqrt(F));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = C * (A * 4.0) tmp = 0 if math.pow(B_m, 2.0) <= 5e+39: tmp = math.sqrt((2.0 * ((math.pow(B_m, 2.0) - t_0) * (F * ((A + C) + math.hypot(B_m, (A - C))))))) / (t_0 - math.pow(B_m, 2.0)) else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt((C + math.hypot(C, B_m))) * -math.sqrt(F)) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(C * Float64(A * 4.0)) tmp = 0.0 if ((B_m ^ 2.0) <= 5e+39) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * Float64(F * Float64(Float64(A + C) + hypot(B_m, Float64(A - C))))))) / Float64(t_0 - (B_m ^ 2.0))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(C + hypot(C, B_m))) * Float64(-sqrt(F)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = C * (A * 4.0); tmp = 0.0; if ((B_m ^ 2.0) <= 5e+39) tmp = sqrt((2.0 * (((B_m ^ 2.0) - t_0) * (F * ((A + C) + hypot(B_m, (A - C))))))) / (t_0 - (B_m ^ 2.0)); else tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -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[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+39], N[(N[Sqrt[N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * N[(F * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{+39}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.00000000000000015e39Initial program 28.9%
*-un-lft-identity28.9%
Applied egg-rr34.1%
*-lft-identity34.1%
distribute-frac-neg34.1%
distribute-neg-frac234.1%
Simplified34.9%
if 5.00000000000000015e39 < (pow.f64 B 2) Initial program 13.8%
Taylor expanded in A around 0 11.2%
mul-1-neg11.2%
Simplified11.2%
pow1/211.2%
*-commutative11.2%
unpow211.2%
unpow211.2%
hypot-undefine25.4%
unpow-prod-down37.6%
pow1/237.6%
hypot-undefine12.0%
unpow212.0%
unpow212.0%
+-commutative12.0%
unpow212.0%
unpow212.0%
hypot-define37.6%
pow1/237.6%
Applied egg-rr37.6%
Final simplification36.3%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 5e+34)
(/ (sqrt (* (* t_0 (* 2.0 F)) (+ (+ A C) (hypot B_m (- A C))))) (- t_0))
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ C (hypot C B_m))) (- (sqrt F)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 5e+34) {
tmp = sqrt(((t_0 * (2.0 * F)) * ((A + C) + hypot(B_m, (A - C))))) / -t_0;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 5e+34) tmp = Float64(sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(Float64(A + C) + hypot(B_m, Float64(A - C))))) / Float64(-t_0)); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(C + hypot(C, B_m))) * Float64(-sqrt(F)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+34], N[(N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{+34}:\\
\;\;\;\;\frac{\sqrt{\left(t\_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.9999999999999998e34Initial program 28.6%
Simplified33.8%
if 4.9999999999999998e34 < (pow.f64 B 2) Initial program 14.4%
Taylor expanded in A around 0 11.8%
mul-1-neg11.8%
Simplified11.8%
pow1/211.8%
*-commutative11.8%
unpow211.8%
unpow211.8%
hypot-undefine25.8%
unpow-prod-down37.7%
pow1/237.7%
hypot-undefine12.6%
unpow212.6%
unpow212.6%
+-commutative12.6%
unpow212.6%
unpow212.6%
hypot-define37.7%
pow1/237.7%
Applied egg-rr37.7%
Final simplification35.8%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* C (* A 4.0))))
(if (<= (pow B_m 2.0) 5e-108)
(/
(sqrt (* (* 2.0 (* F (- (pow B_m 2.0) t_0))) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ C (hypot C B_m))) (- (sqrt F)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = C * (A * 4.0);
double tmp;
if (pow(B_m, 2.0) <= 5e-108) {
tmp = sqrt(((2.0 * (F * (pow(B_m, 2.0) - t_0))) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -sqrt(F));
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = C * (A * 4.0);
double tmp;
if (Math.pow(B_m, 2.0) <= 5e-108) {
tmp = Math.sqrt(((2.0 * (F * (Math.pow(B_m, 2.0) - t_0))) * (2.0 * A))) / (t_0 - Math.pow(B_m, 2.0));
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt((C + Math.hypot(C, B_m))) * -Math.sqrt(F));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = C * (A * 4.0) tmp = 0 if math.pow(B_m, 2.0) <= 5e-108: tmp = math.sqrt(((2.0 * (F * (math.pow(B_m, 2.0) - t_0))) * (2.0 * A))) / (t_0 - math.pow(B_m, 2.0)) else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt((C + math.hypot(C, B_m))) * -math.sqrt(F)) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(C * Float64(A * 4.0)) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-108) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(F * Float64((B_m ^ 2.0) - t_0))) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(C + hypot(C, B_m))) * Float64(-sqrt(F)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = C * (A * 4.0); tmp = 0.0; if ((B_m ^ 2.0) <= 5e-108) tmp = sqrt(((2.0 * (F * ((B_m ^ 2.0) - t_0))) * (2.0 * A))) / (t_0 - (B_m ^ 2.0)); else tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(C, B_m))) * -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[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-108], N[(N[Sqrt[N[(N[(2.0 * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-108}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(F \cdot \left({B\_m}^{2} - t\_0\right)\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5e-108Initial program 24.4%
Taylor expanded in A around inf 29.7%
if 5e-108 < (pow.f64 B 2) Initial program 19.5%
Taylor expanded in A around 0 13.1%
mul-1-neg13.1%
Simplified13.1%
pow1/213.2%
*-commutative13.2%
unpow213.2%
unpow213.2%
hypot-undefine24.7%
unpow-prod-down34.3%
pow1/234.3%
hypot-undefine13.8%
unpow213.8%
unpow213.8%
+-commutative13.8%
unpow213.8%
unpow213.8%
hypot-define34.3%
pow1/234.3%
Applied egg-rr34.3%
Final simplification32.6%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= F 6.5e-307)
(/
(sqrt (* (+ (+ A C) (hypot B_m (- A C))) (* (* A -8.0) (* C F))))
(- (fma B_m B_m (* A (* C -4.0)))))
(if (<= F 5.45e+17)
(* (sqrt (* F (+ A (hypot B_m A)))) (/ t_0 B_m))
(* (sqrt (/ F B_m)) t_0)))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (F <= 6.5e-307) {
tmp = sqrt((((A + C) + hypot(B_m, (A - C))) * ((A * -8.0) * (C * F)))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else if (F <= 5.45e+17) {
tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m);
} else {
tmp = sqrt((F / B_m)) * t_0;
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (F <= 6.5e-307) tmp = Float64(sqrt(Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) * Float64(Float64(A * -8.0) * Float64(C * F)))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif (F <= 5.45e+17) tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(t_0 / B_m)); else tmp = Float64(sqrt(Float64(F / B_m)) * t_0); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 6.5e-307], N[(N[Sqrt[N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(A * -8.0), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 5.45e+17], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 6.5 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{\left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right) \cdot \left(\left(A \cdot -8\right) \cdot \left(C \cdot F\right)\right)}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;F \leq 5.45 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{t\_0}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\
\end{array}
\end{array}
if F < 6.5000000000000001e-307Initial program 33.0%
Simplified43.4%
Taylor expanded in B around 0 30.3%
associate-*r*30.3%
Simplified30.3%
if 6.5000000000000001e-307 < F < 5.45e17Initial program 23.4%
Taylor expanded in C around 0 13.9%
mul-1-neg13.9%
+-commutative13.9%
unpow213.9%
unpow213.9%
hypot-define28.2%
Simplified28.2%
if 5.45e17 < F Initial program 16.3%
Taylor expanded in A around 0 9.6%
mul-1-neg9.6%
Simplified9.6%
Taylor expanded in C around 0 23.8%
Final simplification26.4%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= F 6.5e-307)
(/
(sqrt (* (* A -16.0) (* F (pow C 2.0))))
(- (* 4.0 (* A C)) (pow B_m 2.0)))
(if (<= F 5.45e+17)
(* (sqrt (* F (+ A (hypot B_m A)))) (/ t_0 B_m))
(* (sqrt (/ F B_m)) t_0)))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (F <= 6.5e-307) {
tmp = sqrt(((A * -16.0) * (F * pow(C, 2.0)))) / ((4.0 * (A * C)) - pow(B_m, 2.0));
} else if (F <= 5.45e+17) {
tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m);
} else {
tmp = sqrt((F / B_m)) * t_0;
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double tmp;
if (F <= 6.5e-307) {
tmp = Math.sqrt(((A * -16.0) * (F * Math.pow(C, 2.0)))) / ((4.0 * (A * C)) - Math.pow(B_m, 2.0));
} else if (F <= 5.45e+17) {
tmp = Math.sqrt((F * (A + Math.hypot(B_m, A)))) * (t_0 / B_m);
} else {
tmp = Math.sqrt((F / B_m)) * t_0;
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if F <= 6.5e-307: tmp = math.sqrt(((A * -16.0) * (F * math.pow(C, 2.0)))) / ((4.0 * (A * C)) - math.pow(B_m, 2.0)) elif F <= 5.45e+17: tmp = math.sqrt((F * (A + math.hypot(B_m, A)))) * (t_0 / B_m) else: tmp = math.sqrt((F / B_m)) * t_0 return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (F <= 6.5e-307) tmp = Float64(sqrt(Float64(Float64(A * -16.0) * Float64(F * (C ^ 2.0)))) / Float64(Float64(4.0 * Float64(A * C)) - (B_m ^ 2.0))); elseif (F <= 5.45e+17) tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(t_0 / B_m)); else tmp = Float64(sqrt(Float64(F / B_m)) * t_0); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = -sqrt(2.0); tmp = 0.0; if (F <= 6.5e-307) tmp = sqrt(((A * -16.0) * (F * (C ^ 2.0)))) / ((4.0 * (A * C)) - (B_m ^ 2.0)); elseif (F <= 5.45e+17) tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m); else tmp = sqrt((F / B_m)) * t_0; end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 6.5e-307], N[(N[Sqrt[N[(N[(A * -16.0), $MachinePrecision] * N[(F * N[Power[C, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.45e+17], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 6.5 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{\left(A \cdot -16\right) \cdot \left(F \cdot {C}^{2}\right)}}{4 \cdot \left(A \cdot C\right) - {B\_m}^{2}}\\
\mathbf{elif}\;F \leq 5.45 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{t\_0}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\
\end{array}
\end{array}
if F < 6.5000000000000001e-307Initial program 33.0%
Simplified39.5%
Taylor expanded in A around -inf 17.9%
associate-*r*17.9%
Simplified17.9%
if 6.5000000000000001e-307 < F < 5.45e17Initial program 23.4%
Taylor expanded in C around 0 13.9%
mul-1-neg13.9%
+-commutative13.9%
unpow213.9%
unpow213.9%
hypot-define28.2%
Simplified28.2%
if 5.45e17 < F Initial program 16.3%
Taylor expanded in A around 0 9.6%
mul-1-neg9.6%
Simplified9.6%
Taylor expanded in C around 0 23.8%
Final simplification25.1%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= F 5.45e+17)
(* (sqrt (* F (+ A (hypot B_m A)))) (/ t_0 B_m))
(* (sqrt (/ F B_m)) t_0))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (F <= 5.45e+17) {
tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m);
} else {
tmp = sqrt((F / B_m)) * t_0;
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double tmp;
if (F <= 5.45e+17) {
tmp = Math.sqrt((F * (A + Math.hypot(B_m, A)))) * (t_0 / B_m);
} else {
tmp = Math.sqrt((F / B_m)) * t_0;
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if F <= 5.45e+17: tmp = math.sqrt((F * (A + math.hypot(B_m, A)))) * (t_0 / B_m) else: tmp = math.sqrt((F / B_m)) * t_0 return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (F <= 5.45e+17) tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(t_0 / B_m)); else tmp = Float64(sqrt(Float64(F / B_m)) * t_0); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = -sqrt(2.0); tmp = 0.0; if (F <= 5.45e+17) tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m); else tmp = sqrt((F / B_m)) * t_0; end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 5.45e+17], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 5.45 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{t\_0}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\
\end{array}
\end{array}
if F < 5.45e17Initial program 25.3%
Taylor expanded in C around 0 11.2%
mul-1-neg11.2%
+-commutative11.2%
unpow211.2%
unpow211.2%
hypot-define22.6%
Simplified22.6%
if 5.45e17 < F Initial program 16.3%
Taylor expanded in A around 0 9.6%
mul-1-neg9.6%
Simplified9.6%
Taylor expanded in C around 0 23.8%
Final simplification23.1%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 3.4e-58) (/ (sqrt (* 2.0 (* F (+ C (hypot B_m C))))) (- B_m)) (* (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.4e-58) {
tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 3.4e-58) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(B_m, C))))) / -B_m;
} 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.4e-58: tmp = math.sqrt((2.0 * (F * (C + math.hypot(B_m, C))))) / -B_m 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.4e-58) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(B_m, C))))) / Float64(-B_m)); 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.4e-58) tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m; 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.4e-58], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $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.4 \cdot 10^{-58}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < 3.39999999999999973e-58Initial program 25.7%
Taylor expanded in A around 0 8.6%
mul-1-neg8.6%
Simplified8.6%
associate-*l/8.6%
Applied egg-rr20.0%
unpow1/220.0%
distribute-rgt-in20.0%
hypot-undefine8.7%
unpow28.7%
unpow28.7%
+-commutative8.7%
distribute-rgt-in8.7%
unpow28.7%
unpow28.7%
hypot-undefine20.0%
Simplified20.0%
if 3.39999999999999973e-58 < F Initial program 17.9%
Taylor expanded in A around 0 10.8%
mul-1-neg10.8%
Simplified10.8%
Taylor expanded in C around 0 24.1%
Final simplification22.3%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= F 2.35e-57)
(* (sqrt (* B_m F)) (/ t_0 B_m))
(* (sqrt (/ F B_m)) t_0))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (F <= 2.35e-57) {
tmp = sqrt((B_m * F)) * (t_0 / B_m);
} else {
tmp = sqrt((F / B_m)) * t_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) :: t_0
real(8) :: tmp
t_0 = -sqrt(2.0d0)
if (f <= 2.35d-57) then
tmp = sqrt((b_m * f)) * (t_0 / b_m)
else
tmp = sqrt((f / b_m)) * t_0
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.sqrt(2.0);
double tmp;
if (F <= 2.35e-57) {
tmp = Math.sqrt((B_m * F)) * (t_0 / B_m);
} else {
tmp = Math.sqrt((F / B_m)) * t_0;
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if F <= 2.35e-57: tmp = math.sqrt((B_m * F)) * (t_0 / B_m) else: tmp = math.sqrt((F / B_m)) * t_0 return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (F <= 2.35e-57) tmp = Float64(sqrt(Float64(B_m * F)) * Float64(t_0 / B_m)); else tmp = Float64(sqrt(Float64(F / B_m)) * t_0); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = -sqrt(2.0); tmp = 0.0; if (F <= 2.35e-57) tmp = sqrt((B_m * F)) * (t_0 / B_m); else tmp = sqrt((F / B_m)) * t_0; end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 2.35e-57], N[(N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 2.35 \cdot 10^{-57}:\\
\;\;\;\;\sqrt{B\_m \cdot F} \cdot \frac{t\_0}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot t\_0\\
\end{array}
\end{array}
if F < 2.3499999999999999e-57Initial program 25.7%
Taylor expanded in A around 0 8.6%
mul-1-neg8.6%
Simplified8.6%
Taylor expanded in C around 0 17.8%
if 2.3499999999999999e-57 < F Initial program 17.9%
Taylor expanded in A around 0 10.8%
mul-1-neg10.8%
Simplified10.8%
Taylor expanded in C around 0 24.1%
Final simplification21.3%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (* (sqrt (/ F B_m)) (- (sqrt 2.0))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return sqrt((F / B_m)) * -sqrt(2.0);
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((f / b_m)) * -sqrt(2.0d0)
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
B_m = math.fabs(B) def code(A, B_m, C, F): return math.sqrt((F / B_m)) * -math.sqrt(2.0)
B_m = abs(B) function code(A, B_m, C, F) return Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = sqrt((F / B_m)) * -sqrt(2.0); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)
\end{array}
Initial program 21.3%
Taylor expanded in A around 0 9.8%
mul-1-neg9.8%
Simplified9.8%
Taylor expanded in C around 0 18.0%
Final simplification18.0%
herbie shell --seed 2024043
(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))))