
(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 21 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 (fma B B (* A (* C -4.0)))) (t_1 (* 2.0 (* t_0 F))))
(if (<= B 1.55e-260)
(/ (- (sqrt (* t_1 (+ C C)))) t_0)
(if (<= B 1.1e-221)
(/ (- (sqrt (* t_1 (+ A A)))) t_0)
(if (<= B 2.2e-185)
(*
-0.5
(* (sqrt 2.0) (sqrt (/ F (/ A (fma 0.5 (* (/ B A) (/ B A)) -2.0))))))
(if (<= B 1.9e+97)
(/
(*
(sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))
(- (sqrt (+ A (+ C (hypot B (- A C)))))))
(- (* B B) (* (* A C) 4.0)))
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (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 = 2.0 * (t_0 * F);
double tmp;
if (B <= 1.55e-260) {
tmp = -sqrt((t_1 * (C + C))) / t_0;
} else if (B <= 1.1e-221) {
tmp = -sqrt((t_1 * (A + A))) / t_0;
} else if (B <= 2.2e-185) {
tmp = -0.5 * (sqrt(2.0) * sqrt((F / (A / fma(0.5, ((B / A) * (B / A)), -2.0)))));
} else if (B <= 1.9e+97) {
tmp = (sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -sqrt((A + (C + hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -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(2.0 * Float64(t_0 * F)) tmp = 0.0 if (B <= 1.55e-260) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(C + C)))) / t_0); elseif (B <= 1.1e-221) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + A)))) / t_0); elseif (B <= 2.2e-185) tmp = Float64(-0.5 * Float64(sqrt(2.0) * sqrt(Float64(F / Float64(A / fma(0.5, Float64(Float64(B / A) * Float64(B / A)), -2.0)))))); elseif (B <= 1.9e+97) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(A + Float64(C + hypot(B, Float64(A - C))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, 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[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.55e-260], N[((-N[Sqrt[N[(t$95$1 * N[(C + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.1e-221], N[((-N[Sqrt[N[(t$95$1 * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.2e-185], N[(-0.5 * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F / N[(A / N[(0.5 * N[(N[(B / A), $MachinePrecision] * N[(B / A), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.9e+97], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 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 := 2 \cdot \left(t_0 \cdot F\right)\\
\mathbf{if}\;B \leq 1.55 \cdot 10^{-260}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(C + C\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.1 \cdot 10^{-221}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(A + A\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.2 \cdot 10^{-185}:\\
\;\;\;\;-0.5 \cdot \left(\sqrt{2} \cdot \sqrt{\frac{F}{\frac{A}{\mathsf{fma}\left(0.5, \frac{B}{A} \cdot \frac{B}{A}, -2\right)}}}\right)\\
\mathbf{elif}\;B \leq 1.9 \cdot 10^{+97}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 1.54999999999999991e-260Initial program 19.8%
Simplified26.7%
Taylor expanded in A around -inf 17.1%
if 1.54999999999999991e-260 < B < 1.10000000000000001e-221Initial program 12.4%
Simplified23.7%
Taylor expanded in A around inf 31.9%
distribute-rgt1-in31.9%
metadata-eval31.9%
mul0-lft31.9%
Simplified31.9%
if 1.10000000000000001e-221 < B < 2.2e-185Initial program 1.9%
Simplified1.9%
Taylor expanded in A around -inf 3.0%
associate-+r+3.0%
mul-1-neg3.0%
unsub-neg3.0%
distribute-lft-out3.0%
*-commutative3.0%
unpow23.0%
times-frac3.0%
unpow23.0%
unpow23.0%
Simplified3.0%
Taylor expanded in C around -inf 30.1%
*-commutative30.1%
associate-/l*30.1%
fma-neg30.1%
unpow230.1%
unpow230.1%
times-frac30.1%
metadata-eval30.1%
Simplified30.1%
if 2.2e-185 < B < 1.90000000000000018e97Initial program 40.1%
Simplified40.1%
sqrt-prod46.8%
*-commutative46.8%
cancel-sign-sub-inv46.8%
metadata-eval46.8%
associate-+l+46.8%
unpow246.8%
hypot-udef52.2%
Applied egg-rr52.2%
if 1.90000000000000018e97 < B Initial program 4.5%
Simplified4.5%
Taylor expanded in C around 0 14.5%
mul-1-neg14.5%
distribute-rgt-neg-in14.5%
*-commutative14.5%
+-commutative14.5%
unpow214.5%
unpow214.5%
hypot-def54.4%
Simplified54.4%
sqrt-prod84.7%
Applied egg-rr84.7%
hypot-def14.4%
unpow214.4%
unpow214.4%
+-commutative14.4%
unpow214.4%
unpow214.4%
hypot-def84.7%
Simplified84.7%
Final simplification39.0%
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+194)
(/
(* (sqrt (* 2.0 (* t_0 F))) (- (sqrt (+ A (+ C (hypot B (- A C)))))))
t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (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+194) {
tmp = (sqrt((2.0 * (t_0 * F))) * -sqrt((A + (C + hypot(B, (A - C)))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -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+194) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(t_0 * F))) * Float64(-sqrt(Float64(A + Float64(C + hypot(B, Float64(A - C))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, 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[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 4e+194], N[(N[(N[Sqrt[N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $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[B ^ 2 + A ^ 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^{+194}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(t_0 \cdot F\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 3.99999999999999978e194Initial program 29.1%
Simplified37.1%
sqrt-prod43.5%
associate-+r+42.3%
+-commutative42.3%
associate-+r+42.8%
Applied egg-rr42.8%
if 3.99999999999999978e194 < (pow.f64 B 2) Initial program 3.9%
Simplified3.9%
Taylor expanded in C around 0 8.5%
mul-1-neg8.5%
distribute-rgt-neg-in8.5%
*-commutative8.5%
+-commutative8.5%
unpow28.5%
unpow28.5%
hypot-def31.2%
Simplified31.2%
sqrt-prod48.0%
Applied egg-rr48.0%
hypot-def8.5%
unpow28.5%
unpow28.5%
+-commutative8.5%
unpow28.5%
unpow28.5%
hypot-def48.0%
Simplified48.0%
Final simplification44.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 (* 2.0 (* t_0 F))))
(if (<= B 1.5e-264)
(/ (- (sqrt (* t_1 (+ C C)))) t_0)
(if (<= B 2.2e-222)
(/ (- (sqrt (* t_1 (+ A A)))) t_0)
(if (<= B 5.3e-182)
(*
-0.5
(* (sqrt 2.0) (sqrt (/ F (/ A (fma 0.5 (* (/ B A) (/ B A)) -2.0))))))
(if (<= B 2.3e+131)
(/
(*
(sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))
(- (sqrt (+ A (+ C (hypot B (- A C)))))))
(- (* B B) (* (* A C) 4.0)))
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt (+ C (hypot C B))))))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double t_1 = 2.0 * (t_0 * F);
double tmp;
if (B <= 1.5e-264) {
tmp = -sqrt((t_1 * (C + C))) / t_0;
} else if (B <= 2.2e-222) {
tmp = -sqrt((t_1 * (A + A))) / t_0;
} else if (B <= 5.3e-182) {
tmp = -0.5 * (sqrt(2.0) * sqrt((F / (A / fma(0.5, ((B / A) * (B / A)), -2.0)))));
} else if (B <= 2.3e+131) {
tmp = (sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -sqrt((A + (C + hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((C + hypot(C, B))));
}
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(2.0 * Float64(t_0 * F)) tmp = 0.0 if (B <= 1.5e-264) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(C + C)))) / t_0); elseif (B <= 2.2e-222) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + A)))) / t_0); elseif (B <= 5.3e-182) tmp = Float64(-0.5 * Float64(sqrt(2.0) * sqrt(Float64(F / Float64(A / fma(0.5, Float64(Float64(B / A) * Float64(B / A)), -2.0)))))); elseif (B <= 2.3e+131) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(A + Float64(C + hypot(B, Float64(A - C))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(Float64(C + hypot(C, B)))))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.5e-264], N[((-N[Sqrt[N[(t$95$1 * N[(C + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.2e-222], N[((-N[Sqrt[N[(t$95$1 * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 5.3e-182], N[(-0.5 * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F / N[(A / N[(0.5 * N[(N[(B / A), $MachinePrecision] * N[(B / A), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 2.3e+131], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $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 := 2 \cdot \left(t_0 \cdot F\right)\\
\mathbf{if}\;B \leq 1.5 \cdot 10^{-264}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(C + C\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.2 \cdot 10^{-222}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(A + A\right)}}{t_0}\\
\mathbf{elif}\;B \leq 5.3 \cdot 10^{-182}:\\
\;\;\;\;-0.5 \cdot \left(\sqrt{2} \cdot \sqrt{\frac{F}{\frac{A}{\mathsf{fma}\left(0.5, \frac{B}{A} \cdot \frac{B}{A}, -2\right)}}}\right)\\
\mathbf{elif}\;B \leq 2.3 \cdot 10^{+131}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{C + \mathsf{hypot}\left(C, B\right)}\right)\right)\\
\end{array}
\end{array}
if B < 1.5e-264Initial program 19.8%
Simplified26.7%
Taylor expanded in A around -inf 17.1%
if 1.5e-264 < B < 2.2e-222Initial program 12.4%
Simplified23.7%
Taylor expanded in A around inf 31.9%
distribute-rgt1-in31.9%
metadata-eval31.9%
mul0-lft31.9%
Simplified31.9%
if 2.2e-222 < B < 5.30000000000000005e-182Initial program 1.9%
Simplified1.9%
Taylor expanded in A around -inf 3.0%
associate-+r+3.0%
mul-1-neg3.0%
unsub-neg3.0%
distribute-lft-out3.0%
*-commutative3.0%
unpow23.0%
times-frac3.0%
unpow23.0%
unpow23.0%
Simplified3.0%
Taylor expanded in C around -inf 30.1%
*-commutative30.1%
associate-/l*30.1%
fma-neg30.1%
unpow230.1%
unpow230.1%
times-frac30.1%
metadata-eval30.1%
Simplified30.1%
if 5.30000000000000005e-182 < B < 2.29999999999999992e131Initial program 38.1%
Simplified38.1%
sqrt-prod45.7%
*-commutative45.7%
cancel-sign-sub-inv45.7%
metadata-eval45.7%
associate-+l+45.7%
unpow245.7%
hypot-udef53.6%
Applied egg-rr53.6%
if 2.29999999999999992e131 < B Initial program 2.5%
Simplified2.5%
Taylor expanded in A around 0 7.2%
mul-1-neg7.2%
*-commutative7.2%
distribute-rgt-neg-in7.2%
*-commutative7.2%
+-commutative7.2%
unpow27.2%
unpow27.2%
hypot-def45.3%
Simplified45.3%
sqrt-prod79.0%
Applied egg-rr79.0%
Final simplification37.6%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (* F (+ A (hypot A B)))))
(t_1 (fma B B (* A (* C -4.0))))
(t_2 (* 2.0 (* t_1 F))))
(if (<= B 4.4e-262)
(/ (- (sqrt (* t_2 (+ C C)))) t_1)
(if (<= B 1.05e-221)
(/ (- (sqrt (* t_2 (+ A A)))) t_1)
(if (<= B 3.65e-183)
(*
-0.5
(* (sqrt 2.0) (sqrt (/ F (/ A (fma 0.5 (* (/ B A) (/ B A)) -2.0))))))
(if (<= B 5.9e+99)
(/
(*
(sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))
(- (sqrt (+ A (+ C (hypot B (- A C)))))))
(- (* B B) (* (* A C) 4.0)))
(if (<= B 7.5e+270)
(* (/ (- (sqrt 2.0)) B) t_0)
(if (<= B 2.8e+302)
(* (sqrt 2.0) (- (sqrt (/ F B))))
(/ (* (sqrt 2.0) (- t_0)) B)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((F * (A + hypot(A, B))));
double t_1 = fma(B, B, (A * (C * -4.0)));
double t_2 = 2.0 * (t_1 * F);
double tmp;
if (B <= 4.4e-262) {
tmp = -sqrt((t_2 * (C + C))) / t_1;
} else if (B <= 1.05e-221) {
tmp = -sqrt((t_2 * (A + A))) / t_1;
} else if (B <= 3.65e-183) {
tmp = -0.5 * (sqrt(2.0) * sqrt((F / (A / fma(0.5, ((B / A) * (B / A)), -2.0)))));
} else if (B <= 5.9e+99) {
tmp = (sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -sqrt((A + (C + hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0));
} else if (B <= 7.5e+270) {
tmp = (-sqrt(2.0) / B) * t_0;
} else if (B <= 2.8e+302) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else {
tmp = (sqrt(2.0) * -t_0) / B;
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = sqrt(Float64(F * Float64(A + hypot(A, B)))) t_1 = fma(B, B, Float64(A * Float64(C * -4.0))) t_2 = Float64(2.0 * Float64(t_1 * F)) tmp = 0.0 if (B <= 4.4e-262) tmp = Float64(Float64(-sqrt(Float64(t_2 * Float64(C + C)))) / t_1); elseif (B <= 1.05e-221) tmp = Float64(Float64(-sqrt(Float64(t_2 * Float64(A + A)))) / t_1); elseif (B <= 3.65e-183) tmp = Float64(-0.5 * Float64(sqrt(2.0) * sqrt(Float64(F / Float64(A / fma(0.5, Float64(Float64(B / A) * Float64(B / A)), -2.0)))))); elseif (B <= 5.9e+99) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(A + Float64(C + hypot(B, Float64(A - C))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))); elseif (B <= 7.5e+270) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * t_0); elseif (B <= 2.8e+302) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); else tmp = Float64(Float64(sqrt(2.0) * Float64(-t_0)) / B); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(F * N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 4.4e-262], N[((-N[Sqrt[N[(t$95$2 * N[(C + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 1.05e-221], N[((-N[Sqrt[N[(t$95$2 * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 3.65e-183], N[(-0.5 * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F / N[(A / N[(0.5 * N[(N[(B / A), $MachinePrecision] * N[(B / A), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 5.9e+99], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 7.5e+270], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[B, 2.8e+302], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-t$95$0)), $MachinePrecision] / B), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \sqrt{F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)}\\
t_1 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := 2 \cdot \left(t_1 \cdot F\right)\\
\mathbf{if}\;B \leq 4.4 \cdot 10^{-262}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(C + C\right)}}{t_1}\\
\mathbf{elif}\;B \leq 1.05 \cdot 10^{-221}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(A + A\right)}}{t_1}\\
\mathbf{elif}\;B \leq 3.65 \cdot 10^{-183}:\\
\;\;\;\;-0.5 \cdot \left(\sqrt{2} \cdot \sqrt{\frac{F}{\frac{A}{\mathsf{fma}\left(0.5, \frac{B}{A} \cdot \frac{B}{A}, -2\right)}}}\right)\\
\mathbf{elif}\;B \leq 5.9 \cdot 10^{+99}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{elif}\;B \leq 7.5 \cdot 10^{+270}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot t_0\\
\mathbf{elif}\;B \leq 2.8 \cdot 10^{+302}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-t_0\right)}{B}\\
\end{array}
\end{array}
if B < 4.39999999999999977e-262Initial program 19.8%
Simplified26.7%
Taylor expanded in A around -inf 17.1%
if 4.39999999999999977e-262 < B < 1.05e-221Initial program 12.4%
Simplified23.7%
Taylor expanded in A around inf 31.9%
distribute-rgt1-in31.9%
metadata-eval31.9%
mul0-lft31.9%
Simplified31.9%
if 1.05e-221 < B < 3.64999999999999999e-183Initial program 1.9%
Simplified1.9%
Taylor expanded in A around -inf 3.0%
associate-+r+3.0%
mul-1-neg3.0%
unsub-neg3.0%
distribute-lft-out3.0%
*-commutative3.0%
unpow23.0%
times-frac3.0%
unpow23.0%
unpow23.0%
Simplified3.0%
Taylor expanded in C around -inf 30.1%
*-commutative30.1%
associate-/l*30.1%
fma-neg30.1%
unpow230.1%
unpow230.1%
times-frac30.1%
metadata-eval30.1%
Simplified30.1%
if 3.64999999999999999e-183 < B < 5.8999999999999999e99Initial program 40.1%
Simplified40.1%
sqrt-prod46.8%
*-commutative46.8%
cancel-sign-sub-inv46.8%
metadata-eval46.8%
associate-+l+46.8%
unpow246.8%
hypot-udef52.2%
Applied egg-rr52.2%
if 5.8999999999999999e99 < B < 7.5000000000000001e270Initial program 6.4%
Simplified6.4%
Taylor expanded in C around 0 19.3%
mul-1-neg19.3%
distribute-rgt-neg-in19.3%
*-commutative19.3%
+-commutative19.3%
unpow219.3%
unpow219.3%
hypot-def58.5%
Simplified58.5%
if 7.5000000000000001e270 < B < 2.7999999999999999e302Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 2.4%
mul-1-neg2.4%
distribute-rgt-neg-in2.4%
*-commutative2.4%
+-commutative2.4%
unpow22.4%
unpow22.4%
hypot-def41.2%
Simplified41.2%
Taylor expanded in A around 0 71.6%
associate-*r*71.6%
mul-1-neg71.6%
Simplified71.6%
if 2.7999999999999999e302 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 2.2%
mul-1-neg2.2%
distribute-rgt-neg-in2.2%
*-commutative2.2%
+-commutative2.2%
unpow22.2%
unpow22.2%
hypot-def50.9%
Simplified50.9%
associate-*l/50.9%
Applied egg-rr50.9%
Final simplification34.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* B B) (* -4.0 (* A C)))))
(if (<= F -5e-310)
(/ (- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_0))))) t_0)
(if (<= F 1.8e+25)
(* (sqrt 2.0) (* (sqrt (* F (+ A (hypot A B)))) (/ -1.0 B)))
(if (or (<= F 5.8e+185) (not (<= F 3.6e+197)))
(* (sqrt 2.0) (- (sqrt (/ F B))))
(*
-0.5
(*
(sqrt 2.0)
(sqrt (/ F (/ A (fma 0.5 (* (/ B A) (/ B A)) -2.0)))))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (F <= -5e-310) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 1.8e+25) {
tmp = sqrt(2.0) * (sqrt((F * (A + hypot(A, B)))) * (-1.0 / B));
} else if ((F <= 5.8e+185) || !(F <= 3.6e+197)) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else {
tmp = -0.5 * (sqrt(2.0) * sqrt((F / (A / fma(0.5, ((B / A) * (B / A)), -2.0)))));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (F <= -5e-310) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * t_0))))) / t_0); elseif (F <= 1.8e+25) tmp = Float64(sqrt(2.0) * Float64(sqrt(Float64(F * Float64(A + hypot(A, B)))) * Float64(-1.0 / B))); elseif ((F <= 5.8e+185) || !(F <= 3.6e+197)) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); else tmp = Float64(-0.5 * Float64(sqrt(2.0) * sqrt(Float64(F / Float64(A / fma(0.5, Float64(Float64(B / A) * Float64(B / A)), -2.0)))))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e-310], N[((-N[Sqrt[N[(2.0 * N[(N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 1.8e+25], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[N[(F * N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[F, 5.8e+185], N[Not[LessEqual[F, 3.6e+197]], $MachinePrecision]], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(-0.5 * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F / N[(A / N[(0.5 * N[(N[(B / A), $MachinePrecision] * N[(B / A), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{elif}\;F \leq 1.8 \cdot 10^{+25}:\\
\;\;\;\;\sqrt{2} \cdot \left(\sqrt{F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)} \cdot \frac{-1}{B}\right)\\
\mathbf{elif}\;F \leq 5.8 \cdot 10^{+185} \lor \neg \left(F \leq 3.6 \cdot 10^{+197}\right):\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(\sqrt{2} \cdot \sqrt{\frac{F}{\frac{A}{\mathsf{fma}\left(0.5, \frac{B}{A} \cdot \frac{B}{A}, -2\right)}}}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 26.8%
Simplified26.8%
distribute-frac-neg26.8%
Applied egg-rr54.5%
if -4.999999999999985e-310 < F < 1.80000000000000008e25Initial program 23.6%
Simplified23.6%
Taylor expanded in C around 0 12.3%
mul-1-neg12.3%
distribute-rgt-neg-in12.3%
*-commutative12.3%
+-commutative12.3%
unpow212.3%
unpow212.3%
hypot-def26.3%
Simplified26.3%
associate-*l/26.3%
Applied egg-rr26.3%
div-inv26.3%
Applied egg-rr26.3%
associate-*l*26.3%
Simplified26.3%
if 1.80000000000000008e25 < F < 5.79999999999999976e185 or 3.59999999999999982e197 < F Initial program 14.7%
Simplified14.7%
Taylor expanded in C around 0 11.8%
mul-1-neg11.8%
distribute-rgt-neg-in11.8%
*-commutative11.8%
+-commutative11.8%
unpow211.8%
unpow211.8%
hypot-def15.9%
Simplified15.9%
Taylor expanded in A around 0 25.1%
associate-*r*25.1%
mul-1-neg25.1%
Simplified25.1%
if 5.79999999999999976e185 < F < 3.59999999999999982e197Initial program 19.2%
Simplified19.2%
Taylor expanded in A around -inf 18.7%
associate-+r+18.7%
mul-1-neg18.7%
unsub-neg18.7%
distribute-lft-out18.7%
*-commutative18.7%
unpow218.7%
times-frac18.7%
unpow218.7%
unpow218.7%
Simplified18.7%
Taylor expanded in C around -inf 82.7%
*-commutative82.7%
associate-/l*82.7%
fma-neg82.7%
unpow282.7%
unpow282.7%
times-frac82.7%
metadata-eval82.7%
Simplified82.7%
Final simplification30.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* B B) (* -4.0 (* A C)))))
(if (<= F -5e-310)
(/ (- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_0))))) t_0)
(if (<= F 1.42e+23)
(* (sqrt 2.0) (* (sqrt (* F (+ A (hypot A B)))) (/ -1.0 B)))
(* (sqrt 2.0) (- (sqrt (/ F B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (F <= -5e-310) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 1.42e+23) {
tmp = sqrt(2.0) * (sqrt((F * (A + hypot(A, B)))) * (-1.0 / B));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (F <= -5e-310) {
tmp = -Math.sqrt((2.0 * ((A + (C + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 1.42e+23) {
tmp = Math.sqrt(2.0) * (Math.sqrt((F * (A + Math.hypot(A, B)))) * (-1.0 / B));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if F <= -5e-310: tmp = -math.sqrt((2.0 * ((A + (C + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 elif F <= 1.42e+23: tmp = math.sqrt(2.0) * (math.sqrt((F * (A + math.hypot(A, B)))) * (-1.0 / B)) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (F <= -5e-310) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * t_0))))) / t_0); elseif (F <= 1.42e+23) tmp = Float64(sqrt(2.0) * Float64(sqrt(Float64(F * Float64(A + hypot(A, B)))) * Float64(-1.0 / B))); 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) t_0 = (B * B) + (-4.0 * (A * C)); tmp = 0.0; if (F <= -5e-310) tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0; elseif (F <= 1.42e+23) tmp = sqrt(2.0) * (sqrt((F * (A + hypot(A, B)))) * (-1.0 / B)); 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_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e-310], N[((-N[Sqrt[N[(2.0 * N[(N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 1.42e+23], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[N[(F * N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / B), $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}
t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{elif}\;F \leq 1.42 \cdot 10^{+23}:\\
\;\;\;\;\sqrt{2} \cdot \left(\sqrt{F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)} \cdot \frac{-1}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 26.8%
Simplified26.8%
distribute-frac-neg26.8%
Applied egg-rr54.5%
if -4.999999999999985e-310 < F < 1.42000000000000004e23Initial program 23.6%
Simplified23.6%
Taylor expanded in C around 0 12.3%
mul-1-neg12.3%
distribute-rgt-neg-in12.3%
*-commutative12.3%
+-commutative12.3%
unpow212.3%
unpow212.3%
hypot-def26.3%
Simplified26.3%
associate-*l/26.3%
Applied egg-rr26.3%
div-inv26.3%
Applied egg-rr26.3%
associate-*l*26.3%
Simplified26.3%
if 1.42000000000000004e23 < F Initial program 14.9%
Simplified14.9%
Taylor expanded in C around 0 11.2%
mul-1-neg11.2%
distribute-rgt-neg-in11.2%
*-commutative11.2%
+-commutative11.2%
unpow211.2%
unpow211.2%
hypot-def15.1%
Simplified15.1%
Taylor expanded in A around 0 23.9%
associate-*r*23.9%
mul-1-neg23.9%
Simplified23.9%
Final simplification28.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* B B) (* -4.0 (* A C)))))
(if (<= F -5e-310)
(/ (- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_0))))) t_0)
(if (<= F 4.8e-5)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ C (hypot C B))))))
(* (sqrt 2.0) (- (sqrt (/ F B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (F <= -5e-310) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 4.8e-5) {
tmp = (sqrt(2.0) / B) * -sqrt((F * (C + hypot(C, B))));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (F <= -5e-310) {
tmp = -Math.sqrt((2.0 * ((A + (C + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 4.8e-5) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (C + Math.hypot(C, B))));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if F <= -5e-310: tmp = -math.sqrt((2.0 * ((A + (C + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 elif F <= 4.8e-5: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (C + math.hypot(C, B)))) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (F <= -5e-310) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * t_0))))) / t_0); elseif (F <= 4.8e-5) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(C + hypot(C, B)))))); 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) t_0 = (B * B) + (-4.0 * (A * C)); tmp = 0.0; if (F <= -5e-310) tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0; elseif (F <= 4.8e-5) tmp = (sqrt(2.0) / B) * -sqrt((F * (C + hypot(C, B)))); 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_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e-310], N[((-N[Sqrt[N[(2.0 * N[(N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 4.8e-5], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $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}
t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{elif}\;F \leq 4.8 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 26.8%
Simplified26.8%
distribute-frac-neg26.8%
Applied egg-rr54.5%
if -4.999999999999985e-310 < F < 4.8000000000000001e-5Initial program 24.2%
Simplified24.2%
Taylor expanded in A around 0 14.0%
mul-1-neg14.0%
*-commutative14.0%
distribute-rgt-neg-in14.0%
*-commutative14.0%
+-commutative14.0%
unpow214.0%
unpow214.0%
hypot-def26.2%
Simplified26.2%
if 4.8000000000000001e-5 < F Initial program 14.9%
Simplified14.9%
Taylor expanded in C around 0 11.5%
mul-1-neg11.5%
distribute-rgt-neg-in11.5%
*-commutative11.5%
+-commutative11.5%
unpow211.5%
unpow211.5%
hypot-def16.1%
Simplified16.1%
Taylor expanded in A around 0 24.3%
associate-*r*24.3%
mul-1-neg24.3%
Simplified24.3%
Final simplification28.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* B B) (* -4.0 (* A C)))))
(if (<= F 3e-309)
(/ (- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_0))))) t_0)
(if (<= F 3.5e+23)
(* (/ (- (sqrt 2.0)) B) (sqrt (* F (+ A (hypot A B)))))
(* (sqrt 2.0) (- (sqrt (/ F B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (F <= 3e-309) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 3.5e+23) {
tmp = (-sqrt(2.0) / B) * sqrt((F * (A + hypot(A, B))));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (F <= 3e-309) {
tmp = -Math.sqrt((2.0 * ((A + (C + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 3.5e+23) {
tmp = (-Math.sqrt(2.0) / B) * Math.sqrt((F * (A + Math.hypot(A, B))));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if F <= 3e-309: tmp = -math.sqrt((2.0 * ((A + (C + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 elif F <= 3.5e+23: tmp = (-math.sqrt(2.0) / B) * math.sqrt((F * (A + math.hypot(A, B)))) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (F <= 3e-309) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * t_0))))) / t_0); elseif (F <= 3.5e+23) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(F * Float64(A + hypot(A, B))))); 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) t_0 = (B * B) + (-4.0 * (A * C)); tmp = 0.0; if (F <= 3e-309) tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0; elseif (F <= 3.5e+23) tmp = (-sqrt(2.0) / B) * sqrt((F * (A + hypot(A, B)))); 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_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, 3e-309], N[((-N[Sqrt[N[(2.0 * N[(N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 3.5e+23], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[Sqrt[N[(F * N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $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}
t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;F \leq 3 \cdot 10^{-309}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{elif}\;F \leq 3.5 \cdot 10^{+23}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 3.000000000000001e-309Initial program 26.8%
Simplified26.8%
distribute-frac-neg26.8%
Applied egg-rr54.5%
if 3.000000000000001e-309 < F < 3.5000000000000002e23Initial program 23.6%
Simplified23.6%
Taylor expanded in C around 0 12.3%
mul-1-neg12.3%
distribute-rgt-neg-in12.3%
*-commutative12.3%
+-commutative12.3%
unpow212.3%
unpow212.3%
hypot-def26.3%
Simplified26.3%
if 3.5000000000000002e23 < F Initial program 14.9%
Simplified14.9%
Taylor expanded in C around 0 11.2%
mul-1-neg11.2%
distribute-rgt-neg-in11.2%
*-commutative11.2%
+-commutative11.2%
unpow211.2%
unpow211.2%
hypot-def15.1%
Simplified15.1%
Taylor expanded in A around 0 23.9%
associate-*r*23.9%
mul-1-neg23.9%
Simplified23.9%
Final simplification28.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* B B) (* -4.0 (* A C)))))
(if (<= F -5e-310)
(/ (- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_0))))) t_0)
(if (<= F 1.08e+24)
(/ (* (sqrt 2.0) (- (sqrt (* F (+ A (hypot A B)))))) B)
(* (sqrt 2.0) (- (sqrt (/ F B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (F <= -5e-310) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 1.08e+24) {
tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(A, B))))) / B;
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (F <= -5e-310) {
tmp = -Math.sqrt((2.0 * ((A + (C + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 1.08e+24) {
tmp = (Math.sqrt(2.0) * -Math.sqrt((F * (A + Math.hypot(A, B))))) / B;
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if F <= -5e-310: tmp = -math.sqrt((2.0 * ((A + (C + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 elif F <= 1.08e+24: tmp = (math.sqrt(2.0) * -math.sqrt((F * (A + math.hypot(A, B))))) / B else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (F <= -5e-310) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * t_0))))) / t_0); elseif (F <= 1.08e+24) tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A + hypot(A, B)))))) / B); 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) t_0 = (B * B) + (-4.0 * (A * C)); tmp = 0.0; if (F <= -5e-310) tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0; elseif (F <= 1.08e+24) tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(A, B))))) / B; 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_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e-310], N[((-N[Sqrt[N[(2.0 * N[(N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 1.08e+24], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{elif}\;F \leq 1.08 \cdot 10^{+24}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)}\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 26.8%
Simplified26.8%
distribute-frac-neg26.8%
Applied egg-rr54.5%
if -4.999999999999985e-310 < F < 1.0799999999999999e24Initial program 23.6%
Simplified23.6%
Taylor expanded in C around 0 12.3%
mul-1-neg12.3%
distribute-rgt-neg-in12.3%
*-commutative12.3%
+-commutative12.3%
unpow212.3%
unpow212.3%
hypot-def26.3%
Simplified26.3%
associate-*l/26.3%
Applied egg-rr26.3%
if 1.0799999999999999e24 < F Initial program 14.9%
Simplified14.9%
Taylor expanded in C around 0 11.2%
mul-1-neg11.2%
distribute-rgt-neg-in11.2%
*-commutative11.2%
+-commutative11.2%
unpow211.2%
unpow211.2%
hypot-def15.1%
Simplified15.1%
Taylor expanded in A around 0 23.9%
associate-*r*23.9%
mul-1-neg23.9%
Simplified23.9%
Final simplification28.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* B B) (* -4.0 (* A C)))))
(if (<= B 7.2e+96)
(/ (- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_0))))) t_0)
(* (sqrt 2.0) (- (sqrt (/ F B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 7.2e+96) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 7.2e+96) {
tmp = -Math.sqrt((2.0 * ((A + (C + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if B <= 7.2e+96: tmp = -math.sqrt((2.0 * ((A + (C + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (B <= 7.2e+96) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * t_0))))) / t_0); 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) t_0 = (B * B) + (-4.0 * (A * C)); tmp = 0.0; if (B <= 7.2e+96) tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0; 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_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 7.2e+96], N[((-N[Sqrt[N[(2.0 * N[(N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 7.2 \cdot 10^{+96}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < 7.20000000000000026e96Initial program 24.3%
Simplified24.3%
distribute-frac-neg24.3%
Applied egg-rr30.7%
if 7.20000000000000026e96 < B Initial program 4.5%
Simplified4.5%
Taylor expanded in C around 0 14.7%
mul-1-neg14.7%
distribute-rgt-neg-in14.7%
*-commutative14.7%
+-commutative14.7%
unpow214.7%
unpow214.7%
hypot-def53.0%
Simplified53.0%
Taylor expanded in A around 0 49.4%
associate-*r*49.4%
mul-1-neg49.4%
Simplified49.4%
Final simplification34.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F -5e-310)
(/
(-
(sqrt
(*
2.0
(* (+ A (+ C (hypot B (- A C)))) (* F (+ (* B B) (* -4.0 (* A C))))))))
(* C (* A -4.0)))
(if (<= F 3.1e-43)
(/ (* (sqrt 2.0) (- (sqrt (* B F)))) B)
(* (sqrt 2.0) (- (sqrt (/ F B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -5e-310) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * ((B * B) + (-4.0 * (A * C))))))) / (C * (A * -4.0));
} else if (F <= 3.1e-43) {
tmp = (sqrt(2.0) * -sqrt((B * F))) / B;
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= -5e-310) {
tmp = -Math.sqrt((2.0 * ((A + (C + Math.hypot(B, (A - C)))) * (F * ((B * B) + (-4.0 * (A * C))))))) / (C * (A * -4.0));
} else if (F <= 3.1e-43) {
tmp = (Math.sqrt(2.0) * -Math.sqrt((B * F))) / B;
} 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 <= -5e-310: tmp = -math.sqrt((2.0 * ((A + (C + math.hypot(B, (A - C)))) * (F * ((B * B) + (-4.0 * (A * C))))))) / (C * (A * -4.0)) elif F <= 3.1e-43: tmp = (math.sqrt(2.0) * -math.sqrt((B * F))) / B 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 <= -5e-310) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / Float64(C * Float64(A * -4.0))); elseif (F <= 3.1e-43) tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(B * F)))) / B); 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 <= -5e-310) tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * ((B * B) + (-4.0 * (A * C))))))) / (C * (A * -4.0)); elseif (F <= 3.1e-43) tmp = (sqrt(2.0) * -sqrt((B * F))) / B; 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, -5e-310], N[((-N[Sqrt[N[(2.0 * N[(N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.1e-43], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $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 -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{C \cdot \left(A \cdot -4\right)}\\
\mathbf{elif}\;F \leq 3.1 \cdot 10^{-43}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{B \cdot F}\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 26.8%
Simplified26.8%
distribute-frac-neg26.8%
Applied egg-rr54.5%
Taylor expanded in B around 0 51.8%
associate-*r*51.8%
Simplified51.8%
if -4.999999999999985e-310 < F < 3.0999999999999999e-43Initial program 24.3%
Simplified24.3%
Taylor expanded in C around 0 12.1%
mul-1-neg12.1%
distribute-rgt-neg-in12.1%
*-commutative12.1%
+-commutative12.1%
unpow212.1%
unpow212.1%
hypot-def26.7%
Simplified26.7%
associate-*l/26.7%
Applied egg-rr26.7%
Taylor expanded in A around 0 22.7%
mul-1-neg22.7%
distribute-rgt-neg-in22.7%
Simplified22.7%
if 3.0999999999999999e-43 < F Initial program 15.5%
Simplified15.5%
Taylor expanded in C around 0 11.6%
mul-1-neg11.6%
distribute-rgt-neg-in11.6%
*-commutative11.6%
+-commutative11.6%
unpow211.6%
unpow211.6%
hypot-def16.2%
Simplified16.2%
Taylor expanded in A around 0 23.4%
associate-*r*23.4%
mul-1-neg23.4%
Simplified23.4%
Final simplification26.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F -5e-310)
(-
(/
(sqrt (* (* 2.0 (* -4.0 (* F (* A C)))) (+ A (+ A C))))
(- (* B B) (* (* A C) 4.0))))
(if (<= F 6.8e-6)
(* (/ (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 <= -5e-310) {
tmp = -(sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0)));
} else if (F <= 6.8e-6) {
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 <= (-5d-310)) then
tmp = -(sqrt(((2.0d0 * ((-4.0d0) * (f * (a * c)))) * (a + (a + c)))) / ((b * b) - ((a * c) * 4.0d0)))
else if (f <= 6.8d-6) 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 <= -5e-310) {
tmp = -(Math.sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0)));
} else if (F <= 6.8e-6) {
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 <= -5e-310: tmp = -(math.sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0))) elif F <= 6.8e-6: 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 <= -5e-310) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(-4.0 * Float64(F * Float64(A * C)))) * Float64(A + Float64(A + C)))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)))); elseif (F <= 6.8e-6) 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 <= -5e-310) tmp = -(sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0))); elseif (F <= 6.8e-6) 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, -5e-310], (-N[(N[Sqrt[N[(N[(2.0 * N[(-4.0 * N[(F * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 6.8e-6], 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 -5 \cdot 10^{-310}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(-4 \cdot \left(F \cdot \left(A \cdot C\right)\right)\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{elif}\;F \leq 6.8 \cdot 10^{-6}:\\
\;\;\;\;\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 < -4.999999999999985e-310Initial program 26.8%
Simplified26.8%
Taylor expanded in A around inf 34.6%
Taylor expanded in B around 0 23.8%
associate-*r*34.6%
Simplified34.6%
if -4.999999999999985e-310 < F < 6.80000000000000012e-6Initial program 24.2%
Simplified24.2%
Taylor expanded in C around 0 12.1%
mul-1-neg12.1%
distribute-rgt-neg-in12.1%
*-commutative12.1%
+-commutative12.1%
unpow212.1%
unpow212.1%
hypot-def26.0%
Simplified26.0%
Taylor expanded in A around 0 22.0%
if 6.80000000000000012e-6 < F Initial program 14.9%
Simplified14.9%
Taylor expanded in C around 0 11.5%
mul-1-neg11.5%
distribute-rgt-neg-in11.5%
*-commutative11.5%
+-commutative11.5%
unpow211.5%
unpow211.5%
hypot-def16.1%
Simplified16.1%
Taylor expanded in A around 0 24.3%
associate-*r*24.3%
mul-1-neg24.3%
Simplified24.3%
Final simplification24.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F -5e-310)
(-
(/
(sqrt (* (* 2.0 (* -4.0 (* F (* A C)))) (+ A (+ A C))))
(- (* B B) (* (* A C) 4.0))))
(if (<= F 3.6e-43)
(/ (* (sqrt 2.0) (- (sqrt (* B F)))) B)
(* (sqrt 2.0) (- (sqrt (/ F B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -5e-310) {
tmp = -(sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0)));
} else if (F <= 3.6e-43) {
tmp = (sqrt(2.0) * -sqrt((B * F))) / B;
} 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 <= (-5d-310)) then
tmp = -(sqrt(((2.0d0 * ((-4.0d0) * (f * (a * c)))) * (a + (a + c)))) / ((b * b) - ((a * c) * 4.0d0)))
else if (f <= 3.6d-43) then
tmp = (sqrt(2.0d0) * -sqrt((b * f))) / b
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 <= -5e-310) {
tmp = -(Math.sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0)));
} else if (F <= 3.6e-43) {
tmp = (Math.sqrt(2.0) * -Math.sqrt((B * F))) / B;
} 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 <= -5e-310: tmp = -(math.sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0))) elif F <= 3.6e-43: tmp = (math.sqrt(2.0) * -math.sqrt((B * F))) / B 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 <= -5e-310) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(-4.0 * Float64(F * Float64(A * C)))) * Float64(A + Float64(A + C)))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)))); elseif (F <= 3.6e-43) tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(B * F)))) / B); 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 <= -5e-310) tmp = -(sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0))); elseif (F <= 3.6e-43) tmp = (sqrt(2.0) * -sqrt((B * F))) / B; 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, -5e-310], (-N[(N[Sqrt[N[(N[(2.0 * N[(-4.0 * N[(F * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 3.6e-43], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $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 -5 \cdot 10^{-310}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(-4 \cdot \left(F \cdot \left(A \cdot C\right)\right)\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{elif}\;F \leq 3.6 \cdot 10^{-43}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{B \cdot F}\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 26.8%
Simplified26.8%
Taylor expanded in A around inf 34.6%
Taylor expanded in B around 0 23.8%
associate-*r*34.6%
Simplified34.6%
if -4.999999999999985e-310 < F < 3.5999999999999999e-43Initial program 24.3%
Simplified24.3%
Taylor expanded in C around 0 12.1%
mul-1-neg12.1%
distribute-rgt-neg-in12.1%
*-commutative12.1%
+-commutative12.1%
unpow212.1%
unpow212.1%
hypot-def26.7%
Simplified26.7%
associate-*l/26.7%
Applied egg-rr26.7%
Taylor expanded in A around 0 22.7%
mul-1-neg22.7%
distribute-rgt-neg-in22.7%
Simplified22.7%
if 3.5999999999999999e-43 < F Initial program 15.5%
Simplified15.5%
Taylor expanded in C around 0 11.6%
mul-1-neg11.6%
distribute-rgt-neg-in11.6%
*-commutative11.6%
+-commutative11.6%
unpow211.6%
unpow211.6%
hypot-def16.2%
Simplified16.2%
Taylor expanded in A around 0 23.4%
associate-*r*23.4%
mul-1-neg23.4%
Simplified23.4%
Final simplification24.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* A C) 4.0))))
(if (<= B 9.2e-222)
(- (/ (sqrt (* (* 2.0 (* -4.0 (* F (* A C)))) (+ A (+ A C)))) t_0))
(if (<= B 7.9e-75)
(-
(/
(sqrt
(* (* 2.0 (* F t_0)) (+ (+ A C) (+ C (- (* 0.5 (/ (* B B) C)) A)))))
t_0))
(* (sqrt 2.0) (- (sqrt (/ F B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (B <= 9.2e-222) {
tmp = -(sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / t_0);
} else if (B <= 7.9e-75) {
tmp = -(sqrt(((2.0 * (F * t_0)) * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0);
} 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) :: t_0
real(8) :: tmp
t_0 = (b * b) - ((a * c) * 4.0d0)
if (b <= 9.2d-222) then
tmp = -(sqrt(((2.0d0 * ((-4.0d0) * (f * (a * c)))) * (a + (a + c)))) / t_0)
else if (b <= 7.9d-75) then
tmp = -(sqrt(((2.0d0 * (f * t_0)) * ((a + c) + (c + ((0.5d0 * ((b * b) / c)) - a))))) / t_0)
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 t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (B <= 9.2e-222) {
tmp = -(Math.sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / t_0);
} else if (B <= 7.9e-75) {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0);
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) tmp = 0 if B <= 9.2e-222: tmp = -(math.sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / t_0) elif B <= 7.9e-75: tmp = -(math.sqrt(((2.0 * (F * t_0)) * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) tmp = 0.0 if (B <= 9.2e-222) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(-4.0 * Float64(F * Float64(A * C)))) * Float64(A + Float64(A + C)))) / t_0)); elseif (B <= 7.9e-75) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(Float64(A + C) + Float64(C + Float64(Float64(0.5 * Float64(Float64(B * B) / C)) - A))))) / t_0)); 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) t_0 = (B * B) - ((A * C) * 4.0); tmp = 0.0; if (B <= 9.2e-222) tmp = -(sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / t_0); elseif (B <= 7.9e-75) tmp = -(sqrt(((2.0 * (F * t_0)) * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0); 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_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 9.2e-222], (-N[(N[Sqrt[N[(N[(2.0 * N[(-4.0 * N[(F * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 7.9e-75], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[(C + N[(N[(0.5 * N[(N[(B * B), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision] - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
\mathbf{if}\;B \leq 9.2 \cdot 10^{-222}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(-4 \cdot \left(F \cdot \left(A \cdot C\right)\right)\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 7.9 \cdot 10^{-75}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(\left(A + C\right) + \left(C + \left(0.5 \cdot \frac{B \cdot B}{C} - A\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < 9.2000000000000005e-222Initial program 19.3%
Simplified19.3%
Taylor expanded in A around inf 11.6%
Taylor expanded in B around 0 7.9%
associate-*r*10.6%
Simplified10.6%
if 9.2000000000000005e-222 < B < 7.9e-75Initial program 18.1%
Simplified18.1%
Taylor expanded in C around inf 13.7%
mul-1-neg13.7%
unsub-neg13.7%
Simplified14.2%
if 7.9e-75 < B Initial program 22.6%
Simplified22.6%
Taylor expanded in C around 0 25.1%
mul-1-neg25.1%
distribute-rgt-neg-in25.1%
*-commutative25.1%
+-commutative25.1%
unpow225.1%
unpow225.1%
hypot-def46.6%
Simplified46.6%
Taylor expanded in A around 0 42.2%
associate-*r*42.2%
mul-1-neg42.2%
Simplified42.2%
Final simplification22.3%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* A C) 4.0))) (t_1 (* 2.0 (* F t_0))))
(if (<= C -4.5e-132)
(- (/ (sqrt (* -16.0 (* (* A A) (* C F)))) t_0))
(if (<= C 4.2e-145)
(- (/ (sqrt (* (+ A (+ A C)) t_1)) t_0))
(/ (- (sqrt (* t_1 (+ (+ A C) (- C A))))) t_0)))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double t_1 = 2.0 * (F * t_0);
double tmp;
if (C <= -4.5e-132) {
tmp = -(sqrt((-16.0 * ((A * A) * (C * F)))) / t_0);
} else if (C <= 4.2e-145) {
tmp = -(sqrt(((A + (A + C)) * t_1)) / t_0);
} else {
tmp = -sqrt((t_1 * ((A + C) + (C - A)))) / t_0;
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - ((a * c) * 4.0d0)
t_1 = 2.0d0 * (f * t_0)
if (c <= (-4.5d-132)) then
tmp = -(sqrt(((-16.0d0) * ((a * a) * (c * f)))) / t_0)
else if (c <= 4.2d-145) then
tmp = -(sqrt(((a + (a + c)) * t_1)) / t_0)
else
tmp = -sqrt((t_1 * ((a + c) + (c - a)))) / t_0
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double t_1 = 2.0 * (F * t_0);
double tmp;
if (C <= -4.5e-132) {
tmp = -(Math.sqrt((-16.0 * ((A * A) * (C * F)))) / t_0);
} else if (C <= 4.2e-145) {
tmp = -(Math.sqrt(((A + (A + C)) * t_1)) / t_0);
} else {
tmp = -Math.sqrt((t_1 * ((A + C) + (C - A)))) / t_0;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) t_1 = 2.0 * (F * t_0) tmp = 0 if C <= -4.5e-132: tmp = -(math.sqrt((-16.0 * ((A * A) * (C * F)))) / t_0) elif C <= 4.2e-145: tmp = -(math.sqrt(((A + (A + C)) * t_1)) / t_0) else: tmp = -math.sqrt((t_1 * ((A + C) + (C - A)))) / t_0 return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) t_1 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (C <= -4.5e-132) tmp = Float64(-Float64(sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F)))) / t_0)); elseif (C <= 4.2e-145) tmp = Float64(-Float64(sqrt(Float64(Float64(A + Float64(A + C)) * t_1)) / t_0)); else tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + Float64(C - A))))) / t_0); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - ((A * C) * 4.0); t_1 = 2.0 * (F * t_0); tmp = 0.0; if (C <= -4.5e-132) tmp = -(sqrt((-16.0 * ((A * A) * (C * F)))) / t_0); elseif (C <= 4.2e-145) tmp = -(sqrt(((A + (A + C)) * t_1)) / t_0); else tmp = -sqrt((t_1 * ((A + C) + (C - A)))) / t_0; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -4.5e-132], (-N[(N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[C, 4.2e-145], (-N[(N[Sqrt[N[(N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;C \leq -4.5 \cdot 10^{-132}:\\
\;\;\;\;-\frac{\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{t_0}\\
\mathbf{elif}\;C \leq 4.2 \cdot 10^{-145}:\\
\;\;\;\;-\frac{\sqrt{\left(A + \left(A + C\right)\right) \cdot t_1}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(\left(A + C\right) + \left(C - A\right)\right)}}{t_0}\\
\end{array}
\end{array}
if C < -4.4999999999999999e-132Initial program 12.8%
Simplified12.8%
Taylor expanded in A around inf 1.6%
Taylor expanded in A around inf 14.1%
unpow214.1%
*-commutative14.1%
Simplified14.1%
if -4.4999999999999999e-132 < C < 4.19999999999999982e-145Initial program 26.8%
Simplified26.8%
Taylor expanded in A around inf 18.0%
if 4.19999999999999982e-145 < C Initial program 22.3%
Simplified22.3%
Taylor expanded in A around -inf 21.8%
mul-1-neg21.8%
sub-neg21.8%
Simplified21.8%
Final simplification18.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* A C) 4.0))))
(if (<= C -4.1e-134)
(- (/ (sqrt (* -16.0 (* (* A A) (* C F)))) t_0))
(- (/ (sqrt (* (+ A (+ A C)) (* 2.0 (* F t_0)))) t_0)))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (C <= -4.1e-134) {
tmp = -(sqrt((-16.0 * ((A * A) * (C * F)))) / t_0);
} else {
tmp = -(sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0);
}
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) :: t_0
real(8) :: tmp
t_0 = (b * b) - ((a * c) * 4.0d0)
if (c <= (-4.1d-134)) then
tmp = -(sqrt(((-16.0d0) * ((a * a) * (c * f)))) / t_0)
else
tmp = -(sqrt(((a + (a + c)) * (2.0d0 * (f * t_0)))) / t_0)
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (C <= -4.1e-134) {
tmp = -(Math.sqrt((-16.0 * ((A * A) * (C * F)))) / t_0);
} else {
tmp = -(Math.sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) tmp = 0 if C <= -4.1e-134: tmp = -(math.sqrt((-16.0 * ((A * A) * (C * F)))) / t_0) else: tmp = -(math.sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) tmp = 0.0 if (C <= -4.1e-134) tmp = Float64(-Float64(sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F)))) / t_0)); else tmp = Float64(-Float64(sqrt(Float64(Float64(A + Float64(A + C)) * Float64(2.0 * Float64(F * t_0)))) / t_0)); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - ((A * C) * 4.0); tmp = 0.0; if (C <= -4.1e-134) tmp = -(sqrt((-16.0 * ((A * A) * (C * F)))) / t_0); else tmp = -(sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -4.1e-134], (-N[(N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), (-N[(N[Sqrt[N[(N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision])]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
\mathbf{if}\;C \leq -4.1 \cdot 10^{-134}:\\
\;\;\;\;-\frac{\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(A + \left(A + C\right)\right) \cdot \left(2 \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\end{array}
\end{array}
if C < -4.1000000000000002e-134Initial program 12.8%
Simplified12.8%
Taylor expanded in A around inf 1.6%
Taylor expanded in A around inf 14.1%
unpow214.1%
*-commutative14.1%
Simplified14.1%
if -4.1000000000000002e-134 < C Initial program 24.3%
Simplified24.3%
Taylor expanded in A around inf 11.6%
Final simplification12.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* A C) 4.0))))
(if (<= C -7.5e-78)
(- (/ (sqrt (* -16.0 (* (* A A) (* C F)))) t_0))
(- (/ (sqrt (* (* 2.0 (* -4.0 (* F (* A C)))) (+ A (+ A C)))) t_0)))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (C <= -7.5e-78) {
tmp = -(sqrt((-16.0 * ((A * A) * (C * F)))) / t_0);
} else {
tmp = -(sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / t_0);
}
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) :: t_0
real(8) :: tmp
t_0 = (b * b) - ((a * c) * 4.0d0)
if (c <= (-7.5d-78)) then
tmp = -(sqrt(((-16.0d0) * ((a * a) * (c * f)))) / t_0)
else
tmp = -(sqrt(((2.0d0 * ((-4.0d0) * (f * (a * c)))) * (a + (a + c)))) / t_0)
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (C <= -7.5e-78) {
tmp = -(Math.sqrt((-16.0 * ((A * A) * (C * F)))) / t_0);
} else {
tmp = -(Math.sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / t_0);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) tmp = 0 if C <= -7.5e-78: tmp = -(math.sqrt((-16.0 * ((A * A) * (C * F)))) / t_0) else: tmp = -(math.sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / t_0) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) tmp = 0.0 if (C <= -7.5e-78) tmp = Float64(-Float64(sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F)))) / t_0)); else tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(-4.0 * Float64(F * Float64(A * C)))) * Float64(A + Float64(A + C)))) / t_0)); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - ((A * C) * 4.0); tmp = 0.0; if (C <= -7.5e-78) tmp = -(sqrt((-16.0 * ((A * A) * (C * F)))) / t_0); else tmp = -(sqrt(((2.0 * (-4.0 * (F * (A * C)))) * (A + (A + C)))) / t_0); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -7.5e-78], (-N[(N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), (-N[(N[Sqrt[N[(N[(2.0 * N[(-4.0 * N[(F * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision])]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
\mathbf{if}\;C \leq -7.5 \cdot 10^{-78}:\\
\;\;\;\;-\frac{\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(-4 \cdot \left(F \cdot \left(A \cdot C\right)\right)\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{t_0}\\
\end{array}
\end{array}
if C < -7.50000000000000041e-78Initial program 9.3%
Simplified9.3%
Taylor expanded in A around inf 1.6%
Taylor expanded in A around inf 15.4%
unpow215.4%
*-commutative15.4%
Simplified15.4%
if -7.50000000000000041e-78 < C Initial program 25.2%
Simplified25.2%
Taylor expanded in A around inf 11.0%
Taylor expanded in B around 0 7.4%
associate-*r*9.5%
Simplified9.5%
Final simplification11.3%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= C 1.45e-145) (- (/ (sqrt (* -16.0 (* (* A A) (* C F)))) (- (* B B) (* (* A C) 4.0)))) (* (sqrt (* C F)) (- (/ 2.0 B)))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (C <= 1.45e-145) {
tmp = -(sqrt((-16.0 * ((A * A) * (C * F)))) / ((B * B) - ((A * C) * 4.0)));
} else {
tmp = sqrt((C * F)) * -(2.0 / B);
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 1.45d-145) then
tmp = -(sqrt(((-16.0d0) * ((a * a) * (c * f)))) / ((b * b) - ((a * c) * 4.0d0)))
else
tmp = sqrt((c * f)) * -(2.0d0 / b)
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (C <= 1.45e-145) {
tmp = -(Math.sqrt((-16.0 * ((A * A) * (C * F)))) / ((B * B) - ((A * C) * 4.0)));
} else {
tmp = Math.sqrt((C * F)) * -(2.0 / B);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if C <= 1.45e-145: tmp = -(math.sqrt((-16.0 * ((A * A) * (C * F)))) / ((B * B) - ((A * C) * 4.0))) else: tmp = math.sqrt((C * F)) * -(2.0 / B) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (C <= 1.45e-145) tmp = Float64(-Float64(sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F)))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)))); else tmp = Float64(sqrt(Float64(C * F)) * Float64(-Float64(2.0 / B))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (C <= 1.45e-145) tmp = -(sqrt((-16.0 * ((A * A) * (C * F)))) / ((B * B) - ((A * C) * 4.0))); else tmp = sqrt((C * F)) * -(2.0 / B); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[C, 1.45e-145], (-N[(N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * (-N[(2.0 / B), $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 1.45 \cdot 10^{-145}:\\
\;\;\;\;-\frac{\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{C \cdot F} \cdot \left(-\frac{2}{B}\right)\\
\end{array}
\end{array}
if C < 1.44999999999999992e-145Initial program 19.1%
Simplified19.1%
Taylor expanded in A around inf 9.0%
Taylor expanded in A around inf 11.3%
unpow211.3%
*-commutative11.3%
Simplified11.3%
if 1.44999999999999992e-145 < C Initial program 22.3%
Simplified22.3%
Taylor expanded in A around 0 12.7%
mul-1-neg12.7%
*-commutative12.7%
distribute-rgt-neg-in12.7%
*-commutative12.7%
+-commutative12.7%
unpow212.7%
unpow212.7%
hypot-def18.6%
Simplified18.6%
Taylor expanded in B around 0 7.3%
mul-1-neg7.3%
distribute-rgt-neg-in7.3%
unpow27.3%
rem-square-sqrt7.3%
*-commutative7.3%
Simplified7.3%
Final simplification9.8%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= A 9e-146) (* (sqrt (* C F)) (- (/ 2.0 B))) (* (/ 2.0 B) (- (sqrt (* A F))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (A <= 9e-146) {
tmp = sqrt((C * F)) * -(2.0 / B);
} else {
tmp = (2.0 / B) * -sqrt((A * F));
}
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 (a <= 9d-146) then
tmp = sqrt((c * f)) * -(2.0d0 / b)
else
tmp = (2.0d0 / b) * -sqrt((a * f))
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 (A <= 9e-146) {
tmp = Math.sqrt((C * F)) * -(2.0 / B);
} else {
tmp = (2.0 / B) * -Math.sqrt((A * F));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if A <= 9e-146: tmp = math.sqrt((C * F)) * -(2.0 / B) else: tmp = (2.0 / B) * -math.sqrt((A * F)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (A <= 9e-146) tmp = Float64(sqrt(Float64(C * F)) * Float64(-Float64(2.0 / B))); else tmp = Float64(Float64(2.0 / B) * Float64(-sqrt(Float64(A * F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (A <= 9e-146) tmp = sqrt((C * F)) * -(2.0 / B); else tmp = (2.0 / B) * -sqrt((A * F)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[A, 9e-146], N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * (-N[(2.0 / B), $MachinePrecision])), $MachinePrecision], N[(N[(2.0 / B), $MachinePrecision] * (-N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq 9 \cdot 10^{-146}:\\
\;\;\;\;\sqrt{C \cdot F} \cdot \left(-\frac{2}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{B} \cdot \left(-\sqrt{A \cdot F}\right)\\
\end{array}
\end{array}
if A < 9.0000000000000001e-146Initial program 20.2%
Simplified20.2%
Taylor expanded in A around 0 13.3%
mul-1-neg13.3%
*-commutative13.3%
distribute-rgt-neg-in13.3%
*-commutative13.3%
+-commutative13.3%
unpow213.3%
unpow213.3%
hypot-def19.9%
Simplified19.9%
Taylor expanded in B around 0 4.5%
mul-1-neg4.5%
distribute-rgt-neg-in4.5%
unpow24.5%
rem-square-sqrt4.5%
*-commutative4.5%
Simplified4.5%
if 9.0000000000000001e-146 < A Initial program 20.6%
Simplified20.6%
Taylor expanded in C around 0 9.2%
mul-1-neg9.2%
distribute-rgt-neg-in9.2%
*-commutative9.2%
+-commutative9.2%
unpow29.2%
unpow29.2%
hypot-def20.3%
Simplified20.3%
Taylor expanded in B around 0 6.6%
associate-*r*6.6%
mul-1-neg6.6%
unpow26.6%
rem-square-sqrt6.6%
*-commutative6.6%
Simplified6.6%
Final simplification5.2%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (/ 2.0 B) (- (sqrt (* A F)))))
B = abs(B);
double code(double A, double B, double C, double F) {
return (2.0 / B) * -sqrt((A * F));
}
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 / b) * -sqrt((a * f))
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return (2.0 / B) * -Math.sqrt((A * F));
}
B = abs(B) def code(A, B, C, F): return (2.0 / B) * -math.sqrt((A * F))
B = abs(B) function code(A, B, C, F) return Float64(Float64(2.0 / B) * Float64(-sqrt(Float64(A * F)))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = (2.0 / B) * -sqrt((A * F)); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[(2.0 / B), $MachinePrecision] * (-N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\frac{2}{B} \cdot \left(-\sqrt{A \cdot F}\right)
\end{array}
Initial program 20.3%
Simplified20.3%
Taylor expanded in C around 0 10.6%
mul-1-neg10.6%
distribute-rgt-neg-in10.6%
*-commutative10.6%
+-commutative10.6%
unpow210.6%
unpow210.6%
hypot-def18.8%
Simplified18.8%
Taylor expanded in B around 0 2.9%
associate-*r*2.9%
mul-1-neg2.9%
unpow22.9%
rem-square-sqrt2.9%
*-commutative2.9%
Simplified2.9%
Final simplification2.9%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (/ (* -2.0 (sqrt (* A F))) B))
B = abs(B);
double code(double A, double B, double C, double F) {
return (-2.0 * sqrt((A * 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((a * 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((A * F))) / B;
}
B = abs(B) def code(A, B, C, F): return (-2.0 * math.sqrt((A * F))) / B
B = abs(B) function code(A, B, C, F) return Float64(Float64(-2.0 * sqrt(Float64(A * F))) / B) end
B = abs(B) function tmp = code(A, B, C, F) tmp = (-2.0 * sqrt((A * F))) / B; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[(-2.0 * N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\frac{-2 \cdot \sqrt{A \cdot F}}{B}
\end{array}
Initial program 20.3%
Simplified20.3%
Taylor expanded in C around 0 10.6%
mul-1-neg10.6%
distribute-rgt-neg-in10.6%
*-commutative10.6%
+-commutative10.6%
unpow210.6%
unpow210.6%
hypot-def18.8%
Simplified18.8%
associate-*l/18.8%
Applied egg-rr18.8%
Taylor expanded in B around 0 2.9%
associate-*r*2.9%
unpow22.9%
rem-square-sqrt2.9%
metadata-eval2.9%
*-commutative2.9%
Simplified2.9%
Final simplification2.9%
herbie shell --seed 2023274
(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))))