
(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 13 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) 2e+161)
(/
(*
(sqrt (* 2.0 (* F (fma B B (* (* A C) -4.0)))))
(- (sqrt (+ A (+ C (hypot (- A C) B))))))
(fma B B (* A (* C -4.0))))
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (sqrt F))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 2e+161) {
tmp = (sqrt((2.0 * (F * fma(B, B, ((A * C) * -4.0))))) * -sqrt((A + (C + hypot((A - C), B))))) / fma(B, B, (A * (C * -4.0)));
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 2e+161) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B, B, Float64(Float64(A * C) * -4.0))))) * Float64(-sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B)))))) / fma(B, B, Float64(A * Float64(C * -4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-sqrt(F)))); end return tmp end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e+161], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B * B + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{+161}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\right)\right)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 2.0000000000000001e161Initial program 27.3%
Simplified32.3%
associate-*r*32.3%
associate-+r+30.8%
hypot-udef27.3%
unpow227.3%
unpow227.3%
+-commutative27.3%
sqrt-prod28.2%
*-commutative28.2%
associate-*r*28.2%
associate-+l+29.0%
Applied egg-rr38.7%
if 2.0000000000000001e161 < (pow.f64 B 2) Initial program 7.7%
Taylor expanded in C around 0 6.4%
mul-1-neg6.4%
distribute-rgt-neg-in6.4%
+-commutative6.4%
unpow26.4%
unpow26.4%
hypot-def22.8%
Simplified22.8%
pow1/222.8%
*-commutative22.8%
unpow-prod-down35.3%
pow1/235.3%
pow1/235.3%
Applied egg-rr35.3%
Final simplification37.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 4e-212)
(/
(-
(sqrt
(fabs (* (* (* 2.0 F) (+ (pow B 2.0) (* (* A C) -4.0))) (* 2.0 C)))))
(- (pow B 2.0) (* C (* A 4.0))))
(if (<= (pow B 2.0) 1e+109)
(/ (- (sqrt (* F (* t_0 (* 2.0 (+ (hypot (- A C) B) (+ A C))))))) t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (sqrt F))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 4e-212) {
tmp = -sqrt(fabs((((2.0 * F) * (pow(B, 2.0) + ((A * C) * -4.0))) * (2.0 * C)))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else if (pow(B, 2.0) <= 1e+109) {
tmp = -sqrt((F * (t_0 * (2.0 * (hypot((A - C), B) + (A + C)))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 4e-212) tmp = Float64(Float64(-sqrt(abs(Float64(Float64(Float64(2.0 * F) * Float64((B ^ 2.0) + Float64(Float64(A * C) * -4.0))) * Float64(2.0 * C))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); elseif ((B ^ 2.0) <= 1e+109) tmp = Float64(Float64(-sqrt(Float64(F * Float64(t_0 * Float64(2.0 * Float64(hypot(Float64(A - C), B) + Float64(A + C))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-sqrt(F)))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 4e-212], N[((-N[Sqrt[N[Abs[N[(N[(N[(2.0 * F), $MachinePrecision] * N[(N[Power[B, 2.0], $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+109], N[((-N[Sqrt[N[(F * N[(t$95$0 * N[(2.0 * N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 4 \cdot 10^{-212}:\\
\;\;\;\;\frac{-\sqrt{\left|\left(\left(2 \cdot F\right) \cdot \left({B}^{2} + \left(A \cdot C\right) \cdot -4\right)\right) \cdot \left(2 \cdot C\right)\right|}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{elif}\;{B}^{2} \leq 10^{+109}:\\
\;\;\;\;\frac{-\sqrt{F \cdot \left(t_0 \cdot \left(2 \cdot \left(\mathsf{hypot}\left(A - C, B\right) + \left(A + C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 3.99999999999999982e-212Initial program 14.7%
Taylor expanded in A around -inf 21.5%
add-sqr-sqrt21.5%
pow1/221.5%
pow1/221.6%
pow-prod-down13.1%
pow213.1%
associate-*l*13.1%
*-commutative13.1%
associate-*l*13.1%
Applied egg-rr13.1%
unpow1/213.1%
unpow213.1%
rem-sqrt-square22.5%
associate-*r*22.5%
associate-*r*22.5%
cancel-sign-sub-inv22.5%
metadata-eval22.5%
Simplified22.5%
if 3.99999999999999982e-212 < (pow.f64 B 2) < 9.99999999999999982e108Initial program 45.0%
neg-sub045.0%
div-sub45.0%
associate-*l*45.0%
Applied egg-rr49.6%
Simplified50.5%
if 9.99999999999999982e108 < (pow.f64 B 2) Initial program 10.0%
Taylor expanded in C around 0 7.0%
mul-1-neg7.0%
distribute-rgt-neg-in7.0%
+-commutative7.0%
unpow27.0%
unpow27.0%
hypot-def23.1%
Simplified23.1%
pow1/223.2%
*-commutative23.2%
unpow-prod-down34.7%
pow1/234.7%
pow1/234.7%
Applied egg-rr34.7%
Final simplification34.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 1e+109)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A (+ C (hypot B (- A C)))))))) t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (sqrt F)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 1e+109) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + (C + hypot(B, (A - C))))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 1e+109) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + Float64(C + hypot(B, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-sqrt(F)))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+109], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 10^{+109}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.99999999999999982e108Initial program 26.7%
Simplified31.7%
if 9.99999999999999982e108 < (pow.f64 B 2) Initial program 10.0%
Taylor expanded in C around 0 7.0%
mul-1-neg7.0%
distribute-rgt-neg-in7.0%
+-commutative7.0%
unpow27.0%
unpow27.0%
hypot-def23.1%
Simplified23.1%
pow1/223.2%
*-commutative23.2%
unpow-prod-down34.7%
pow1/234.7%
pow1/234.7%
Applied egg-rr34.7%
Final simplification33.0%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= B 69000000000.0)
(/
(-
(sqrt
(fabs (* (* (* 2.0 F) (+ (pow B 2.0) (* (* A C) -4.0))) (* 2.0 C)))))
(- (pow B 2.0) (* C (* A 4.0))))
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (sqrt F))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 69000000000.0) {
tmp = -sqrt(fabs((((2.0 * F) * (pow(B, 2.0) + ((A * C) * -4.0))) * (2.0 * C)))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 69000000000.0) {
tmp = -Math.sqrt(Math.abs((((2.0 * F) * (Math.pow(B, 2.0) + ((A * C) * -4.0))) * (2.0 * C)))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt((A + Math.hypot(B, A))) * -Math.sqrt(F));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if B <= 69000000000.0: tmp = -math.sqrt(math.fabs((((2.0 * F) * (math.pow(B, 2.0) + ((A * C) * -4.0))) * (2.0 * C)))) / (math.pow(B, 2.0) - (C * (A * 4.0))) else: tmp = (math.sqrt(2.0) / B) * (math.sqrt((A + math.hypot(B, A))) * -math.sqrt(F)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (B <= 69000000000.0) tmp = Float64(Float64(-sqrt(abs(Float64(Float64(Float64(2.0 * F) * Float64((B ^ 2.0) + Float64(Float64(A * C) * -4.0))) * Float64(2.0 * C))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-sqrt(F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (B <= 69000000000.0) tmp = -sqrt(abs((((2.0 * F) * ((B ^ 2.0) + ((A * C) * -4.0))) * (2.0 * C)))) / ((B ^ 2.0) - (C * (A * 4.0))); else tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[B, 69000000000.0], N[((-N[Sqrt[N[Abs[N[(N[(N[(2.0 * F), $MachinePrecision] * N[(N[Power[B, 2.0], $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 69000000000:\\
\;\;\;\;\frac{-\sqrt{\left|\left(\left(2 \cdot F\right) \cdot \left({B}^{2} + \left(A \cdot C\right) \cdot -4\right)\right) \cdot \left(2 \cdot C\right)\right|}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 6.9e10Initial program 22.3%
Taylor expanded in A around -inf 17.7%
add-sqr-sqrt17.7%
pow1/217.7%
pow1/217.9%
pow-prod-down11.5%
pow211.5%
associate-*l*11.5%
*-commutative11.5%
associate-*l*11.5%
Applied egg-rr11.5%
unpow1/211.5%
unpow211.5%
rem-sqrt-square18.7%
associate-*r*18.7%
associate-*r*18.7%
cancel-sign-sub-inv18.7%
metadata-eval18.7%
Simplified18.7%
if 6.9e10 < B Initial program 10.9%
Taylor expanded in C around 0 14.8%
mul-1-neg14.8%
distribute-rgt-neg-in14.8%
+-commutative14.8%
unpow214.8%
unpow214.8%
hypot-def42.6%
Simplified42.6%
pow1/242.6%
*-commutative42.6%
unpow-prod-down63.1%
pow1/263.1%
pow1/263.1%
Applied egg-rr63.1%
Final simplification29.3%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= B 155000000000.0)
(/
(- (sqrt (* 4.0 (* C (* F (- (pow B 2.0) (* (* A C) 4.0)))))))
(- (pow B 2.0) (* C (* A 4.0))))
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (sqrt F))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 155000000000.0) {
tmp = -sqrt((4.0 * (C * (F * (pow(B, 2.0) - ((A * C) * 4.0)))))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 155000000000.0) {
tmp = -Math.sqrt((4.0 * (C * (F * (Math.pow(B, 2.0) - ((A * C) * 4.0)))))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt((A + Math.hypot(B, A))) * -Math.sqrt(F));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if B <= 155000000000.0: tmp = -math.sqrt((4.0 * (C * (F * (math.pow(B, 2.0) - ((A * C) * 4.0)))))) / (math.pow(B, 2.0) - (C * (A * 4.0))) else: tmp = (math.sqrt(2.0) / B) * (math.sqrt((A + math.hypot(B, A))) * -math.sqrt(F)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (B <= 155000000000.0) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64((B ^ 2.0) - Float64(Float64(A * C) * 4.0))))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-sqrt(F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (B <= 155000000000.0) tmp = -sqrt((4.0 * (C * (F * ((B ^ 2.0) - ((A * C) * 4.0)))))) / ((B ^ 2.0) - (C * (A * 4.0))); else tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[B, 155000000000.0], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 155000000000:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left({B}^{2} - \left(A \cdot C\right) \cdot 4\right)\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 1.55e11Initial program 22.3%
Taylor expanded in A around -inf 17.7%
Taylor expanded in F around 0 17.7%
if 1.55e11 < B Initial program 10.9%
Taylor expanded in C around 0 14.8%
mul-1-neg14.8%
distribute-rgt-neg-in14.8%
+-commutative14.8%
unpow214.8%
unpow214.8%
hypot-def42.6%
Simplified42.6%
pow1/242.6%
*-commutative42.6%
unpow-prod-down63.1%
pow1/263.1%
pow1/263.1%
Applied egg-rr63.1%
Final simplification28.5%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F -2e-310)
(/
(- (sqrt (* 4.0 (* (+ (pow B 2.0) (* (* A C) -4.0)) (* F C)))))
(- (pow B 2.0) (* C (* A 4.0))))
(if (<= F 1.2e+37)
(/ (- (sqrt (* (* 2.0 F) (+ C (hypot B C))))) B)
(* (sqrt 2.0) (- (sqrt (/ F B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -2e-310) {
tmp = -sqrt((4.0 * ((pow(B, 2.0) + ((A * C) * -4.0)) * (F * C)))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else if (F <= 1.2e+37) {
tmp = -sqrt(((2.0 * F) * (C + hypot(B, C)))) / B;
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= -2e-310) {
tmp = -Math.sqrt((4.0 * ((Math.pow(B, 2.0) + ((A * C) * -4.0)) * (F * C)))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else if (F <= 1.2e+37) {
tmp = -Math.sqrt(((2.0 * F) * (C + Math.hypot(B, C)))) / B;
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= -2e-310: tmp = -math.sqrt((4.0 * ((math.pow(B, 2.0) + ((A * C) * -4.0)) * (F * C)))) / (math.pow(B, 2.0) - (C * (A * 4.0))) elif F <= 1.2e+37: tmp = -math.sqrt(((2.0 * F) * (C + math.hypot(B, C)))) / B else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= -2e-310) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(Float64((B ^ 2.0) + Float64(Float64(A * C) * -4.0)) * Float64(F * C))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); elseif (F <= 1.2e+37) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * F) * Float64(C + hypot(B, C))))) / B); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= -2e-310) tmp = -sqrt((4.0 * (((B ^ 2.0) + ((A * C) * -4.0)) * (F * C)))) / ((B ^ 2.0) - (C * (A * 4.0))); elseif (F <= 1.2e+37) tmp = -sqrt(((2.0 * F) * (C + hypot(B, C)))) / B; else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, -2e-310], N[((-N[Sqrt[N[(4.0 * N[(N[(N[Power[B, 2.0], $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(F * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.2e+37], N[((-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / B), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(\left({B}^{2} + \left(A \cdot C\right) \cdot -4\right) \cdot \left(F \cdot C\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{elif}\;F \leq 1.2 \cdot 10^{+37}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot F\right) \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -1.999999999999994e-310Initial program 32.8%
Taylor expanded in A around -inf 18.9%
Taylor expanded in F around 0 18.9%
associate-*r*26.9%
*-commutative26.9%
cancel-sign-sub-inv26.9%
metadata-eval26.9%
Simplified26.9%
if -1.999999999999994e-310 < F < 1.2e37Initial program 22.2%
Taylor expanded in A around 0 8.2%
mul-1-neg8.2%
Simplified8.2%
expm1-log1p-u7.7%
expm1-udef3.7%
associate-*l/3.7%
unpow23.7%
unpow23.7%
hypot-udef6.3%
sqrt-unprod6.3%
Applied egg-rr6.3%
expm1-def22.0%
expm1-log1p22.3%
associate-*r*22.3%
Simplified22.3%
if 1.2e37 < F Initial program 13.0%
Taylor expanded in C around 0 6.0%
mul-1-neg6.0%
distribute-rgt-neg-in6.0%
+-commutative6.0%
unpow26.0%
unpow26.0%
hypot-def6.4%
Simplified6.4%
Taylor expanded in A around 0 14.9%
mul-1-neg14.9%
Simplified14.9%
Final simplification19.8%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F 7e-309)
(/
(- (sqrt (* (* A -16.0) (* F (pow C 2.0)))))
(- (pow B 2.0) (* C (* A 4.0))))
(if (<= F 1.4e+37)
(/ (- (sqrt (* (* 2.0 F) (+ C (hypot B C))))) B)
(* (sqrt 2.0) (- (sqrt (/ F B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 7e-309) {
tmp = -sqrt(((A * -16.0) * (F * pow(C, 2.0)))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else if (F <= 1.4e+37) {
tmp = -sqrt(((2.0 * F) * (C + hypot(B, C)))) / B;
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 7e-309) {
tmp = -Math.sqrt(((A * -16.0) * (F * Math.pow(C, 2.0)))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else if (F <= 1.4e+37) {
tmp = -Math.sqrt(((2.0 * F) * (C + Math.hypot(B, C)))) / B;
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 7e-309: tmp = -math.sqrt(((A * -16.0) * (F * math.pow(C, 2.0)))) / (math.pow(B, 2.0) - (C * (A * 4.0))) elif F <= 1.4e+37: tmp = -math.sqrt(((2.0 * F) * (C + math.hypot(B, C)))) / B else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 7e-309) tmp = Float64(Float64(-sqrt(Float64(Float64(A * -16.0) * Float64(F * (C ^ 2.0))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); elseif (F <= 1.4e+37) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * F) * Float64(C + hypot(B, C))))) / B); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 7e-309) tmp = -sqrt(((A * -16.0) * (F * (C ^ 2.0)))) / ((B ^ 2.0) - (C * (A * 4.0))); elseif (F <= 1.4e+37) tmp = -sqrt(((2.0 * F) * (C + hypot(B, C)))) / B; else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 7e-309], N[((-N[Sqrt[N[(N[(A * -16.0), $MachinePrecision] * N[(F * N[Power[C, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.4e+37], N[((-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / B), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 7 \cdot 10^{-309}:\\
\;\;\;\;\frac{-\sqrt{\left(A \cdot -16\right) \cdot \left(F \cdot {C}^{2}\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{elif}\;F \leq 1.4 \cdot 10^{+37}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot F\right) \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 6.9999999999999984e-309Initial program 31.5%
Taylor expanded in A around -inf 18.2%
Taylor expanded in B around 0 20.6%
associate-*r*20.6%
*-commutative20.6%
Simplified20.6%
if 6.9999999999999984e-309 < F < 1.3999999999999999e37Initial program 22.4%
Taylor expanded in A around 0 8.2%
mul-1-neg8.2%
Simplified8.2%
expm1-log1p-u7.7%
expm1-udef3.7%
associate-*l/3.7%
unpow23.7%
unpow23.7%
hypot-udef6.3%
sqrt-unprod6.3%
Applied egg-rr6.3%
expm1-def22.1%
expm1-log1p22.4%
associate-*r*22.4%
Simplified22.4%
if 1.3999999999999999e37 < F Initial program 13.0%
Taylor expanded in C around 0 6.0%
mul-1-neg6.0%
distribute-rgt-neg-in6.0%
+-commutative6.0%
unpow26.0%
unpow26.0%
hypot-def6.4%
Simplified6.4%
Taylor expanded in A around 0 14.9%
mul-1-neg14.9%
Simplified14.9%
Final simplification19.3%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F 7e-309)
(/
(- (sqrt (* (* 2.0 C) (* 2.0 (* -4.0 (* A (* F C)))))))
(- (pow B 2.0) (* C (* A 4.0))))
(if (<= F 2.2e+37)
(/ (- (sqrt (* (* 2.0 F) (+ C (hypot B C))))) B)
(* (sqrt 2.0) (- (sqrt (/ F B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 7e-309) {
tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (F * C)))))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else if (F <= 2.2e+37) {
tmp = -sqrt(((2.0 * F) * (C + hypot(B, C)))) / B;
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 7e-309) {
tmp = -Math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (F * C)))))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else if (F <= 2.2e+37) {
tmp = -Math.sqrt(((2.0 * F) * (C + Math.hypot(B, C)))) / B;
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 7e-309: tmp = -math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (F * C)))))) / (math.pow(B, 2.0) - (C * (A * 4.0))) elif F <= 2.2e+37: tmp = -math.sqrt(((2.0 * F) * (C + math.hypot(B, C)))) / B else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 7e-309) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * C) * Float64(2.0 * Float64(-4.0 * Float64(A * Float64(F * C))))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); elseif (F <= 2.2e+37) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * F) * Float64(C + hypot(B, C))))) / B); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 7e-309) tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (F * C)))))) / ((B ^ 2.0) - (C * (A * 4.0))); elseif (F <= 2.2e+37) tmp = -sqrt(((2.0 * F) * (C + hypot(B, C)))) / B; else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 7e-309], N[((-N[Sqrt[N[(N[(2.0 * C), $MachinePrecision] * N[(2.0 * N[(-4.0 * N[(A * N[(F * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.2e+37], N[((-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / B), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 7 \cdot 10^{-309}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot C\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(F \cdot C\right)\right)\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{elif}\;F \leq 2.2 \cdot 10^{+37}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot F\right) \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 6.9999999999999984e-309Initial program 31.5%
Taylor expanded in A around -inf 18.2%
Taylor expanded in B around 0 18.6%
*-commutative18.6%
Simplified18.6%
if 6.9999999999999984e-309 < F < 2.2000000000000001e37Initial program 22.4%
Taylor expanded in A around 0 8.2%
mul-1-neg8.2%
Simplified8.2%
expm1-log1p-u7.7%
expm1-udef3.7%
associate-*l/3.7%
unpow23.7%
unpow23.7%
hypot-udef6.3%
sqrt-unprod6.3%
Applied egg-rr6.3%
expm1-def22.1%
expm1-log1p22.4%
associate-*r*22.4%
Simplified22.4%
if 2.2000000000000001e37 < F Initial program 13.0%
Taylor expanded in C around 0 6.0%
mul-1-neg6.0%
distribute-rgt-neg-in6.0%
+-commutative6.0%
unpow26.0%
unpow26.0%
hypot-def6.4%
Simplified6.4%
Taylor expanded in A around 0 14.9%
mul-1-neg14.9%
Simplified14.9%
Final simplification19.1%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= F 5.5e+36) (/ (- (sqrt (* (* 2.0 F) (+ C (hypot B C))))) B) (* (sqrt 2.0) (- (sqrt (/ F B))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 5.5e+36) {
tmp = -sqrt(((2.0 * F) * (C + hypot(B, C)))) / B;
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 5.5e+36) {
tmp = -Math.sqrt(((2.0 * F) * (C + Math.hypot(B, C)))) / B;
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 5.5e+36: tmp = -math.sqrt(((2.0 * F) * (C + math.hypot(B, C)))) / B else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 5.5e+36) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * F) * Float64(C + hypot(B, C))))) / B); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 5.5e+36) tmp = -sqrt(((2.0 * F) * (C + hypot(B, C)))) / B; else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 5.5e+36], N[((-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / B), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 5.5 \cdot 10^{+36}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot F\right) \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 5.5000000000000002e36Initial program 23.9%
Taylor expanded in A around 0 6.9%
mul-1-neg6.9%
Simplified6.9%
expm1-log1p-u6.5%
expm1-udef3.2%
associate-*l/3.2%
unpow23.2%
unpow23.2%
hypot-udef5.4%
sqrt-unprod5.4%
Applied egg-rr5.4%
expm1-def18.7%
expm1-log1p18.9%
associate-*r*18.9%
Simplified18.9%
if 5.5000000000000002e36 < F Initial program 13.0%
Taylor expanded in C around 0 6.0%
mul-1-neg6.0%
distribute-rgt-neg-in6.0%
+-commutative6.0%
unpow26.0%
unpow26.0%
hypot-def6.4%
Simplified6.4%
Taylor expanded in A around 0 14.9%
mul-1-neg14.9%
Simplified14.9%
Final simplification17.3%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= F 2.4e-83) (* (/ (sqrt 2.0) B) (- (sqrt (* B F)))) (* (sqrt 2.0) (- (sqrt (/ F B))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 2.4e-83) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 2.4d-83) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 2.4e-83) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 2.4e-83: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 2.4e-83) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 2.4e-83) tmp = (sqrt(2.0) / B) * -sqrt((B * F)); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 2.4e-83], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 2.4 \cdot 10^{-83}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 2.4000000000000001e-83Initial program 25.7%
Taylor expanded in C around 0 5.9%
mul-1-neg5.9%
distribute-rgt-neg-in5.9%
+-commutative5.9%
unpow25.9%
unpow25.9%
hypot-def15.0%
Simplified15.0%
Taylor expanded in A around 0 14.6%
if 2.4000000000000001e-83 < F Initial program 15.1%
Taylor expanded in C around 0 6.8%
mul-1-neg6.8%
distribute-rgt-neg-in6.8%
+-commutative6.8%
unpow26.8%
unpow26.8%
hypot-def13.3%
Simplified13.3%
Taylor expanded in A around 0 17.8%
mul-1-neg17.8%
Simplified17.8%
Final simplification16.4%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (sqrt 2.0) (- (sqrt (/ F B)))))
B = abs(B);
double code(double A, double B, double C, double F) {
return sqrt(2.0) * -sqrt((F / B));
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt(2.0d0) * -sqrt((f / b))
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return Math.sqrt(2.0) * -Math.sqrt((F / B));
}
B = abs(B) def code(A, B, C, F): return math.sqrt(2.0) * -math.sqrt((F / B))
B = abs(B) function code(A, B, C, F) return Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = sqrt(2.0) * -sqrt((F / B)); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)
\end{array}
Initial program 19.6%
Taylor expanded in C around 0 6.4%
mul-1-neg6.4%
distribute-rgt-neg-in6.4%
+-commutative6.4%
unpow26.4%
unpow26.4%
hypot-def14.0%
Simplified14.0%
Taylor expanded in A around 0 13.4%
mul-1-neg13.4%
Simplified13.4%
Final simplification13.4%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= C 1.08e-153) (* (sqrt (* F A)) (/ (- 2.0) B)) (* (/ 2.0 B) (- (sqrt (* F C))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (C <= 1.08e-153) {
tmp = sqrt((F * A)) * (-2.0 / B);
} else {
tmp = (2.0 / B) * -sqrt((F * C));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 1.08d-153) then
tmp = sqrt((f * a)) * (-2.0d0 / b)
else
tmp = (2.0d0 / b) * -sqrt((f * c))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (C <= 1.08e-153) {
tmp = Math.sqrt((F * A)) * (-2.0 / B);
} else {
tmp = (2.0 / B) * -Math.sqrt((F * C));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if C <= 1.08e-153: tmp = math.sqrt((F * A)) * (-2.0 / B) else: tmp = (2.0 / B) * -math.sqrt((F * C)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (C <= 1.08e-153) tmp = Float64(sqrt(Float64(F * A)) * Float64(Float64(-2.0) / B)); else tmp = Float64(Float64(2.0 / B) * Float64(-sqrt(Float64(F * C)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (C <= 1.08e-153) tmp = sqrt((F * A)) * (-2.0 / B); else tmp = (2.0 / B) * -sqrt((F * C)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[C, 1.08e-153], N[(N[Sqrt[N[(F * A), $MachinePrecision]], $MachinePrecision] * N[((-2.0) / B), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / B), $MachinePrecision] * (-N[Sqrt[N[(F * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 1.08 \cdot 10^{-153}:\\
\;\;\;\;\sqrt{F \cdot A} \cdot \frac{-2}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{B} \cdot \left(-\sqrt{F \cdot C}\right)\\
\end{array}
\end{array}
if C < 1.07999999999999996e-153Initial program 16.5%
Taylor expanded in C around 0 7.9%
mul-1-neg7.9%
distribute-rgt-neg-in7.9%
+-commutative7.9%
unpow27.9%
unpow27.9%
hypot-def16.2%
Simplified16.2%
Taylor expanded in B around 0 2.8%
mul-1-neg2.8%
*-commutative2.8%
unpow22.8%
rem-square-sqrt2.8%
Simplified2.8%
if 1.07999999999999996e-153 < C Initial program 24.1%
Taylor expanded in A around 0 5.8%
mul-1-neg5.8%
Simplified5.8%
Taylor expanded in B around 0 6.7%
unpow26.7%
rem-square-sqrt6.7%
*-commutative6.7%
Simplified6.7%
Final simplification4.4%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (sqrt (* F A)) (/ (- 2.0) B)))
B = abs(B);
double code(double A, double B, double C, double F) {
return sqrt((F * A)) * (-2.0 / B);
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((f * a)) * (-2.0d0 / b)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return Math.sqrt((F * A)) * (-2.0 / B);
}
B = abs(B) def code(A, B, C, F): return math.sqrt((F * A)) * (-2.0 / B)
B = abs(B) function code(A, B, C, F) return Float64(sqrt(Float64(F * A)) * Float64(Float64(-2.0) / B)) end
B = abs(B) function tmp = code(A, B, C, F) tmp = sqrt((F * A)) * (-2.0 / B); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[Sqrt[N[(F * A), $MachinePrecision]], $MachinePrecision] * N[((-2.0) / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\sqrt{F \cdot A} \cdot \frac{-2}{B}
\end{array}
Initial program 19.6%
Taylor expanded in C around 0 6.4%
mul-1-neg6.4%
distribute-rgt-neg-in6.4%
+-commutative6.4%
unpow26.4%
unpow26.4%
hypot-def14.0%
Simplified14.0%
Taylor expanded in B around 0 2.2%
mul-1-neg2.2%
*-commutative2.2%
unpow22.2%
rem-square-sqrt2.2%
Simplified2.2%
Final simplification2.2%
herbie shell --seed 2023314
(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))))