
(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 20 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 -4.0 (* A C) (* B B)))
(t_1 (hypot B (- A C)))
(t_2 (- (pow B 2.0) (* (* 4.0 A) C)))
(t_3
(/
(-
(sqrt
(*
(* 2.0 (* t_2 F))
(+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
t_2)))
(if (<= t_3 0.0)
(/
(*
(* (sqrt 2.0) (* (sqrt F) (sqrt (fma B B (* -4.0 (* A C))))))
(- (sqrt (+ A (+ C t_1)))))
(- (* B B) (* 4.0 (* A C))))
(if (<= t_3 INFINITY)
(* (/ (sqrt (* 2.0 (* F t_0))) t_0) (- (sqrt (+ C (+ A t_1)))))
(* (sqrt (/ F B)) (- (sqrt 2.0)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(-4.0, (A * C), (B * B));
double t_1 = hypot(B, (A - C));
double t_2 = pow(B, 2.0) - ((4.0 * A) * C);
double t_3 = -sqrt(((2.0 * (t_2 * F)) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_2;
double tmp;
if (t_3 <= 0.0) {
tmp = ((sqrt(2.0) * (sqrt(F) * sqrt(fma(B, B, (-4.0 * (A * C)))))) * -sqrt((A + (C + t_1)))) / ((B * B) - (4.0 * (A * C)));
} else if (t_3 <= ((double) INFINITY)) {
tmp = (sqrt((2.0 * (F * t_0))) / t_0) * -sqrt((C + (A + t_1)));
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(-4.0, Float64(A * C), Float64(B * B)) t_1 = hypot(B, Float64(A - C)) t_2 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_3 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_2) tmp = 0.0 if (t_3 <= 0.0) tmp = Float64(Float64(Float64(sqrt(2.0) * Float64(sqrt(F) * sqrt(fma(B, B, Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(A + Float64(C + t_1))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); elseif (t_3 <= Inf) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) / t_0) * Float64(-sqrt(Float64(C + Float64(A + t_1))))); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, 0.0], N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] * (-N[Sqrt[N[(C + N[(A + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)\\
t_1 := \mathsf{hypot}\left(B, A - C\right)\\
t_2 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_3 := \frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_2}\\
\mathbf{if}\;t_3 \leq 0:\\
\;\;\;\;\frac{\left(\sqrt{2} \cdot \left(\sqrt{F} \cdot \sqrt{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}\right)\right) \cdot \left(-\sqrt{A + \left(C + t_1\right)}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_0\right)}}{t_0} \cdot \left(-\sqrt{C + \left(A + t_1\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -0.0Initial program 40.0%
Simplified40.0%
sqrt-prod43.4%
*-commutative43.4%
cancel-sign-sub-inv43.4%
metadata-eval43.4%
associate-+l+43.9%
unpow243.9%
hypot-udef54.4%
Applied egg-rr54.4%
sqrt-prod54.3%
fma-def54.3%
Applied egg-rr54.3%
sqrt-prod64.4%
Applied egg-rr64.4%
*-commutative64.4%
*-commutative64.4%
Simplified64.4%
if -0.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0Initial program 45.1%
Simplified45.1%
sqrt-prod51.3%
*-commutative51.3%
cancel-sign-sub-inv51.3%
metadata-eval51.3%
associate-+l+51.3%
unpow251.3%
hypot-udef86.2%
Applied egg-rr86.2%
sqrt-prod86.2%
fma-def86.2%
Applied egg-rr86.2%
div-inv83.4%
distribute-rgt-neg-in83.4%
sqrt-unprod83.3%
cancel-sign-sub-inv83.3%
metadata-eval83.3%
fma-def83.3%
Applied egg-rr83.3%
associate-*r/86.2%
*-rgt-identity86.2%
associate-/l*86.2%
fma-def86.2%
unpow286.2%
+-commutative86.2%
fma-def86.2%
*-commutative86.2%
unpow286.2%
Simplified86.2%
associate-/r/86.5%
associate-+l+86.5%
Applied egg-rr86.5%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 0.0%
Simplified0.0%
div-inv0.0%
Applied egg-rr1.2%
Taylor expanded in B around inf 1.1%
Taylor expanded in A around 0 9.2%
mul-1-neg9.2%
*-commutative9.2%
distribute-rgt-neg-in9.2%
Simplified9.2%
Final simplification46.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= A -4.6e+170)
(/
(- (sqrt (* (* 2.0 (* F t_0)) (+ C (+ C (* -0.5 (/ (* B B) A)))))))
t_0)
(if (<= A 1.62e-285)
(/ 1.0 (* (sqrt (/ (/ 1.0 F) (+ C (hypot C B)))) (/ (- B) (sqrt 2.0))))
(if (<= A 2.3e-145)
(* (sqrt (/ F B)) (- (sqrt 2.0)))
(/
(*
(sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))
(- (sqrt (+ A (+ C (hypot B (- A C)))))))
(- (* B B) (* 4.0 (* A C)))))))))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 (A <= -4.6e+170) {
tmp = -sqrt(((2.0 * (F * t_0)) * (C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
} else if (A <= 1.62e-285) {
tmp = 1.0 / (sqrt(((1.0 / F) / (C + hypot(C, B)))) * (-B / sqrt(2.0)));
} else if (A <= 2.3e-145) {
tmp = sqrt((F / B)) * -sqrt(2.0);
} else {
tmp = (sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -sqrt((A + (C + hypot(B, (A - C)))))) / ((B * B) - (4.0 * (A * C)));
}
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 (A <= -4.6e+170) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / t_0); elseif (A <= 1.62e-285) tmp = Float64(1.0 / Float64(sqrt(Float64(Float64(1.0 / F) / Float64(C + hypot(C, B)))) * Float64(Float64(-B) / sqrt(2.0)))); elseif (A <= 2.3e-145) tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); else 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(4.0 * Float64(A * C)))); 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[A, -4.6e+170], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[A, 1.62e-285], N[(1.0 / N[(N[Sqrt[N[(N[(1.0 / F), $MachinePrecision] / N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-B) / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 2.3e-145], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], 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[(4.0 * N[(A * C), $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)\\
\mathbf{if}\;A \leq -4.6 \cdot 10^{+170}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)\right)}}{t_0}\\
\mathbf{elif}\;A \leq 1.62 \cdot 10^{-285}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\frac{1}{F}}{C + \mathsf{hypot}\left(C, B\right)}} \cdot \frac{-B}{\sqrt{2}}}\\
\mathbf{elif}\;A \leq 2.3 \cdot 10^{-145}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\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 - 4 \cdot \left(A \cdot C\right)}\\
\end{array}
\end{array}
if A < -4.6000000000000001e170Initial program 1.1%
Simplified7.4%
Taylor expanded in A around -inf 48.3%
unpow248.3%
Simplified48.3%
if -4.6000000000000001e170 < A < 1.61999999999999994e-285Initial program 22.3%
Simplified22.3%
div-inv22.2%
Applied egg-rr26.8%
Applied egg-rr21.0%
Taylor expanded in A around 0 14.0%
mul-1-neg14.0%
*-commutative14.0%
distribute-rgt-neg-in14.0%
+-commutative14.0%
unpow214.0%
unpow214.0%
hypot-def21.3%
Simplified21.3%
pow1/221.3%
Applied egg-rr21.3%
unpow1/221.3%
associate-/r*21.8%
Simplified21.8%
if 1.61999999999999994e-285 < A < 2.30000000000000007e-145Initial program 30.4%
Simplified30.4%
div-inv30.4%
Applied egg-rr31.2%
Taylor expanded in B around inf 15.7%
Taylor expanded in A around 0 33.0%
mul-1-neg33.0%
*-commutative33.0%
distribute-rgt-neg-in33.0%
Simplified33.0%
if 2.30000000000000007e-145 < A Initial program 35.8%
Simplified35.8%
sqrt-prod38.7%
*-commutative38.7%
cancel-sign-sub-inv38.7%
metadata-eval38.7%
associate-+l+39.2%
unpow239.2%
hypot-udef60.3%
Applied egg-rr60.3%
Final simplification40.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))))
(t_1 (* -4.0 (* A C)))
(t_2 (+ (* B B) t_1)))
(if (<= A -4.6e+170)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ C C)))) t_0)
(if (<= A 8.2e-284)
(/ 1.0 (* (sqrt (/ (/ 1.0 F) (+ C (hypot C B)))) (/ (- B) (sqrt 2.0))))
(if (<= A 5.9e-142)
(* (sqrt (/ F B)) (- (sqrt 2.0)))
(if (<= A 0.00065)
(/
(- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_2)))))
t_2)
(/
(* (sqrt (* (* 2.0 F) (fma B B t_1))) (- (sqrt (+ A (+ A C)))))
(- (* B B) (* 4.0 (* A C))))))))))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 = -4.0 * (A * C);
double t_2 = (B * B) + t_1;
double tmp;
if (A <= -4.6e+170) {
tmp = -sqrt(((2.0 * (F * t_0)) * (C + C))) / t_0;
} else if (A <= 8.2e-284) {
tmp = 1.0 / (sqrt(((1.0 / F) / (C + hypot(C, B)))) * (-B / sqrt(2.0)));
} else if (A <= 5.9e-142) {
tmp = sqrt((F / B)) * -sqrt(2.0);
} else if (A <= 0.00065) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_2)))) / t_2;
} else {
tmp = (sqrt(((2.0 * F) * fma(B, B, t_1))) * -sqrt((A + (A + C)))) / ((B * B) - (4.0 * (A * C)));
}
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(-4.0 * Float64(A * C)) t_2 = Float64(Float64(B * B) + t_1) tmp = 0.0 if (A <= -4.6e+170) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(C + C)))) / t_0); elseif (A <= 8.2e-284) tmp = Float64(1.0 / Float64(sqrt(Float64(Float64(1.0 / F) / Float64(C + hypot(C, B)))) * Float64(Float64(-B) / sqrt(2.0)))); elseif (A <= 5.9e-142) tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); elseif (A <= 0.00065) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * t_2))))) / t_2); else tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * F) * fma(B, B, t_1))) * Float64(-sqrt(Float64(A + Float64(A + C))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); 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[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[A, -4.6e+170], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(C + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[A, 8.2e-284], N[(1.0 / N[(N[Sqrt[N[(N[(1.0 / F), $MachinePrecision] / N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-B) / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 5.9e-142], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[A, 0.00065], 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$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(B * B + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $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 := -4 \cdot \left(A \cdot C\right)\\
t_2 := B \cdot B + t_1\\
\mathbf{if}\;A \leq -4.6 \cdot 10^{+170}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(C + C\right)}}{t_0}\\
\mathbf{elif}\;A \leq 8.2 \cdot 10^{-284}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\frac{1}{F}}{C + \mathsf{hypot}\left(C, B\right)}} \cdot \frac{-B}{\sqrt{2}}}\\
\mathbf{elif}\;A \leq 5.9 \cdot 10^{-142}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;A \leq 0.00065:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_2\right)\right)}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \mathsf{fma}\left(B, B, t_1\right)} \cdot \left(-\sqrt{A + \left(A + C\right)}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\end{array}
\end{array}
if A < -4.6000000000000001e170Initial program 1.1%
Simplified7.4%
Taylor expanded in A around -inf 30.9%
if -4.6000000000000001e170 < A < 8.19999999999999997e-284Initial program 22.3%
Simplified22.3%
div-inv22.2%
Applied egg-rr26.8%
Applied egg-rr21.0%
Taylor expanded in A around 0 14.0%
mul-1-neg14.0%
*-commutative14.0%
distribute-rgt-neg-in14.0%
+-commutative14.0%
unpow214.0%
unpow214.0%
hypot-def21.3%
Simplified21.3%
pow1/221.3%
Applied egg-rr21.3%
unpow1/221.3%
associate-/r*21.8%
Simplified21.8%
if 8.19999999999999997e-284 < A < 5.89999999999999966e-142Initial program 30.4%
Simplified30.4%
div-inv30.4%
Applied egg-rr31.2%
Taylor expanded in B around inf 15.7%
Taylor expanded in A around 0 33.0%
mul-1-neg33.0%
*-commutative33.0%
distribute-rgt-neg-in33.0%
Simplified33.0%
if 5.89999999999999966e-142 < A < 6.4999999999999997e-4Initial program 52.6%
Simplified52.6%
distribute-frac-neg52.6%
Applied egg-rr63.0%
if 6.4999999999999997e-4 < A Initial program 30.4%
Simplified30.4%
Taylor expanded in A around inf 42.5%
sqrt-prod53.4%
*-commutative53.4%
cancel-sign-sub-inv53.4%
metadata-eval53.4%
fma-def53.4%
+-commutative53.4%
Applied egg-rr53.4%
associate-*r*53.4%
+-commutative53.4%
Simplified53.4%
Final simplification36.5%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0))))
(t_1 (* -4.0 (* A C)))
(t_2 (+ (* B B) t_1)))
(if (<= A -4.8e+170)
(/
(- (sqrt (* (* 2.0 (* F t_0)) (+ C (+ C (* -0.5 (/ (* B B) A)))))))
t_0)
(if (<= A 5.6e-284)
(/ 1.0 (* (sqrt (/ (/ 1.0 F) (+ C (hypot C B)))) (/ (- B) (sqrt 2.0))))
(if (<= A 2.5e-144)
(* (sqrt (/ F B)) (- (sqrt 2.0)))
(if (<= A 0.00065)
(/
(- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_2)))))
t_2)
(/
(* (sqrt (* (* 2.0 F) (fma B B t_1))) (- (sqrt (+ A (+ A C)))))
(- (* B B) (* 4.0 (* A C))))))))))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 = -4.0 * (A * C);
double t_2 = (B * B) + t_1;
double tmp;
if (A <= -4.8e+170) {
tmp = -sqrt(((2.0 * (F * t_0)) * (C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
} else if (A <= 5.6e-284) {
tmp = 1.0 / (sqrt(((1.0 / F) / (C + hypot(C, B)))) * (-B / sqrt(2.0)));
} else if (A <= 2.5e-144) {
tmp = sqrt((F / B)) * -sqrt(2.0);
} else if (A <= 0.00065) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_2)))) / t_2;
} else {
tmp = (sqrt(((2.0 * F) * fma(B, B, t_1))) * -sqrt((A + (A + C)))) / ((B * B) - (4.0 * (A * C)));
}
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(-4.0 * Float64(A * C)) t_2 = Float64(Float64(B * B) + t_1) tmp = 0.0 if (A <= -4.8e+170) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / t_0); elseif (A <= 5.6e-284) tmp = Float64(1.0 / Float64(sqrt(Float64(Float64(1.0 / F) / Float64(C + hypot(C, B)))) * Float64(Float64(-B) / sqrt(2.0)))); elseif (A <= 2.5e-144) tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); elseif (A <= 0.00065) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * t_2))))) / t_2); else tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * F) * fma(B, B, t_1))) * Float64(-sqrt(Float64(A + Float64(A + C))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); 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[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[A, -4.8e+170], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[A, 5.6e-284], N[(1.0 / N[(N[Sqrt[N[(N[(1.0 / F), $MachinePrecision] / N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-B) / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 2.5e-144], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[A, 0.00065], 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$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(B * B + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $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 := -4 \cdot \left(A \cdot C\right)\\
t_2 := B \cdot B + t_1\\
\mathbf{if}\;A \leq -4.8 \cdot 10^{+170}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)\right)}}{t_0}\\
\mathbf{elif}\;A \leq 5.6 \cdot 10^{-284}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\frac{1}{F}}{C + \mathsf{hypot}\left(C, B\right)}} \cdot \frac{-B}{\sqrt{2}}}\\
\mathbf{elif}\;A \leq 2.5 \cdot 10^{-144}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;A \leq 0.00065:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_2\right)\right)}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \mathsf{fma}\left(B, B, t_1\right)} \cdot \left(-\sqrt{A + \left(A + C\right)}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\end{array}
\end{array}
if A < -4.8e170Initial program 1.1%
Simplified7.4%
Taylor expanded in A around -inf 48.3%
unpow248.3%
Simplified48.3%
if -4.8e170 < A < 5.6000000000000006e-284Initial program 22.3%
Simplified22.3%
div-inv22.2%
Applied egg-rr26.8%
Applied egg-rr21.0%
Taylor expanded in A around 0 14.0%
mul-1-neg14.0%
*-commutative14.0%
distribute-rgt-neg-in14.0%
+-commutative14.0%
unpow214.0%
unpow214.0%
hypot-def21.3%
Simplified21.3%
pow1/221.3%
Applied egg-rr21.3%
unpow1/221.3%
associate-/r*21.8%
Simplified21.8%
if 5.6000000000000006e-284 < A < 2.4999999999999999e-144Initial program 30.4%
Simplified30.4%
div-inv30.4%
Applied egg-rr31.2%
Taylor expanded in B around inf 15.7%
Taylor expanded in A around 0 33.0%
mul-1-neg33.0%
*-commutative33.0%
distribute-rgt-neg-in33.0%
Simplified33.0%
if 2.4999999999999999e-144 < A < 6.4999999999999997e-4Initial program 52.6%
Simplified52.6%
distribute-frac-neg52.6%
Applied egg-rr63.0%
if 6.4999999999999997e-4 < A Initial program 30.4%
Simplified30.4%
Taylor expanded in A around inf 42.5%
sqrt-prod53.4%
*-commutative53.4%
cancel-sign-sub-inv53.4%
metadata-eval53.4%
fma-def53.4%
+-commutative53.4%
Applied egg-rr53.4%
associate-*r*53.4%
+-commutative53.4%
Simplified53.4%
Final simplification38.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ A (+ C (hypot B (- A C)))))
(t_1 (* -4.0 (* A C)))
(t_2 (+ (* B B) t_1)))
(if (<= B 5.4e-126)
(/
(* (sqrt (* 2.0 (* F t_1))) (- (sqrt t_0)))
(- (* B B) (* 4.0 (* A C))))
(if (<= B 3e+31)
(/ (- (sqrt (* 2.0 (* t_0 (* F t_2))))) t_2)
(/
1.0
(* (sqrt (/ (/ 1.0 F) (+ C (hypot C B)))) (/ (- B) (sqrt 2.0))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = A + (C + hypot(B, (A - C)));
double t_1 = -4.0 * (A * C);
double t_2 = (B * B) + t_1;
double tmp;
if (B <= 5.4e-126) {
tmp = (sqrt((2.0 * (F * t_1))) * -sqrt(t_0)) / ((B * B) - (4.0 * (A * C)));
} else if (B <= 3e+31) {
tmp = -sqrt((2.0 * (t_0 * (F * t_2)))) / t_2;
} else {
tmp = 1.0 / (sqrt(((1.0 / F) / (C + hypot(C, B)))) * (-B / sqrt(2.0)));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = A + (C + Math.hypot(B, (A - C)));
double t_1 = -4.0 * (A * C);
double t_2 = (B * B) + t_1;
double tmp;
if (B <= 5.4e-126) {
tmp = (Math.sqrt((2.0 * (F * t_1))) * -Math.sqrt(t_0)) / ((B * B) - (4.0 * (A * C)));
} else if (B <= 3e+31) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * t_2)))) / t_2;
} else {
tmp = 1.0 / (Math.sqrt(((1.0 / F) / (C + Math.hypot(C, B)))) * (-B / Math.sqrt(2.0)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = A + (C + math.hypot(B, (A - C))) t_1 = -4.0 * (A * C) t_2 = (B * B) + t_1 tmp = 0 if B <= 5.4e-126: tmp = (math.sqrt((2.0 * (F * t_1))) * -math.sqrt(t_0)) / ((B * B) - (4.0 * (A * C))) elif B <= 3e+31: tmp = -math.sqrt((2.0 * (t_0 * (F * t_2)))) / t_2 else: tmp = 1.0 / (math.sqrt(((1.0 / F) / (C + math.hypot(C, B)))) * (-B / math.sqrt(2.0))) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(A + Float64(C + hypot(B, Float64(A - C)))) t_1 = Float64(-4.0 * Float64(A * C)) t_2 = Float64(Float64(B * B) + t_1) tmp = 0.0 if (B <= 5.4e-126) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_1))) * Float64(-sqrt(t_0))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); elseif (B <= 3e+31) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * t_2))))) / t_2); else tmp = Float64(1.0 / Float64(sqrt(Float64(Float64(1.0 / F) / Float64(C + hypot(C, B)))) * Float64(Float64(-B) / sqrt(2.0)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = A + (C + hypot(B, (A - C))); t_1 = -4.0 * (A * C); t_2 = (B * B) + t_1; tmp = 0.0; if (B <= 5.4e-126) tmp = (sqrt((2.0 * (F * t_1))) * -sqrt(t_0)) / ((B * B) - (4.0 * (A * C))); elseif (B <= 3e+31) tmp = -sqrt((2.0 * (t_0 * (F * t_2)))) / t_2; else tmp = 1.0 / (sqrt(((1.0 / F) / (C + hypot(C, B)))) * (-B / sqrt(2.0))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[B, 5.4e-126], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[t$95$0], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 3e+31], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(N[(1.0 / F), $MachinePrecision] / N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-B) / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\\
t_1 := -4 \cdot \left(A \cdot C\right)\\
t_2 := B \cdot B + t_1\\
\mathbf{if}\;B \leq 5.4 \cdot 10^{-126}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_1\right)} \cdot \left(-\sqrt{t_0}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B \leq 3 \cdot 10^{+31}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot t_2\right)\right)}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\frac{1}{F}}{C + \mathsf{hypot}\left(C, B\right)}} \cdot \frac{-B}{\sqrt{2}}}\\
\end{array}
\end{array}
if B < 5.39999999999999991e-126Initial program 22.7%
Simplified22.7%
sqrt-prod24.6%
*-commutative24.6%
cancel-sign-sub-inv24.6%
metadata-eval24.6%
associate-+l+25.0%
unpow225.0%
hypot-udef35.7%
Applied egg-rr35.7%
Taylor expanded in B around 0 19.2%
associate-*r*22.8%
associate-*l*22.8%
Simplified22.8%
if 5.39999999999999991e-126 < B < 2.99999999999999989e31Initial program 50.7%
Simplified50.7%
distribute-frac-neg50.7%
Applied egg-rr56.6%
if 2.99999999999999989e31 < B Initial program 18.6%
Simplified18.6%
div-inv18.4%
Applied egg-rr18.6%
Applied egg-rr8.7%
Taylor expanded in A around 0 27.7%
mul-1-neg27.7%
*-commutative27.7%
distribute-rgt-neg-in27.7%
+-commutative27.7%
unpow227.7%
unpow227.7%
hypot-def61.6%
Simplified61.6%
pow1/261.6%
Applied egg-rr61.6%
unpow1/261.6%
associate-/r*62.6%
Simplified62.6%
Final simplification33.5%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))) (t_1 (+ (* B B) (* -4.0 (* A C)))))
(if (<= B 1.35e-144)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A A)))) t_0)
(if (<= B 3.2e+31)
(/ (- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_1))))) t_1)
(/
1.0
(* (sqrt (/ (/ 1.0 F) (+ C (hypot C B)))) (/ (- B) (sqrt 2.0))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double t_1 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 1.35e-144) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + A))) / t_0;
} else if (B <= 3.2e+31) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_1)))) / t_1;
} else {
tmp = 1.0 / (sqrt(((1.0 / F) / (C + hypot(C, B)))) * (-B / sqrt(2.0)));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (B <= 1.35e-144) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + A)))) / t_0); elseif (B <= 3.2e+31) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * t_1))))) / t_1); else tmp = Float64(1.0 / Float64(sqrt(Float64(Float64(1.0 / F) / Float64(C + hypot(C, B)))) * Float64(Float64(-B) / sqrt(2.0)))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.35e-144], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 3.2e+31], 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$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(N[(1.0 / F), $MachinePrecision] / N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-B) / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 1.35 \cdot 10^{-144}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + A\right)}}{t_0}\\
\mathbf{elif}\;B \leq 3.2 \cdot 10^{+31}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_1\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\frac{1}{F}}{C + \mathsf{hypot}\left(C, B\right)}} \cdot \frac{-B}{\sqrt{2}}}\\
\end{array}
\end{array}
if B < 1.34999999999999988e-144Initial program 22.9%
Simplified30.9%
Taylor expanded in A around inf 22.4%
distribute-rgt1-in22.4%
metadata-eval22.4%
mul0-lft22.4%
Simplified22.4%
if 1.34999999999999988e-144 < B < 3.2000000000000001e31Initial program 48.2%
Simplified48.2%
distribute-frac-neg48.2%
Applied egg-rr53.7%
if 3.2000000000000001e31 < B Initial program 18.6%
Simplified18.6%
div-inv18.4%
Applied egg-rr18.6%
Applied egg-rr8.7%
Taylor expanded in A around 0 27.7%
mul-1-neg27.7%
*-commutative27.7%
distribute-rgt-neg-in27.7%
+-commutative27.7%
unpow227.7%
unpow227.7%
hypot-def61.6%
Simplified61.6%
pow1/261.6%
Applied egg-rr61.6%
unpow1/261.6%
associate-/r*62.6%
Simplified62.6%
Final simplification33.1%
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 3.35e+31)
(/ (- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_0))))) t_0)
(/ 1.0 (* (sqrt (/ (/ 1.0 F) (+ C (hypot C B)))) (/ (- B) (sqrt 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 (B <= 3.35e+31) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = 1.0 / (sqrt(((1.0 / F) / (C + hypot(C, B)))) * (-B / sqrt(2.0)));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 3.35e+31) {
tmp = -Math.sqrt((2.0 * ((A + (C + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = 1.0 / (Math.sqrt(((1.0 / F) / (C + Math.hypot(C, B)))) * (-B / Math.sqrt(2.0)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if B <= 3.35e+31: tmp = -math.sqrt((2.0 * ((A + (C + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 else: tmp = 1.0 / (math.sqrt(((1.0 / F) / (C + math.hypot(C, B)))) * (-B / math.sqrt(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 (B <= 3.35e+31) 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(1.0 / Float64(sqrt(Float64(Float64(1.0 / F) / Float64(C + hypot(C, B)))) * Float64(Float64(-B) / sqrt(2.0)))); 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 <= 3.35e+31) tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0; else tmp = 1.0 / (sqrt(((1.0 / F) / (C + hypot(C, B)))) * (-B / sqrt(2.0))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 3.35e+31], 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[(1.0 / N[(N[Sqrt[N[(N[(1.0 / F), $MachinePrecision] / N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-B) / N[Sqrt[2.0], $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}\;B \leq 3.35 \cdot 10^{+31}:\\
\;\;\;\;\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}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\frac{1}{F}}{C + \mathsf{hypot}\left(C, B\right)}} \cdot \frac{-B}{\sqrt{2}}}\\
\end{array}
\end{array}
if B < 3.35000000000000008e31Initial program 27.2%
Simplified27.2%
distribute-frac-neg27.2%
Applied egg-rr34.8%
if 3.35000000000000008e31 < B Initial program 18.6%
Simplified18.6%
div-inv18.4%
Applied egg-rr18.6%
Applied egg-rr8.7%
Taylor expanded in A around 0 27.7%
mul-1-neg27.7%
*-commutative27.7%
distribute-rgt-neg-in27.7%
+-commutative27.7%
unpow227.7%
unpow227.7%
hypot-def61.6%
Simplified61.6%
pow1/261.6%
Applied egg-rr61.6%
unpow1/261.6%
associate-/r*62.6%
Simplified62.6%
Final simplification39.0%
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 3.1e+31)
(/ (- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_0))))) t_0)
(/ (* (sqrt 2.0) (- (sqrt (* F (+ C (hypot C B)))))) 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 <= 3.1e+31) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = (sqrt(2.0) * -sqrt((F * (C + hypot(C, B))))) / 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 <= 3.1e+31) {
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 * (C + Math.hypot(C, B))))) / B;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if B <= 3.1e+31: 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 * (C + math.hypot(C, B))))) / 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 <= 3.1e+31) 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(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(C + hypot(C, B)))))) / 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 <= 3.1e+31) tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0; else tmp = (sqrt(2.0) * -sqrt((F * (C + hypot(C, B))))) / 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, 3.1e+31], 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[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $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 3.1 \cdot 10^{+31}:\\
\;\;\;\;\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}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}\right)}{B}\\
\end{array}
\end{array}
if B < 3.1000000000000002e31Initial program 27.2%
Simplified27.2%
distribute-frac-neg27.2%
Applied egg-rr34.8%
if 3.1000000000000002e31 < B Initial program 18.6%
Simplified19.2%
Taylor expanded in A around 0 27.8%
associate-*l/27.8%
+-commutative27.8%
unpow227.8%
unpow227.8%
hypot-def61.7%
Simplified61.7%
Final simplification38.9%
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 1800000.0)
(/ (- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_0))))) t_0)
(* (sqrt (* F (+ A (hypot B A)))) (/ (- (sqrt 2.0)) 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 <= 1800000.0) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = sqrt((F * (A + hypot(B, A)))) * (-sqrt(2.0) / 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 <= 1800000.0) {
tmp = -Math.sqrt((2.0 * ((A + (C + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = Math.sqrt((F * (A + Math.hypot(B, A)))) * (-Math.sqrt(2.0) / B);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if B <= 1800000.0: tmp = -math.sqrt((2.0 * ((A + (C + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 else: tmp = math.sqrt((F * (A + math.hypot(B, A)))) * (-math.sqrt(2.0) / 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 <= 1800000.0) 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(Float64(F * Float64(A + hypot(B, A)))) * Float64(Float64(-sqrt(2.0)) / 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 <= 1800000.0) tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0; else tmp = sqrt((F * (A + hypot(B, A)))) * (-sqrt(2.0) / 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, 1800000.0], 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[N[(F * N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $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 1800000:\\
\;\;\;\;\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{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < 1.8e6Initial program 26.1%
Simplified26.1%
distribute-frac-neg26.1%
Applied egg-rr33.9%
if 1.8e6 < B Initial program 25.2%
Simplified25.2%
Taylor expanded in C around 0 36.9%
mul-1-neg36.9%
distribute-rgt-neg-in36.9%
+-commutative36.9%
unpow236.9%
unpow236.9%
hypot-def61.3%
Simplified61.3%
Final simplification38.7%
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)))) (t_1 (* -4.0 (* A C))))
(if (<= B 1e-99)
(*
(sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F (+ (* B B) t_1)))))
(/ -1.0 t_1))
(if (<= B 2.45e+119)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ (+ A C) (hypot B A))))) t_0)
(* (sqrt (/ F B)) (- (sqrt 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 t_1 = -4.0 * (A * C);
double tmp;
if (B <= 1e-99) {
tmp = sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * ((B * B) + t_1))))) * (-1.0 / t_1);
} else if (B <= 2.45e+119) {
tmp = -sqrt(((2.0 * (F * t_0)) * ((A + C) + hypot(B, A)))) / t_0;
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = -4.0 * (A * C);
double tmp;
if (B <= 1e-99) {
tmp = Math.sqrt((2.0 * ((A + (C + Math.hypot(B, (A - C)))) * (F * ((B * B) + t_1))))) * (-1.0 / t_1);
} else if (B <= 2.45e+119) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * ((A + C) + Math.hypot(B, A)))) / t_0;
} else {
tmp = Math.sqrt((F / B)) * -Math.sqrt(2.0);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = -4.0 * (A * C) tmp = 0 if B <= 1e-99: tmp = math.sqrt((2.0 * ((A + (C + math.hypot(B, (A - C)))) * (F * ((B * B) + t_1))))) * (-1.0 / t_1) elif B <= 2.45e+119: tmp = -math.sqrt(((2.0 * (F * t_0)) * ((A + C) + math.hypot(B, A)))) / t_0 else: tmp = math.sqrt((F / B)) * -math.sqrt(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))) t_1 = Float64(-4.0 * Float64(A * C)) tmp = 0.0 if (B <= 1e-99) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * Float64(Float64(B * B) + t_1))))) * Float64(-1.0 / t_1)); elseif (B <= 2.45e+119) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(Float64(A + C) + hypot(B, A))))) / t_0); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); t_1 = -4.0 * (A * C); tmp = 0.0; if (B <= 1e-99) tmp = sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * ((B * B) + t_1))))) * (-1.0 / t_1); elseif (B <= 2.45e+119) tmp = -sqrt(((2.0 * (F * t_0)) * ((A + C) + hypot(B, A)))) / t_0; else tmp = sqrt((F / B)) * -sqrt(2.0); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1e-99], 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] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 2.45e+119], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 10^{-99}:\\
\;\;\;\;\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 + t_1\right)\right)\right)} \cdot \frac{-1}{t_1}\\
\mathbf{elif}\;B \leq 2.45 \cdot 10^{+119}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < 1e-99Initial program 22.8%
Simplified22.8%
div-inv22.3%
Applied egg-rr30.6%
Taylor expanded in B around 0 19.2%
if 1e-99 < B < 2.44999999999999998e119Initial program 48.5%
Simplified48.5%
Taylor expanded in C around 0 47.9%
+-commutative47.9%
unpow247.9%
unpow247.9%
hypot-def48.2%
Simplified48.2%
if 2.44999999999999998e119 < B Initial program 4.8%
Simplified4.8%
div-inv4.8%
Applied egg-rr4.8%
Taylor expanded in B around inf 0.6%
Taylor expanded in A around 0 46.0%
mul-1-neg46.0%
*-commutative46.0%
distribute-rgt-neg-in46.0%
Simplified46.0%
Final simplification26.9%
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 1.55e+110)
(/ (- (sqrt (* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F t_0))))) t_0)
(* (sqrt (/ F B)) (- (sqrt 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 (B <= 1.55e+110) {
tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 1.55e+110) {
tmp = -Math.sqrt((2.0 * ((A + (C + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = Math.sqrt((F / B)) * -Math.sqrt(2.0);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if B <= 1.55e+110: tmp = -math.sqrt((2.0 * ((A + (C + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 else: tmp = math.sqrt((F / B)) * -math.sqrt(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 (B <= 1.55e+110) 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(Float64(F / B)) * Float64(-sqrt(2.0))); 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 <= 1.55e+110) tmp = -sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * t_0)))) / t_0; else tmp = sqrt((F / B)) * -sqrt(2.0); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.55e+110], 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[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $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 1.55 \cdot 10^{+110}:\\
\;\;\;\;\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{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < 1.55000000000000009e110Initial program 28.0%
Simplified28.0%
distribute-frac-neg28.0%
Applied egg-rr35.1%
if 1.55000000000000009e110 < B Initial program 4.8%
Simplified4.8%
div-inv4.8%
Applied egg-rr4.8%
Taylor expanded in B around inf 0.6%
Taylor expanded in A around 0 46.0%
mul-1-neg46.0%
*-commutative46.0%
distribute-rgt-neg-in46.0%
Simplified46.0%
Final simplification36.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* -4.0 (* A C)))
(t_1
(sqrt
(* 2.0 (* (+ A (+ C (hypot B (- A C)))) (* F (+ (* B B) t_0)))))))
(if (<= B 3.05e-89)
(* t_1 (/ -1.0 t_0))
(if (<= B 1.06e+110)
(* t_1 (/ -1.0 (* B B)))
(* (sqrt (/ F B)) (- (sqrt 2.0)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = -4.0 * (A * C);
double t_1 = sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * ((B * B) + t_0)))));
double tmp;
if (B <= 3.05e-89) {
tmp = t_1 * (-1.0 / t_0);
} else if (B <= 1.06e+110) {
tmp = t_1 * (-1.0 / (B * B));
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = -4.0 * (A * C);
double t_1 = Math.sqrt((2.0 * ((A + (C + Math.hypot(B, (A - C)))) * (F * ((B * B) + t_0)))));
double tmp;
if (B <= 3.05e-89) {
tmp = t_1 * (-1.0 / t_0);
} else if (B <= 1.06e+110) {
tmp = t_1 * (-1.0 / (B * B));
} else {
tmp = Math.sqrt((F / B)) * -Math.sqrt(2.0);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = -4.0 * (A * C) t_1 = math.sqrt((2.0 * ((A + (C + math.hypot(B, (A - C)))) * (F * ((B * B) + t_0))))) tmp = 0 if B <= 3.05e-89: tmp = t_1 * (-1.0 / t_0) elif B <= 1.06e+110: tmp = t_1 * (-1.0 / (B * B)) else: tmp = math.sqrt((F / B)) * -math.sqrt(2.0) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(-4.0 * Float64(A * C)) t_1 = sqrt(Float64(2.0 * Float64(Float64(A + Float64(C + hypot(B, Float64(A - C)))) * Float64(F * Float64(Float64(B * B) + t_0))))) tmp = 0.0 if (B <= 3.05e-89) tmp = Float64(t_1 * Float64(-1.0 / t_0)); elseif (B <= 1.06e+110) tmp = Float64(t_1 * Float64(-1.0 / Float64(B * B))); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = -4.0 * (A * C); t_1 = sqrt((2.0 * ((A + (C + hypot(B, (A - C)))) * (F * ((B * B) + t_0))))); tmp = 0.0; if (B <= 3.05e-89) tmp = t_1 * (-1.0 / t_0); elseif (B <= 1.06e+110) tmp = t_1 * (-1.0 / (B * B)); else tmp = sqrt((F / B)) * -sqrt(2.0); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, 3.05e-89], N[(t$95$1 * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.06e+110], N[(t$95$1 * N[(-1.0 / N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := -4 \cdot \left(A \cdot C\right)\\
t_1 := \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 + t_0\right)\right)\right)}\\
\mathbf{if}\;B \leq 3.05 \cdot 10^{-89}:\\
\;\;\;\;t_1 \cdot \frac{-1}{t_0}\\
\mathbf{elif}\;B \leq 1.06 \cdot 10^{+110}:\\
\;\;\;\;t_1 \cdot \frac{-1}{B \cdot B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < 3.0500000000000001e-89Initial program 22.5%
Simplified22.5%
div-inv22.0%
Applied egg-rr30.1%
Taylor expanded in B around 0 18.9%
if 3.0500000000000001e-89 < B < 1.06000000000000005e110Initial program 51.7%
Simplified51.7%
div-inv51.6%
Applied egg-rr54.2%
Taylor expanded in B around inf 47.7%
unpow247.7%
Simplified47.7%
if 1.06000000000000005e110 < B Initial program 4.8%
Simplified4.8%
div-inv4.8%
Applied egg-rr4.8%
Taylor expanded in B around inf 0.6%
Taylor expanded in A around 0 46.0%
mul-1-neg46.0%
*-commutative46.0%
distribute-rgt-neg-in46.0%
Simplified46.0%
Final simplification26.3%
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 (<= A 3.1e-280)
(/ 1.0 (* (/ (- B) (sqrt 2.0)) (sqrt (/ 1.0 (* B F)))))
(if (<= A 2.7e-25)
(* (sqrt (/ F B)) (- (sqrt 2.0)))
(- (/ (sqrt (* (* 2.0 (* F t_0)) (+ A (+ A C)))) t_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 (A <= 3.1e-280) {
tmp = 1.0 / ((-B / sqrt(2.0)) * sqrt((1.0 / (B * F))));
} else if (A <= 2.7e-25) {
tmp = sqrt((F / B)) * -sqrt(2.0);
} else {
tmp = -(sqrt(((2.0 * (F * t_0)) * (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) - (4.0d0 * (a * c))
if (a <= 3.1d-280) then
tmp = 1.0d0 / ((-b / sqrt(2.0d0)) * sqrt((1.0d0 / (b * f))))
else if (a <= 2.7d-25) then
tmp = sqrt((f / b)) * -sqrt(2.0d0)
else
tmp = -(sqrt(((2.0d0 * (f * t_0)) * (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) - (4.0 * (A * C));
double tmp;
if (A <= 3.1e-280) {
tmp = 1.0 / ((-B / Math.sqrt(2.0)) * Math.sqrt((1.0 / (B * F))));
} else if (A <= 2.7e-25) {
tmp = Math.sqrt((F / B)) * -Math.sqrt(2.0);
} else {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if A <= 3.1e-280: tmp = 1.0 / ((-B / math.sqrt(2.0)) * math.sqrt((1.0 / (B * F)))) elif A <= 2.7e-25: tmp = math.sqrt((F / B)) * -math.sqrt(2.0) else: tmp = -(math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_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 (A <= 3.1e-280) tmp = Float64(1.0 / Float64(Float64(Float64(-B) / sqrt(2.0)) * sqrt(Float64(1.0 / Float64(B * F))))); elseif (A <= 2.7e-25) tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); else tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * 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) - (4.0 * (A * C)); tmp = 0.0; if (A <= 3.1e-280) tmp = 1.0 / ((-B / sqrt(2.0)) * sqrt((1.0 / (B * F)))); elseif (A <= 2.7e-25) tmp = sqrt((F / B)) * -sqrt(2.0); else tmp = -(sqrt(((2.0 * (F * t_0)) * (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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, 3.1e-280], N[(1.0 / N[(N[((-B) / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(B * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 2.7e-25], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $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 - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;A \leq 3.1 \cdot 10^{-280}:\\
\;\;\;\;\frac{1}{\frac{-B}{\sqrt{2}} \cdot \sqrt{\frac{1}{B \cdot F}}}\\
\mathbf{elif}\;A \leq 2.7 \cdot 10^{-25}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{t_0}\\
\end{array}
\end{array}
if A < 3.10000000000000021e-280Initial program 17.9%
Simplified17.9%
div-inv17.8%
Applied egg-rr21.8%
Applied egg-rr17.1%
Taylor expanded in A around 0 11.8%
mul-1-neg11.8%
*-commutative11.8%
distribute-rgt-neg-in11.8%
+-commutative11.8%
unpow211.8%
unpow211.8%
hypot-def18.3%
Simplified18.3%
Taylor expanded in C around 0 16.2%
if 3.10000000000000021e-280 < A < 2.70000000000000016e-25Initial program 36.3%
Simplified36.3%
div-inv34.4%
Applied egg-rr40.1%
Taylor expanded in B around inf 14.7%
Taylor expanded in A around 0 24.8%
mul-1-neg24.8%
*-commutative24.8%
distribute-rgt-neg-in24.8%
Simplified24.8%
if 2.70000000000000016e-25 < A Initial program 34.0%
Simplified34.0%
Taylor expanded in A around inf 43.4%
Final simplification25.8%
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 (<= A 4.2e-25)
(* (sqrt (/ F B)) (- (sqrt 2.0)))
(- (/ (sqrt (* (* 2.0 (* F t_0)) (+ A (+ A C)))) t_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 (A <= 4.2e-25) {
tmp = sqrt((F / B)) * -sqrt(2.0);
} else {
tmp = -(sqrt(((2.0 * (F * t_0)) * (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) - (4.0d0 * (a * c))
if (a <= 4.2d-25) then
tmp = sqrt((f / b)) * -sqrt(2.0d0)
else
tmp = -(sqrt(((2.0d0 * (f * t_0)) * (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) - (4.0 * (A * C));
double tmp;
if (A <= 4.2e-25) {
tmp = Math.sqrt((F / B)) * -Math.sqrt(2.0);
} else {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if A <= 4.2e-25: tmp = math.sqrt((F / B)) * -math.sqrt(2.0) else: tmp = -(math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_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 (A <= 4.2e-25) tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); else tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * 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) - (4.0 * (A * C)); tmp = 0.0; if (A <= 4.2e-25) tmp = sqrt((F / B)) * -sqrt(2.0); else tmp = -(sqrt(((2.0 * (F * t_0)) * (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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, 4.2e-25], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $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 - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;A \leq 4.2 \cdot 10^{-25}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{t_0}\\
\end{array}
\end{array}
if A < 4.20000000000000005e-25Initial program 22.5%
Simplified22.5%
div-inv21.9%
Applied egg-rr26.3%
Taylor expanded in B around inf 8.2%
Taylor expanded in A around 0 15.6%
mul-1-neg15.6%
*-commutative15.6%
distribute-rgt-neg-in15.6%
Simplified15.6%
if 4.20000000000000005e-25 < A Initial program 34.0%
Simplified34.0%
Taylor expanded in A around inf 43.4%
Final simplification23.9%
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)))) (t_1 (* 2.0 (* F t_0))))
(if (<= A -4.4e-47)
(*
(sqrt (* 2.0 (* -8.0 (* F (* A (* C C))))))
(/ -1.0 (+ (* B B) (* -4.0 (* A C)))))
(if (<= A 6.1e-34)
(/ (- (sqrt (* t_1 (+ (+ A C) (- C A))))) t_0)
(- (/ (sqrt (* t_1 (+ A (+ A C)))) t_0))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (A <= -4.4e-47) {
tmp = sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((B * B) + (-4.0 * (A * C))));
} else if (A <= 6.1e-34) {
tmp = -sqrt((t_1 * ((A + C) + (C - A)))) / t_0;
} else {
tmp = -(sqrt((t_1 * (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) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = 2.0d0 * (f * t_0)
if (a <= (-4.4d-47)) then
tmp = sqrt((2.0d0 * ((-8.0d0) * (f * (a * (c * c)))))) * ((-1.0d0) / ((b * b) + ((-4.0d0) * (a * c))))
else if (a <= 6.1d-34) then
tmp = -sqrt((t_1 * ((a + c) + (c - a)))) / t_0
else
tmp = -(sqrt((t_1 * (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) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (A <= -4.4e-47) {
tmp = Math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((B * B) + (-4.0 * (A * C))));
} else if (A <= 6.1e-34) {
tmp = -Math.sqrt((t_1 * ((A + C) + (C - A)))) / t_0;
} else {
tmp = -(Math.sqrt((t_1 * (A + (A + C)))) / t_0);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = 2.0 * (F * t_0) tmp = 0 if A <= -4.4e-47: tmp = math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((B * B) + (-4.0 * (A * C)))) elif A <= 6.1e-34: tmp = -math.sqrt((t_1 * ((A + C) + (C - A)))) / t_0 else: tmp = -(math.sqrt((t_1 * (A + (A + C)))) / t_0) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (A <= -4.4e-47) tmp = Float64(sqrt(Float64(2.0 * Float64(-8.0 * Float64(F * Float64(A * Float64(C * C)))))) * Float64(-1.0 / Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))))); elseif (A <= 6.1e-34) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + Float64(C - A))))) / t_0); else tmp = Float64(-Float64(sqrt(Float64(t_1 * 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) - (4.0 * (A * C)); t_1 = 2.0 * (F * t_0); tmp = 0.0; if (A <= -4.4e-47) tmp = sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((B * B) + (-4.0 * (A * C)))); elseif (A <= 6.1e-34) tmp = -sqrt((t_1 * ((A + C) + (C - A)))) / t_0; else tmp = -(sqrt((t_1 * (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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -4.4e-47], N[(N[Sqrt[N[(2.0 * N[(-8.0 * N[(F * N[(A * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 6.1e-34], N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], (-N[(N[Sqrt[N[(t$95$1 * 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 - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;A \leq -4.4 \cdot 10^{-47}:\\
\;\;\;\;\sqrt{2 \cdot \left(-8 \cdot \left(F \cdot \left(A \cdot \left(C \cdot C\right)\right)\right)\right)} \cdot \frac{-1}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;A \leq 6.1 \cdot 10^{-34}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(\left(A + C\right) + \left(C - A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{t_1 \cdot \left(A + \left(A + C\right)\right)}}{t_0}\\
\end{array}
\end{array}
if A < -4.40000000000000037e-47Initial program 6.8%
Simplified6.8%
div-inv6.8%
Applied egg-rr8.9%
Taylor expanded in A around -inf 17.2%
associate-*r*17.2%
unpow217.2%
Simplified17.2%
if -4.40000000000000037e-47 < A < 6.0999999999999998e-34Initial program 31.6%
Simplified31.6%
Taylor expanded in A around -inf 11.4%
mul-1-neg11.4%
sub-neg11.4%
Simplified11.4%
if 6.0999999999999998e-34 < A Initial program 36.1%
Simplified36.1%
Taylor expanded in A around inf 42.7%
Final simplification22.8%
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 (<= A -4.2e-176)
(*
(sqrt (* 2.0 (* -8.0 (* F (* A (* C C))))))
(/ -1.0 (+ (* B B) (* -4.0 (* A C)))))
(- (/ (sqrt (* (* 2.0 (* F t_0)) (+ A (+ A C)))) t_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 (A <= -4.2e-176) {
tmp = sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((B * B) + (-4.0 * (A * C))));
} else {
tmp = -(sqrt(((2.0 * (F * t_0)) * (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) - (4.0d0 * (a * c))
if (a <= (-4.2d-176)) then
tmp = sqrt((2.0d0 * ((-8.0d0) * (f * (a * (c * c)))))) * ((-1.0d0) / ((b * b) + ((-4.0d0) * (a * c))))
else
tmp = -(sqrt(((2.0d0 * (f * t_0)) * (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) - (4.0 * (A * C));
double tmp;
if (A <= -4.2e-176) {
tmp = Math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((B * B) + (-4.0 * (A * C))));
} else {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if A <= -4.2e-176: tmp = math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((B * B) + (-4.0 * (A * C)))) else: tmp = -(math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_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 (A <= -4.2e-176) tmp = Float64(sqrt(Float64(2.0 * Float64(-8.0 * Float64(F * Float64(A * Float64(C * C)))))) * Float64(-1.0 / Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))))); else tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * 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) - (4.0 * (A * C)); tmp = 0.0; if (A <= -4.2e-176) tmp = sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((B * B) + (-4.0 * (A * C)))); else tmp = -(sqrt(((2.0 * (F * t_0)) * (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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -4.2e-176], N[(N[Sqrt[N[(2.0 * N[(-8.0 * N[(F * N[(A * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $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 - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;A \leq -4.2 \cdot 10^{-176}:\\
\;\;\;\;\sqrt{2 \cdot \left(-8 \cdot \left(F \cdot \left(A \cdot \left(C \cdot C\right)\right)\right)\right)} \cdot \frac{-1}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{t_0}\\
\end{array}
\end{array}
if A < -4.19999999999999984e-176Initial program 12.7%
Simplified12.7%
div-inv12.7%
Applied egg-rr15.1%
Taylor expanded in A around -inf 14.7%
associate-*r*14.6%
unpow214.6%
Simplified14.6%
if -4.19999999999999984e-176 < A Initial program 34.4%
Simplified34.4%
Taylor expanded in A around inf 24.7%
Final simplification20.8%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ -1.0 (+ (* B B) (* -4.0 (* A C)))))
(t_1 (* (sqrt (* 2.0 (* -8.0 (* (* A A) (* C F))))) t_0)))
(if (<= A -6.6e-42)
(* (sqrt (* 2.0 (* -8.0 (* F (* A (* C C)))))) t_0)
(if (<= A 1.3e+25)
t_1
(if (<= A 3.3e+48)
(* (sqrt (* A F)) (- (/ 2.0 B)))
(if (<= A 2.35e+106) t_1 (* (/ 2.0 B) (- (pow (* A F) 0.5)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = -1.0 / ((B * B) + (-4.0 * (A * C)));
double t_1 = sqrt((2.0 * (-8.0 * ((A * A) * (C * F))))) * t_0;
double tmp;
if (A <= -6.6e-42) {
tmp = sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * t_0;
} else if (A <= 1.3e+25) {
tmp = t_1;
} else if (A <= 3.3e+48) {
tmp = sqrt((A * F)) * -(2.0 / B);
} else if (A <= 2.35e+106) {
tmp = t_1;
} else {
tmp = (2.0 / B) * -pow((A * F), 0.5);
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-1.0d0) / ((b * b) + ((-4.0d0) * (a * c)))
t_1 = sqrt((2.0d0 * ((-8.0d0) * ((a * a) * (c * f))))) * t_0
if (a <= (-6.6d-42)) then
tmp = sqrt((2.0d0 * ((-8.0d0) * (f * (a * (c * c)))))) * t_0
else if (a <= 1.3d+25) then
tmp = t_1
else if (a <= 3.3d+48) then
tmp = sqrt((a * f)) * -(2.0d0 / b)
else if (a <= 2.35d+106) then
tmp = t_1
else
tmp = (2.0d0 / b) * -((a * f) ** 0.5d0)
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = -1.0 / ((B * B) + (-4.0 * (A * C)));
double t_1 = Math.sqrt((2.0 * (-8.0 * ((A * A) * (C * F))))) * t_0;
double tmp;
if (A <= -6.6e-42) {
tmp = Math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * t_0;
} else if (A <= 1.3e+25) {
tmp = t_1;
} else if (A <= 3.3e+48) {
tmp = Math.sqrt((A * F)) * -(2.0 / B);
} else if (A <= 2.35e+106) {
tmp = t_1;
} else {
tmp = (2.0 / B) * -Math.pow((A * F), 0.5);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = -1.0 / ((B * B) + (-4.0 * (A * C))) t_1 = math.sqrt((2.0 * (-8.0 * ((A * A) * (C * F))))) * t_0 tmp = 0 if A <= -6.6e-42: tmp = math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * t_0 elif A <= 1.3e+25: tmp = t_1 elif A <= 3.3e+48: tmp = math.sqrt((A * F)) * -(2.0 / B) elif A <= 2.35e+106: tmp = t_1 else: tmp = (2.0 / B) * -math.pow((A * F), 0.5) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(-1.0 / Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))) t_1 = Float64(sqrt(Float64(2.0 * Float64(-8.0 * Float64(Float64(A * A) * Float64(C * F))))) * t_0) tmp = 0.0 if (A <= -6.6e-42) tmp = Float64(sqrt(Float64(2.0 * Float64(-8.0 * Float64(F * Float64(A * Float64(C * C)))))) * t_0); elseif (A <= 1.3e+25) tmp = t_1; elseif (A <= 3.3e+48) tmp = Float64(sqrt(Float64(A * F)) * Float64(-Float64(2.0 / B))); elseif (A <= 2.35e+106) tmp = t_1; else tmp = Float64(Float64(2.0 / B) * Float64(-(Float64(A * F) ^ 0.5))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = -1.0 / ((B * B) + (-4.0 * (A * C))); t_1 = sqrt((2.0 * (-8.0 * ((A * A) * (C * F))))) * t_0; tmp = 0.0; if (A <= -6.6e-42) tmp = sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * t_0; elseif (A <= 1.3e+25) tmp = t_1; elseif (A <= 3.3e+48) tmp = sqrt((A * F)) * -(2.0 / B); elseif (A <= 2.35e+106) tmp = t_1; else tmp = (2.0 / B) * -((A * F) ^ 0.5); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(-1.0 / N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(2.0 * N[(-8.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[A, -6.6e-42], N[(N[Sqrt[N[(2.0 * N[(-8.0 * N[(F * N[(A * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[A, 1.3e+25], t$95$1, If[LessEqual[A, 3.3e+48], N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * (-N[(2.0 / B), $MachinePrecision])), $MachinePrecision], If[LessEqual[A, 2.35e+106], t$95$1, N[(N[(2.0 / B), $MachinePrecision] * (-N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \frac{-1}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\
t_1 := \sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)} \cdot t_0\\
\mathbf{if}\;A \leq -6.6 \cdot 10^{-42}:\\
\;\;\;\;\sqrt{2 \cdot \left(-8 \cdot \left(F \cdot \left(A \cdot \left(C \cdot C\right)\right)\right)\right)} \cdot t_0\\
\mathbf{elif}\;A \leq 1.3 \cdot 10^{+25}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;A \leq 3.3 \cdot 10^{+48}:\\
\;\;\;\;\sqrt{A \cdot F} \cdot \left(-\frac{2}{B}\right)\\
\mathbf{elif}\;A \leq 2.35 \cdot 10^{+106}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{B} \cdot \left(-{\left(A \cdot F\right)}^{0.5}\right)\\
\end{array}
\end{array}
if A < -6.6000000000000005e-42Initial program 6.8%
Simplified6.8%
div-inv6.8%
Applied egg-rr9.0%
Taylor expanded in A around -inf 17.4%
associate-*r*17.4%
unpow217.4%
Simplified17.4%
if -6.6000000000000005e-42 < A < 1.2999999999999999e25 or 3.30000000000000023e48 < A < 2.35000000000000012e106Initial program 38.3%
Simplified38.3%
div-inv37.6%
Applied egg-rr42.4%
Taylor expanded in B around 0 16.3%
unpow216.3%
Simplified16.3%
if 1.2999999999999999e25 < A < 3.30000000000000023e48Initial program 82.8%
Simplified82.8%
Taylor expanded in A around inf 82.8%
Taylor expanded in C around 0 50.2%
mul-1-neg50.2%
unpow250.2%
rem-square-sqrt50.8%
Simplified50.8%
if 2.35000000000000012e106 < A Initial program 12.6%
Simplified12.6%
Taylor expanded in A around inf 31.4%
Taylor expanded in C around 0 5.8%
mul-1-neg5.8%
unpow25.8%
rem-square-sqrt5.9%
Simplified5.9%
pow1/26.5%
*-commutative6.5%
Applied egg-rr6.5%
Final simplification15.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= B 3.7e-87)
(*
(sqrt (* 2.0 (* -8.0 (* (* A A) (* C F)))))
(/ -1.0 (+ (* B B) (* -4.0 (* A C)))))
(* (/ 2.0 B) (- (pow (* A F) 0.5)))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 3.7e-87) {
tmp = sqrt((2.0 * (-8.0 * ((A * A) * (C * F))))) * (-1.0 / ((B * B) + (-4.0 * (A * C))));
} else {
tmp = (2.0 / B) * -pow((A * F), 0.5);
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= 3.7d-87) then
tmp = sqrt((2.0d0 * ((-8.0d0) * ((a * a) * (c * f))))) * ((-1.0d0) / ((b * b) + ((-4.0d0) * (a * c))))
else
tmp = (2.0d0 / b) * -((a * f) ** 0.5d0)
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 3.7e-87) {
tmp = Math.sqrt((2.0 * (-8.0 * ((A * A) * (C * F))))) * (-1.0 / ((B * B) + (-4.0 * (A * C))));
} else {
tmp = (2.0 / B) * -Math.pow((A * F), 0.5);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if B <= 3.7e-87: tmp = math.sqrt((2.0 * (-8.0 * ((A * A) * (C * F))))) * (-1.0 / ((B * B) + (-4.0 * (A * C)))) else: tmp = (2.0 / B) * -math.pow((A * F), 0.5) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (B <= 3.7e-87) tmp = Float64(sqrt(Float64(2.0 * Float64(-8.0 * Float64(Float64(A * A) * Float64(C * F))))) * Float64(-1.0 / Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))))); else tmp = Float64(Float64(2.0 / B) * Float64(-(Float64(A * F) ^ 0.5))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (B <= 3.7e-87) tmp = sqrt((2.0 * (-8.0 * ((A * A) * (C * F))))) * (-1.0 / ((B * B) + (-4.0 * (A * C)))); else tmp = (2.0 / B) * -((A * F) ^ 0.5); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[B, 3.7e-87], N[(N[Sqrt[N[(2.0 * N[(-8.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / B), $MachinePrecision] * (-N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 3.7 \cdot 10^{-87}:\\
\;\;\;\;\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)\right)} \cdot \frac{-1}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{B} \cdot \left(-{\left(A \cdot F\right)}^{0.5}\right)\\
\end{array}
\end{array}
if B < 3.7000000000000002e-87Initial program 22.3%
Simplified22.3%
div-inv21.9%
Applied egg-rr30.0%
Taylor expanded in B around 0 12.0%
unpow212.0%
Simplified12.0%
if 3.7000000000000002e-87 < B Initial program 36.1%
Simplified36.1%
Taylor expanded in A around inf 11.9%
Taylor expanded in C around 0 9.7%
mul-1-neg9.7%
unpow29.7%
rem-square-sqrt9.8%
Simplified9.8%
pow1/210.0%
*-commutative10.0%
Applied egg-rr10.0%
Final simplification11.5%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (/ 2.0 B) (- (pow (* A F) 0.5))))
B = abs(B);
double code(double A, double B, double C, double F) {
return (2.0 / B) * -pow((A * F), 0.5);
}
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) * -((a * f) ** 0.5d0)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return (2.0 / B) * -Math.pow((A * F), 0.5);
}
B = abs(B) def code(A, B, C, F): return (2.0 / B) * -math.pow((A * F), 0.5)
B = abs(B) function code(A, B, C, F) return Float64(Float64(2.0 / B) * Float64(-(Float64(A * F) ^ 0.5))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = (2.0 / B) * -((A * F) ^ 0.5); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[(2.0 / B), $MachinePrecision] * (-N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\frac{2}{B} \cdot \left(-{\left(A \cdot F\right)}^{0.5}\right)
\end{array}
Initial program 25.9%
Simplified25.9%
Taylor expanded in A around inf 15.7%
Taylor expanded in C around 0 3.4%
mul-1-neg3.4%
unpow23.4%
rem-square-sqrt3.4%
Simplified3.4%
pow1/23.7%
*-commutative3.7%
Applied egg-rr3.7%
Final simplification3.7%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (sqrt (* A F)) (- (/ 2.0 B))))
B = abs(B);
double code(double A, double B, double C, double F) {
return sqrt((A * F)) * -(2.0 / B);
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((a * f)) * -(2.0d0 / b)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return Math.sqrt((A * F)) * -(2.0 / B);
}
B = abs(B) def code(A, B, C, F): return math.sqrt((A * F)) * -(2.0 / B)
B = abs(B) function code(A, B, C, F) return Float64(sqrt(Float64(A * F)) * Float64(-Float64(2.0 / B))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = sqrt((A * F)) * -(2.0 / B); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * (-N[(2.0 / B), $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\sqrt{A \cdot F} \cdot \left(-\frac{2}{B}\right)
\end{array}
Initial program 25.9%
Simplified25.9%
Taylor expanded in A around inf 15.7%
Taylor expanded in C around 0 3.4%
mul-1-neg3.4%
unpow23.4%
rem-square-sqrt3.4%
Simplified3.4%
Final simplification3.4%
herbie shell --seed 2023283
(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))))