
(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 14 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
(if (<= (pow B 2.0) 1e+139)
(/
(*
(sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))
(- (sqrt (+ A (+ C (hypot B (- A C)))))))
(- (* B B) (* (* A C) 4.0)))
(* (* (sqrt (+ C (hypot C B))) (sqrt F)) (/ (- (sqrt 2.0)) B))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 1e+139) {
tmp = (sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -sqrt((A + (C + hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = (sqrt((C + hypot(C, B))) * sqrt(F)) * (-sqrt(2.0) / B);
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (Math.pow(B, 2.0) <= 1e+139) {
tmp = (Math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -Math.sqrt((A + (C + Math.hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = (Math.sqrt((C + Math.hypot(C, B))) * Math.sqrt(F)) * (-Math.sqrt(2.0) / B);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if math.pow(B, 2.0) <= 1e+139: tmp = (math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -math.sqrt((A + (C + math.hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0)) else: tmp = (math.sqrt((C + math.hypot(C, B))) * math.sqrt(F)) * (-math.sqrt(2.0) / B) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 1e+139) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(A + Float64(C + hypot(B, Float64(A - C))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if ((B ^ 2.0) <= 1e+139) tmp = (sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -sqrt((A + (C + hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0)); else tmp = (sqrt((C + hypot(C, B))) * sqrt(F)) * (-sqrt(2.0) / B); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+139], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 10^{+139}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.00000000000000003e139Initial program 25.9%
Simplified25.9%
sqrt-prod28.2%
*-commutative28.2%
cancel-sign-sub-inv28.2%
metadata-eval28.2%
associate-+l+28.5%
unpow228.5%
hypot-udef41.5%
Applied egg-rr41.5%
if 1.00000000000000003e139 < (pow.f64 B 2) Initial program 12.1%
Simplified12.1%
Taylor expanded in A around 0 7.3%
mul-1-neg7.3%
distribute-rgt-neg-in7.3%
+-commutative7.3%
unpow27.3%
unpow27.3%
hypot-def24.5%
Simplified24.5%
pow1/224.5%
*-commutative24.5%
unpow-prod-down34.9%
pow1/234.9%
pow1/234.9%
Applied egg-rr34.9%
Final simplification38.6%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= B 1.75e+55)
(/
(*
(sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))
(- (sqrt (+ A (+ C (hypot B (- A C)))))))
(- (* B B) (* (* A C) 4.0)))
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt (+ A (hypot B A))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 1.75e+55) {
tmp = (sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -sqrt((A + (C + hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((A + hypot(B, A))));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 1.75e+55) {
tmp = (Math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -Math.sqrt((A + (C + Math.hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt(F) * -Math.sqrt((A + Math.hypot(B, A))));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if B <= 1.75e+55: tmp = (math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -math.sqrt((A + (C + math.hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0)) else: tmp = (math.sqrt(2.0) / B) * (math.sqrt(F) * -math.sqrt((A + math.hypot(B, A)))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (B <= 1.75e+55) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(A + Float64(C + hypot(B, Float64(A - C))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(Float64(A + hypot(B, A)))))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (B <= 1.75e+55) tmp = (sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -sqrt((A + (C + hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0)); else tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((A + hypot(B, A)))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[B, 1.75e+55], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.75 \cdot 10^{+55}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(B, A\right)}\right)\right)\\
\end{array}
\end{array}
if B < 1.75000000000000005e55Initial program 23.0%
Simplified23.0%
sqrt-prod26.0%
*-commutative26.0%
cancel-sign-sub-inv26.0%
metadata-eval26.0%
associate-+l+26.2%
unpow226.2%
hypot-udef35.2%
Applied egg-rr35.2%
if 1.75000000000000005e55 < B Initial program 6.6%
Simplified6.6%
Taylor expanded in C around 0 13.9%
mul-1-neg13.9%
distribute-rgt-neg-in13.9%
+-commutative13.9%
unpow213.9%
unpow213.9%
hypot-def55.0%
Simplified55.0%
sqrt-prod74.8%
Applied egg-rr74.8%
Final simplification43.0%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= B 1.02e+71)
(/
(*
(sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))
(- (sqrt (+ A (+ C (hypot B (- A C)))))))
(- (* B B) (* (* A C) 4.0)))
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt B))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 1.02e+71) {
tmp = (sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -sqrt((A + (C + hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt(B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 1.02e+71) {
tmp = (Math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -Math.sqrt((A + (C + Math.hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt(F) * -Math.sqrt(B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if B <= 1.02e+71: tmp = (math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -math.sqrt((A + (C + math.hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0)) else: tmp = (math.sqrt(2.0) / B) * (math.sqrt(F) * -math.sqrt(B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (B <= 1.02e+71) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(A + Float64(C + hypot(B, Float64(A - C))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (B <= 1.02e+71) tmp = (sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * -sqrt((A + (C + hypot(B, (A - C)))))) / ((B * B) - ((A * C) * 4.0)); else tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt(B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[B, 1.02e+71], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[B], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.02 \cdot 10^{+71}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B}\right)\right)\\
\end{array}
\end{array}
if B < 1.02000000000000003e71Initial program 23.0%
Simplified23.0%
sqrt-prod26.0%
*-commutative26.0%
cancel-sign-sub-inv26.0%
metadata-eval26.0%
associate-+l+26.2%
unpow226.2%
hypot-udef35.2%
Applied egg-rr35.2%
if 1.02000000000000003e71 < B Initial program 6.6%
Simplified6.6%
Taylor expanded in C around 0 13.9%
mul-1-neg13.9%
distribute-rgt-neg-in13.9%
+-commutative13.9%
unpow213.9%
unpow213.9%
hypot-def55.0%
Simplified55.0%
sqrt-prod74.8%
Applied egg-rr74.8%
Taylor expanded in A around 0 67.1%
Final simplification41.5%
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 2e+46)
(/ (- (sqrt (* 2.0 (* (* F t_0) (+ A (+ C (hypot B (- A C)))))))) t_0)
(* (/ (sqrt 2.0) B) (* (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 <= 2e+46) {
tmp = -sqrt((2.0 * ((F * t_0) * (A + (C + hypot(B, (A - C))))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (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 <= 2e+46) {
tmp = -Math.sqrt((2.0 * ((F * t_0) * (A + (C + Math.hypot(B, (A - C))))))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt(F) * -Math.sqrt(B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if B <= 2e+46: tmp = -math.sqrt((2.0 * ((F * t_0) * (A + (C + math.hypot(B, (A - C))))))) / t_0 else: tmp = (math.sqrt(2.0) / B) * (math.sqrt(F) * -math.sqrt(B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (B <= 2e+46) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(A + Float64(C + hypot(B, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) + (-4.0 * (A * C)); tmp = 0.0; if (B <= 2e+46) tmp = -sqrt((2.0 * ((F * t_0) * (A + (C + hypot(B, (A - C))))))) / t_0; else tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt(B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 2e+46], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[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 \cdot 10^{+46}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B}\right)\right)\\
\end{array}
\end{array}
if B < 2e46Initial program 22.4%
Simplified22.4%
distribute-frac-neg22.4%
Applied egg-rr29.7%
if 2e46 < B Initial program 10.0%
Simplified10.0%
Taylor expanded in C around 0 16.7%
mul-1-neg16.7%
distribute-rgt-neg-in16.7%
+-commutative16.7%
unpow216.7%
unpow216.7%
hypot-def54.7%
Simplified54.7%
sqrt-prod73.1%
Applied egg-rr73.1%
Taylor expanded in A around 0 66.0%
Final simplification37.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.25e+46)
(/ (- (sqrt (* 2.0 (* (* F t_0) (+ A (+ C (hypot B (- A C)))))))) 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.25e+46) {
tmp = -sqrt((2.0 * ((F * t_0) * (A + (C + hypot(B, (A - C))))))) / 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.25e+46) {
tmp = -Math.sqrt((2.0 * ((F * t_0) * (A + (C + Math.hypot(B, (A - C))))))) / 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.25e+46: tmp = -math.sqrt((2.0 * ((F * t_0) * (A + (C + math.hypot(B, (A - C))))))) / 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.25e+46) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(A + Float64(C + hypot(B, Float64(A - C)))))))) / 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.25e+46) tmp = -sqrt((2.0 * ((F * t_0) * (A + (C + hypot(B, (A - C))))))) / 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.25e+46], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[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.25 \cdot 10^{+46}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{-\sqrt{F}}{\sqrt{B}}\\
\end{array}
\end{array}
if B < 2.25000000000000005e46Initial program 22.4%
Simplified22.4%
distribute-frac-neg22.4%
Applied egg-rr29.7%
if 2.25000000000000005e46 < B Initial program 10.0%
Simplified10.0%
Taylor expanded in C around 0 16.7%
mul-1-neg16.7%
distribute-rgt-neg-in16.7%
+-commutative16.7%
unpow216.7%
unpow216.7%
hypot-def54.7%
Simplified54.7%
Taylor expanded in A around 0 48.4%
mul-1-neg48.4%
Simplified48.4%
sqrt-div65.9%
Applied egg-rr65.9%
Final simplification37.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 (<= B 3.8e+45)
(/ (- (sqrt (* 2.0 (* (* F t_0) (+ A (+ C (hypot B (- A C)))))))) t_0)
(if (<= B 2.15e+145)
(* (sqrt (* B F)) (/ (- (sqrt 2.0)) B))
(if (<= B 2.95e+178)
(- (sqrt (* 2.0 (/ F B))))
(/ (- (pow (* 2.0 (* F (+ B C))) 0.5)) 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.8e+45) {
tmp = -sqrt((2.0 * ((F * t_0) * (A + (C + hypot(B, (A - C))))))) / t_0;
} else if (B <= 2.15e+145) {
tmp = sqrt((B * F)) * (-sqrt(2.0) / B);
} else if (B <= 2.95e+178) {
tmp = -sqrt((2.0 * (F / B)));
} else {
tmp = -pow((2.0 * (F * (B + C))), 0.5) / 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.8e+45) {
tmp = -Math.sqrt((2.0 * ((F * t_0) * (A + (C + Math.hypot(B, (A - C))))))) / t_0;
} else if (B <= 2.15e+145) {
tmp = Math.sqrt((B * F)) * (-Math.sqrt(2.0) / B);
} else if (B <= 2.95e+178) {
tmp = -Math.sqrt((2.0 * (F / B)));
} else {
tmp = -Math.pow((2.0 * (F * (B + C))), 0.5) / 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.8e+45: tmp = -math.sqrt((2.0 * ((F * t_0) * (A + (C + math.hypot(B, (A - C))))))) / t_0 elif B <= 2.15e+145: tmp = math.sqrt((B * F)) * (-math.sqrt(2.0) / B) elif B <= 2.95e+178: tmp = -math.sqrt((2.0 * (F / B))) else: tmp = -math.pow((2.0 * (F * (B + C))), 0.5) / 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.8e+45) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(A + Float64(C + hypot(B, Float64(A - C)))))))) / t_0); elseif (B <= 2.15e+145) tmp = Float64(sqrt(Float64(B * F)) * Float64(Float64(-sqrt(2.0)) / B)); elseif (B <= 2.95e+178) tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B)))); else tmp = Float64(Float64(-(Float64(2.0 * Float64(F * Float64(B + C))) ^ 0.5)) / 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.8e+45) tmp = -sqrt((2.0 * ((F * t_0) * (A + (C + hypot(B, (A - C))))))) / t_0; elseif (B <= 2.15e+145) tmp = sqrt((B * F)) * (-sqrt(2.0) / B); elseif (B <= 2.95e+178) tmp = -sqrt((2.0 * (F / B))); else tmp = -((2.0 * (F * (B + C))) ^ 0.5) / 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.8e+45], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.15e+145], N[(N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 2.95e+178], (-N[Sqrt[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[((-N[Power[N[(2.0 * N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $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.8 \cdot 10^{+45}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.15 \cdot 10^{+145}:\\
\;\;\;\;\sqrt{B \cdot F} \cdot \frac{-\sqrt{2}}{B}\\
\mathbf{elif}\;B \leq 2.95 \cdot 10^{+178}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-{\left(2 \cdot \left(F \cdot \left(B + C\right)\right)\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < 3.8000000000000002e45Initial program 22.5%
Simplified22.5%
distribute-frac-neg22.5%
Applied egg-rr29.8%
if 3.8000000000000002e45 < B < 2.14999999999999999e145Initial program 28.5%
Simplified28.5%
Taylor expanded in C around 0 42.9%
mul-1-neg42.9%
distribute-rgt-neg-in42.9%
+-commutative42.9%
unpow242.9%
unpow242.9%
hypot-def47.9%
Simplified47.9%
Taylor expanded in A around 0 43.5%
if 2.14999999999999999e145 < B < 2.94999999999999992e178Initial program 0.2%
Simplified0.2%
Taylor expanded in C around 0 3.0%
mul-1-neg3.0%
distribute-rgt-neg-in3.0%
+-commutative3.0%
unpow23.0%
unpow23.0%
hypot-def61.9%
Simplified61.9%
Taylor expanded in A around 0 62.6%
mul-1-neg62.6%
Simplified62.6%
sqrt-unprod63.1%
Applied egg-rr63.1%
if 2.94999999999999992e178 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 0.0%
+-commutative0.0%
unpow20.0%
unpow20.0%
hypot-def0.0%
Simplified0.0%
Taylor expanded in A around 0 47.4%
mul-1-neg47.4%
Simplified47.4%
associate-*l/47.4%
pow1/247.4%
pow1/247.5%
pow-prod-down47.6%
Applied egg-rr47.6%
Final simplification33.9%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (- (sqrt 2.0)) B)))
(if (<= F -5e-310)
(-
(/
(sqrt (* (* 2.0 (* F (* -4.0 (* A C)))) (+ A (+ A C))))
(- (* B B) (* (* A C) 4.0))))
(if (<= F 7.5e+34)
(* (sqrt (* B F)) t_0)
(if (<= F 1.2e+262)
(- (sqrt (/ 2.0 (/ B F))))
(if (<= F 1.7e+303)
(* (sqrt (* -0.5 (/ (* B B) (/ A F)))) t_0)
(- (sqrt (* 2.0 (/ F B))))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = -sqrt(2.0) / B;
double tmp;
if (F <= -5e-310) {
tmp = -(sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0)));
} else if (F <= 7.5e+34) {
tmp = sqrt((B * F)) * t_0;
} else if (F <= 1.2e+262) {
tmp = -sqrt((2.0 / (B / F)));
} else if (F <= 1.7e+303) {
tmp = sqrt((-0.5 * ((B * B) / (A / F)))) * 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 = -sqrt(2.0d0) / b
if (f <= (-5d-310)) then
tmp = -(sqrt(((2.0d0 * (f * ((-4.0d0) * (a * c)))) * (a + (a + c)))) / ((b * b) - ((a * c) * 4.0d0)))
else if (f <= 7.5d+34) then
tmp = sqrt((b * f)) * t_0
else if (f <= 1.2d+262) then
tmp = -sqrt((2.0d0 / (b / f)))
else if (f <= 1.7d+303) then
tmp = sqrt(((-0.5d0) * ((b * b) / (a / f)))) * 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 = -Math.sqrt(2.0) / B;
double tmp;
if (F <= -5e-310) {
tmp = -(Math.sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0)));
} else if (F <= 7.5e+34) {
tmp = Math.sqrt((B * F)) * t_0;
} else if (F <= 1.2e+262) {
tmp = -Math.sqrt((2.0 / (B / F)));
} else if (F <= 1.7e+303) {
tmp = Math.sqrt((-0.5 * ((B * B) / (A / F)))) * t_0;
} else {
tmp = -Math.sqrt((2.0 * (F / B)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = -math.sqrt(2.0) / B tmp = 0 if F <= -5e-310: tmp = -(math.sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0))) elif F <= 7.5e+34: tmp = math.sqrt((B * F)) * t_0 elif F <= 1.2e+262: tmp = -math.sqrt((2.0 / (B / F))) elif F <= 1.7e+303: tmp = math.sqrt((-0.5 * ((B * B) / (A / F)))) * 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(-sqrt(2.0)) / B) tmp = 0.0 if (F <= -5e-310) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * Float64(-4.0 * Float64(A * C)))) * Float64(A + Float64(A + C)))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)))); elseif (F <= 7.5e+34) tmp = Float64(sqrt(Float64(B * F)) * t_0); elseif (F <= 1.2e+262) tmp = Float64(-sqrt(Float64(2.0 / Float64(B / F)))); elseif (F <= 1.7e+303) tmp = Float64(sqrt(Float64(-0.5 * Float64(Float64(B * B) / Float64(A / F)))) * 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 = -sqrt(2.0) / B; tmp = 0.0; if (F <= -5e-310) tmp = -(sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0))); elseif (F <= 7.5e+34) tmp = sqrt((B * F)) * t_0; elseif (F <= 1.2e+262) tmp = -sqrt((2.0 / (B / F))); elseif (F <= 1.7e+303) tmp = sqrt((-0.5 * ((B * B) / (A / F)))) * 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[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]}, If[LessEqual[F, -5e-310], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 7.5e+34], N[(N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[F, 1.2e+262], (-N[Sqrt[N[(2.0 / N[(B / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[F, 1.7e+303], N[(N[Sqrt[N[(-0.5 * N[(N[(B * B), $MachinePrecision] / N[(A / F), $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 := \frac{-\sqrt{2}}{B}\\
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot \left(-4 \cdot \left(A \cdot C\right)\right)\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{+34}:\\
\;\;\;\;\sqrt{B \cdot F} \cdot t_0\\
\mathbf{elif}\;F \leq 1.2 \cdot 10^{+262}:\\
\;\;\;\;-\sqrt{\frac{2}{\frac{B}{F}}}\\
\mathbf{elif}\;F \leq 1.7 \cdot 10^{+303}:\\
\;\;\;\;\sqrt{-0.5 \cdot \frac{B \cdot B}{\frac{A}{F}}} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 36.5%
Simplified36.5%
Taylor expanded in A around inf 39.4%
Taylor expanded in B around 0 39.4%
if -4.999999999999985e-310 < F < 7.49999999999999976e34Initial program 20.8%
Simplified20.8%
Taylor expanded in C around 0 8.8%
mul-1-neg8.8%
distribute-rgt-neg-in8.8%
+-commutative8.8%
unpow28.8%
unpow28.8%
hypot-def22.9%
Simplified22.9%
Taylor expanded in A around 0 18.4%
if 7.49999999999999976e34 < F < 1.19999999999999991e262Initial program 15.4%
Simplified15.4%
Taylor expanded in C around 0 13.6%
mul-1-neg13.6%
distribute-rgt-neg-in13.6%
+-commutative13.6%
unpow213.6%
unpow213.6%
hypot-def17.9%
Simplified17.9%
Taylor expanded in A around 0 25.1%
mul-1-neg25.1%
Simplified25.1%
sqrt-unprod25.2%
Applied egg-rr25.2%
expm1-log1p-u24.5%
expm1-udef12.5%
*-commutative12.5%
Applied egg-rr12.5%
expm1-def24.5%
expm1-log1p25.2%
associate-*r/25.2%
associate-/l*25.2%
Simplified25.2%
if 1.19999999999999991e262 < F < 1.7e303Initial program 9.5%
Simplified9.5%
Taylor expanded in C around 0 2.7%
mul-1-neg2.7%
distribute-rgt-neg-in2.7%
+-commutative2.7%
unpow22.7%
unpow22.7%
hypot-def3.7%
Simplified3.7%
Taylor expanded in A around -inf 1.6%
associate-/l*8.7%
unpow28.7%
Simplified8.7%
if 1.7e303 < F Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 3.2%
mul-1-neg3.2%
distribute-rgt-neg-in3.2%
+-commutative3.2%
unpow23.2%
unpow23.2%
hypot-def3.2%
Simplified3.2%
Taylor expanded in A around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
sqrt-unprod100.0%
Applied egg-rr100.0%
Final simplification22.3%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F -5e-310)
(-
(/
(sqrt (* (* 2.0 (* F (* -4.0 (* A C)))) (+ A (+ A C))))
(- (* B B) (* (* A C) 4.0))))
(if (<= F 9e+41)
(* (sqrt (* B F)) (/ (- (sqrt 2.0)) B))
(- (sqrt (/ 2.0 (/ B F)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -5e-310) {
tmp = -(sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0)));
} else if (F <= 9e+41) {
tmp = sqrt((B * F)) * (-sqrt(2.0) / B);
} else {
tmp = -sqrt((2.0 / (B / F)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= (-5d-310)) then
tmp = -(sqrt(((2.0d0 * (f * ((-4.0d0) * (a * c)))) * (a + (a + c)))) / ((b * b) - ((a * c) * 4.0d0)))
else if (f <= 9d+41) then
tmp = sqrt((b * f)) * (-sqrt(2.0d0) / b)
else
tmp = -sqrt((2.0d0 / (b / f)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= -5e-310) {
tmp = -(Math.sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0)));
} else if (F <= 9e+41) {
tmp = Math.sqrt((B * F)) * (-Math.sqrt(2.0) / B);
} else {
tmp = -Math.sqrt((2.0 / (B / F)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= -5e-310: tmp = -(math.sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0))) elif F <= 9e+41: tmp = math.sqrt((B * F)) * (-math.sqrt(2.0) / B) else: tmp = -math.sqrt((2.0 / (B / F))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= -5e-310) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * Float64(-4.0 * Float64(A * C)))) * Float64(A + Float64(A + C)))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)))); elseif (F <= 9e+41) tmp = Float64(sqrt(Float64(B * F)) * Float64(Float64(-sqrt(2.0)) / B)); else tmp = Float64(-sqrt(Float64(2.0 / Float64(B / F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= -5e-310) tmp = -(sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0))); elseif (F <= 9e+41) tmp = sqrt((B * F)) * (-sqrt(2.0) / B); else tmp = -sqrt((2.0 / (B / F))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, -5e-310], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 9e+41], N[(N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(2.0 / N[(B / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot \left(-4 \cdot \left(A \cdot C\right)\right)\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{elif}\;F \leq 9 \cdot 10^{+41}:\\
\;\;\;\;\sqrt{B \cdot F} \cdot \frac{-\sqrt{2}}{B}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{\frac{2}{\frac{B}{F}}}\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 36.5%
Simplified36.5%
Taylor expanded in A around inf 39.4%
Taylor expanded in B around 0 39.4%
if -4.999999999999985e-310 < F < 9.0000000000000002e41Initial program 20.5%
Simplified20.5%
Taylor expanded in C around 0 8.7%
mul-1-neg8.7%
distribute-rgt-neg-in8.7%
+-commutative8.7%
unpow28.7%
unpow28.7%
hypot-def22.8%
Simplified22.8%
Taylor expanded in A around 0 18.2%
if 9.0000000000000002e41 < F Initial program 14.7%
Simplified14.7%
Taylor expanded in C around 0 12.3%
mul-1-neg12.3%
distribute-rgt-neg-in12.3%
+-commutative12.3%
unpow212.3%
unpow212.3%
hypot-def15.9%
Simplified15.9%
Taylor expanded in A around 0 23.3%
mul-1-neg23.3%
Simplified23.3%
sqrt-unprod23.3%
Applied egg-rr23.3%
expm1-log1p-u22.7%
expm1-udef12.3%
*-commutative12.3%
Applied egg-rr12.3%
expm1-def22.7%
expm1-log1p23.3%
associate-*r/23.3%
associate-/l*23.4%
Simplified23.4%
Final simplification22.0%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F -4.2e-302)
(/
(- (sqrt (* (+ A (+ A C)) (* 2.0 (* -4.0 (* A (* F C)))))))
(- (* B B) (* (* A C) 4.0)))
(if (<= F 7e-29)
(/ (- (sqrt (* (+ B C) (* 2.0 F)))) B)
(- (sqrt (/ 2.0 (/ B F)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -4.2e-302) {
tmp = -sqrt(((A + (A + C)) * (2.0 * (-4.0 * (A * (F * C)))))) / ((B * B) - ((A * C) * 4.0));
} else if (F <= 7e-29) {
tmp = -sqrt(((B + C) * (2.0 * F))) / B;
} else {
tmp = -sqrt((2.0 / (B / F)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= (-4.2d-302)) then
tmp = -sqrt(((a + (a + c)) * (2.0d0 * ((-4.0d0) * (a * (f * c)))))) / ((b * b) - ((a * c) * 4.0d0))
else if (f <= 7d-29) then
tmp = -sqrt(((b + c) * (2.0d0 * f))) / b
else
tmp = -sqrt((2.0d0 / (b / f)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= -4.2e-302) {
tmp = -Math.sqrt(((A + (A + C)) * (2.0 * (-4.0 * (A * (F * C)))))) / ((B * B) - ((A * C) * 4.0));
} else if (F <= 7e-29) {
tmp = -Math.sqrt(((B + C) * (2.0 * F))) / B;
} else {
tmp = -Math.sqrt((2.0 / (B / F)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= -4.2e-302: tmp = -math.sqrt(((A + (A + C)) * (2.0 * (-4.0 * (A * (F * C)))))) / ((B * B) - ((A * C) * 4.0)) elif F <= 7e-29: tmp = -math.sqrt(((B + C) * (2.0 * F))) / B else: tmp = -math.sqrt((2.0 / (B / F))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= -4.2e-302) tmp = Float64(Float64(-sqrt(Float64(Float64(A + Float64(A + C)) * Float64(2.0 * Float64(-4.0 * Float64(A * Float64(F * C))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))); elseif (F <= 7e-29) tmp = Float64(Float64(-sqrt(Float64(Float64(B + C) * Float64(2.0 * F)))) / B); else tmp = Float64(-sqrt(Float64(2.0 / Float64(B / F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= -4.2e-302) tmp = -sqrt(((A + (A + C)) * (2.0 * (-4.0 * (A * (F * C)))))) / ((B * B) - ((A * C) * 4.0)); elseif (F <= 7e-29) tmp = -sqrt(((B + C) * (2.0 * F))) / B; else tmp = -sqrt((2.0 / (B / F))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, -4.2e-302], N[((-N[Sqrt[N[(N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(-4.0 * N[(A * N[(F * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7e-29], N[((-N[Sqrt[N[(N[(B + C), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / B), $MachinePrecision], (-N[Sqrt[N[(2.0 / N[(B / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.2 \cdot 10^{-302}:\\
\;\;\;\;\frac{-\sqrt{\left(A + \left(A + C\right)\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(F \cdot C\right)\right)\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{elif}\;F \leq 7 \cdot 10^{-29}:\\
\;\;\;\;\frac{-\sqrt{\left(B + C\right) \cdot \left(2 \cdot F\right)}}{B}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{\frac{2}{\frac{B}{F}}}\\
\end{array}
\end{array}
if F < -4.20000000000000026e-302Initial program 38.0%
Simplified38.0%
Taylor expanded in A around inf 36.7%
Taylor expanded in B around 0 31.0%
if -4.20000000000000026e-302 < F < 6.9999999999999995e-29Initial program 22.8%
Simplified22.8%
Taylor expanded in C around 0 21.8%
+-commutative21.8%
unpow221.8%
unpow221.8%
hypot-def25.7%
Simplified25.7%
Taylor expanded in A around 0 17.4%
mul-1-neg17.4%
Simplified17.4%
expm1-log1p-u17.3%
expm1-udef2.7%
associate-*l/2.7%
pow1/22.7%
pow1/22.7%
pow-prod-down2.7%
Applied egg-rr2.7%
expm1-def17.4%
expm1-log1p17.5%
unpow1/217.5%
*-commutative17.5%
*-commutative17.5%
associate-*l*17.5%
Simplified17.5%
if 6.9999999999999995e-29 < F Initial program 13.6%
Simplified13.6%
Taylor expanded in C around 0 10.2%
mul-1-neg10.2%
distribute-rgt-neg-in10.2%
+-commutative10.2%
unpow210.2%
unpow210.2%
hypot-def16.6%
Simplified16.6%
Taylor expanded in A around 0 22.2%
mul-1-neg22.2%
Simplified22.2%
sqrt-unprod22.2%
Applied egg-rr22.2%
expm1-log1p-u21.7%
expm1-udef10.1%
*-commutative10.1%
Applied egg-rr10.1%
expm1-def21.7%
expm1-log1p22.2%
associate-*r/22.2%
associate-/l*22.2%
Simplified22.2%
Final simplification20.9%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F -5e-310)
(-
(/
(sqrt (* (* 2.0 (* F (* -4.0 (* A C)))) (+ A (+ A C))))
(- (* B B) (* (* A C) 4.0))))
(if (<= F 4.1e-32)
(/ (- (pow (* 2.0 (* F (+ B C))) 0.5)) B)
(- (sqrt (/ 2.0 (/ B F)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -5e-310) {
tmp = -(sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0)));
} else if (F <= 4.1e-32) {
tmp = -pow((2.0 * (F * (B + C))), 0.5) / B;
} else {
tmp = -sqrt((2.0 / (B / F)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= (-5d-310)) then
tmp = -(sqrt(((2.0d0 * (f * ((-4.0d0) * (a * c)))) * (a + (a + c)))) / ((b * b) - ((a * c) * 4.0d0)))
else if (f <= 4.1d-32) then
tmp = -((2.0d0 * (f * (b + c))) ** 0.5d0) / b
else
tmp = -sqrt((2.0d0 / (b / f)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= -5e-310) {
tmp = -(Math.sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0)));
} else if (F <= 4.1e-32) {
tmp = -Math.pow((2.0 * (F * (B + C))), 0.5) / B;
} else {
tmp = -Math.sqrt((2.0 / (B / F)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= -5e-310: tmp = -(math.sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0))) elif F <= 4.1e-32: tmp = -math.pow((2.0 * (F * (B + C))), 0.5) / B else: tmp = -math.sqrt((2.0 / (B / F))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= -5e-310) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * Float64(-4.0 * Float64(A * C)))) * Float64(A + Float64(A + C)))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)))); elseif (F <= 4.1e-32) tmp = Float64(Float64(-(Float64(2.0 * Float64(F * Float64(B + C))) ^ 0.5)) / B); else tmp = Float64(-sqrt(Float64(2.0 / Float64(B / F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= -5e-310) tmp = -(sqrt(((2.0 * (F * (-4.0 * (A * C)))) * (A + (A + C)))) / ((B * B) - ((A * C) * 4.0))); elseif (F <= 4.1e-32) tmp = -((2.0 * (F * (B + C))) ^ 0.5) / B; else tmp = -sqrt((2.0 / (B / F))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, -5e-310], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 4.1e-32], N[((-N[Power[N[(2.0 * N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]) / B), $MachinePrecision], (-N[Sqrt[N[(2.0 / N[(B / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot \left(-4 \cdot \left(A \cdot C\right)\right)\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{elif}\;F \leq 4.1 \cdot 10^{-32}:\\
\;\;\;\;\frac{-{\left(2 \cdot \left(F \cdot \left(B + C\right)\right)\right)}^{0.5}}{B}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{\frac{2}{\frac{B}{F}}}\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 36.5%
Simplified36.5%
Taylor expanded in A around inf 39.4%
Taylor expanded in B around 0 39.4%
if -4.999999999999985e-310 < F < 4.09999999999999975e-32Initial program 23.0%
Simplified23.0%
Taylor expanded in C around 0 22.0%
+-commutative22.0%
unpow222.0%
unpow222.0%
hypot-def25.0%
Simplified25.0%
Taylor expanded in A around 0 17.5%
mul-1-neg17.5%
Simplified17.5%
associate-*l/17.6%
pow1/217.6%
pow1/217.6%
pow-prod-down17.6%
Applied egg-rr17.6%
if 4.09999999999999975e-32 < F Initial program 13.6%
Simplified13.6%
Taylor expanded in C around 0 10.2%
mul-1-neg10.2%
distribute-rgt-neg-in10.2%
+-commutative10.2%
unpow210.2%
unpow210.2%
hypot-def16.6%
Simplified16.6%
Taylor expanded in A around 0 22.2%
mul-1-neg22.2%
Simplified22.2%
sqrt-unprod22.2%
Applied egg-rr22.2%
expm1-log1p-u21.7%
expm1-udef10.1%
*-commutative10.1%
Applied egg-rr10.1%
expm1-def21.7%
expm1-log1p22.2%
associate-*r/22.2%
associate-/l*22.2%
Simplified22.2%
Final simplification21.7%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= F 5.9e-33) (/ (- (pow (* 2.0 (* F (+ B C))) 0.5)) B) (- (sqrt (/ 2.0 (/ B F))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 5.9e-33) {
tmp = -pow((2.0 * (F * (B + C))), 0.5) / B;
} else {
tmp = -sqrt((2.0 / (B / F)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 5.9d-33) then
tmp = -((2.0d0 * (f * (b + c))) ** 0.5d0) / b
else
tmp = -sqrt((2.0d0 / (b / f)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 5.9e-33) {
tmp = -Math.pow((2.0 * (F * (B + C))), 0.5) / B;
} else {
tmp = -Math.sqrt((2.0 / (B / F)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 5.9e-33: tmp = -math.pow((2.0 * (F * (B + C))), 0.5) / B else: tmp = -math.sqrt((2.0 / (B / F))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 5.9e-33) tmp = Float64(Float64(-(Float64(2.0 * Float64(F * Float64(B + C))) ^ 0.5)) / B); else tmp = Float64(-sqrt(Float64(2.0 / Float64(B / F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 5.9e-33) tmp = -((2.0 * (F * (B + C))) ^ 0.5) / B; else tmp = -sqrt((2.0 / (B / F))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 5.9e-33], N[((-N[Power[N[(2.0 * N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]) / B), $MachinePrecision], (-N[Sqrt[N[(2.0 / N[(B / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 5.9 \cdot 10^{-33}:\\
\;\;\;\;\frac{-{\left(2 \cdot \left(F \cdot \left(B + C\right)\right)\right)}^{0.5}}{B}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{\frac{2}{\frac{B}{F}}}\\
\end{array}
\end{array}
if F < 5.89999999999999985e-33Initial program 25.2%
Simplified25.2%
Taylor expanded in C around 0 22.8%
+-commutative22.8%
unpow222.8%
unpow222.8%
hypot-def27.5%
Simplified27.5%
Taylor expanded in A around 0 14.8%
mul-1-neg14.8%
Simplified14.8%
associate-*l/14.8%
pow1/214.8%
pow1/214.9%
pow-prod-down14.9%
Applied egg-rr14.9%
if 5.89999999999999985e-33 < F Initial program 13.6%
Simplified13.6%
Taylor expanded in C around 0 10.2%
mul-1-neg10.2%
distribute-rgt-neg-in10.2%
+-commutative10.2%
unpow210.2%
unpow210.2%
hypot-def16.6%
Simplified16.6%
Taylor expanded in A around 0 22.2%
mul-1-neg22.2%
Simplified22.2%
sqrt-unprod22.2%
Applied egg-rr22.2%
expm1-log1p-u21.7%
expm1-udef10.1%
*-commutative10.1%
Applied egg-rr10.1%
expm1-def21.7%
expm1-log1p22.2%
associate-*r/22.2%
associate-/l*22.2%
Simplified22.2%
Final simplification18.3%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= F 1.75e-28) (/ (- (sqrt (* (+ B C) (* 2.0 F)))) B) (- (sqrt (/ 2.0 (/ B F))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 1.75e-28) {
tmp = -sqrt(((B + C) * (2.0 * F))) / B;
} else {
tmp = -sqrt((2.0 / (B / F)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 1.75d-28) then
tmp = -sqrt(((b + c) * (2.0d0 * f))) / b
else
tmp = -sqrt((2.0d0 / (b / f)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 1.75e-28) {
tmp = -Math.sqrt(((B + C) * (2.0 * F))) / B;
} else {
tmp = -Math.sqrt((2.0 / (B / F)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 1.75e-28: tmp = -math.sqrt(((B + C) * (2.0 * F))) / B else: tmp = -math.sqrt((2.0 / (B / F))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 1.75e-28) tmp = Float64(Float64(-sqrt(Float64(Float64(B + C) * Float64(2.0 * F)))) / B); else tmp = Float64(-sqrt(Float64(2.0 / Float64(B / F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 1.75e-28) tmp = -sqrt(((B + C) * (2.0 * F))) / B; else tmp = -sqrt((2.0 / (B / F))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 1.75e-28], N[((-N[Sqrt[N[(N[(B + C), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / B), $MachinePrecision], (-N[Sqrt[N[(2.0 / N[(B / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.75 \cdot 10^{-28}:\\
\;\;\;\;\frac{-\sqrt{\left(B + C\right) \cdot \left(2 \cdot F\right)}}{B}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{\frac{2}{\frac{B}{F}}}\\
\end{array}
\end{array}
if F < 1.75e-28Initial program 25.2%
Simplified25.2%
Taylor expanded in C around 0 22.8%
+-commutative22.8%
unpow222.8%
unpow222.8%
hypot-def27.5%
Simplified27.5%
Taylor expanded in A around 0 14.8%
mul-1-neg14.8%
Simplified14.8%
expm1-log1p-u14.5%
expm1-udef2.3%
associate-*l/2.3%
pow1/22.3%
pow1/22.3%
pow-prod-down2.3%
Applied egg-rr2.3%
expm1-def14.6%
expm1-log1p14.9%
unpow1/214.8%
*-commutative14.8%
*-commutative14.8%
associate-*l*14.8%
Simplified14.8%
if 1.75e-28 < F Initial program 13.6%
Simplified13.6%
Taylor expanded in C around 0 10.2%
mul-1-neg10.2%
distribute-rgt-neg-in10.2%
+-commutative10.2%
unpow210.2%
unpow210.2%
hypot-def16.6%
Simplified16.6%
Taylor expanded in A around 0 22.2%
mul-1-neg22.2%
Simplified22.2%
sqrt-unprod22.2%
Applied egg-rr22.2%
expm1-log1p-u21.7%
expm1-udef10.1%
*-commutative10.1%
Applied egg-rr10.1%
expm1-def21.7%
expm1-log1p22.2%
associate-*r/22.2%
associate-/l*22.2%
Simplified22.2%
Final simplification18.3%
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 19.8%
Simplified19.8%
Taylor expanded in C around 0 9.3%
mul-1-neg9.3%
distribute-rgt-neg-in9.3%
+-commutative9.3%
unpow29.3%
unpow29.3%
hypot-def18.2%
Simplified18.2%
Taylor expanded in A around 0 16.0%
mul-1-neg16.0%
Simplified16.0%
sqrt-unprod16.1%
Applied egg-rr16.1%
pow1/216.2%
*-commutative16.2%
Applied egg-rr16.2%
Final simplification16.2%
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 19.8%
Simplified19.8%
Taylor expanded in C around 0 9.3%
mul-1-neg9.3%
distribute-rgt-neg-in9.3%
+-commutative9.3%
unpow29.3%
unpow29.3%
hypot-def18.2%
Simplified18.2%
Taylor expanded in A around 0 16.0%
mul-1-neg16.0%
Simplified16.0%
sqrt-unprod16.1%
Applied egg-rr16.1%
Final simplification16.1%
herbie shell --seed 2023271
(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))))