
(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 15 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 (* C (* -4.0 A))))
(if (<= (pow B 2.0) 2e+234)
(/
(*
(sqrt (* 2.0 (* (+ (* B B) t_0) F)))
(- (sqrt (+ C (+ A (hypot B (- A C)))))))
(fma B B t_0))
(* (/ (sqrt 2.0) B) (* (sqrt (+ C (hypot C B))) (- (sqrt F)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = C * (-4.0 * A);
double tmp;
if (pow(B, 2.0) <= 2e+234) {
tmp = (sqrt((2.0 * (((B * B) + t_0) * F))) * -sqrt((C + (A + hypot(B, (A - C)))))) / fma(B, B, t_0);
} else {
tmp = (sqrt(2.0) / B) * (sqrt((C + hypot(C, B))) * -sqrt(F));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = Float64(C * Float64(-4.0 * A)) tmp = 0.0 if ((B ^ 2.0) <= 2e+234) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(Float64(Float64(B * B) + t_0) * F))) * Float64(-sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))))) / fma(B, B, t_0)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(F)))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(C * N[(-4.0 * A), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e+234], N[(N[(N[Sqrt[N[(2.0 * N[(N[(N[(B * B), $MachinePrecision] + t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(B * B + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := C \cdot \left(-4 \cdot A\right)\\
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{+234}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left(B \cdot B + t_0\right) \cdot F\right)} \cdot \left(-\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{\mathsf{fma}\left(B, B, t_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 2.00000000000000004e234Initial program 30.4%
Simplified37.3%
sqrt-prod47.9%
*-commutative47.9%
associate-+r+46.9%
+-commutative46.9%
associate-+r+47.6%
Applied egg-rr47.6%
Taylor expanded in F around 0 47.6%
unpow247.6%
associate-*r*47.6%
Simplified47.6%
if 2.00000000000000004e234 < (pow.f64 B 2) Initial program 0.5%
Simplified3.4%
Taylor expanded in A around 0 7.8%
mul-1-neg7.8%
distribute-rgt-neg-in7.8%
*-commutative7.8%
unpow27.8%
unpow27.8%
hypot-def30.2%
Simplified30.2%
sqrt-prod45.1%
Applied egg-rr45.1%
hypot-def9.5%
unpow29.5%
unpow29.5%
+-commutative9.5%
unpow29.5%
unpow29.5%
hypot-def45.1%
Simplified45.1%
Final simplification47.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.8e+120)
(/
(* (sqrt (+ C (+ A (hypot B (- A C))))) (- (sqrt (* 2.0 (* F t_0)))))
t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ C (hypot C B))) (- (sqrt F)))))))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.8e+120) {
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * -sqrt((2.0 * (F * t_0)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((C + hypot(C, B))) * -sqrt(F));
}
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.8e+120) {
tmp = (Math.sqrt((C + (A + Math.hypot(B, (A - C))))) * -Math.sqrt((2.0 * (F * t_0)))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt((C + Math.hypot(C, B))) * -Math.sqrt(F));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 3.8e+120: tmp = (math.sqrt((C + (A + math.hypot(B, (A - C))))) * -math.sqrt((2.0 * (F * t_0)))) / t_0 else: tmp = (math.sqrt(2.0) / B) * (math.sqrt((C + math.hypot(C, B))) * -math.sqrt(F)) 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.8e+120) tmp = Float64(Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * Float64(-sqrt(Float64(2.0 * Float64(F * t_0))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(F)))); 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.8e+120) tmp = (sqrt((C + (A + hypot(B, (A - C))))) * -sqrt((2.0 * (F * t_0)))) / t_0; else tmp = (sqrt(2.0) / B) * (sqrt((C + hypot(C, B))) * -sqrt(F)); 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.8e+120], N[(N[(N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $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.8 \cdot 10^{+120}:\\
\;\;\;\;\frac{\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_0\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 3.7999999999999998e120Initial program 26.3%
associate-*l*26.3%
unpow226.3%
+-commutative26.3%
unpow226.3%
associate-*l*26.3%
unpow226.3%
Simplified26.3%
sqrt-prod29.7%
*-commutative29.7%
*-commutative29.7%
associate-+l+30.0%
unpow230.0%
hypot-udef41.9%
associate-+r+41.0%
+-commutative41.0%
associate-+r+41.6%
Applied egg-rr41.6%
if 3.7999999999999998e120 < B Initial program 0.6%
Simplified3.2%
Taylor expanded in A around 0 13.1%
mul-1-neg13.1%
distribute-rgt-neg-in13.1%
*-commutative13.1%
unpow213.1%
unpow213.1%
hypot-def52.7%
Simplified52.7%
sqrt-prod79.4%
Applied egg-rr79.4%
hypot-def16.1%
unpow216.1%
unpow216.1%
+-commutative16.1%
unpow216.1%
unpow216.1%
hypot-def79.4%
Simplified79.4%
Final simplification47.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* -4.0 A))))
(t_1 (- (* B B) (* 4.0 (* A C))))
(t_2 (sqrt (* 2.0 (* (+ C (+ A (hypot B (- A C)))) (* F t_1))))))
(if (<= B 4.2e-114)
(/ (- t_2) t_1)
(if (<= B 1e-83)
(/
(- (sqrt (* (* 2.0 (* F t_0)) (+ A (+ A (* -0.5 (/ (* B B) C)))))))
t_0)
(if (<= B 2.3e+25)
(* t_2 (/ -1.0 t_1))
(* (sqrt 2.0) (/ (- (sqrt F)) (sqrt B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (-4.0 * A)));
double t_1 = (B * B) - (4.0 * (A * C));
double t_2 = sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_1))));
double tmp;
if (B <= 4.2e-114) {
tmp = -t_2 / t_1;
} else if (B <= 1e-83) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (A + (-0.5 * ((B * B) / C)))))) / t_0;
} else if (B <= 2.3e+25) {
tmp = t_2 * (-1.0 / t_1);
} else {
tmp = sqrt(2.0) * (-sqrt(F) / sqrt(B));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(-4.0 * A))) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_2 = sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + hypot(B, Float64(A - C)))) * Float64(F * t_1)))) tmp = 0.0 if (B <= 4.2e-114) tmp = Float64(Float64(-t_2) / t_1); elseif (B <= 1e-83) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64(B * B) / C))))))) / t_0); elseif (B <= 2.3e+25) tmp = Float64(t_2 * Float64(-1.0 / t_1)); else tmp = Float64(sqrt(2.0) * Float64(Float64(-sqrt(F)) / sqrt(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[(C * N[(-4.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(2.0 * N[(N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, 4.2e-114], N[((-t$95$2) / t$95$1), $MachinePrecision], If[LessEqual[B, 1e-83], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.3e+25], N[(t$95$2 * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[((-N[Sqrt[F], $MachinePrecision]) / N[Sqrt[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(-4 \cdot A\right)\right)\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_2 := \sqrt{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_1\right)\right)}\\
\mathbf{if}\;B \leq 4.2 \cdot 10^{-114}:\\
\;\;\;\;\frac{-t_2}{t_1}\\
\mathbf{elif}\;B \leq 10^{-83}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{B \cdot B}{C}\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.3 \cdot 10^{+25}:\\
\;\;\;\;t_2 \cdot \frac{-1}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{-\sqrt{F}}{\sqrt{B}}\\
\end{array}
\end{array}
if B < 4.19999999999999985e-114Initial program 26.5%
associate-*l*26.5%
unpow226.5%
+-commutative26.5%
unpow226.5%
associate-*l*26.5%
unpow226.5%
Simplified26.5%
distribute-frac-neg26.5%
Applied egg-rr33.0%
if 4.19999999999999985e-114 < B < 1e-83Initial program 15.1%
Simplified24.0%
Taylor expanded in C around -inf 49.4%
unpow249.4%
Simplified49.4%
if 1e-83 < B < 2.2999999999999998e25Initial program 39.0%
associate-*l*39.0%
unpow239.0%
+-commutative39.0%
unpow239.0%
associate-*l*39.0%
unpow239.0%
Simplified39.0%
div-inv39.0%
Applied egg-rr44.0%
if 2.2999999999999998e25 < B Initial program 6.4%
Simplified8.2%
Taylor expanded in C around 0 16.4%
mul-1-neg16.4%
distribute-rgt-neg-in16.4%
unpow216.4%
unpow216.4%
hypot-def41.5%
Simplified41.5%
Taylor expanded in A around 0 46.2%
mul-1-neg46.2%
Simplified46.2%
sqrt-div60.1%
Applied egg-rr60.1%
Final simplification40.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 5.5e+117)
(/
(* (sqrt (+ C (+ A (hypot B (- A C))))) (- (sqrt (* 2.0 (* F t_0)))))
t_0)
(* (sqrt 2.0) (/ (- (sqrt F)) (sqrt 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 <= 5.5e+117) {
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * -sqrt((2.0 * (F * t_0)))) / t_0;
} else {
tmp = sqrt(2.0) * (-sqrt(F) / sqrt(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 <= 5.5e+117) {
tmp = (Math.sqrt((C + (A + Math.hypot(B, (A - C))))) * -Math.sqrt((2.0 * (F * t_0)))) / t_0;
} else {
tmp = Math.sqrt(2.0) * (-Math.sqrt(F) / Math.sqrt(B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 5.5e+117: tmp = (math.sqrt((C + (A + math.hypot(B, (A - C))))) * -math.sqrt((2.0 * (F * t_0)))) / t_0 else: tmp = math.sqrt(2.0) * (-math.sqrt(F) / math.sqrt(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 <= 5.5e+117) tmp = Float64(Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * Float64(-sqrt(Float64(2.0 * Float64(F * t_0))))) / t_0); else tmp = Float64(sqrt(2.0) * Float64(Float64(-sqrt(F)) / sqrt(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 <= 5.5e+117) tmp = (sqrt((C + (A + hypot(B, (A - C))))) * -sqrt((2.0 * (F * t_0)))) / t_0; else tmp = sqrt(2.0) * (-sqrt(F) / sqrt(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, 5.5e+117], N[(N[(N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[((-N[Sqrt[F], $MachinePrecision]) / N[Sqrt[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 5.5 \cdot 10^{+117}:\\
\;\;\;\;\frac{\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_0\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{-\sqrt{F}}{\sqrt{B}}\\
\end{array}
\end{array}
if B < 5.49999999999999965e117Initial program 26.3%
associate-*l*26.3%
unpow226.3%
+-commutative26.3%
unpow226.3%
associate-*l*26.3%
unpow226.3%
Simplified26.3%
sqrt-prod29.7%
*-commutative29.7%
*-commutative29.7%
associate-+l+30.0%
unpow230.0%
hypot-udef41.9%
associate-+r+41.0%
+-commutative41.0%
associate-+r+41.6%
Applied egg-rr41.6%
if 5.49999999999999965e117 < B Initial program 0.6%
Simplified3.2%
Taylor expanded in C around 0 12.4%
mul-1-neg12.4%
distribute-rgt-neg-in12.4%
unpow212.4%
unpow212.4%
hypot-def51.0%
Simplified51.0%
Taylor expanded in A around 0 60.7%
mul-1-neg60.7%
Simplified60.7%
sqrt-div77.0%
Applied egg-rr77.0%
Final simplification46.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma C (* -4.0 A) (* B B)))
(t_1 (- (* B B) (* 4.0 (* A C))))
(t_2 (sqrt (* 2.0 (* (+ C (+ A (hypot B (- A C)))) (* F t_1))))))
(if (<= B 3e-99)
(/ (- t_2) t_1)
(if (<= B 1.6e-83)
(/ (- (sqrt (* 2.0 (* (* F t_0) (* 2.0 A))))) t_0)
(if (<= B 3.8e+25)
(* t_2 (/ -1.0 t_1))
(* (sqrt 2.0) (/ (- (sqrt F)) (sqrt B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(C, (-4.0 * A), (B * B));
double t_1 = (B * B) - (4.0 * (A * C));
double t_2 = sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_1))));
double tmp;
if (B <= 3e-99) {
tmp = -t_2 / t_1;
} else if (B <= 1.6e-83) {
tmp = -sqrt((2.0 * ((F * t_0) * (2.0 * A)))) / t_0;
} else if (B <= 3.8e+25) {
tmp = t_2 * (-1.0 / t_1);
} else {
tmp = sqrt(2.0) * (-sqrt(F) / sqrt(B));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(C, Float64(-4.0 * A), Float64(B * B)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_2 = sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + hypot(B, Float64(A - C)))) * Float64(F * t_1)))) tmp = 0.0 if (B <= 3e-99) tmp = Float64(Float64(-t_2) / t_1); elseif (B <= 1.6e-83) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(2.0 * A))))) / t_0); elseif (B <= 3.8e+25) tmp = Float64(t_2 * Float64(-1.0 / t_1)); else tmp = Float64(sqrt(2.0) * Float64(Float64(-sqrt(F)) / sqrt(B))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(C * N[(-4.0 * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(2.0 * N[(N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, 3e-99], N[((-t$95$2) / t$95$1), $MachinePrecision], If[LessEqual[B, 1.6e-83], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 3.8e+25], N[(t$95$2 * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[((-N[Sqrt[F], $MachinePrecision]) / N[Sqrt[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(C, -4 \cdot A, B \cdot B\right)\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_2 := \sqrt{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_1\right)\right)}\\
\mathbf{if}\;B \leq 3 \cdot 10^{-99}:\\
\;\;\;\;\frac{-t_2}{t_1}\\
\mathbf{elif}\;B \leq 1.6 \cdot 10^{-83}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 3.8 \cdot 10^{+25}:\\
\;\;\;\;t_2 \cdot \frac{-1}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{-\sqrt{F}}{\sqrt{B}}\\
\end{array}
\end{array}
if B < 3.00000000000000006e-99Initial program 26.6%
associate-*l*26.6%
unpow226.6%
+-commutative26.6%
unpow226.6%
associate-*l*26.6%
unpow226.6%
Simplified26.6%
distribute-frac-neg26.6%
Applied egg-rr33.0%
if 3.00000000000000006e-99 < B < 1.6000000000000001e-83Initial program 3.7%
Simplified7.2%
Taylor expanded in C around -inf 59.7%
if 1.6000000000000001e-83 < B < 3.8e25Initial program 39.0%
associate-*l*39.0%
unpow239.0%
+-commutative39.0%
unpow239.0%
associate-*l*39.0%
unpow239.0%
Simplified39.0%
div-inv39.0%
Applied egg-rr44.0%
if 3.8e25 < B Initial program 6.4%
Simplified8.2%
Taylor expanded in C around 0 16.4%
mul-1-neg16.4%
distribute-rgt-neg-in16.4%
unpow216.4%
unpow216.4%
hypot-def41.5%
Simplified41.5%
Taylor expanded in A around 0 46.2%
mul-1-neg46.2%
Simplified46.2%
sqrt-div60.1%
Applied egg-rr60.1%
Final simplification40.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 2.6e+20)
(/ (- (sqrt (* 2.0 (* (+ C (+ A (hypot B (- A C)))) (* F t_0))))) t_0)
(* (sqrt 2.0) (/ (- (sqrt F)) (sqrt 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 <= 2.6e+20) {
tmp = -sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = sqrt(2.0) * (-sqrt(F) / sqrt(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 <= 2.6e+20) {
tmp = -Math.sqrt((2.0 * ((C + (A + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = Math.sqrt(2.0) * (-Math.sqrt(F) / Math.sqrt(B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 2.6e+20: tmp = -math.sqrt((2.0 * ((C + (A + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 else: tmp = math.sqrt(2.0) * (-math.sqrt(F) / math.sqrt(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 <= 2.6e+20) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + hypot(B, Float64(A - C)))) * Float64(F * t_0))))) / t_0); else tmp = Float64(sqrt(2.0) * Float64(Float64(-sqrt(F)) / sqrt(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 <= 2.6e+20) tmp = -sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_0)))) / t_0; else tmp = sqrt(2.0) * (-sqrt(F) / sqrt(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, 2.6e+20], N[((-N[Sqrt[N[(2.0 * N[(N[(C + N[(A + 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[((-N[Sqrt[F], $MachinePrecision]) / N[Sqrt[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 2.6 \cdot 10^{+20}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{-\sqrt{F}}{\sqrt{B}}\\
\end{array}
\end{array}
if B < 2.6e20Initial program 27.2%
associate-*l*27.2%
unpow227.2%
+-commutative27.2%
unpow227.2%
associate-*l*27.2%
unpow227.2%
Simplified27.2%
distribute-frac-neg27.2%
Applied egg-rr33.4%
if 2.6e20 < B Initial program 6.4%
Simplified8.2%
Taylor expanded in C around 0 16.4%
mul-1-neg16.4%
distribute-rgt-neg-in16.4%
unpow216.4%
unpow216.4%
hypot-def41.5%
Simplified41.5%
Taylor expanded in A around 0 46.2%
mul-1-neg46.2%
Simplified46.2%
sqrt-div60.1%
Applied egg-rr60.1%
Final simplification39.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 4.5e+66)
(/ (- (sqrt (* 2.0 (* (+ C (+ A (hypot B (- A C)))) (* F t_0))))) t_0)
(- (sqrt (* 2.0 (/ 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 <= 4.5e+66) {
tmp = -sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = -sqrt((2.0 * (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 <= 4.5e+66) {
tmp = -Math.sqrt((2.0 * ((C + (A + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = -Math.sqrt((2.0 * (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 <= 4.5e+66: tmp = -math.sqrt((2.0 * ((C + (A + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 else: tmp = -math.sqrt((2.0 * (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 <= 4.5e+66) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + hypot(B, Float64(A - C)))) * Float64(F * t_0))))) / t_0); else tmp = Float64(-sqrt(Float64(2.0 * 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 <= 4.5e+66) tmp = -sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_0)))) / t_0; else tmp = -sqrt((2.0 * (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, 4.5e+66], N[((-N[Sqrt[N[(2.0 * N[(N[(C + N[(A + 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[Sqrt[N[(2.0 * 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 4.5 \cdot 10^{+66}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\end{array}
\end{array}
if B < 4.4999999999999998e66Initial program 27.1%
associate-*l*27.1%
unpow227.1%
+-commutative27.1%
unpow227.1%
associate-*l*27.1%
unpow227.1%
Simplified27.1%
distribute-frac-neg27.1%
Applied egg-rr33.0%
if 4.4999999999999998e66 < B Initial program 3.2%
Simplified5.3%
Taylor expanded in C around 0 14.8%
mul-1-neg14.8%
distribute-rgt-neg-in14.8%
unpow214.8%
unpow214.8%
hypot-def44.6%
Simplified44.6%
Taylor expanded in A around 0 54.1%
mul-1-neg54.1%
Simplified54.1%
pow154.1%
sqrt-unprod54.3%
Applied egg-rr54.3%
unpow154.3%
Simplified54.3%
Final simplification37.0%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F 3.6e-301)
(/
(*
(sqrt (* (+ (* B B) (* C (* -4.0 A))) (* 2.0 F)))
(- (sqrt (+ A (+ A C)))))
(- (* B B) (* 4.0 (* A C))))
(if (<= F 2.85e-55)
(* (/ (sqrt 2.0) B) (- (sqrt (* B F))))
(- (sqrt (* 2.0 (/ F B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 3.6e-301) {
tmp = (sqrt((((B * B) + (C * (-4.0 * A))) * (2.0 * F))) * -sqrt((A + (A + C)))) / ((B * B) - (4.0 * (A * C)));
} else if (F <= 2.85e-55) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else {
tmp = -sqrt((2.0 * (F / B)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 3.6d-301) then
tmp = (sqrt((((b * b) + (c * ((-4.0d0) * a))) * (2.0d0 * f))) * -sqrt((a + (a + c)))) / ((b * b) - (4.0d0 * (a * c)))
else if (f <= 2.85d-55) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else
tmp = -sqrt((2.0d0 * (f / b)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 3.6e-301) {
tmp = (Math.sqrt((((B * B) + (C * (-4.0 * A))) * (2.0 * F))) * -Math.sqrt((A + (A + C)))) / ((B * B) - (4.0 * (A * C)));
} else if (F <= 2.85e-55) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else {
tmp = -Math.sqrt((2.0 * (F / B)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 3.6e-301: tmp = (math.sqrt((((B * B) + (C * (-4.0 * A))) * (2.0 * F))) * -math.sqrt((A + (A + C)))) / ((B * B) - (4.0 * (A * C))) elif F <= 2.85e-55: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) else: tmp = -math.sqrt((2.0 * (F / B))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 3.6e-301) tmp = Float64(Float64(sqrt(Float64(Float64(Float64(B * B) + Float64(C * Float64(-4.0 * A))) * Float64(2.0 * F))) * Float64(-sqrt(Float64(A + Float64(A + C))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); elseif (F <= 2.85e-55) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 3.6e-301) tmp = (sqrt((((B * B) + (C * (-4.0 * A))) * (2.0 * F))) * -sqrt((A + (A + C)))) / ((B * B) - (4.0 * (A * C))); elseif (F <= 2.85e-55) tmp = (sqrt(2.0) / B) * -sqrt((B * F)); else tmp = -sqrt((2.0 * (F / B))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 3.6e-301], N[(N[(N[Sqrt[N[(N[(N[(B * B), $MachinePrecision] + N[(C * N[(-4.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $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], If[LessEqual[F, 2.85e-55], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 3.6 \cdot 10^{-301}:\\
\;\;\;\;\frac{\sqrt{\left(B \cdot B + C \cdot \left(-4 \cdot A\right)\right) \cdot \left(2 \cdot F\right)} \cdot \left(-\sqrt{A + \left(A + C\right)}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;F \leq 2.85 \cdot 10^{-55}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\end{array}
\end{array}
if F < 3.60000000000000007e-301Initial program 37.4%
associate-*l*37.4%
unpow237.4%
+-commutative37.4%
unpow237.4%
associate-*l*37.4%
unpow237.4%
Simplified37.4%
Taylor expanded in A around inf 29.1%
sqrt-prod43.1%
*-commutative43.1%
fma-neg43.1%
*-commutative43.1%
*-commutative43.1%
associate-*r*43.1%
associate-+l+43.1%
Applied egg-rr43.1%
associate-*r*43.1%
fma-neg43.1%
unpow243.1%
associate-*r*43.1%
cancel-sign-sub-inv43.1%
unpow243.1%
metadata-eval43.1%
associate-*r*43.1%
Simplified43.1%
if 3.60000000000000007e-301 < F < 2.8500000000000001e-55Initial program 17.6%
Simplified27.3%
Taylor expanded in C around 0 12.2%
mul-1-neg12.2%
distribute-rgt-neg-in12.2%
unpow212.2%
unpow212.2%
hypot-def23.1%
Simplified23.1%
Taylor expanded in A around 0 20.6%
if 2.8500000000000001e-55 < F Initial program 20.1%
Simplified21.1%
Taylor expanded in C around 0 9.4%
mul-1-neg9.4%
distribute-rgt-neg-in9.4%
unpow29.4%
unpow29.4%
hypot-def15.4%
Simplified15.4%
Taylor expanded in A around 0 22.6%
mul-1-neg22.6%
Simplified22.6%
pow122.6%
sqrt-unprod22.7%
Applied egg-rr22.7%
unpow122.7%
Simplified22.7%
Final simplification25.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 (<= F 3.6e-301)
(/ (- (sqrt (* (+ A (+ A C)) (* 2.0 (* F t_0))))) t_0)
(if (<= F 2.85e-55)
(* (/ (sqrt 2.0) B) (- (sqrt (* B F))))
(- (sqrt (* 2.0 (/ 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 <= 3.6e-301) {
tmp = -sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0;
} else if (F <= 2.85e-55) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else {
tmp = -sqrt((2.0 * (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) - (4.0d0 * (a * c))
if (f <= 3.6d-301) then
tmp = -sqrt(((a + (a + c)) * (2.0d0 * (f * t_0)))) / t_0
else if (f <= 2.85d-55) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else
tmp = -sqrt((2.0d0 * (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) - (4.0 * (A * C));
double tmp;
if (F <= 3.6e-301) {
tmp = -Math.sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0;
} else if (F <= 2.85e-55) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else {
tmp = -Math.sqrt((2.0 * (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 <= 3.6e-301: tmp = -math.sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0 elif F <= 2.85e-55: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) else: tmp = -math.sqrt((2.0 * (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 <= 3.6e-301) tmp = Float64(Float64(-sqrt(Float64(Float64(A + Float64(A + C)) * Float64(2.0 * Float64(F * t_0))))) / t_0); elseif (F <= 2.85e-55) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); else tmp = Float64(-sqrt(Float64(2.0 * 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 <= 3.6e-301) tmp = -sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0; elseif (F <= 2.85e-55) tmp = (sqrt(2.0) / B) * -sqrt((B * F)); else tmp = -sqrt((2.0 * (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, 3.6e-301], 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], If[LessEqual[F, 2.85e-55], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], (-N[Sqrt[N[(2.0 * 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.6 \cdot 10^{-301}:\\
\;\;\;\;\frac{-\sqrt{\left(A + \left(A + C\right)\right) \cdot \left(2 \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{elif}\;F \leq 2.85 \cdot 10^{-55}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\end{array}
\end{array}
if F < 3.60000000000000007e-301Initial program 37.4%
associate-*l*37.4%
unpow237.4%
+-commutative37.4%
unpow237.4%
associate-*l*37.4%
unpow237.4%
Simplified37.4%
Taylor expanded in A around inf 29.1%
if 3.60000000000000007e-301 < F < 2.8500000000000001e-55Initial program 17.6%
Simplified27.3%
Taylor expanded in C around 0 12.2%
mul-1-neg12.2%
distribute-rgt-neg-in12.2%
unpow212.2%
unpow212.2%
hypot-def23.1%
Simplified23.1%
Taylor expanded in A around 0 20.6%
if 2.8500000000000001e-55 < F Initial program 20.1%
Simplified21.1%
Taylor expanded in C around 0 9.4%
mul-1-neg9.4%
distribute-rgt-neg-in9.4%
unpow29.4%
unpow29.4%
hypot-def15.4%
Simplified15.4%
Taylor expanded in A around 0 22.6%
mul-1-neg22.6%
Simplified22.6%
pow122.6%
sqrt-unprod22.7%
Applied egg-rr22.7%
unpow122.7%
Simplified22.7%
Final simplification23.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F 3.6e-239)
(/
(- (sqrt (* 2.0 (* F (* (+ (* B B) (* C (* -4.0 A))) (+ A (+ A C)))))))
(- (* B B) (* 4.0 (* A C))))
(- (sqrt (* 2.0 (/ F B))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 3.6e-239) {
tmp = -sqrt((2.0 * (F * (((B * B) + (C * (-4.0 * A))) * (A + (A + C)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -sqrt((2.0 * (F / B)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 3.6d-239) then
tmp = -sqrt((2.0d0 * (f * (((b * b) + (c * ((-4.0d0) * a))) * (a + (a + c)))))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = -sqrt((2.0d0 * (f / b)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 3.6e-239) {
tmp = -Math.sqrt((2.0 * (F * (((B * B) + (C * (-4.0 * A))) * (A + (A + C)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -Math.sqrt((2.0 * (F / B)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 3.6e-239: tmp = -math.sqrt((2.0 * (F * (((B * B) + (C * (-4.0 * A))) * (A + (A + C)))))) / ((B * B) - (4.0 * (A * C))) else: tmp = -math.sqrt((2.0 * (F / B))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 3.6e-239) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(F * Float64(Float64(Float64(B * B) + Float64(C * Float64(-4.0 * A))) * Float64(A + Float64(A + C))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 3.6e-239) tmp = -sqrt((2.0 * (F * (((B * B) + (C * (-4.0 * A))) * (A + (A + C)))))) / ((B * B) - (4.0 * (A * C))); else tmp = -sqrt((2.0 * (F / B))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 3.6e-239], N[((-N[Sqrt[N[(2.0 * N[(F * N[(N[(N[(B * B), $MachinePrecision] + N[(C * N[(-4.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 3.6 \cdot 10^{-239}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(F \cdot \left(\left(B \cdot B + C \cdot \left(-4 \cdot A\right)\right) \cdot \left(A + \left(A + C\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\end{array}
\end{array}
if F < 3.6000000000000001e-239Initial program 31.6%
associate-*l*31.6%
unpow231.6%
+-commutative31.6%
unpow231.6%
associate-*l*31.6%
unpow231.6%
Simplified31.6%
Taylor expanded in A around inf 25.4%
*-un-lft-identity25.4%
associate-*l*25.4%
*-commutative25.4%
fma-neg25.4%
*-commutative25.4%
*-commutative25.4%
associate-*r*25.4%
associate-+l+25.4%
Applied egg-rr25.4%
*-lft-identity25.4%
associate-*l*22.2%
fma-neg22.2%
unpow222.2%
associate-*r*22.2%
cancel-sign-sub-inv22.2%
unpow222.2%
metadata-eval22.2%
associate-*r*22.2%
Simplified22.2%
if 3.6000000000000001e-239 < F Initial program 19.3%
Simplified22.4%
Taylor expanded in C around 0 10.4%
mul-1-neg10.4%
distribute-rgt-neg-in10.4%
unpow210.4%
unpow210.4%
hypot-def18.8%
Simplified18.8%
Taylor expanded in A around 0 20.1%
mul-1-neg20.1%
Simplified20.1%
pow120.1%
sqrt-unprod20.2%
Applied egg-rr20.2%
unpow120.2%
Simplified20.2%
Final simplification20.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)))))
(if (<= F 2.25e-238)
(/ (- (sqrt (* (+ A (+ A C)) (* 2.0 (* F t_0))))) t_0)
(- (sqrt (* 2.0 (/ 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 <= 2.25e-238) {
tmp = -sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0;
} else {
tmp = -sqrt((2.0 * (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) - (4.0d0 * (a * c))
if (f <= 2.25d-238) then
tmp = -sqrt(((a + (a + c)) * (2.0d0 * (f * t_0)))) / t_0
else
tmp = -sqrt((2.0d0 * (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) - (4.0 * (A * C));
double tmp;
if (F <= 2.25e-238) {
tmp = -Math.sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0;
} else {
tmp = -Math.sqrt((2.0 * (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 <= 2.25e-238: tmp = -math.sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0 else: tmp = -math.sqrt((2.0 * (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 <= 2.25e-238) tmp = Float64(Float64(-sqrt(Float64(Float64(A + Float64(A + C)) * Float64(2.0 * Float64(F * t_0))))) / t_0); else tmp = Float64(-sqrt(Float64(2.0 * 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 <= 2.25e-238) tmp = -sqrt(((A + (A + C)) * (2.0 * (F * t_0)))) / t_0; else tmp = -sqrt((2.0 * (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, 2.25e-238], 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], (-N[Sqrt[N[(2.0 * 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 2.25 \cdot 10^{-238}:\\
\;\;\;\;\frac{-\sqrt{\left(A + \left(A + C\right)\right) \cdot \left(2 \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\end{array}
\end{array}
if F < 2.24999999999999998e-238Initial program 31.6%
associate-*l*31.6%
unpow231.6%
+-commutative31.6%
unpow231.6%
associate-*l*31.6%
unpow231.6%
Simplified31.6%
Taylor expanded in A around inf 25.4%
if 2.24999999999999998e-238 < F Initial program 19.3%
Simplified22.4%
Taylor expanded in C around 0 10.4%
mul-1-neg10.4%
distribute-rgt-neg-in10.4%
unpow210.4%
unpow210.4%
hypot-def18.8%
Simplified18.8%
Taylor expanded in A around 0 20.1%
mul-1-neg20.1%
Simplified20.1%
pow120.1%
sqrt-unprod20.2%
Applied egg-rr20.2%
unpow120.2%
Simplified20.2%
Final simplification21.6%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= B 2.5e-141) (/ (- (sqrt (* (* A -16.0) (* A (* C F))))) (- (* B B) (* 4.0 (* A C)))) (- (pow (* 2.0 (/ F B)) 0.5))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 2.5e-141) {
tmp = -sqrt(((A * -16.0) * (A * (C * F)))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -pow((2.0 * (F / B)), 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 <= 2.5d-141) then
tmp = -sqrt(((a * (-16.0d0)) * (a * (c * f)))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = -((2.0d0 * (f / b)) ** 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 <= 2.5e-141) {
tmp = -Math.sqrt(((A * -16.0) * (A * (C * F)))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -Math.pow((2.0 * (F / B)), 0.5);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if B <= 2.5e-141: tmp = -math.sqrt(((A * -16.0) * (A * (C * F)))) / ((B * B) - (4.0 * (A * C))) else: tmp = -math.pow((2.0 * (F / B)), 0.5) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (B <= 2.5e-141) tmp = Float64(Float64(-sqrt(Float64(Float64(A * -16.0) * Float64(A * Float64(C * F))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(-(Float64(2.0 * Float64(F / B)) ^ 0.5)); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (B <= 2.5e-141) tmp = -sqrt(((A * -16.0) * (A * (C * F)))) / ((B * B) - (4.0 * (A * C))); else tmp = -((2.0 * (F / B)) ^ 0.5); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[B, 2.5e-141], N[((-N[Sqrt[N[(N[(A * -16.0), $MachinePrecision] * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[Power[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.5 \cdot 10^{-141}:\\
\;\;\;\;\frac{-\sqrt{\left(A \cdot -16\right) \cdot \left(A \cdot \left(C \cdot F\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B}\right)}^{0.5}\\
\end{array}
\end{array}
if B < 2.5e-141Initial program 25.6%
associate-*l*25.6%
unpow225.6%
+-commutative25.6%
unpow225.6%
associate-*l*25.6%
unpow225.6%
Simplified25.6%
Taylor expanded in A around inf 14.5%
Taylor expanded in A around inf 12.9%
unpow212.9%
Simplified12.9%
*-un-lft-identity12.9%
associate-*l*14.9%
*-commutative14.9%
Applied egg-rr14.9%
*-lft-identity14.9%
associate-*r*14.9%
Simplified14.9%
if 2.5e-141 < B Initial program 17.0%
Simplified19.6%
Taylor expanded in C around 0 20.2%
mul-1-neg20.2%
distribute-rgt-neg-in20.2%
unpow220.2%
unpow220.2%
hypot-def36.2%
Simplified36.2%
Taylor expanded in A around 0 39.4%
mul-1-neg39.4%
Simplified39.4%
pow139.4%
sqrt-unprod39.5%
Applied egg-rr39.5%
unpow139.5%
Simplified39.5%
pow1/239.5%
Applied egg-rr39.5%
Final simplification23.6%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= B 4e-179) (/ (- (sqrt (* -16.0 (* (* A A) (* C F))))) (* -4.0 (* A C))) (- (pow (* 2.0 (/ F B)) 0.5))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 4e-179) {
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / (-4.0 * (A * C));
} else {
tmp = -pow((2.0 * (F / B)), 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 <= 4d-179) then
tmp = -sqrt(((-16.0d0) * ((a * a) * (c * f)))) / ((-4.0d0) * (a * c))
else
tmp = -((2.0d0 * (f / b)) ** 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 <= 4e-179) {
tmp = -Math.sqrt((-16.0 * ((A * A) * (C * F)))) / (-4.0 * (A * C));
} else {
tmp = -Math.pow((2.0 * (F / B)), 0.5);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if B <= 4e-179: tmp = -math.sqrt((-16.0 * ((A * A) * (C * F)))) / (-4.0 * (A * C)) else: tmp = -math.pow((2.0 * (F / B)), 0.5) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (B <= 4e-179) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F))))) / Float64(-4.0 * Float64(A * C))); else tmp = Float64(-(Float64(2.0 * Float64(F / B)) ^ 0.5)); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (B <= 4e-179) tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / (-4.0 * (A * C)); else tmp = -((2.0 * (F / B)) ^ 0.5); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[B, 4e-179], N[((-N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[Power[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 4 \cdot 10^{-179}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{-4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B}\right)}^{0.5}\\
\end{array}
\end{array}
if B < 4.0000000000000001e-179Initial program 24.2%
associate-*l*24.2%
unpow224.2%
+-commutative24.2%
unpow224.2%
associate-*l*24.2%
unpow224.2%
Simplified24.2%
Taylor expanded in A around inf 13.7%
Taylor expanded in A around inf 13.6%
unpow213.6%
Simplified13.6%
Taylor expanded in B around 0 13.7%
if 4.0000000000000001e-179 < B Initial program 20.2%
Simplified23.6%
Taylor expanded in C around 0 19.2%
mul-1-neg19.2%
distribute-rgt-neg-in19.2%
unpow219.2%
unpow219.2%
hypot-def34.4%
Simplified34.4%
Taylor expanded in A around 0 36.3%
mul-1-neg36.3%
Simplified36.3%
pow136.3%
sqrt-unprod36.4%
Applied egg-rr36.4%
unpow136.4%
Simplified36.4%
pow1/236.4%
Applied egg-rr36.4%
Final simplification22.7%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (- (pow (* 2.0 (/ F B)) 0.5)))
B = abs(B);
double code(double A, double B, double C, double F) {
return -pow((2.0 * (F / B)), 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 * (f / b)) ** 0.5d0)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return -Math.pow((2.0 * (F / B)), 0.5);
}
B = abs(B) def code(A, B, C, F): return -math.pow((2.0 * (F / B)), 0.5)
B = abs(B) function code(A, B, C, F) return Float64(-(Float64(2.0 * Float64(F / B)) ^ 0.5)) end
B = abs(B) function tmp = code(A, B, C, F) tmp = -((2.0 * (F / B)) ^ 0.5); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := (-N[Power[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])
\begin{array}{l}
B = |B|\\
\\
-{\left(2 \cdot \frac{F}{B}\right)}^{0.5}
\end{array}
Initial program 22.6%
Simplified27.8%
Taylor expanded in C around 0 8.6%
mul-1-neg8.6%
distribute-rgt-neg-in8.6%
unpow28.6%
unpow28.6%
hypot-def15.0%
Simplified15.0%
Taylor expanded in A around 0 15.1%
mul-1-neg15.1%
Simplified15.1%
pow115.1%
sqrt-unprod15.2%
Applied egg-rr15.2%
unpow115.2%
Simplified15.2%
pow1/215.3%
Applied egg-rr15.3%
Final simplification15.3%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (- (sqrt (* 2.0 (/ F B)))))
B = abs(B);
double code(double A, double B, double C, double F) {
return -sqrt((2.0 * (F / B)));
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((2.0d0 * (f / b)))
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return -Math.sqrt((2.0 * (F / B)));
}
B = abs(B) def code(A, B, C, F): return -math.sqrt((2.0 * (F / B)))
B = abs(B) function code(A, B, C, F) return Float64(-sqrt(Float64(2.0 * Float64(F / B)))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = -sqrt((2.0 * (F / B))); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := (-N[Sqrt[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B = |B|\\
\\
-\sqrt{2 \cdot \frac{F}{B}}
\end{array}
Initial program 22.6%
Simplified27.8%
Taylor expanded in C around 0 8.6%
mul-1-neg8.6%
distribute-rgt-neg-in8.6%
unpow28.6%
unpow28.6%
hypot-def15.0%
Simplified15.0%
Taylor expanded in A around 0 15.1%
mul-1-neg15.1%
Simplified15.1%
pow115.1%
sqrt-unprod15.2%
Applied egg-rr15.2%
unpow115.2%
Simplified15.2%
Final simplification15.2%
herbie shell --seed 2023207
(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))))