
(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 18 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
(let* ((t_0 (sqrt (hypot A B))))
(if (<= (pow B 2.0) 4e+52)
(/
(*
(sqrt (+ A (+ C (hypot (- A C) B))))
(- (sqrt (* 2.0 (* F (- (pow B 2.0) (* 4.0 (* A C))))))))
(- (pow B 2.0) (* C (* A 4.0))))
(* (/ (sqrt 2.0) B) (* (sqrt (fma t_0 t_0 A)) (- (sqrt F)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(hypot(A, B));
double tmp;
if (pow(B, 2.0) <= 4e+52) {
tmp = (sqrt((A + (C + hypot((A - C), B)))) * -sqrt((2.0 * (F * (pow(B, 2.0) - (4.0 * (A * C))))))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt(2.0) / B) * (sqrt(fma(t_0, t_0, A)) * -sqrt(F));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = sqrt(hypot(A, B)) tmp = 0.0 if ((B ^ 2.0) <= 4e+52) tmp = Float64(Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B)))) * Float64(-sqrt(Float64(2.0 * Float64(F * Float64((B ^ 2.0) - Float64(4.0 * Float64(A * C)))))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(fma(t_0, t_0, A)) * Float64(-sqrt(F)))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 4e+52], N[(N[(N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * N[(N[Power[B, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(t$95$0 * t$95$0 + A), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{hypot}\left(A, B\right)}\\
\mathbf{if}\;{B}^{2} \leq 4 \cdot 10^{+52}:\\
\;\;\;\;\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\right)\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)}\right)}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{\mathsf{fma}\left(t_0, t_0, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4e52Initial program 22.8%
+-commutative22.8%
unpow222.8%
unpow222.8%
hypot-udef32.5%
expm1-log1p-u30.8%
hypot-udef22.0%
unpow222.0%
unpow222.0%
+-commutative22.0%
unpow222.0%
unpow222.0%
hypot-def30.8%
Applied egg-rr30.8%
pow1/230.9%
*-commutative30.9%
expm1-log1p-u32.5%
unpow-prod-down42.8%
pow1/242.8%
associate-+l+43.5%
pow1/243.5%
*-commutative43.5%
associate-*l*43.5%
Applied egg-rr43.5%
if 4e52 < (pow.f64 B 2) Initial program 10.7%
Taylor expanded in C around 0 12.9%
mul-1-neg12.9%
distribute-rgt-neg-in12.9%
+-commutative12.9%
unpow212.9%
unpow212.9%
hypot-def30.6%
Simplified30.6%
pow1/230.6%
*-commutative30.6%
hypot-udef12.9%
unpow212.9%
unpow212.9%
unpow-prod-down13.6%
Applied egg-rr39.8%
+-commutative39.8%
add-sqr-sqrt39.8%
fma-def39.8%
Applied egg-rr39.8%
Final simplification41.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))))
(t_1 (- (pow B 2.0) (* C (* A 4.0))))
(t_2 (/ (- (sqrt (* (* F t_0) (* 2.0 (+ A A))))) t_0)))
(if (<= (pow B 2.0) 1e-320)
t_2
(if (<= (pow B 2.0) 1e-258)
(/ (- (sqrt (* -16.0 (* A (* F (pow C 2.0)))))) t_1)
(if (<= (pow B 2.0) 2e-135)
t_2
(if (<= (pow B 2.0) 5e-62)
(/
(- (sqrt (* 4.0 (* C (* F (- (pow B 2.0) (* 4.0 (* A C))))))))
t_1)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot A B))) (- (sqrt F))))))))))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 t_2 = -sqrt(((F * t_0) * (2.0 * (A + A)))) / t_0;
double tmp;
if (pow(B, 2.0) <= 1e-320) {
tmp = t_2;
} else if (pow(B, 2.0) <= 1e-258) {
tmp = -sqrt((-16.0 * (A * (F * pow(C, 2.0))))) / t_1;
} else if (pow(B, 2.0) <= 2e-135) {
tmp = t_2;
} else if (pow(B, 2.0) <= 5e-62) {
tmp = -sqrt((4.0 * (C * (F * (pow(B, 2.0) - (4.0 * (A * C))))))) / t_1;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(A, B))) * -sqrt(F));
}
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))) t_2 = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + A))))) / t_0) tmp = 0.0 if ((B ^ 2.0) <= 1e-320) tmp = t_2; elseif ((B ^ 2.0) <= 1e-258) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(A * Float64(F * (C ^ 2.0)))))) / t_1); elseif ((B ^ 2.0) <= 2e-135) tmp = t_2; elseif ((B ^ 2.0) <= 5e-62) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64((B ^ 2.0) - Float64(4.0 * Float64(A * C)))))))) / t_1); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(A, B))) * Float64(-sqrt(F)))); 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]}, Block[{t$95$2 = 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-320], t$95$2, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e-258], N[((-N[Sqrt[N[(-16.0 * N[(A * N[(F * N[Power[C, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-135], t$95$2, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-62], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[Power[B, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $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)\\
t_2 := \frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{if}\;{B}^{2} \leq 10^{-320}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;{B}^{2} \leq 10^{-258}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(A \cdot \left(F \cdot {C}^{2}\right)\right)}}{t_1}\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-135}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;{B}^{2} \leq 5 \cdot 10^{-62}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.99989e-321 or 9.99999999999999954e-259 < (pow.f64 B 2) < 2.0000000000000001e-135Initial program 15.4%
Simplified25.1%
Taylor expanded in A around inf 25.2%
distribute-rgt1-in25.2%
metadata-eval25.2%
mul0-lft25.2%
Simplified25.2%
if 9.99989e-321 < (pow.f64 B 2) < 9.99999999999999954e-259Initial program 31.4%
Taylor expanded in A around -inf 37.0%
Taylor expanded in B around 0 43.1%
if 2.0000000000000001e-135 < (pow.f64 B 2) < 5.0000000000000002e-62Initial program 26.8%
Taylor expanded in A around -inf 69.8%
Taylor expanded in F around 0 69.8%
if 5.0000000000000002e-62 < (pow.f64 B 2) Initial program 14.5%
Taylor expanded in C around 0 12.7%
mul-1-neg12.7%
distribute-rgt-neg-in12.7%
+-commutative12.7%
unpow212.7%
unpow212.7%
hypot-def28.3%
Simplified28.3%
pow1/228.4%
*-commutative28.4%
hypot-udef12.8%
unpow212.8%
unpow212.8%
unpow-prod-down13.4%
Applied egg-rr36.4%
Final simplification35.7%
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))))
(t_2 (/ (- (sqrt (* (* F t_0) (* 2.0 (+ A A))))) t_0)))
(if (<= (pow B 2.0) 1e-320)
t_2
(if (<= (pow B 2.0) 1e-258)
(/ (- (sqrt (* -16.0 (* A (* F (pow C 2.0)))))) t_1)
(if (<= (pow B 2.0) 2e-135)
t_2
(if (<= (pow B 2.0) 5e-62)
(/
(- (sqrt (* 4.0 (* C (* F (- (pow B 2.0) (* 4.0 (* A C))))))))
t_1)
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt (+ B A)))))))))))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 t_2 = -sqrt(((F * t_0) * (2.0 * (A + A)))) / t_0;
double tmp;
if (pow(B, 2.0) <= 1e-320) {
tmp = t_2;
} else if (pow(B, 2.0) <= 1e-258) {
tmp = -sqrt((-16.0 * (A * (F * pow(C, 2.0))))) / t_1;
} else if (pow(B, 2.0) <= 2e-135) {
tmp = t_2;
} else if (pow(B, 2.0) <= 5e-62) {
tmp = -sqrt((4.0 * (C * (F * (pow(B, 2.0) - (4.0 * (A * C))))))) / t_1;
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((B + A)));
}
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))) t_2 = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + A))))) / t_0) tmp = 0.0 if ((B ^ 2.0) <= 1e-320) tmp = t_2; elseif ((B ^ 2.0) <= 1e-258) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(A * Float64(F * (C ^ 2.0)))))) / t_1); elseif ((B ^ 2.0) <= 2e-135) tmp = t_2; elseif ((B ^ 2.0) <= 5e-62) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64((B ^ 2.0) - Float64(4.0 * Float64(A * C)))))))) / t_1); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(Float64(B + A))))); 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]}, Block[{t$95$2 = 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-320], t$95$2, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e-258], N[((-N[Sqrt[N[(-16.0 * N[(A * N[(F * N[Power[C, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-135], t$95$2, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-62], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[Power[B, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B + A), $MachinePrecision]], $MachinePrecision])), $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)\\
t_2 := \frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{if}\;{B}^{2} \leq 10^{-320}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;{B}^{2} \leq 10^{-258}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(A \cdot \left(F \cdot {C}^{2}\right)\right)}}{t_1}\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-135}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;{B}^{2} \leq 5 \cdot 10^{-62}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B + A}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.99989e-321 or 9.99999999999999954e-259 < (pow.f64 B 2) < 2.0000000000000001e-135Initial program 15.4%
Simplified25.1%
Taylor expanded in A around inf 25.2%
distribute-rgt1-in25.2%
metadata-eval25.2%
mul0-lft25.2%
Simplified25.2%
if 9.99989e-321 < (pow.f64 B 2) < 9.99999999999999954e-259Initial program 31.4%
Taylor expanded in A around -inf 37.0%
Taylor expanded in B around 0 43.1%
if 2.0000000000000001e-135 < (pow.f64 B 2) < 5.0000000000000002e-62Initial program 26.8%
Taylor expanded in A around -inf 69.8%
Taylor expanded in F around 0 69.8%
if 5.0000000000000002e-62 < (pow.f64 B 2) Initial program 14.5%
Taylor expanded in C around 0 12.7%
mul-1-neg12.7%
distribute-rgt-neg-in12.7%
+-commutative12.7%
unpow212.7%
unpow212.7%
hypot-def28.3%
Simplified28.3%
pow1/228.4%
*-commutative28.4%
hypot-udef12.8%
unpow212.8%
unpow212.8%
unpow-prod-down13.4%
Applied egg-rr36.4%
Taylor expanded in A around 0 32.7%
+-commutative32.7%
Simplified32.7%
Final simplification33.5%
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) 4e-259)
(/
(*
(sqrt (* 2.0 (* 2.0 (* F (+ (pow B 2.0) (* (* A C) -4.0))))))
(- (sqrt C)))
t_1)
(if (<= (pow B 2.0) 2e-135)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A A))))) t_0)
(if (<= (pow B 2.0) 1e-22)
(/ (- (sqrt (* (* 2.0 (* F t_1)) (+ C (hypot B C))))) t_1)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot A B))) (- (sqrt F)))))))))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) <= 4e-259) {
tmp = (sqrt((2.0 * (2.0 * (F * (pow(B, 2.0) + ((A * C) * -4.0)))))) * -sqrt(C)) / t_1;
} else if (pow(B, 2.0) <= 2e-135) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + A)))) / t_0;
} else if (pow(B, 2.0) <= 1e-22) {
tmp = -sqrt(((2.0 * (F * t_1)) * (C + hypot(B, C)))) / t_1;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(A, B))) * -sqrt(F));
}
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) <= 4e-259) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(2.0 * Float64(F * Float64((B ^ 2.0) + Float64(Float64(A * C) * -4.0)))))) * Float64(-sqrt(C))) / t_1); elseif ((B ^ 2.0) <= 2e-135) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + A))))) / t_0); elseif ((B ^ 2.0) <= 1e-22) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(C + hypot(B, C))))) / t_1); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(A, B))) * Float64(-sqrt(F)))); 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], 4e-259], N[(N[(N[Sqrt[N[(2.0 * N[(2.0 * N[(F * N[(N[Power[B, 2.0], $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[C], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-135], 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-22], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $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 4 \cdot 10^{-259}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(2 \cdot \left(F \cdot \left({B}^{2} + \left(A \cdot C\right) \cdot -4\right)\right)\right)} \cdot \left(-\sqrt{C}\right)}{t_1}\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-135}:\\
\;\;\;\;\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^{-22}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.0000000000000003e-259Initial program 17.9%
Taylor expanded in A around -inf 16.6%
pow1/216.7%
associate-*r*16.7%
unpow-prod-down26.8%
*-commutative26.8%
associate-*l*26.8%
pow1/226.8%
Applied egg-rr26.8%
unpow1/226.8%
*-commutative26.8%
cancel-sign-sub-inv26.8%
metadata-eval26.8%
Simplified26.8%
if 4.0000000000000003e-259 < (pow.f64 B 2) < 2.0000000000000001e-135Initial program 20.0%
Simplified29.5%
Taylor expanded in A around inf 32.1%
distribute-rgt1-in32.1%
metadata-eval32.1%
mul0-lft32.1%
Simplified32.1%
if 2.0000000000000001e-135 < (pow.f64 B 2) < 1e-22Initial program 30.3%
Taylor expanded in A around 0 44.9%
unpow244.9%
unpow244.9%
hypot-def63.4%
Simplified63.4%
if 1e-22 < (pow.f64 B 2) Initial program 13.6%
Taylor expanded in C around 0 13.1%
mul-1-neg13.1%
distribute-rgt-neg-in13.1%
+-commutative13.1%
unpow213.1%
unpow213.1%
hypot-def29.3%
Simplified29.3%
pow1/229.3%
*-commutative29.3%
hypot-udef13.2%
unpow213.2%
unpow213.2%
unpow-prod-down13.8%
Applied egg-rr37.6%
Final simplification36.3%
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) 4e-259)
(/
(*
(sqrt (* 2.0 (* 2.0 (* F (+ (pow B 2.0) (* (* A C) -4.0))))))
(- (sqrt C)))
t_1)
(if (<= (pow B 2.0) 2e-135)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A A))))) t_0)
(if (<= (pow B 2.0) 5e-62)
(/ (- (sqrt (* 4.0 (* C (* F (- (pow B 2.0) (* 4.0 (* A C)))))))) t_1)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot A B))) (- (sqrt F)))))))))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) <= 4e-259) {
tmp = (sqrt((2.0 * (2.0 * (F * (pow(B, 2.0) + ((A * C) * -4.0)))))) * -sqrt(C)) / t_1;
} else if (pow(B, 2.0) <= 2e-135) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + A)))) / t_0;
} else if (pow(B, 2.0) <= 5e-62) {
tmp = -sqrt((4.0 * (C * (F * (pow(B, 2.0) - (4.0 * (A * C))))))) / t_1;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(A, B))) * -sqrt(F));
}
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) <= 4e-259) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(2.0 * Float64(F * Float64((B ^ 2.0) + Float64(Float64(A * C) * -4.0)))))) * Float64(-sqrt(C))) / t_1); elseif ((B ^ 2.0) <= 2e-135) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + A))))) / t_0); elseif ((B ^ 2.0) <= 5e-62) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64((B ^ 2.0) - Float64(4.0 * Float64(A * C)))))))) / t_1); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(A, B))) * Float64(-sqrt(F)))); 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], 4e-259], N[(N[(N[Sqrt[N[(2.0 * N[(2.0 * N[(F * N[(N[Power[B, 2.0], $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[C], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-135], 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], 5e-62], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[Power[B, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $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 4 \cdot 10^{-259}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(2 \cdot \left(F \cdot \left({B}^{2} + \left(A \cdot C\right) \cdot -4\right)\right)\right)} \cdot \left(-\sqrt{C}\right)}{t_1}\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-135}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 5 \cdot 10^{-62}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.0000000000000003e-259Initial program 17.9%
Taylor expanded in A around -inf 16.6%
pow1/216.7%
associate-*r*16.7%
unpow-prod-down26.8%
*-commutative26.8%
associate-*l*26.8%
pow1/226.8%
Applied egg-rr26.8%
unpow1/226.8%
*-commutative26.8%
cancel-sign-sub-inv26.8%
metadata-eval26.8%
Simplified26.8%
if 4.0000000000000003e-259 < (pow.f64 B 2) < 2.0000000000000001e-135Initial program 20.0%
Simplified29.5%
Taylor expanded in A around inf 32.1%
distribute-rgt1-in32.1%
metadata-eval32.1%
mul0-lft32.1%
Simplified32.1%
if 2.0000000000000001e-135 < (pow.f64 B 2) < 5.0000000000000002e-62Initial program 26.8%
Taylor expanded in A around -inf 69.8%
Taylor expanded in F around 0 69.8%
if 5.0000000000000002e-62 < (pow.f64 B 2) Initial program 14.5%
Taylor expanded in C around 0 12.7%
mul-1-neg12.7%
distribute-rgt-neg-in12.7%
+-commutative12.7%
unpow212.7%
unpow212.7%
hypot-def28.3%
Simplified28.3%
pow1/228.4%
*-commutative28.4%
hypot-udef12.8%
unpow212.8%
unpow212.8%
unpow-prod-down13.4%
Applied egg-rr36.4%
Final simplification35.5%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= (pow B 2.0) 4e+52)
(/
(*
(sqrt (+ A (+ C (hypot (- A C) B))))
(- (sqrt (* 2.0 (* F (- (pow B 2.0) (* 4.0 (* A C))))))))
(- (pow B 2.0) (* C (* A 4.0))))
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot A B))) (- (sqrt F))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 4e+52) {
tmp = (sqrt((A + (C + hypot((A - C), B)))) * -sqrt((2.0 * (F * (pow(B, 2.0) - (4.0 * (A * C))))))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(A, B))) * -sqrt(F));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (Math.pow(B, 2.0) <= 4e+52) {
tmp = (Math.sqrt((A + (C + Math.hypot((A - C), B)))) * -Math.sqrt((2.0 * (F * (Math.pow(B, 2.0) - (4.0 * (A * C))))))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt((A + Math.hypot(A, B))) * -Math.sqrt(F));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if math.pow(B, 2.0) <= 4e+52: tmp = (math.sqrt((A + (C + math.hypot((A - C), B)))) * -math.sqrt((2.0 * (F * (math.pow(B, 2.0) - (4.0 * (A * C))))))) / (math.pow(B, 2.0) - (C * (A * 4.0))) else: tmp = (math.sqrt(2.0) / B) * (math.sqrt((A + math.hypot(A, B))) * -math.sqrt(F)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 4e+52) tmp = Float64(Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B)))) * Float64(-sqrt(Float64(2.0 * Float64(F * Float64((B ^ 2.0) - Float64(4.0 * Float64(A * C)))))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(A, B))) * Float64(-sqrt(F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if ((B ^ 2.0) <= 4e+52) tmp = (sqrt((A + (C + hypot((A - C), B)))) * -sqrt((2.0 * (F * ((B ^ 2.0) - (4.0 * (A * C))))))) / ((B ^ 2.0) - (C * (A * 4.0))); else tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(A, B))) * -sqrt(F)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 4e+52], N[(N[(N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * N[(N[Power[B, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 4 \cdot 10^{+52}:\\
\;\;\;\;\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\right)\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)}\right)}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4e52Initial program 22.8%
+-commutative22.8%
unpow222.8%
unpow222.8%
hypot-udef32.5%
expm1-log1p-u30.8%
hypot-udef22.0%
unpow222.0%
unpow222.0%
+-commutative22.0%
unpow222.0%
unpow222.0%
hypot-def30.8%
Applied egg-rr30.8%
pow1/230.9%
*-commutative30.9%
expm1-log1p-u32.5%
unpow-prod-down42.8%
pow1/242.8%
associate-+l+43.5%
pow1/243.5%
*-commutative43.5%
associate-*l*43.5%
Applied egg-rr43.5%
if 4e52 < (pow.f64 B 2) Initial program 10.7%
Taylor expanded in C around 0 12.9%
mul-1-neg12.9%
distribute-rgt-neg-in12.9%
+-commutative12.9%
unpow212.9%
unpow212.9%
hypot-def30.6%
Simplified30.6%
pow1/230.6%
*-commutative30.6%
hypot-udef12.9%
unpow212.9%
unpow212.9%
unpow-prod-down13.6%
Applied egg-rr39.8%
Final simplification41.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) 4e+52)
(/
(* (sqrt (* F t_0)) (- (sqrt (* 2.0 (+ (hypot (- A C) B) (+ A C))))))
t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot A B))) (- (sqrt F)))))))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) <= 4e+52) {
tmp = (sqrt((F * t_0)) * -sqrt((2.0 * (hypot((A - C), B) + (A + C))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(A, B))) * -sqrt(F));
}
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) <= 4e+52) tmp = Float64(Float64(sqrt(Float64(F * t_0)) * Float64(-sqrt(Float64(2.0 * Float64(hypot(Float64(A - C), B) + Float64(A + C)))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(A, B))) * Float64(-sqrt(F)))); 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], 4e+52], N[(N[(N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $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 4 \cdot 10^{+52}:\\
\;\;\;\;\frac{\sqrt{F \cdot t_0} \cdot \left(-\sqrt{2 \cdot \left(\mathsf{hypot}\left(A - C, B\right) + \left(A + C\right)\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4e52Initial program 22.8%
Simplified33.9%
sqrt-prod43.6%
*-commutative43.6%
associate-+r+42.8%
hypot-udef24.9%
unpow224.9%
unpow224.9%
+-commutative24.9%
+-commutative24.9%
unpow224.9%
unpow224.9%
hypot-def42.8%
Applied egg-rr42.8%
+-commutative42.8%
Simplified42.8%
if 4e52 < (pow.f64 B 2) Initial program 10.7%
Taylor expanded in C around 0 12.9%
mul-1-neg12.9%
distribute-rgt-neg-in12.9%
+-commutative12.9%
unpow212.9%
unpow212.9%
hypot-def30.6%
Simplified30.6%
pow1/230.6%
*-commutative30.6%
hypot-udef12.9%
unpow212.9%
unpow212.9%
unpow-prod-down13.6%
Applied egg-rr39.8%
Final simplification41.3%
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) 4e+52)
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ (hypot (- A C) B) (+ A C))))))) t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot A B))) (- (sqrt F)))))))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) <= 4e+52) {
tmp = -sqrt((2.0 * (t_0 * (F * (hypot((A - C), B) + (A + C)))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(A, B))) * -sqrt(F));
}
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) <= 4e+52) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(hypot(Float64(A - C), B) + Float64(A + C))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(A, B))) * Float64(-sqrt(F)))); 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], 4e+52], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $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 4 \cdot 10^{+52}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(\mathsf{hypot}\left(A - C, B\right) + \left(A + C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4e52Initial program 22.8%
expm1-log1p-u10.1%
expm1-udef5.6%
Applied egg-rr10.9%
Simplified33.1%
if 4e52 < (pow.f64 B 2) Initial program 10.7%
Taylor expanded in C around 0 12.9%
mul-1-neg12.9%
distribute-rgt-neg-in12.9%
+-commutative12.9%
unpow212.9%
unpow212.9%
hypot-def30.6%
Simplified30.6%
pow1/230.6%
*-commutative30.6%
hypot-udef12.9%
unpow212.9%
unpow212.9%
unpow-prod-down13.6%
Applied egg-rr39.8%
Final simplification36.5%
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) 4e+52)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A (+ C (hypot B (- A C)))))))) t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot A B))) (- (sqrt F)))))))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) <= 4e+52) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + (C + hypot(B, (A - C))))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(A, B))) * -sqrt(F));
}
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) <= 4e+52) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + Float64(C + hypot(B, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(A, B))) * Float64(-sqrt(F)))); 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], 4e+52], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $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 4 \cdot 10^{+52}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4e52Initial program 22.8%
Simplified33.9%
if 4e52 < (pow.f64 B 2) Initial program 10.7%
Taylor expanded in C around 0 12.9%
mul-1-neg12.9%
distribute-rgt-neg-in12.9%
+-commutative12.9%
unpow212.9%
unpow212.9%
hypot-def30.6%
Simplified30.6%
pow1/230.6%
*-commutative30.6%
hypot-udef12.9%
unpow212.9%
unpow212.9%
unpow-prod-down13.6%
Applied egg-rr39.8%
Final simplification36.9%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= (pow B 2.0) 5e-62)
(/
(- (sqrt (* 4.0 (* C (* F (- (pow B 2.0) (* 4.0 (* A C))))))))
(- (pow B 2.0) (* C (* A 4.0))))
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt (+ B A)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 5e-62) {
tmp = -sqrt((4.0 * (C * (F * (pow(B, 2.0) - (4.0 * (A * C))))))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((B + A)));
}
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 ((b ** 2.0d0) <= 5d-62) then
tmp = -sqrt((4.0d0 * (c * (f * ((b ** 2.0d0) - (4.0d0 * (a * c))))))) / ((b ** 2.0d0) - (c * (a * 4.0d0)))
else
tmp = (sqrt(2.0d0) / b) * (sqrt(f) * -sqrt((b + a)))
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 (Math.pow(B, 2.0) <= 5e-62) {
tmp = -Math.sqrt((4.0 * (C * (F * (Math.pow(B, 2.0) - (4.0 * (A * C))))))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt(F) * -Math.sqrt((B + A)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if math.pow(B, 2.0) <= 5e-62: tmp = -math.sqrt((4.0 * (C * (F * (math.pow(B, 2.0) - (4.0 * (A * C))))))) / (math.pow(B, 2.0) - (C * (A * 4.0))) else: tmp = (math.sqrt(2.0) / B) * (math.sqrt(F) * -math.sqrt((B + A))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 5e-62) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64((B ^ 2.0) - Float64(4.0 * Float64(A * C)))))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(Float64(B + A))))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if ((B ^ 2.0) <= 5e-62) tmp = -sqrt((4.0 * (C * (F * ((B ^ 2.0) - (4.0 * (A * C))))))) / ((B ^ 2.0) - (C * (A * 4.0))); else tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((B + A))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-62], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[Power[B, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B + A), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-62}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B + A}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.0000000000000002e-62Initial program 19.7%
Taylor expanded in A around -inf 24.7%
Taylor expanded in F around 0 24.7%
if 5.0000000000000002e-62 < (pow.f64 B 2) Initial program 14.5%
Taylor expanded in C around 0 12.7%
mul-1-neg12.7%
distribute-rgt-neg-in12.7%
+-commutative12.7%
unpow212.7%
unpow212.7%
hypot-def28.3%
Simplified28.3%
pow1/228.4%
*-commutative28.4%
hypot-udef12.8%
unpow212.8%
unpow212.8%
unpow-prod-down13.4%
Applied egg-rr36.4%
Taylor expanded in A around 0 32.7%
+-commutative32.7%
Simplified32.7%
Final simplification29.3%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= (pow B 2.0) 5e-73)
(/
(- (sqrt (* (* 2.0 (* -4.0 (* A (* C F)))) (* 2.0 C))))
(- (pow B 2.0) (* C (* A 4.0))))
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt (+ B A)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 5e-73) {
tmp = -sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((B + A)));
}
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 ((b ** 2.0d0) <= 5d-73) then
tmp = -sqrt(((2.0d0 * ((-4.0d0) * (a * (c * f)))) * (2.0d0 * c))) / ((b ** 2.0d0) - (c * (a * 4.0d0)))
else
tmp = (sqrt(2.0d0) / b) * (sqrt(f) * -sqrt((b + a)))
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 (Math.pow(B, 2.0) <= 5e-73) {
tmp = -Math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt(F) * -Math.sqrt((B + A)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if math.pow(B, 2.0) <= 5e-73: tmp = -math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / (math.pow(B, 2.0) - (C * (A * 4.0))) else: tmp = (math.sqrt(2.0) / B) * (math.sqrt(F) * -math.sqrt((B + A))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 5e-73) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F)))) * Float64(2.0 * C)))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(Float64(B + A))))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if ((B ^ 2.0) <= 5e-73) tmp = -sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / ((B ^ 2.0) - (C * (A * 4.0))); else tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((B + A))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-73], N[((-N[Sqrt[N[(N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B + A), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-73}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right) \cdot \left(2 \cdot C\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B + A}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.9999999999999998e-73Initial program 19.2%
Taylor expanded in A around -inf 24.5%
Taylor expanded in B around 0 23.5%
*-commutative23.5%
Simplified23.5%
if 4.9999999999999998e-73 < (pow.f64 B 2) Initial program 14.9%
Taylor expanded in C around 0 12.6%
mul-1-neg12.6%
distribute-rgt-neg-in12.6%
+-commutative12.6%
unpow212.6%
unpow212.6%
hypot-def27.9%
Simplified27.9%
pow1/227.9%
*-commutative27.9%
hypot-udef12.6%
unpow212.6%
unpow212.6%
unpow-prod-down13.2%
Applied egg-rr35.7%
Taylor expanded in A around 0 32.1%
+-commutative32.1%
Simplified32.1%
Final simplification28.6%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= (pow B 2.0) 5e-73)
(/
(- (sqrt (* (* 2.0 (* -4.0 (* A (* C F)))) (* 2.0 C))))
(- (pow B 2.0) (* C (* A 4.0))))
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt B))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 5e-73) {
tmp = -sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt(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 ((b ** 2.0d0) <= 5d-73) then
tmp = -sqrt(((2.0d0 * ((-4.0d0) * (a * (c * f)))) * (2.0d0 * c))) / ((b ** 2.0d0) - (c * (a * 4.0d0)))
else
tmp = (sqrt(2.0d0) / b) * (sqrt(f) * -sqrt(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 (Math.pow(B, 2.0) <= 5e-73) {
tmp = -Math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt(F) * -Math.sqrt(B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if math.pow(B, 2.0) <= 5e-73: tmp = -math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / (math.pow(B, 2.0) - (C * (A * 4.0))) else: tmp = (math.sqrt(2.0) / B) * (math.sqrt(F) * -math.sqrt(B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 5e-73) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F)))) * Float64(2.0 * C)))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if ((B ^ 2.0) <= 5e-73) tmp = -sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / ((B ^ 2.0) - (C * (A * 4.0))); else tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt(B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-73], N[((-N[Sqrt[N[(N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[B], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-73}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right) \cdot \left(2 \cdot C\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.9999999999999998e-73Initial program 19.2%
Taylor expanded in A around -inf 24.5%
Taylor expanded in B around 0 23.5%
*-commutative23.5%
Simplified23.5%
if 4.9999999999999998e-73 < (pow.f64 B 2) Initial program 14.9%
Taylor expanded in C around 0 12.6%
mul-1-neg12.6%
distribute-rgt-neg-in12.6%
+-commutative12.6%
unpow212.6%
unpow212.6%
hypot-def27.9%
Simplified27.9%
pow1/227.9%
*-commutative27.9%
hypot-udef12.6%
unpow212.6%
unpow212.6%
unpow-prod-down13.2%
Applied egg-rr35.7%
Taylor expanded in A around 0 31.9%
Final simplification28.5%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F -3.6e-210)
(/
(- (sqrt (* (* 2.0 (* -4.0 (* A (* C F)))) (* 2.0 C))))
(- (pow B 2.0) (* C (* A 4.0))))
(if (<= F 2.55e+39)
(* (/ (sqrt 2.0) B) (- (sqrt (* B F))))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -3.6e-210) {
tmp = -sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else if (F <= 2.55e+39) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else {
tmp = sqrt(2.0) * -sqrt((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 <= (-3.6d-210)) then
tmp = -sqrt(((2.0d0 * ((-4.0d0) * (a * (c * f)))) * (2.0d0 * c))) / ((b ** 2.0d0) - (c * (a * 4.0d0)))
else if (f <= 2.55d+39) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else
tmp = sqrt(2.0d0) * -sqrt((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 <= -3.6e-210) {
tmp = -Math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else if (F <= 2.55e+39) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= -3.6e-210: tmp = -math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / (math.pow(B, 2.0) - (C * (A * 4.0))) elif F <= 2.55e+39: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= -3.6e-210) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F)))) * Float64(2.0 * C)))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); elseif (F <= 2.55e+39) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= -3.6e-210) tmp = -sqrt(((2.0 * (-4.0 * (A * (C * F)))) * (2.0 * C))) / ((B ^ 2.0) - (C * (A * 4.0))); elseif (F <= 2.55e+39) tmp = (sqrt(2.0) / B) * -sqrt((B * F)); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, -3.6e-210], N[((-N[Sqrt[N[(N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.55e+39], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.6 \cdot 10^{-210}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right) \cdot \left(2 \cdot C\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{elif}\;F \leq 2.55 \cdot 10^{+39}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -3.5999999999999999e-210Initial program 21.8%
Taylor expanded in A around -inf 25.5%
Taylor expanded in B around 0 25.5%
*-commutative25.5%
Simplified25.5%
if -3.5999999999999999e-210 < F < 2.5499999999999999e39Initial program 19.9%
Taylor expanded in C around 0 11.6%
mul-1-neg11.6%
distribute-rgt-neg-in11.6%
+-commutative11.6%
unpow211.6%
unpow211.6%
hypot-def27.9%
Simplified27.9%
Taylor expanded in A around 0 25.0%
if 2.5499999999999999e39 < F Initial program 11.6%
Taylor expanded in C around 0 11.9%
mul-1-neg11.9%
distribute-rgt-neg-in11.9%
+-commutative11.9%
unpow211.9%
unpow211.9%
hypot-def15.9%
Simplified15.9%
Taylor expanded in A around 0 22.8%
mul-1-neg22.8%
Simplified22.8%
Final simplification24.2%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= F 1.4e+39) (* (/ (sqrt 2.0) B) (- (sqrt (* B F)))) (* (sqrt 2.0) (- (sqrt (/ F B))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 1.4e+39) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else {
tmp = sqrt(2.0) * -sqrt((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 <= 1.4d+39) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else
tmp = sqrt(2.0d0) * -sqrt((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 <= 1.4e+39) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 1.4e+39: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 1.4e+39) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 1.4e+39) tmp = (sqrt(2.0) / B) * -sqrt((B * F)); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 1.4e+39], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.4 \cdot 10^{+39}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 1.40000000000000001e39Initial program 20.3%
Taylor expanded in C around 0 9.2%
mul-1-neg9.2%
distribute-rgt-neg-in9.2%
+-commutative9.2%
unpow29.2%
unpow29.2%
hypot-def22.1%
Simplified22.1%
Taylor expanded in A around 0 20.6%
if 1.40000000000000001e39 < F Initial program 11.6%
Taylor expanded in C around 0 11.9%
mul-1-neg11.9%
distribute-rgt-neg-in11.9%
+-commutative11.9%
unpow211.9%
unpow211.9%
hypot-def15.9%
Simplified15.9%
Taylor expanded in A around 0 22.8%
mul-1-neg22.8%
Simplified22.8%
Final simplification21.5%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (sqrt 2.0) (- (sqrt (/ F B)))))
B = abs(B);
double code(double A, double B, double C, double F) {
return sqrt(2.0) * -sqrt((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) * -sqrt((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) * -Math.sqrt((F / B));
}
B = abs(B) def code(A, B, C, F): return math.sqrt(2.0) * -math.sqrt((F / B))
B = abs(B) function code(A, B, C, F) return Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = sqrt(2.0) * -sqrt((F / B)); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)
\end{array}
Initial program 16.7%
Taylor expanded in C around 0 10.3%
mul-1-neg10.3%
distribute-rgt-neg-in10.3%
+-commutative10.3%
unpow210.3%
unpow210.3%
hypot-def19.5%
Simplified19.5%
Taylor expanded in A around 0 15.2%
mul-1-neg15.2%
Simplified15.2%
Final simplification15.2%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= C 2.4e-286) (* (sqrt (* A F)) (/ (- 2.0) B)) (* -2.0 (* (/ 1.0 B) (pow (* C F) 0.5)))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (C <= 2.4e-286) {
tmp = sqrt((A * F)) * (-2.0 / B);
} else {
tmp = -2.0 * ((1.0 / B) * pow((C * F), 0.5));
}
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 <= 2.4d-286) then
tmp = sqrt((a * f)) * (-2.0d0 / b)
else
tmp = (-2.0d0) * ((1.0d0 / b) * ((c * f) ** 0.5d0))
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 <= 2.4e-286) {
tmp = Math.sqrt((A * F)) * (-2.0 / B);
} else {
tmp = -2.0 * ((1.0 / B) * Math.pow((C * F), 0.5));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if C <= 2.4e-286: tmp = math.sqrt((A * F)) * (-2.0 / B) else: tmp = -2.0 * ((1.0 / B) * math.pow((C * F), 0.5)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (C <= 2.4e-286) tmp = Float64(sqrt(Float64(A * F)) * Float64(Float64(-2.0) / B)); else tmp = Float64(-2.0 * Float64(Float64(1.0 / B) * (Float64(C * F) ^ 0.5))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (C <= 2.4e-286) tmp = sqrt((A * F)) * (-2.0 / B); else tmp = -2.0 * ((1.0 / B) * ((C * F) ^ 0.5)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[C, 2.4e-286], N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[((-2.0) / B), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(1.0 / B), $MachinePrecision] * N[Power[N[(C * F), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 2.4 \cdot 10^{-286}:\\
\;\;\;\;\sqrt{A \cdot F} \cdot \frac{-2}{B}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(\frac{1}{B} \cdot {\left(C \cdot F\right)}^{0.5}\right)\\
\end{array}
\end{array}
if C < 2.39999999999999993e-286Initial program 15.7%
Taylor expanded in C around 0 11.5%
mul-1-neg11.5%
distribute-rgt-neg-in11.5%
+-commutative11.5%
unpow211.5%
unpow211.5%
hypot-def20.2%
Simplified20.2%
pow1/220.2%
*-commutative20.2%
hypot-udef11.5%
unpow211.5%
unpow211.5%
unpow-prod-down12.2%
Applied egg-rr27.7%
Taylor expanded in B around 0 4.0%
mul-1-neg4.0%
distribute-rgt-neg-in4.0%
unpow24.0%
rem-square-sqrt4.0%
Simplified4.0%
if 2.39999999999999993e-286 < C Initial program 17.5%
Taylor expanded in A around -inf 20.1%
Taylor expanded in B around inf 6.4%
pow1/26.7%
*-commutative6.7%
Applied egg-rr6.7%
Final simplification5.4%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= C 7.2e-286) (* (sqrt (* A F)) (/ (- 2.0) B)) (* -2.0 (/ (sqrt (* C F)) B))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (C <= 7.2e-286) {
tmp = sqrt((A * F)) * (-2.0 / B);
} else {
tmp = -2.0 * (sqrt((C * 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 (c <= 7.2d-286) then
tmp = sqrt((a * f)) * (-2.0d0 / b)
else
tmp = (-2.0d0) * (sqrt((c * 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 (C <= 7.2e-286) {
tmp = Math.sqrt((A * F)) * (-2.0 / B);
} else {
tmp = -2.0 * (Math.sqrt((C * F)) / B);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if C <= 7.2e-286: tmp = math.sqrt((A * F)) * (-2.0 / B) else: tmp = -2.0 * (math.sqrt((C * F)) / B) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (C <= 7.2e-286) tmp = Float64(sqrt(Float64(A * F)) * Float64(Float64(-2.0) / B)); else tmp = Float64(-2.0 * Float64(sqrt(Float64(C * F)) / B)); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (C <= 7.2e-286) tmp = sqrt((A * F)) * (-2.0 / B); else tmp = -2.0 * (sqrt((C * F)) / B); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[C, 7.2e-286], N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[((-2.0) / B), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 7.2 \cdot 10^{-286}:\\
\;\;\;\;\sqrt{A \cdot F} \cdot \frac{-2}{B}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{C \cdot F}}{B}\\
\end{array}
\end{array}
if C < 7.20000000000000027e-286Initial program 15.7%
Taylor expanded in C around 0 11.5%
mul-1-neg11.5%
distribute-rgt-neg-in11.5%
+-commutative11.5%
unpow211.5%
unpow211.5%
hypot-def20.2%
Simplified20.2%
pow1/220.2%
*-commutative20.2%
hypot-udef11.5%
unpow211.5%
unpow211.5%
unpow-prod-down12.2%
Applied egg-rr27.7%
Taylor expanded in B around 0 4.0%
mul-1-neg4.0%
distribute-rgt-neg-in4.0%
unpow24.0%
rem-square-sqrt4.0%
Simplified4.0%
if 7.20000000000000027e-286 < C Initial program 17.5%
Taylor expanded in A around -inf 20.1%
Taylor expanded in B around inf 6.4%
expm1-log1p-u6.2%
expm1-udef4.8%
associate-*l/4.8%
*-un-lft-identity4.8%
*-commutative4.8%
Applied egg-rr4.8%
expm1-def6.2%
expm1-log1p6.4%
Simplified6.4%
Final simplification5.3%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* -2.0 (/ (sqrt (* C F)) B)))
B = abs(B);
double code(double A, double B, double C, double F) {
return -2.0 * (sqrt((C * 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 = (-2.0d0) * (sqrt((c * f)) / b)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return -2.0 * (Math.sqrt((C * F)) / B);
}
B = abs(B) def code(A, B, C, F): return -2.0 * (math.sqrt((C * F)) / B)
B = abs(B) function code(A, B, C, F) return Float64(-2.0 * Float64(sqrt(Float64(C * F)) / B)) end
B = abs(B) function tmp = code(A, B, C, F) tmp = -2.0 * (sqrt((C * F)) / B); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(-2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
-2 \cdot \frac{\sqrt{C \cdot F}}{B}
\end{array}
Initial program 16.7%
Taylor expanded in A around -inf 11.6%
Taylor expanded in B around inf 3.8%
expm1-log1p-u3.7%
expm1-udef2.9%
associate-*l/2.9%
*-un-lft-identity2.9%
*-commutative2.9%
Applied egg-rr2.9%
expm1-def3.7%
expm1-log1p3.8%
Simplified3.8%
Final simplification3.8%
herbie shell --seed 2023309
(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))))