
(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 18 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: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ C (+ A (hypot B (- A C)))))
(t_1 (fma C (* A -4.0) (* B B)))
(t_2 (* -4.0 (* A C)))
(t_3 (/ (sqrt 2.0) B))
(t_4 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -2e+153)
(* t_3 (* (sqrt (+ A (hypot A B))) (sqrt F)))
(if (<= B -3.1e+84)
(* t_3 (sqrt (* F (/ (- (* B B)) (- A (hypot A B))))))
(if (<= B -1.9e+51)
(* (* (sqrt 2.0) (* B (sqrt F))) (* (sqrt t_0) (/ 1.0 (fma B B t_2))))
(if (<= B -1.25e-82)
(-
(/
(sqrt (* (* 2.0 (* F t_4)) (fma 2.0 C (* -0.5 (/ (* B B) A)))))
t_4))
(if (<= B -9.6e-98)
(- (/ (sqrt (* 2.0 (* t_1 (* F t_0)))) t_1))
(if (<= B 0.0068)
(-
(/
(* (sqrt (* 2.0 (* F (+ (* B B) t_2)))) (sqrt (* 2.0 C)))
t_4))
(* t_3 (* (sqrt (+ C (hypot C B))) (- (sqrt F))))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = C + (A + hypot(B, (A - C)));
double t_1 = fma(C, (A * -4.0), (B * B));
double t_2 = -4.0 * (A * C);
double t_3 = sqrt(2.0) / B;
double t_4 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -2e+153) {
tmp = t_3 * (sqrt((A + hypot(A, B))) * sqrt(F));
} else if (B <= -3.1e+84) {
tmp = t_3 * sqrt((F * (-(B * B) / (A - hypot(A, B)))));
} else if (B <= -1.9e+51) {
tmp = (sqrt(2.0) * (B * sqrt(F))) * (sqrt(t_0) * (1.0 / fma(B, B, t_2)));
} else if (B <= -1.25e-82) {
tmp = -(sqrt(((2.0 * (F * t_4)) * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_4);
} else if (B <= -9.6e-98) {
tmp = -(sqrt((2.0 * (t_1 * (F * t_0)))) / t_1);
} else if (B <= 0.0068) {
tmp = -((sqrt((2.0 * (F * ((B * B) + t_2)))) * sqrt((2.0 * C))) / t_4);
} else {
tmp = t_3 * (sqrt((C + hypot(C, B))) * -sqrt(F));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(C + Float64(A + hypot(B, Float64(A - C)))) t_1 = fma(C, Float64(A * -4.0), Float64(B * B)) t_2 = Float64(-4.0 * Float64(A * C)) t_3 = Float64(sqrt(2.0) / B) t_4 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -2e+153) tmp = Float64(t_3 * Float64(sqrt(Float64(A + hypot(A, B))) * sqrt(F))); elseif (B <= -3.1e+84) tmp = Float64(t_3 * sqrt(Float64(F * Float64(Float64(-Float64(B * B)) / Float64(A - hypot(A, B)))))); elseif (B <= -1.9e+51) tmp = Float64(Float64(sqrt(2.0) * Float64(B * sqrt(F))) * Float64(sqrt(t_0) * Float64(1.0 / fma(B, B, t_2)))); elseif (B <= -1.25e-82) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_4)) * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A))))) / t_4)); elseif (B <= -9.6e-98) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(F * t_0)))) / t_1)); elseif (B <= 0.0068) tmp = Float64(-Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + t_2)))) * sqrt(Float64(2.0 * C))) / t_4)); else tmp = Float64(t_3 * Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(F)))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C * N[(A * -4.0), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$4 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -2e+153], N[(t$95$3 * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -3.1e+84], N[(t$95$3 * N[Sqrt[N[(F * N[((-N[(B * B), $MachinePrecision]) / N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.9e+51], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(B * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[t$95$0], $MachinePrecision] * N[(1.0 / N[(B * B + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.25e-82], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$4), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$4), $MachinePrecision]), If[LessEqual[B, -9.6e-98], (-N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), If[LessEqual[B, 0.0068], (-N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision]), N[(t$95$3 * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\\
t_1 := \mathsf{fma}\left(C, A \cdot -4, B \cdot B\right)\\
t_2 := -4 \cdot \left(A \cdot C\right)\\
t_3 := \frac{\sqrt{2}}{B}\\
t_4 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -2 \cdot 10^{+153}:\\
\;\;\;\;t_3 \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \sqrt{F}\right)\\
\mathbf{elif}\;B \leq -3.1 \cdot 10^{+84}:\\
\;\;\;\;t_3 \cdot \sqrt{F \cdot \frac{-B \cdot B}{A - \mathsf{hypot}\left(A, B\right)}}\\
\mathbf{elif}\;B \leq -1.9 \cdot 10^{+51}:\\
\;\;\;\;\left(\sqrt{2} \cdot \left(B \cdot \sqrt{F}\right)\right) \cdot \left(\sqrt{t_0} \cdot \frac{1}{\mathsf{fma}\left(B, B, t_2\right)}\right)\\
\mathbf{elif}\;B \leq -1.25 \cdot 10^{-82}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_4\right)\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_4}\\
\mathbf{elif}\;B \leq -9.6 \cdot 10^{-98}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot t_0\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 0.0068:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + t_2\right)\right)} \cdot \sqrt{2 \cdot C}}{t_4}\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < -2e153Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
sqrt-prod0.0%
*-commutative0.0%
*-commutative0.0%
associate-+l+0.0%
unpow20.0%
hypot-udef0.0%
associate-+r+0.0%
+-commutative0.0%
associate-+r+0.0%
Applied egg-rr0.0%
Taylor expanded in B around -inf 1.6%
mul-1-neg1.6%
Simplified1.6%
Taylor expanded in C around 0 2.6%
+-commutative2.6%
unpow22.6%
unpow22.6%
hypot-def39.3%
Simplified39.3%
sqrt-prod83.4%
Applied egg-rr83.4%
if -2e153 < B < -3.10000000000000003e84Initial program 20.0%
associate-*l*20.0%
unpow220.0%
+-commutative20.0%
unpow220.0%
associate-*l*20.0%
unpow220.0%
Simplified20.0%
sqrt-prod31.2%
*-commutative31.2%
*-commutative31.2%
associate-+l+31.2%
unpow231.2%
hypot-udef31.5%
associate-+r+31.4%
+-commutative31.4%
associate-+r+30.9%
Applied egg-rr30.9%
Taylor expanded in B around -inf 53.8%
mul-1-neg53.8%
Simplified53.8%
Taylor expanded in C around 0 54.7%
+-commutative54.7%
unpow254.7%
unpow254.7%
hypot-def55.1%
Simplified55.1%
flip-+54.5%
hypot-udef54.5%
hypot-udef54.5%
add-sqr-sqrt54.5%
Applied egg-rr54.5%
unpow254.5%
unpow254.5%
unpow254.5%
associate--r+65.6%
+-inverses77.3%
unpow277.3%
Simplified77.3%
if -3.10000000000000003e84 < B < -1.8999999999999999e51Initial program 25.2%
associate-*l*25.2%
unpow225.2%
+-commutative25.2%
unpow225.2%
associate-*l*25.2%
unpow225.2%
Simplified25.2%
sqrt-prod25.0%
*-commutative25.0%
*-commutative25.0%
associate-+l+25.0%
unpow225.0%
hypot-udef25.6%
associate-+r+25.6%
+-commutative25.6%
associate-+r+25.8%
Applied egg-rr25.8%
Taylor expanded in B around -inf 71.0%
mul-1-neg71.0%
Simplified71.0%
div-inv71.0%
distribute-rgt-neg-in71.0%
associate-*l*71.2%
cancel-sign-sub-inv71.2%
metadata-eval71.2%
*-commutative71.2%
fma-def71.2%
Applied egg-rr71.2%
associate-*l*81.6%
distribute-rgt-neg-in81.6%
Simplified81.6%
if -1.8999999999999999e51 < B < -1.25e-82Initial program 20.8%
associate-*l*20.8%
unpow220.8%
+-commutative20.8%
unpow220.8%
associate-*l*20.8%
unpow220.8%
Simplified20.8%
Taylor expanded in A around -inf 30.9%
fma-def30.9%
unpow230.9%
Simplified30.9%
if -1.25e-82 < B < -9.60000000000000019e-98Initial program 82.8%
Simplified84.3%
distribute-frac-neg84.3%
associate-*l*84.9%
Applied egg-rr84.9%
if -9.60000000000000019e-98 < B < 0.00679999999999999962Initial program 19.6%
associate-*l*19.6%
unpow219.6%
+-commutative19.6%
unpow219.6%
associate-*l*19.6%
unpow219.6%
Simplified19.6%
Taylor expanded in A around -inf 15.6%
sqrt-prod16.5%
*-commutative16.5%
cancel-sign-sub-inv16.5%
*-commutative16.5%
metadata-eval16.5%
Applied egg-rr16.5%
if 0.00679999999999999962 < B Initial program 14.4%
Simplified17.6%
Taylor expanded in A around 0 24.2%
mul-1-neg24.2%
*-commutative24.2%
distribute-rgt-neg-in24.2%
*-commutative24.2%
unpow224.2%
unpow224.2%
hypot-def45.8%
Simplified45.8%
sqrt-prod58.8%
Applied egg-rr58.8%
hypot-def27.4%
unpow227.4%
unpow227.4%
+-commutative27.4%
unpow227.4%
unpow227.4%
hypot-def58.8%
Simplified58.8%
Final simplification45.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* F (+ (* B B) (* -4.0 (* A C)))))
(t_1 (/ (sqrt 2.0) B))
(t_2 (* t_1 (sqrt (* F (/ (- (* B B)) (- A (hypot A B)))))))
(t_3 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -1.4e+154)
(* t_1 (* (sqrt (+ A (hypot A B))) (sqrt F)))
(if (<= B -7e+78)
t_2
(if (<= B -1.9e+51)
(/
(* (sqrt 2.0) (* B (sqrt F)))
(/ (fma B B (* A (* C -4.0))) (sqrt (+ (hypot B (- A C)) (+ A C)))))
(if (<= B -0.0085)
(/ (- (sqrt (* t_0 (* C 4.0)))) t_3)
(if (<= B -3.6e-27)
t_2
(if (<= B 0.0146)
(- (/ (* (sqrt (* 2.0 t_0)) (sqrt (* 2.0 C))) t_3))
(* t_1 (* (sqrt (+ C (hypot C B))) (- (sqrt F))))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * ((B * B) + (-4.0 * (A * C)));
double t_1 = sqrt(2.0) / B;
double t_2 = t_1 * sqrt((F * (-(B * B) / (A - hypot(A, B)))));
double t_3 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -1.4e+154) {
tmp = t_1 * (sqrt((A + hypot(A, B))) * sqrt(F));
} else if (B <= -7e+78) {
tmp = t_2;
} else if (B <= -1.9e+51) {
tmp = (sqrt(2.0) * (B * sqrt(F))) / (fma(B, B, (A * (C * -4.0))) / sqrt((hypot(B, (A - C)) + (A + C))));
} else if (B <= -0.0085) {
tmp = -sqrt((t_0 * (C * 4.0))) / t_3;
} else if (B <= -3.6e-27) {
tmp = t_2;
} else if (B <= 0.0146) {
tmp = -((sqrt((2.0 * t_0)) * sqrt((2.0 * C))) / t_3);
} else {
tmp = t_1 * (sqrt((C + hypot(C, B))) * -sqrt(F));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))) t_1 = Float64(sqrt(2.0) / B) t_2 = Float64(t_1 * sqrt(Float64(F * Float64(Float64(-Float64(B * B)) / Float64(A - hypot(A, B)))))) t_3 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -1.4e+154) tmp = Float64(t_1 * Float64(sqrt(Float64(A + hypot(A, B))) * sqrt(F))); elseif (B <= -7e+78) tmp = t_2; elseif (B <= -1.9e+51) tmp = Float64(Float64(sqrt(2.0) * Float64(B * sqrt(F))) / Float64(fma(B, B, Float64(A * Float64(C * -4.0))) / sqrt(Float64(hypot(B, Float64(A - C)) + Float64(A + C))))); elseif (B <= -0.0085) tmp = Float64(Float64(-sqrt(Float64(t_0 * Float64(C * 4.0)))) / t_3); elseif (B <= -3.6e-27) tmp = t_2; elseif (B <= 0.0146) tmp = Float64(-Float64(Float64(sqrt(Float64(2.0 * t_0)) * sqrt(Float64(2.0 * C))) / t_3)); else tmp = Float64(t_1 * Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(F)))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Sqrt[N[(F * N[((-N[(B * B), $MachinePrecision]) / N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.4e+154], N[(t$95$1 * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -7e+78], t$95$2, If[LessEqual[B, -1.9e+51], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(B * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -0.0085], N[((-N[Sqrt[N[(t$95$0 * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision], If[LessEqual[B, -3.6e-27], t$95$2, If[LessEqual[B, 0.0146], (-N[(N[(N[Sqrt[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), N[(t$95$1 * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\\
t_1 := \frac{\sqrt{2}}{B}\\
t_2 := t_1 \cdot \sqrt{F \cdot \frac{-B \cdot B}{A - \mathsf{hypot}\left(A, B\right)}}\\
t_3 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -1.4 \cdot 10^{+154}:\\
\;\;\;\;t_1 \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \sqrt{F}\right)\\
\mathbf{elif}\;B \leq -7 \cdot 10^{+78}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq -1.9 \cdot 10^{+51}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(B \cdot \sqrt{F}\right)}{\frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)}}}\\
\mathbf{elif}\;B \leq -0.0085:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(C \cdot 4\right)}}{t_3}\\
\mathbf{elif}\;B \leq -3.6 \cdot 10^{-27}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq 0.0146:\\
\;\;\;\;-\frac{\sqrt{2 \cdot t_0} \cdot \sqrt{2 \cdot C}}{t_3}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < -1.4e154Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
sqrt-prod0.0%
*-commutative0.0%
*-commutative0.0%
associate-+l+0.0%
unpow20.0%
hypot-udef0.0%
associate-+r+0.0%
+-commutative0.0%
associate-+r+0.0%
Applied egg-rr0.0%
Taylor expanded in B around -inf 1.6%
mul-1-neg1.6%
Simplified1.6%
Taylor expanded in C around 0 2.6%
+-commutative2.6%
unpow22.6%
unpow22.6%
hypot-def39.3%
Simplified39.3%
sqrt-prod83.4%
Applied egg-rr83.4%
if -1.4e154 < B < -7.0000000000000003e78 or -0.0085000000000000006 < B < -3.5999999999999999e-27Initial program 29.4%
associate-*l*29.4%
unpow229.4%
+-commutative29.4%
unpow229.4%
associate-*l*29.4%
unpow229.4%
Simplified29.4%
sqrt-prod37.8%
*-commutative37.8%
*-commutative37.8%
associate-+l+37.6%
unpow237.6%
hypot-udef37.9%
associate-+r+38.0%
+-commutative38.0%
associate-+r+37.6%
Applied egg-rr37.6%
Taylor expanded in B around -inf 55.5%
mul-1-neg55.5%
Simplified55.5%
Taylor expanded in C around 0 56.3%
+-commutative56.3%
unpow256.3%
unpow256.3%
hypot-def56.6%
Simplified56.6%
flip-+56.0%
hypot-udef56.0%
hypot-udef56.0%
add-sqr-sqrt56.0%
Applied egg-rr56.0%
unpow256.0%
unpow256.0%
unpow256.0%
associate--r+64.6%
+-inverses73.6%
unpow273.6%
Simplified73.6%
if -7.0000000000000003e78 < B < -1.8999999999999999e51Initial program 15.8%
associate-*l*15.8%
unpow215.8%
+-commutative15.8%
unpow215.8%
associate-*l*15.8%
unpow215.8%
Simplified15.8%
sqrt-prod15.8%
*-commutative15.8%
*-commutative15.8%
associate-+l+15.8%
unpow215.8%
hypot-udef16.5%
associate-+r+16.5%
+-commutative16.5%
associate-+r+16.7%
Applied egg-rr16.7%
Taylor expanded in B around -inf 67.4%
mul-1-neg67.4%
Simplified67.4%
distribute-lft-neg-out67.4%
associate-*l*67.6%
Applied egg-rr67.6%
distribute-rgt-neg-in67.6%
Simplified67.6%
*-un-lft-identity67.6%
distribute-rgt-neg-in67.6%
cancel-sign-sub-inv67.6%
metadata-eval67.6%
*-commutative67.6%
fma-udef67.6%
associate-*r*67.6%
Applied egg-rr67.6%
*-lft-identity67.6%
remove-double-neg67.6%
associate-/l*78.9%
Simplified78.7%
if -1.8999999999999999e51 < B < -0.0085000000000000006Initial program 19.0%
associate-*l*19.0%
unpow219.0%
+-commutative19.0%
unpow219.0%
associate-*l*19.0%
unpow219.0%
Simplified19.0%
Taylor expanded in A around -inf 14.3%
Taylor expanded in F around 0 14.3%
associate-*r*14.3%
cancel-sign-sub-inv14.3%
unpow214.3%
metadata-eval14.3%
Simplified14.3%
if -3.5999999999999999e-27 < B < 0.0146000000000000001Initial program 21.9%
associate-*l*21.9%
unpow221.9%
+-commutative21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in A around -inf 20.5%
sqrt-prod20.4%
*-commutative20.4%
cancel-sign-sub-inv20.4%
*-commutative20.4%
metadata-eval20.4%
Applied egg-rr20.4%
if 0.0146000000000000001 < B Initial program 14.4%
Simplified17.6%
Taylor expanded in A around 0 24.2%
mul-1-neg24.2%
*-commutative24.2%
distribute-rgt-neg-in24.2%
*-commutative24.2%
unpow224.2%
unpow224.2%
hypot-def45.8%
Simplified45.8%
sqrt-prod58.8%
Applied egg-rr58.8%
hypot-def27.4%
unpow227.4%
unpow227.4%
+-commutative27.4%
unpow227.4%
unpow227.4%
hypot-def58.8%
Simplified58.8%
Final simplification44.7%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* F (+ (* B B) (* -4.0 (* A C)))))
(t_1 (/ (sqrt 2.0) B))
(t_2 (* t_1 (sqrt (* F (/ (- (* B B)) (- A (hypot A B)))))))
(t_3 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -2.7e+153)
(* t_1 (* (sqrt (+ A (hypot A B))) (sqrt F)))
(if (<= B -2.5e+83)
t_2
(if (<= B -1.9e+51)
(/
(*
(sqrt (+ C (+ A (hypot B (- A C)))))
(* (sqrt 2.0) (* B (sqrt F))))
t_3)
(if (<= B -1.7e-7)
(/ (- (sqrt (* t_0 (* C 4.0)))) t_3)
(if (<= B -2.32e-26)
t_2
(if (<= B 0.245)
(- (/ (* (sqrt (* 2.0 t_0)) (sqrt (* 2.0 C))) t_3))
(* t_1 (* (sqrt (+ C (hypot C B))) (- (sqrt F))))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * ((B * B) + (-4.0 * (A * C)));
double t_1 = sqrt(2.0) / B;
double t_2 = t_1 * sqrt((F * (-(B * B) / (A - hypot(A, B)))));
double t_3 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -2.7e+153) {
tmp = t_1 * (sqrt((A + hypot(A, B))) * sqrt(F));
} else if (B <= -2.5e+83) {
tmp = t_2;
} else if (B <= -1.9e+51) {
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * (sqrt(2.0) * (B * sqrt(F)))) / t_3;
} else if (B <= -1.7e-7) {
tmp = -sqrt((t_0 * (C * 4.0))) / t_3;
} else if (B <= -2.32e-26) {
tmp = t_2;
} else if (B <= 0.245) {
tmp = -((sqrt((2.0 * t_0)) * sqrt((2.0 * C))) / t_3);
} else {
tmp = t_1 * (sqrt((C + hypot(C, B))) * -sqrt(F));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = F * ((B * B) + (-4.0 * (A * C)));
double t_1 = Math.sqrt(2.0) / B;
double t_2 = t_1 * Math.sqrt((F * (-(B * B) / (A - Math.hypot(A, B)))));
double t_3 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -2.7e+153) {
tmp = t_1 * (Math.sqrt((A + Math.hypot(A, B))) * Math.sqrt(F));
} else if (B <= -2.5e+83) {
tmp = t_2;
} else if (B <= -1.9e+51) {
tmp = (Math.sqrt((C + (A + Math.hypot(B, (A - C))))) * (Math.sqrt(2.0) * (B * Math.sqrt(F)))) / t_3;
} else if (B <= -1.7e-7) {
tmp = -Math.sqrt((t_0 * (C * 4.0))) / t_3;
} else if (B <= -2.32e-26) {
tmp = t_2;
} else if (B <= 0.245) {
tmp = -((Math.sqrt((2.0 * t_0)) * Math.sqrt((2.0 * C))) / t_3);
} else {
tmp = t_1 * (Math.sqrt((C + Math.hypot(C, B))) * -Math.sqrt(F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = F * ((B * B) + (-4.0 * (A * C))) t_1 = math.sqrt(2.0) / B t_2 = t_1 * math.sqrt((F * (-(B * B) / (A - math.hypot(A, B))))) t_3 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -2.7e+153: tmp = t_1 * (math.sqrt((A + math.hypot(A, B))) * math.sqrt(F)) elif B <= -2.5e+83: tmp = t_2 elif B <= -1.9e+51: tmp = (math.sqrt((C + (A + math.hypot(B, (A - C))))) * (math.sqrt(2.0) * (B * math.sqrt(F)))) / t_3 elif B <= -1.7e-7: tmp = -math.sqrt((t_0 * (C * 4.0))) / t_3 elif B <= -2.32e-26: tmp = t_2 elif B <= 0.245: tmp = -((math.sqrt((2.0 * t_0)) * math.sqrt((2.0 * C))) / t_3) else: tmp = t_1 * (math.sqrt((C + math.hypot(C, B))) * -math.sqrt(F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))) t_1 = Float64(sqrt(2.0) / B) t_2 = Float64(t_1 * sqrt(Float64(F * Float64(Float64(-Float64(B * B)) / Float64(A - hypot(A, B)))))) t_3 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -2.7e+153) tmp = Float64(t_1 * Float64(sqrt(Float64(A + hypot(A, B))) * sqrt(F))); elseif (B <= -2.5e+83) tmp = t_2; elseif (B <= -1.9e+51) tmp = Float64(Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * Float64(sqrt(2.0) * Float64(B * sqrt(F)))) / t_3); elseif (B <= -1.7e-7) tmp = Float64(Float64(-sqrt(Float64(t_0 * Float64(C * 4.0)))) / t_3); elseif (B <= -2.32e-26) tmp = t_2; elseif (B <= 0.245) tmp = Float64(-Float64(Float64(sqrt(Float64(2.0 * t_0)) * sqrt(Float64(2.0 * C))) / t_3)); else tmp = Float64(t_1 * Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(F)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = F * ((B * B) + (-4.0 * (A * C)));
t_1 = sqrt(2.0) / B;
t_2 = t_1 * sqrt((F * (-(B * B) / (A - hypot(A, B)))));
t_3 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -2.7e+153)
tmp = t_1 * (sqrt((A + hypot(A, B))) * sqrt(F));
elseif (B <= -2.5e+83)
tmp = t_2;
elseif (B <= -1.9e+51)
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * (sqrt(2.0) * (B * sqrt(F)))) / t_3;
elseif (B <= -1.7e-7)
tmp = -sqrt((t_0 * (C * 4.0))) / t_3;
elseif (B <= -2.32e-26)
tmp = t_2;
elseif (B <= 0.245)
tmp = -((sqrt((2.0 * t_0)) * sqrt((2.0 * C))) / t_3);
else
tmp = t_1 * (sqrt((C + hypot(C, B))) * -sqrt(F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Sqrt[N[(F * N[((-N[(B * B), $MachinePrecision]) / N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -2.7e+153], N[(t$95$1 * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -2.5e+83], t$95$2, If[LessEqual[B, -1.9e+51], N[(N[(N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(B * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[B, -1.7e-7], N[((-N[Sqrt[N[(t$95$0 * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision], If[LessEqual[B, -2.32e-26], t$95$2, If[LessEqual[B, 0.245], (-N[(N[(N[Sqrt[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), N[(t$95$1 * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\\
t_1 := \frac{\sqrt{2}}{B}\\
t_2 := t_1 \cdot \sqrt{F \cdot \frac{-B \cdot B}{A - \mathsf{hypot}\left(A, B\right)}}\\
t_3 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -2.7 \cdot 10^{+153}:\\
\;\;\;\;t_1 \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \sqrt{F}\right)\\
\mathbf{elif}\;B \leq -2.5 \cdot 10^{+83}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq -1.9 \cdot 10^{+51}:\\
\;\;\;\;\frac{\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(\sqrt{2} \cdot \left(B \cdot \sqrt{F}\right)\right)}{t_3}\\
\mathbf{elif}\;B \leq -1.7 \cdot 10^{-7}:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(C \cdot 4\right)}}{t_3}\\
\mathbf{elif}\;B \leq -2.32 \cdot 10^{-26}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq 0.245:\\
\;\;\;\;-\frac{\sqrt{2 \cdot t_0} \cdot \sqrt{2 \cdot C}}{t_3}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < -2.7000000000000001e153Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
sqrt-prod0.0%
*-commutative0.0%
*-commutative0.0%
associate-+l+0.0%
unpow20.0%
hypot-udef0.0%
associate-+r+0.0%
+-commutative0.0%
associate-+r+0.0%
Applied egg-rr0.0%
Taylor expanded in B around -inf 1.6%
mul-1-neg1.6%
Simplified1.6%
Taylor expanded in C around 0 2.6%
+-commutative2.6%
unpow22.6%
unpow22.6%
hypot-def39.3%
Simplified39.3%
sqrt-prod83.4%
Applied egg-rr83.4%
if -2.7000000000000001e153 < B < -2.50000000000000014e83 or -1.69999999999999987e-7 < B < -2.32000000000000003e-26Initial program 26.0%
associate-*l*26.0%
unpow226.0%
+-commutative26.0%
unpow226.0%
associate-*l*26.0%
unpow226.0%
Simplified26.0%
sqrt-prod34.9%
*-commutative34.9%
*-commutative34.9%
associate-+l+34.7%
unpow234.7%
hypot-udef35.1%
associate-+r+35.1%
+-commutative35.1%
associate-+r+34.7%
Applied egg-rr34.7%
Taylor expanded in B around -inf 53.4%
mul-1-neg53.4%
Simplified53.4%
Taylor expanded in C around 0 54.3%
+-commutative54.3%
unpow254.3%
unpow254.3%
hypot-def54.6%
Simplified54.6%
flip-+53.9%
hypot-udef53.9%
hypot-udef53.9%
add-sqr-sqrt53.9%
Applied egg-rr53.9%
unpow253.9%
unpow253.9%
unpow253.9%
associate--r+62.9%
+-inverses72.4%
unpow272.4%
Simplified72.4%
if -2.50000000000000014e83 < B < -1.8999999999999999e51Initial program 25.2%
associate-*l*25.2%
unpow225.2%
+-commutative25.2%
unpow225.2%
associate-*l*25.2%
unpow225.2%
Simplified25.2%
sqrt-prod25.0%
*-commutative25.0%
*-commutative25.0%
associate-+l+25.0%
unpow225.0%
hypot-udef25.6%
associate-+r+25.6%
+-commutative25.6%
associate-+r+25.8%
Applied egg-rr25.8%
Taylor expanded in B around -inf 71.0%
mul-1-neg71.0%
associate-*l*71.2%
Simplified71.2%
if -1.8999999999999999e51 < B < -1.69999999999999987e-7Initial program 19.0%
associate-*l*19.0%
unpow219.0%
+-commutative19.0%
unpow219.0%
associate-*l*19.0%
unpow219.0%
Simplified19.0%
Taylor expanded in A around -inf 14.3%
Taylor expanded in F around 0 14.3%
associate-*r*14.3%
cancel-sign-sub-inv14.3%
unpow214.3%
metadata-eval14.3%
Simplified14.3%
if -2.32000000000000003e-26 < B < 0.245Initial program 21.9%
associate-*l*21.9%
unpow221.9%
+-commutative21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in A around -inf 20.5%
sqrt-prod20.4%
*-commutative20.4%
cancel-sign-sub-inv20.4%
*-commutative20.4%
metadata-eval20.4%
Applied egg-rr20.4%
if 0.245 < B Initial program 14.4%
Simplified17.6%
Taylor expanded in A around 0 24.2%
mul-1-neg24.2%
*-commutative24.2%
distribute-rgt-neg-in24.2%
*-commutative24.2%
unpow224.2%
unpow224.2%
hypot-def45.8%
Simplified45.8%
sqrt-prod58.8%
Applied egg-rr58.8%
hypot-def27.4%
unpow227.4%
unpow227.4%
+-commutative27.4%
unpow227.4%
unpow227.4%
hypot-def58.8%
Simplified58.8%
Final simplification44.3%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B)))
(if (<= B -4e+153)
(* t_0 (* (sqrt (+ A (hypot A B))) (sqrt F)))
(if (<= B -2.6e-27)
(* t_0 (sqrt (* F (/ (- (* B B)) (- A (hypot A B))))))
(if (<= B 0.013)
(-
(/
(*
(sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))
(sqrt (* 2.0 C)))
(- (* B B) (* 4.0 (* A C)))))
(* t_0 (* (sqrt (+ C (hypot C B))) (- (sqrt F)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(2.0) / B;
double tmp;
if (B <= -4e+153) {
tmp = t_0 * (sqrt((A + hypot(A, B))) * sqrt(F));
} else if (B <= -2.6e-27) {
tmp = t_0 * sqrt((F * (-(B * B) / (A - hypot(A, B)))));
} else if (B <= 0.013) {
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = t_0 * (sqrt((C + hypot(C, B))) * -sqrt(F));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt(2.0) / B;
double tmp;
if (B <= -4e+153) {
tmp = t_0 * (Math.sqrt((A + Math.hypot(A, B))) * Math.sqrt(F));
} else if (B <= -2.6e-27) {
tmp = t_0 * Math.sqrt((F * (-(B * B) / (A - Math.hypot(A, B)))));
} else if (B <= 0.013) {
tmp = -((Math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * Math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = t_0 * (Math.sqrt((C + Math.hypot(C, B))) * -Math.sqrt(F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt(2.0) / B tmp = 0 if B <= -4e+153: tmp = t_0 * (math.sqrt((A + math.hypot(A, B))) * math.sqrt(F)) elif B <= -2.6e-27: tmp = t_0 * math.sqrt((F * (-(B * B) / (A - math.hypot(A, B))))) elif B <= 0.013: tmp = -((math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C)))) else: tmp = t_0 * (math.sqrt((C + math.hypot(C, B))) * -math.sqrt(F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(2.0) / B) tmp = 0.0 if (B <= -4e+153) tmp = Float64(t_0 * Float64(sqrt(Float64(A + hypot(A, B))) * sqrt(F))); elseif (B <= -2.6e-27) tmp = Float64(t_0 * sqrt(Float64(F * Float64(Float64(-Float64(B * B)) / Float64(A - hypot(A, B)))))); elseif (B <= 0.013) tmp = Float64(-Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * sqrt(Float64(2.0 * C))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))); else tmp = Float64(t_0 * Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(F)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt(2.0) / B;
tmp = 0.0;
if (B <= -4e+153)
tmp = t_0 * (sqrt((A + hypot(A, B))) * sqrt(F));
elseif (B <= -2.6e-27)
tmp = t_0 * sqrt((F * (-(B * B) / (A - hypot(A, B)))));
elseif (B <= 0.013)
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
else
tmp = t_0 * (sqrt((C + hypot(C, B))) * -sqrt(F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -4e+153], N[(t$95$0 * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -2.6e-27], N[(t$95$0 * N[Sqrt[N[(F * N[((-N[(B * B), $MachinePrecision]) / N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 0.013], (-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[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(t$95$0 * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B}\\
\mathbf{if}\;B \leq -4 \cdot 10^{+153}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \sqrt{F}\right)\\
\mathbf{elif}\;B \leq -2.6 \cdot 10^{-27}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \frac{-B \cdot B}{A - \mathsf{hypot}\left(A, B\right)}}\\
\mathbf{elif}\;B \leq 0.013:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \sqrt{2 \cdot C}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < -4e153Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
sqrt-prod0.0%
*-commutative0.0%
*-commutative0.0%
associate-+l+0.0%
unpow20.0%
hypot-udef0.0%
associate-+r+0.0%
+-commutative0.0%
associate-+r+0.0%
Applied egg-rr0.0%
Taylor expanded in B around -inf 1.6%
mul-1-neg1.6%
Simplified1.6%
Taylor expanded in C around 0 2.6%
+-commutative2.6%
unpow22.6%
unpow22.6%
hypot-def39.3%
Simplified39.3%
sqrt-prod83.4%
Applied egg-rr83.4%
if -4e153 < B < -2.60000000000000017e-27Initial program 24.2%
associate-*l*24.2%
unpow224.2%
+-commutative24.2%
unpow224.2%
associate-*l*24.2%
unpow224.2%
Simplified24.2%
sqrt-prod27.7%
*-commutative27.7%
*-commutative27.7%
associate-+l+28.0%
unpow228.0%
hypot-udef33.2%
associate-+r+33.0%
+-commutative33.0%
associate-+r+32.8%
Applied egg-rr32.8%
Taylor expanded in B around -inf 51.7%
mul-1-neg51.7%
Simplified51.7%
Taylor expanded in C around 0 41.3%
+-commutative41.3%
unpow241.3%
unpow241.3%
hypot-def42.7%
Simplified42.7%
flip-+38.2%
hypot-udef38.2%
hypot-udef38.2%
add-sqr-sqrt38.2%
Applied egg-rr38.2%
unpow238.2%
unpow238.2%
unpow238.2%
associate--r+44.8%
+-inverses50.1%
unpow250.1%
Simplified50.1%
if -2.60000000000000017e-27 < B < 0.0129999999999999994Initial program 21.9%
associate-*l*21.9%
unpow221.9%
+-commutative21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in A around -inf 20.5%
sqrt-prod20.4%
*-commutative20.4%
cancel-sign-sub-inv20.4%
*-commutative20.4%
metadata-eval20.4%
Applied egg-rr20.4%
if 0.0129999999999999994 < B Initial program 14.4%
Simplified17.6%
Taylor expanded in A around 0 24.2%
mul-1-neg24.2%
*-commutative24.2%
distribute-rgt-neg-in24.2%
*-commutative24.2%
unpow224.2%
unpow224.2%
hypot-def45.8%
Simplified45.8%
sqrt-prod58.8%
Applied egg-rr58.8%
hypot-def27.4%
unpow227.4%
unpow227.4%
+-commutative27.4%
unpow227.4%
unpow227.4%
hypot-def58.8%
Simplified58.8%
Final simplification43.0%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B)))
(if (<= B -1e+154)
(* t_0 (* (sqrt (+ A (hypot A B))) (sqrt F)))
(if (<= B -2.55e-27)
(* t_0 (sqrt (* F (/ (- (* B B)) (- A (hypot A B))))))
(if (<= B 4.6e+35)
(-
(/
(*
(sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))
(sqrt (* 2.0 C)))
(- (* B B) (* 4.0 (* A C)))))
(* (/ (sqrt F) (sqrt B)) (- (sqrt 2.0))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(2.0) / B;
double tmp;
if (B <= -1e+154) {
tmp = t_0 * (sqrt((A + hypot(A, B))) * sqrt(F));
} else if (B <= -2.55e-27) {
tmp = t_0 * sqrt((F * (-(B * B) / (A - hypot(A, B)))));
} else if (B <= 4.6e+35) {
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = (sqrt(F) / sqrt(B)) * -sqrt(2.0);
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt(2.0) / B;
double tmp;
if (B <= -1e+154) {
tmp = t_0 * (Math.sqrt((A + Math.hypot(A, B))) * Math.sqrt(F));
} else if (B <= -2.55e-27) {
tmp = t_0 * Math.sqrt((F * (-(B * B) / (A - Math.hypot(A, B)))));
} else if (B <= 4.6e+35) {
tmp = -((Math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * Math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = (Math.sqrt(F) / Math.sqrt(B)) * -Math.sqrt(2.0);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt(2.0) / B tmp = 0 if B <= -1e+154: tmp = t_0 * (math.sqrt((A + math.hypot(A, B))) * math.sqrt(F)) elif B <= -2.55e-27: tmp = t_0 * math.sqrt((F * (-(B * B) / (A - math.hypot(A, B))))) elif B <= 4.6e+35: tmp = -((math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C)))) else: tmp = (math.sqrt(F) / math.sqrt(B)) * -math.sqrt(2.0) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(2.0) / B) tmp = 0.0 if (B <= -1e+154) tmp = Float64(t_0 * Float64(sqrt(Float64(A + hypot(A, B))) * sqrt(F))); elseif (B <= -2.55e-27) tmp = Float64(t_0 * sqrt(Float64(F * Float64(Float64(-Float64(B * B)) / Float64(A - hypot(A, B)))))); elseif (B <= 4.6e+35) tmp = Float64(-Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * sqrt(Float64(2.0 * C))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))); else tmp = Float64(Float64(sqrt(F) / sqrt(B)) * Float64(-sqrt(2.0))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt(2.0) / B;
tmp = 0.0;
if (B <= -1e+154)
tmp = t_0 * (sqrt((A + hypot(A, B))) * sqrt(F));
elseif (B <= -2.55e-27)
tmp = t_0 * sqrt((F * (-(B * B) / (A - hypot(A, B)))));
elseif (B <= 4.6e+35)
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
else
tmp = (sqrt(F) / sqrt(B)) * -sqrt(2.0);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -1e+154], N[(t$95$0 * N[(N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -2.55e-27], N[(t$95$0 * N[Sqrt[N[(F * N[((-N[(B * B), $MachinePrecision]) / N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 4.6e+35], (-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[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B}\\
\mathbf{if}\;B \leq -1 \cdot 10^{+154}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{A + \mathsf{hypot}\left(A, B\right)} \cdot \sqrt{F}\right)\\
\mathbf{elif}\;B \leq -2.55 \cdot 10^{-27}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \frac{-B \cdot B}{A - \mathsf{hypot}\left(A, B\right)}}\\
\mathbf{elif}\;B \leq 4.6 \cdot 10^{+35}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \sqrt{2 \cdot C}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < -1.00000000000000004e154Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
sqrt-prod0.0%
*-commutative0.0%
*-commutative0.0%
associate-+l+0.0%
unpow20.0%
hypot-udef0.0%
associate-+r+0.0%
+-commutative0.0%
associate-+r+0.0%
Applied egg-rr0.0%
Taylor expanded in B around -inf 1.6%
mul-1-neg1.6%
Simplified1.6%
Taylor expanded in C around 0 2.6%
+-commutative2.6%
unpow22.6%
unpow22.6%
hypot-def39.3%
Simplified39.3%
sqrt-prod83.4%
Applied egg-rr83.4%
if -1.00000000000000004e154 < B < -2.55e-27Initial program 24.2%
associate-*l*24.2%
unpow224.2%
+-commutative24.2%
unpow224.2%
associate-*l*24.2%
unpow224.2%
Simplified24.2%
sqrt-prod27.7%
*-commutative27.7%
*-commutative27.7%
associate-+l+28.0%
unpow228.0%
hypot-udef33.2%
associate-+r+33.0%
+-commutative33.0%
associate-+r+32.8%
Applied egg-rr32.8%
Taylor expanded in B around -inf 51.7%
mul-1-neg51.7%
Simplified51.7%
Taylor expanded in C around 0 41.3%
+-commutative41.3%
unpow241.3%
unpow241.3%
hypot-def42.7%
Simplified42.7%
flip-+38.2%
hypot-udef38.2%
hypot-udef38.2%
add-sqr-sqrt38.2%
Applied egg-rr38.2%
unpow238.2%
unpow238.2%
unpow238.2%
associate--r+44.8%
+-inverses50.1%
unpow250.1%
Simplified50.1%
if -2.55e-27 < B < 4.5999999999999996e35Initial program 23.7%
associate-*l*23.7%
unpow223.7%
+-commutative23.7%
unpow223.7%
associate-*l*23.7%
unpow223.7%
Simplified23.7%
Taylor expanded in A around -inf 20.8%
sqrt-prod21.4%
*-commutative21.4%
cancel-sign-sub-inv21.4%
*-commutative21.4%
metadata-eval21.4%
Applied egg-rr21.4%
if 4.5999999999999996e35 < B Initial program 10.0%
Simplified13.4%
Taylor expanded in A around 0 20.5%
mul-1-neg20.5%
*-commutative20.5%
distribute-rgt-neg-in20.5%
*-commutative20.5%
unpow220.5%
unpow220.5%
hypot-def43.6%
Simplified43.6%
Taylor expanded in C around 0 33.4%
mul-1-neg33.4%
Simplified33.4%
sqrt-div53.3%
Applied egg-rr53.3%
Final simplification41.7%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B)))
(if (<= B -1.4e+154)
(* t_0 (sqrt (* F (+ C (hypot C B)))))
(if (<= B -2.55e-27)
(* t_0 (sqrt (* F (/ (- (* B B)) (- A (hypot A B))))))
(if (<= B 8e+35)
(-
(/
(*
(sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))
(sqrt (* 2.0 C)))
(- (* B B) (* 4.0 (* A C)))))
(* (/ (sqrt F) (sqrt B)) (- (sqrt 2.0))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(2.0) / B;
double tmp;
if (B <= -1.4e+154) {
tmp = t_0 * sqrt((F * (C + hypot(C, B))));
} else if (B <= -2.55e-27) {
tmp = t_0 * sqrt((F * (-(B * B) / (A - hypot(A, B)))));
} else if (B <= 8e+35) {
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = (sqrt(F) / sqrt(B)) * -sqrt(2.0);
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt(2.0) / B;
double tmp;
if (B <= -1.4e+154) {
tmp = t_0 * Math.sqrt((F * (C + Math.hypot(C, B))));
} else if (B <= -2.55e-27) {
tmp = t_0 * Math.sqrt((F * (-(B * B) / (A - Math.hypot(A, B)))));
} else if (B <= 8e+35) {
tmp = -((Math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * Math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = (Math.sqrt(F) / Math.sqrt(B)) * -Math.sqrt(2.0);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt(2.0) / B tmp = 0 if B <= -1.4e+154: tmp = t_0 * math.sqrt((F * (C + math.hypot(C, B)))) elif B <= -2.55e-27: tmp = t_0 * math.sqrt((F * (-(B * B) / (A - math.hypot(A, B))))) elif B <= 8e+35: tmp = -((math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C)))) else: tmp = (math.sqrt(F) / math.sqrt(B)) * -math.sqrt(2.0) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(2.0) / B) tmp = 0.0 if (B <= -1.4e+154) tmp = Float64(t_0 * sqrt(Float64(F * Float64(C + hypot(C, B))))); elseif (B <= -2.55e-27) tmp = Float64(t_0 * sqrt(Float64(F * Float64(Float64(-Float64(B * B)) / Float64(A - hypot(A, B)))))); elseif (B <= 8e+35) tmp = Float64(-Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * sqrt(Float64(2.0 * C))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))); else tmp = Float64(Float64(sqrt(F) / sqrt(B)) * Float64(-sqrt(2.0))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt(2.0) / B;
tmp = 0.0;
if (B <= -1.4e+154)
tmp = t_0 * sqrt((F * (C + hypot(C, B))));
elseif (B <= -2.55e-27)
tmp = t_0 * sqrt((F * (-(B * B) / (A - hypot(A, B)))));
elseif (B <= 8e+35)
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
else
tmp = (sqrt(F) / sqrt(B)) * -sqrt(2.0);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -1.4e+154], N[(t$95$0 * N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -2.55e-27], N[(t$95$0 * N[Sqrt[N[(F * N[((-N[(B * B), $MachinePrecision]) / N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 8e+35], (-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[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B}\\
\mathbf{if}\;B \leq -1.4 \cdot 10^{+154}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}\\
\mathbf{elif}\;B \leq -2.55 \cdot 10^{-27}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \frac{-B \cdot B}{A - \mathsf{hypot}\left(A, B\right)}}\\
\mathbf{elif}\;B \leq 8 \cdot 10^{+35}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \sqrt{2 \cdot C}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < -1.4e154Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
sqrt-prod0.0%
*-commutative0.0%
*-commutative0.0%
associate-+l+0.0%
unpow20.0%
hypot-udef0.0%
associate-+r+0.0%
+-commutative0.0%
associate-+r+0.0%
Applied egg-rr0.0%
Taylor expanded in B around -inf 1.6%
mul-1-neg1.6%
Simplified1.6%
Taylor expanded in A around 0 2.6%
+-commutative2.6%
unpow22.6%
unpow22.6%
hypot-def42.6%
Simplified42.6%
if -1.4e154 < B < -2.55e-27Initial program 24.2%
associate-*l*24.2%
unpow224.2%
+-commutative24.2%
unpow224.2%
associate-*l*24.2%
unpow224.2%
Simplified24.2%
sqrt-prod27.7%
*-commutative27.7%
*-commutative27.7%
associate-+l+28.0%
unpow228.0%
hypot-udef33.2%
associate-+r+33.0%
+-commutative33.0%
associate-+r+32.8%
Applied egg-rr32.8%
Taylor expanded in B around -inf 51.7%
mul-1-neg51.7%
Simplified51.7%
Taylor expanded in C around 0 41.3%
+-commutative41.3%
unpow241.3%
unpow241.3%
hypot-def42.7%
Simplified42.7%
flip-+38.2%
hypot-udef38.2%
hypot-udef38.2%
add-sqr-sqrt38.2%
Applied egg-rr38.2%
unpow238.2%
unpow238.2%
unpow238.2%
associate--r+44.8%
+-inverses50.1%
unpow250.1%
Simplified50.1%
if -2.55e-27 < B < 7.9999999999999997e35Initial program 23.7%
associate-*l*23.7%
unpow223.7%
+-commutative23.7%
unpow223.7%
associate-*l*23.7%
unpow223.7%
Simplified23.7%
Taylor expanded in A around -inf 20.8%
sqrt-prod21.4%
*-commutative21.4%
cancel-sign-sub-inv21.4%
*-commutative21.4%
metadata-eval21.4%
Applied egg-rr21.4%
if 7.9999999999999997e35 < B Initial program 10.0%
Simplified13.4%
Taylor expanded in A around 0 20.5%
mul-1-neg20.5%
*-commutative20.5%
distribute-rgt-neg-in20.5%
*-commutative20.5%
unpow220.5%
unpow220.5%
hypot-def43.6%
Simplified43.6%
Taylor expanded in C around 0 33.4%
mul-1-neg33.4%
Simplified33.4%
sqrt-div53.3%
Applied egg-rr53.3%
Final simplification35.8%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B -1.9e+51)
(* (/ (sqrt 2.0) B) (sqrt (* F (+ C (hypot C B)))))
(if (<= B 8e+35)
(-
(/
(* (sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C)))))) (sqrt (* 2.0 C)))
(- (* B B) (* 4.0 (* A C)))))
(* (/ (sqrt F) (sqrt B)) (- (sqrt 2.0))))))assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -1.9e+51) {
tmp = (sqrt(2.0) / B) * sqrt((F * (C + hypot(C, B))));
} else if (B <= 8e+35) {
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = (sqrt(F) / sqrt(B)) * -sqrt(2.0);
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= -1.9e+51) {
tmp = (Math.sqrt(2.0) / B) * Math.sqrt((F * (C + Math.hypot(C, B))));
} else if (B <= 8e+35) {
tmp = -((Math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * Math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = (Math.sqrt(F) / Math.sqrt(B)) * -Math.sqrt(2.0);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -1.9e+51: tmp = (math.sqrt(2.0) / B) * math.sqrt((F * (C + math.hypot(C, B)))) elif B <= 8e+35: tmp = -((math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C)))) else: tmp = (math.sqrt(F) / math.sqrt(B)) * -math.sqrt(2.0) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -1.9e+51) tmp = Float64(Float64(sqrt(2.0) / B) * sqrt(Float64(F * Float64(C + hypot(C, B))))); elseif (B <= 8e+35) tmp = Float64(-Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * sqrt(Float64(2.0 * C))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))); else tmp = Float64(Float64(sqrt(F) / sqrt(B)) * Float64(-sqrt(2.0))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -1.9e+51)
tmp = (sqrt(2.0) / B) * sqrt((F * (C + hypot(C, B))));
elseif (B <= 8e+35)
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
else
tmp = (sqrt(F) / sqrt(B)) * -sqrt(2.0);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, -1.9e+51], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 8e+35], (-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[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.9 \cdot 10^{+51}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}\\
\mathbf{elif}\;B \leq 8 \cdot 10^{+35}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \sqrt{2 \cdot C}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < -1.8999999999999999e51Initial program 9.0%
associate-*l*9.0%
unpow29.0%
+-commutative9.0%
unpow29.0%
associate-*l*9.0%
unpow29.0%
Simplified9.0%
sqrt-prod12.0%
*-commutative12.0%
*-commutative12.0%
associate-+l+12.0%
unpow212.0%
hypot-udef12.2%
associate-+r+12.1%
+-commutative12.1%
associate-+r+12.0%
Applied egg-rr12.0%
Taylor expanded in B around -inf 25.6%
mul-1-neg25.6%
Simplified25.6%
Taylor expanded in A around 0 21.9%
+-commutative21.9%
unpow221.9%
unpow221.9%
hypot-def45.4%
Simplified45.4%
if -1.8999999999999999e51 < B < 7.9999999999999997e35Initial program 24.2%
associate-*l*24.2%
unpow224.2%
+-commutative24.2%
unpow224.2%
associate-*l*24.2%
unpow224.2%
Simplified24.2%
Taylor expanded in A around -inf 19.8%
sqrt-prod20.2%
*-commutative20.2%
cancel-sign-sub-inv20.2%
*-commutative20.2%
metadata-eval20.2%
Applied egg-rr20.2%
if 7.9999999999999997e35 < B Initial program 10.0%
Simplified13.4%
Taylor expanded in A around 0 20.5%
mul-1-neg20.5%
*-commutative20.5%
distribute-rgt-neg-in20.5%
*-commutative20.5%
unpow220.5%
unpow220.5%
hypot-def43.6%
Simplified43.6%
Taylor expanded in C around 0 33.4%
mul-1-neg33.4%
Simplified33.4%
sqrt-div53.3%
Applied egg-rr53.3%
Final simplification33.6%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B -1.9e+51)
(* (/ (sqrt 2.0) B) (sqrt (* B (- F))))
(if (<= B 1.45e+35)
(-
(/
(* (sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C)))))) (sqrt (* 2.0 C)))
(- (* B B) (* 4.0 (* A C)))))
(* (/ (sqrt F) (sqrt B)) (- (sqrt 2.0))))))assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -1.9e+51) {
tmp = (sqrt(2.0) / B) * sqrt((B * -F));
} else if (B <= 1.45e+35) {
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = (sqrt(F) / sqrt(B)) * -sqrt(2.0);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= (-1.9d+51)) then
tmp = (sqrt(2.0d0) / b) * sqrt((b * -f))
else if (b <= 1.45d+35) then
tmp = -((sqrt((2.0d0 * (f * ((b * b) + ((-4.0d0) * (a * c)))))) * sqrt((2.0d0 * c))) / ((b * b) - (4.0d0 * (a * c))))
else
tmp = (sqrt(f) / sqrt(b)) * -sqrt(2.0d0)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= -1.9e+51) {
tmp = (Math.sqrt(2.0) / B) * Math.sqrt((B * -F));
} else if (B <= 1.45e+35) {
tmp = -((Math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * Math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = (Math.sqrt(F) / Math.sqrt(B)) * -Math.sqrt(2.0);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -1.9e+51: tmp = (math.sqrt(2.0) / B) * math.sqrt((B * -F)) elif B <= 1.45e+35: tmp = -((math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C)))) else: tmp = (math.sqrt(F) / math.sqrt(B)) * -math.sqrt(2.0) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -1.9e+51) tmp = Float64(Float64(sqrt(2.0) / B) * sqrt(Float64(B * Float64(-F)))); elseif (B <= 1.45e+35) tmp = Float64(-Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * sqrt(Float64(2.0 * C))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))); else tmp = Float64(Float64(sqrt(F) / sqrt(B)) * Float64(-sqrt(2.0))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -1.9e+51)
tmp = (sqrt(2.0) / B) * sqrt((B * -F));
elseif (B <= 1.45e+35)
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
else
tmp = (sqrt(F) / sqrt(B)) * -sqrt(2.0);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, -1.9e+51], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[Sqrt[N[(B * (-F)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.45e+35], (-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[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.9 \cdot 10^{+51}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \sqrt{B \cdot \left(-F\right)}\\
\mathbf{elif}\;B \leq 1.45 \cdot 10^{+35}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \sqrt{2 \cdot C}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < -1.8999999999999999e51Initial program 9.0%
associate-*l*9.0%
unpow29.0%
+-commutative9.0%
unpow29.0%
associate-*l*9.0%
unpow29.0%
Simplified9.0%
sqrt-prod12.0%
*-commutative12.0%
*-commutative12.0%
associate-+l+12.0%
unpow212.0%
hypot-udef12.2%
associate-+r+12.1%
+-commutative12.1%
associate-+r+12.0%
Applied egg-rr12.0%
Taylor expanded in B around -inf 25.6%
mul-1-neg25.6%
Simplified25.6%
Taylor expanded in C around 0 23.3%
+-commutative23.3%
unpow223.3%
unpow223.3%
hypot-def45.0%
Simplified45.0%
Taylor expanded in B around -inf 42.2%
mul-1-neg42.2%
Simplified42.2%
if -1.8999999999999999e51 < B < 1.44999999999999997e35Initial program 24.2%
associate-*l*24.2%
unpow224.2%
+-commutative24.2%
unpow224.2%
associate-*l*24.2%
unpow224.2%
Simplified24.2%
Taylor expanded in A around -inf 19.8%
sqrt-prod20.2%
*-commutative20.2%
cancel-sign-sub-inv20.2%
*-commutative20.2%
metadata-eval20.2%
Applied egg-rr20.2%
if 1.44999999999999997e35 < B Initial program 10.0%
Simplified13.4%
Taylor expanded in A around 0 20.5%
mul-1-neg20.5%
*-commutative20.5%
distribute-rgt-neg-in20.5%
*-commutative20.5%
unpow220.5%
unpow220.5%
hypot-def43.6%
Simplified43.6%
Taylor expanded in C around 0 33.4%
mul-1-neg33.4%
Simplified33.4%
sqrt-div53.3%
Applied egg-rr53.3%
Final simplification32.9%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B)))
(if (<= B -2e+51)
(* t_0 (sqrt (* B (- F))))
(if (<= B 1.9e+35)
(-
(/
(* (sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C)))))) (sqrt (* 2.0 C)))
(- (* B B) (* 4.0 (* A C)))))
(* t_0 (- (sqrt (+ (* B F) (* F C)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(2.0) / B;
double tmp;
if (B <= -2e+51) {
tmp = t_0 * sqrt((B * -F));
} else if (B <= 1.9e+35) {
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = t_0 * -sqrt(((B * F) + (F * C)));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order 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 (b <= (-2d+51)) then
tmp = t_0 * sqrt((b * -f))
else if (b <= 1.9d+35) then
tmp = -((sqrt((2.0d0 * (f * ((b * b) + ((-4.0d0) * (a * c)))))) * sqrt((2.0d0 * c))) / ((b * b) - (4.0d0 * (a * c))))
else
tmp = t_0 * -sqrt(((b * f) + (f * c)))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt(2.0) / B;
double tmp;
if (B <= -2e+51) {
tmp = t_0 * Math.sqrt((B * -F));
} else if (B <= 1.9e+35) {
tmp = -((Math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * Math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
} else {
tmp = t_0 * -Math.sqrt(((B * F) + (F * C)));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt(2.0) / B tmp = 0 if B <= -2e+51: tmp = t_0 * math.sqrt((B * -F)) elif B <= 1.9e+35: tmp = -((math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * math.sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C)))) else: tmp = t_0 * -math.sqrt(((B * F) + (F * C))) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(2.0) / B) tmp = 0.0 if (B <= -2e+51) tmp = Float64(t_0 * sqrt(Float64(B * Float64(-F)))); elseif (B <= 1.9e+35) tmp = Float64(-Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) * sqrt(Float64(2.0 * C))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))); else tmp = Float64(t_0 * Float64(-sqrt(Float64(Float64(B * F) + Float64(F * C))))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt(2.0) / B;
tmp = 0.0;
if (B <= -2e+51)
tmp = t_0 * sqrt((B * -F));
elseif (B <= 1.9e+35)
tmp = -((sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / ((B * B) - (4.0 * (A * C))));
else
tmp = t_0 * -sqrt(((B * F) + (F * C)));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -2e+51], N[(t$95$0 * N[Sqrt[N[(B * (-F)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.9e+35], (-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[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(t$95$0 * (-N[Sqrt[N[(N[(B * F), $MachinePrecision] + N[(F * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B}\\
\mathbf{if}\;B \leq -2 \cdot 10^{+51}:\\
\;\;\;\;t_0 \cdot \sqrt{B \cdot \left(-F\right)}\\
\mathbf{elif}\;B \leq 1.9 \cdot 10^{+35}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \sqrt{2 \cdot C}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{B \cdot F + F \cdot C}\right)\\
\end{array}
\end{array}
if B < -2e51Initial program 9.0%
associate-*l*9.0%
unpow29.0%
+-commutative9.0%
unpow29.0%
associate-*l*9.0%
unpow29.0%
Simplified9.0%
sqrt-prod12.0%
*-commutative12.0%
*-commutative12.0%
associate-+l+12.0%
unpow212.0%
hypot-udef12.2%
associate-+r+12.1%
+-commutative12.1%
associate-+r+12.0%
Applied egg-rr12.0%
Taylor expanded in B around -inf 25.6%
mul-1-neg25.6%
Simplified25.6%
Taylor expanded in C around 0 23.3%
+-commutative23.3%
unpow223.3%
unpow223.3%
hypot-def45.0%
Simplified45.0%
Taylor expanded in B around -inf 42.2%
mul-1-neg42.2%
Simplified42.2%
if -2e51 < B < 1.9e35Initial program 24.2%
associate-*l*24.2%
unpow224.2%
+-commutative24.2%
unpow224.2%
associate-*l*24.2%
unpow224.2%
Simplified24.2%
Taylor expanded in A around -inf 19.8%
sqrt-prod20.2%
*-commutative20.2%
cancel-sign-sub-inv20.2%
*-commutative20.2%
metadata-eval20.2%
Applied egg-rr20.2%
if 1.9e35 < B Initial program 10.0%
Simplified13.4%
Taylor expanded in A around 0 20.5%
mul-1-neg20.5%
*-commutative20.5%
distribute-rgt-neg-in20.5%
*-commutative20.5%
unpow220.5%
unpow220.5%
hypot-def43.6%
Simplified43.6%
Taylor expanded in C around 0 40.1%
Final simplification30.0%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (sqrt (* F C))))
(if (<= B -7.2e+152)
(* 2.0 (* (/ 1.0 B) t_1))
(if (<= B -7e+77)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A (- C B))))) t_0)
(if (<= B -3.6e+51)
(/ (* -2.0 (- (* B t_1))) t_0)
(if (<= B 5500.0)
(/ (- (sqrt (* (* F (+ (* B B) (* -4.0 (* A C)))) (* C 4.0)))) t_0)
(* (/ (- (sqrt 2.0)) B) (sqrt (* B F)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = sqrt((F * C));
double tmp;
if (B <= -7.2e+152) {
tmp = 2.0 * ((1.0 / B) * t_1);
} else if (B <= -7e+77) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= -3.6e+51) {
tmp = (-2.0 * -(B * t_1)) / t_0;
} else if (B <= 5500.0) {
tmp = -sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / t_0;
} else {
tmp = (-sqrt(2.0) / B) * sqrt((B * F));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = sqrt((f * c))
if (b <= (-7.2d+152)) then
tmp = 2.0d0 * ((1.0d0 / b) * t_1)
else if (b <= (-7d+77)) then
tmp = -sqrt(((2.0d0 * (f * t_0)) * (a + (c - b)))) / t_0
else if (b <= (-3.6d+51)) then
tmp = ((-2.0d0) * -(b * t_1)) / t_0
else if (b <= 5500.0d0) then
tmp = -sqrt(((f * ((b * b) + ((-4.0d0) * (a * c)))) * (c * 4.0d0))) / t_0
else
tmp = (-sqrt(2.0d0) / b) * sqrt((b * f))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = Math.sqrt((F * C));
double tmp;
if (B <= -7.2e+152) {
tmp = 2.0 * ((1.0 / B) * t_1);
} else if (B <= -7e+77) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= -3.6e+51) {
tmp = (-2.0 * -(B * t_1)) / t_0;
} else if (B <= 5500.0) {
tmp = -Math.sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / t_0;
} else {
tmp = (-Math.sqrt(2.0) / B) * Math.sqrt((B * F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = math.sqrt((F * C)) tmp = 0 if B <= -7.2e+152: tmp = 2.0 * ((1.0 / B) * t_1) elif B <= -7e+77: tmp = -math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0 elif B <= -3.6e+51: tmp = (-2.0 * -(B * t_1)) / t_0 elif B <= 5500.0: tmp = -math.sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / t_0 else: tmp = (-math.sqrt(2.0) / B) * math.sqrt((B * F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = sqrt(Float64(F * C)) tmp = 0.0 if (B <= -7.2e+152) tmp = Float64(2.0 * Float64(Float64(1.0 / B) * t_1)); elseif (B <= -7e+77) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + Float64(C - B))))) / t_0); elseif (B <= -3.6e+51) tmp = Float64(Float64(-2.0 * Float64(-Float64(B * t_1))) / t_0); elseif (B <= 5500.0) tmp = Float64(Float64(-sqrt(Float64(Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))) * Float64(C * 4.0)))) / t_0); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(B * F))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = sqrt((F * C));
tmp = 0.0;
if (B <= -7.2e+152)
tmp = 2.0 * ((1.0 / B) * t_1);
elseif (B <= -7e+77)
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
elseif (B <= -3.6e+51)
tmp = (-2.0 * -(B * t_1)) / t_0;
elseif (B <= 5500.0)
tmp = -sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / t_0;
else
tmp = (-sqrt(2.0) / B) * sqrt((B * F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(F * C), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -7.2e+152], N[(2.0 * N[(N[(1.0 / B), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -7e+77], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, -3.6e+51], N[(N[(-2.0 * (-N[(B * t$95$1), $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 5500.0], N[((-N[Sqrt[N[(N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \sqrt{F \cdot C}\\
\mathbf{if}\;B \leq -7.2 \cdot 10^{+152}:\\
\;\;\;\;2 \cdot \left(\frac{1}{B} \cdot t_1\right)\\
\mathbf{elif}\;B \leq -7 \cdot 10^{+77}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq -3.6 \cdot 10^{+51}:\\
\;\;\;\;\frac{-2 \cdot \left(-B \cdot t_1\right)}{t_0}\\
\mathbf{elif}\;B \leq 5500:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right) \cdot \left(C \cdot 4\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{B \cdot F}\\
\end{array}
\end{array}
if B < -7.1999999999999998e152Initial program 0.1%
associate-*l*0.1%
unpow20.1%
+-commutative0.1%
unpow20.1%
associate-*l*0.1%
unpow20.1%
Simplified0.1%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 6.3%
if -7.1999999999999998e152 < B < -7.0000000000000003e77Initial program 29.8%
associate-*l*29.8%
unpow229.8%
+-commutative29.8%
unpow229.8%
associate-*l*29.8%
unpow229.8%
Simplified29.8%
Taylor expanded in B around -inf 28.9%
mul-1-neg28.9%
unsub-neg28.9%
Simplified28.9%
if -7.0000000000000003e77 < B < -3.60000000000000011e51Initial program 3.8%
associate-*l*3.8%
unpow23.8%
+-commutative3.8%
unpow23.8%
associate-*l*3.8%
unpow23.8%
Simplified3.8%
Taylor expanded in A around -inf 4.1%
Taylor expanded in B around -inf 4.9%
if -3.60000000000000011e51 < B < 5500Initial program 23.2%
associate-*l*23.2%
unpow223.2%
+-commutative23.2%
unpow223.2%
associate-*l*23.2%
unpow223.2%
Simplified23.2%
Taylor expanded in A around -inf 20.1%
Taylor expanded in F around 0 20.1%
associate-*r*20.1%
cancel-sign-sub-inv20.1%
unpow220.1%
metadata-eval20.1%
Simplified20.1%
if 5500 < B Initial program 13.0%
Simplified16.2%
Taylor expanded in A around 0 22.9%
mul-1-neg22.9%
*-commutative22.9%
distribute-rgt-neg-in22.9%
*-commutative22.9%
unpow222.9%
unpow222.9%
hypot-def44.9%
Simplified44.9%
Taylor expanded in C around 0 40.5%
Final simplification23.0%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B)))
(if (<= B -1.9e+51)
(* t_0 (sqrt (* B (- F))))
(if (<= B 3700.0)
(/
(- (sqrt (* (* F (+ (* B B) (* -4.0 (* A C)))) (* C 4.0))))
(- (* B B) (* 4.0 (* A C))))
(* t_0 (- (sqrt (+ (* B F) (* F C)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(2.0) / B;
double tmp;
if (B <= -1.9e+51) {
tmp = t_0 * sqrt((B * -F));
} else if (B <= 3700.0) {
tmp = -sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = t_0 * -sqrt(((B * F) + (F * C)));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order 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 (b <= (-1.9d+51)) then
tmp = t_0 * sqrt((b * -f))
else if (b <= 3700.0d0) then
tmp = -sqrt(((f * ((b * b) + ((-4.0d0) * (a * c)))) * (c * 4.0d0))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = t_0 * -sqrt(((b * f) + (f * c)))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt(2.0) / B;
double tmp;
if (B <= -1.9e+51) {
tmp = t_0 * Math.sqrt((B * -F));
} else if (B <= 3700.0) {
tmp = -Math.sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = t_0 * -Math.sqrt(((B * F) + (F * C)));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt(2.0) / B tmp = 0 if B <= -1.9e+51: tmp = t_0 * math.sqrt((B * -F)) elif B <= 3700.0: tmp = -math.sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C))) else: tmp = t_0 * -math.sqrt(((B * F) + (F * C))) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(2.0) / B) tmp = 0.0 if (B <= -1.9e+51) tmp = Float64(t_0 * sqrt(Float64(B * Float64(-F)))); elseif (B <= 3700.0) tmp = Float64(Float64(-sqrt(Float64(Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))) * Float64(C * 4.0)))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(t_0 * Float64(-sqrt(Float64(Float64(B * F) + Float64(F * C))))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt(2.0) / B;
tmp = 0.0;
if (B <= -1.9e+51)
tmp = t_0 * sqrt((B * -F));
elseif (B <= 3700.0)
tmp = -sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C)));
else
tmp = t_0 * -sqrt(((B * F) + (F * C)));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -1.9e+51], N[(t$95$0 * N[Sqrt[N[(B * (-F)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 3700.0], N[((-N[Sqrt[N[(N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * (-N[Sqrt[N[(N[(B * F), $MachinePrecision] + N[(F * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B}\\
\mathbf{if}\;B \leq -1.9 \cdot 10^{+51}:\\
\;\;\;\;t_0 \cdot \sqrt{B \cdot \left(-F\right)}\\
\mathbf{elif}\;B \leq 3700:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right) \cdot \left(C \cdot 4\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{B \cdot F + F \cdot C}\right)\\
\end{array}
\end{array}
if B < -1.8999999999999999e51Initial program 9.0%
associate-*l*9.0%
unpow29.0%
+-commutative9.0%
unpow29.0%
associate-*l*9.0%
unpow29.0%
Simplified9.0%
sqrt-prod12.0%
*-commutative12.0%
*-commutative12.0%
associate-+l+12.0%
unpow212.0%
hypot-udef12.2%
associate-+r+12.1%
+-commutative12.1%
associate-+r+12.0%
Applied egg-rr12.0%
Taylor expanded in B around -inf 25.6%
mul-1-neg25.6%
Simplified25.6%
Taylor expanded in C around 0 23.3%
+-commutative23.3%
unpow223.3%
unpow223.3%
hypot-def45.0%
Simplified45.0%
Taylor expanded in B around -inf 42.2%
mul-1-neg42.2%
Simplified42.2%
if -1.8999999999999999e51 < B < 3700Initial program 23.2%
associate-*l*23.2%
unpow223.2%
+-commutative23.2%
unpow223.2%
associate-*l*23.2%
unpow223.2%
Simplified23.2%
Taylor expanded in A around -inf 20.1%
Taylor expanded in F around 0 20.1%
associate-*r*20.1%
cancel-sign-sub-inv20.1%
unpow220.1%
metadata-eval20.1%
Simplified20.1%
if 3700 < B Initial program 13.0%
Simplified16.2%
Taylor expanded in A around 0 22.9%
mul-1-neg22.9%
*-commutative22.9%
distribute-rgt-neg-in22.9%
*-commutative22.9%
unpow222.9%
unpow222.9%
hypot-def44.9%
Simplified44.9%
Taylor expanded in C around 0 40.3%
Final simplification30.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B -2e+51)
(* (/ (sqrt 2.0) B) (sqrt (* B (- F))))
(if (<= B 32.0)
(/
(- (sqrt (* (* F (+ (* B B) (* -4.0 (* A C)))) (* C 4.0))))
(- (* B B) (* 4.0 (* A C))))
(* (/ (- (sqrt 2.0)) B) (sqrt (* B F))))))assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -2e+51) {
tmp = (sqrt(2.0) / B) * sqrt((B * -F));
} else if (B <= 32.0) {
tmp = -sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (-sqrt(2.0) / B) * sqrt((B * F));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= (-2d+51)) then
tmp = (sqrt(2.0d0) / b) * sqrt((b * -f))
else if (b <= 32.0d0) then
tmp = -sqrt(((f * ((b * b) + ((-4.0d0) * (a * c)))) * (c * 4.0d0))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = (-sqrt(2.0d0) / b) * sqrt((b * f))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= -2e+51) {
tmp = (Math.sqrt(2.0) / B) * Math.sqrt((B * -F));
} else if (B <= 32.0) {
tmp = -Math.sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (-Math.sqrt(2.0) / B) * Math.sqrt((B * F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -2e+51: tmp = (math.sqrt(2.0) / B) * math.sqrt((B * -F)) elif B <= 32.0: tmp = -math.sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C))) else: tmp = (-math.sqrt(2.0) / B) * math.sqrt((B * F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -2e+51) tmp = Float64(Float64(sqrt(2.0) / B) * sqrt(Float64(B * Float64(-F)))); elseif (B <= 32.0) tmp = Float64(Float64(-sqrt(Float64(Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))) * Float64(C * 4.0)))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(B * F))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -2e+51)
tmp = (sqrt(2.0) / B) * sqrt((B * -F));
elseif (B <= 32.0)
tmp = -sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C)));
else
tmp = (-sqrt(2.0) / B) * sqrt((B * F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, -2e+51], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[Sqrt[N[(B * (-F)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 32.0], N[((-N[Sqrt[N[(N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2 \cdot 10^{+51}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \sqrt{B \cdot \left(-F\right)}\\
\mathbf{elif}\;B \leq 32:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right) \cdot \left(C \cdot 4\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{B \cdot F}\\
\end{array}
\end{array}
if B < -2e51Initial program 9.0%
associate-*l*9.0%
unpow29.0%
+-commutative9.0%
unpow29.0%
associate-*l*9.0%
unpow29.0%
Simplified9.0%
sqrt-prod12.0%
*-commutative12.0%
*-commutative12.0%
associate-+l+12.0%
unpow212.0%
hypot-udef12.2%
associate-+r+12.1%
+-commutative12.1%
associate-+r+12.0%
Applied egg-rr12.0%
Taylor expanded in B around -inf 25.6%
mul-1-neg25.6%
Simplified25.6%
Taylor expanded in C around 0 23.3%
+-commutative23.3%
unpow223.3%
unpow223.3%
hypot-def45.0%
Simplified45.0%
Taylor expanded in B around -inf 42.2%
mul-1-neg42.2%
Simplified42.2%
if -2e51 < B < 32Initial program 23.2%
associate-*l*23.2%
unpow223.2%
+-commutative23.2%
unpow223.2%
associate-*l*23.2%
unpow223.2%
Simplified23.2%
Taylor expanded in A around -inf 20.1%
Taylor expanded in F around 0 20.1%
associate-*r*20.1%
cancel-sign-sub-inv20.1%
unpow220.1%
metadata-eval20.1%
Simplified20.1%
if 32 < B Initial program 13.0%
Simplified16.2%
Taylor expanded in A around 0 22.9%
mul-1-neg22.9%
*-commutative22.9%
distribute-rgt-neg-in22.9%
*-commutative22.9%
unpow222.9%
unpow222.9%
hypot-def44.9%
Simplified44.9%
Taylor expanded in C around 0 40.5%
Final simplification30.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (sqrt (* F C))))
(if (<= B -1.85e+152)
(* 2.0 (* (/ 1.0 B) t_1))
(if (<= B -4.6e+77)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A (- C B))))) t_0)
(if (<= B -2.5e+51)
(/ (* -2.0 (- (* B t_1))) t_0)
(if (<= B 185.0)
(/ (- (sqrt (* (* F (+ (* B B) (* -4.0 (* A C)))) (* C 4.0)))) t_0)
(- (sqrt (* 2.0 (/ F B))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = sqrt((F * C));
double tmp;
if (B <= -1.85e+152) {
tmp = 2.0 * ((1.0 / B) * t_1);
} else if (B <= -4.6e+77) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= -2.5e+51) {
tmp = (-2.0 * -(B * t_1)) / t_0;
} else if (B <= 185.0) {
tmp = -sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / t_0;
} else {
tmp = -sqrt((2.0 * (F / B)));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = sqrt((f * c))
if (b <= (-1.85d+152)) then
tmp = 2.0d0 * ((1.0d0 / b) * t_1)
else if (b <= (-4.6d+77)) then
tmp = -sqrt(((2.0d0 * (f * t_0)) * (a + (c - b)))) / t_0
else if (b <= (-2.5d+51)) then
tmp = ((-2.0d0) * -(b * t_1)) / t_0
else if (b <= 185.0d0) then
tmp = -sqrt(((f * ((b * b) + ((-4.0d0) * (a * c)))) * (c * 4.0d0))) / t_0
else
tmp = -sqrt((2.0d0 * (f / b)))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = Math.sqrt((F * C));
double tmp;
if (B <= -1.85e+152) {
tmp = 2.0 * ((1.0 / B) * t_1);
} else if (B <= -4.6e+77) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= -2.5e+51) {
tmp = (-2.0 * -(B * t_1)) / t_0;
} else if (B <= 185.0) {
tmp = -Math.sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / t_0;
} else {
tmp = -Math.sqrt((2.0 * (F / B)));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = math.sqrt((F * C)) tmp = 0 if B <= -1.85e+152: tmp = 2.0 * ((1.0 / B) * t_1) elif B <= -4.6e+77: tmp = -math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0 elif B <= -2.5e+51: tmp = (-2.0 * -(B * t_1)) / t_0 elif B <= 185.0: tmp = -math.sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / t_0 else: tmp = -math.sqrt((2.0 * (F / B))) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = sqrt(Float64(F * C)) tmp = 0.0 if (B <= -1.85e+152) tmp = Float64(2.0 * Float64(Float64(1.0 / B) * t_1)); elseif (B <= -4.6e+77) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + Float64(C - B))))) / t_0); elseif (B <= -2.5e+51) tmp = Float64(Float64(-2.0 * Float64(-Float64(B * t_1))) / t_0); elseif (B <= 185.0) tmp = Float64(Float64(-sqrt(Float64(Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))) * Float64(C * 4.0)))) / t_0); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = sqrt((F * C));
tmp = 0.0;
if (B <= -1.85e+152)
tmp = 2.0 * ((1.0 / B) * t_1);
elseif (B <= -4.6e+77)
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
elseif (B <= -2.5e+51)
tmp = (-2.0 * -(B * t_1)) / t_0;
elseif (B <= 185.0)
tmp = -sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / t_0;
else
tmp = -sqrt((2.0 * (F / B)));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(F * C), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -1.85e+152], N[(2.0 * N[(N[(1.0 / B), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -4.6e+77], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, -2.5e+51], N[(N[(-2.0 * (-N[(B * t$95$1), $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 185.0], N[((-N[Sqrt[N[(N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \sqrt{F \cdot C}\\
\mathbf{if}\;B \leq -1.85 \cdot 10^{+152}:\\
\;\;\;\;2 \cdot \left(\frac{1}{B} \cdot t_1\right)\\
\mathbf{elif}\;B \leq -4.6 \cdot 10^{+77}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq -2.5 \cdot 10^{+51}:\\
\;\;\;\;\frac{-2 \cdot \left(-B \cdot t_1\right)}{t_0}\\
\mathbf{elif}\;B \leq 185:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right) \cdot \left(C \cdot 4\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\end{array}
\end{array}
if B < -1.84999999999999998e152Initial program 0.1%
associate-*l*0.1%
unpow20.1%
+-commutative0.1%
unpow20.1%
associate-*l*0.1%
unpow20.1%
Simplified0.1%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 6.3%
if -1.84999999999999998e152 < B < -4.5999999999999999e77Initial program 29.8%
associate-*l*29.8%
unpow229.8%
+-commutative29.8%
unpow229.8%
associate-*l*29.8%
unpow229.8%
Simplified29.8%
Taylor expanded in B around -inf 28.9%
mul-1-neg28.9%
unsub-neg28.9%
Simplified28.9%
if -4.5999999999999999e77 < B < -2.5e51Initial program 3.8%
associate-*l*3.8%
unpow23.8%
+-commutative3.8%
unpow23.8%
associate-*l*3.8%
unpow23.8%
Simplified3.8%
Taylor expanded in A around -inf 4.1%
Taylor expanded in B around -inf 4.9%
if -2.5e51 < B < 185Initial program 23.2%
associate-*l*23.2%
unpow223.2%
+-commutative23.2%
unpow223.2%
associate-*l*23.2%
unpow223.2%
Simplified23.2%
Taylor expanded in A around -inf 20.1%
Taylor expanded in F around 0 20.1%
associate-*r*20.1%
cancel-sign-sub-inv20.1%
unpow220.1%
metadata-eval20.1%
Simplified20.1%
if 185 < B Initial program 13.0%
Simplified16.2%
Taylor expanded in A around 0 22.9%
mul-1-neg22.9%
*-commutative22.9%
distribute-rgt-neg-in22.9%
*-commutative22.9%
unpow222.9%
unpow222.9%
hypot-def44.9%
Simplified44.9%
Taylor expanded in C around 0 33.7%
mul-1-neg33.7%
Simplified33.7%
pow133.7%
sqrt-unprod33.8%
Applied egg-rr33.8%
unpow133.8%
Simplified33.8%
Final simplification21.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B -2.9e+51)
(* 2.0 (* (/ 1.0 B) (sqrt (* F C))))
(if (<= B 57.0)
(/
(- (sqrt (* (* F (+ (* B B) (* -4.0 (* A C)))) (* C 4.0))))
(- (* B B) (* 4.0 (* A C))))
(- (sqrt (* 2.0 (/ F B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -2.9e+51) {
tmp = 2.0 * ((1.0 / B) * sqrt((F * C)));
} else if (B <= 57.0) {
tmp = -sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -sqrt((2.0 * (F / B)));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= (-2.9d+51)) then
tmp = 2.0d0 * ((1.0d0 / b) * sqrt((f * c)))
else if (b <= 57.0d0) then
tmp = -sqrt(((f * ((b * b) + ((-4.0d0) * (a * c)))) * (c * 4.0d0))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = -sqrt((2.0d0 * (f / b)))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= -2.9e+51) {
tmp = 2.0 * ((1.0 / B) * Math.sqrt((F * C)));
} else if (B <= 57.0) {
tmp = -Math.sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -Math.sqrt((2.0 * (F / B)));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -2.9e+51: tmp = 2.0 * ((1.0 / B) * math.sqrt((F * C))) elif B <= 57.0: tmp = -math.sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C))) else: tmp = -math.sqrt((2.0 * (F / B))) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -2.9e+51) tmp = Float64(2.0 * Float64(Float64(1.0 / B) * sqrt(Float64(F * C)))); elseif (B <= 57.0) tmp = Float64(Float64(-sqrt(Float64(Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))) * Float64(C * 4.0)))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -2.9e+51)
tmp = 2.0 * ((1.0 / B) * sqrt((F * C)));
elseif (B <= 57.0)
tmp = -sqrt(((F * ((B * B) + (-4.0 * (A * C)))) * (C * 4.0))) / ((B * B) - (4.0 * (A * C)));
else
tmp = -sqrt((2.0 * (F / B)));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, -2.9e+51], N[(2.0 * N[(N[(1.0 / B), $MachinePrecision] * N[Sqrt[N[(F * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 57.0], N[((-N[Sqrt[N[(N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2.9 \cdot 10^{+51}:\\
\;\;\;\;2 \cdot \left(\frac{1}{B} \cdot \sqrt{F \cdot C}\right)\\
\mathbf{elif}\;B \leq 57:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right) \cdot \left(C \cdot 4\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\end{array}
\end{array}
if B < -2.8999999999999998e51Initial program 9.0%
associate-*l*9.0%
unpow29.0%
+-commutative9.0%
unpow29.0%
associate-*l*9.0%
unpow29.0%
Simplified9.0%
Taylor expanded in A around -inf 1.3%
Taylor expanded in B around -inf 5.4%
if -2.8999999999999998e51 < B < 57Initial program 23.2%
associate-*l*23.2%
unpow223.2%
+-commutative23.2%
unpow223.2%
associate-*l*23.2%
unpow223.2%
Simplified23.2%
Taylor expanded in A around -inf 20.1%
Taylor expanded in F around 0 20.1%
associate-*r*20.1%
cancel-sign-sub-inv20.1%
unpow220.1%
metadata-eval20.1%
Simplified20.1%
if 57 < B Initial program 13.0%
Simplified16.2%
Taylor expanded in A around 0 22.9%
mul-1-neg22.9%
*-commutative22.9%
distribute-rgt-neg-in22.9%
*-commutative22.9%
unpow222.9%
unpow222.9%
hypot-def44.9%
Simplified44.9%
Taylor expanded in C around 0 33.7%
mul-1-neg33.7%
Simplified33.7%
pow133.7%
sqrt-unprod33.8%
Applied egg-rr33.8%
unpow133.8%
Simplified33.8%
Final simplification19.7%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (* F C))))
(if (<= B -2e+51)
(* 2.0 (* (/ 1.0 B) t_0))
(if (<= B 4.6e-32)
(- (/ (sqrt (* -16.0 (* F (* A (* C C))))) (- (* B B) (* 4.0 (* A C)))))
(if (<= B 1.25e+58) (/ (* -2.0 t_0) B) (- (sqrt (* 2.0 (/ F B)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((F * C));
double tmp;
if (B <= -2e+51) {
tmp = 2.0 * ((1.0 / B) * t_0);
} else if (B <= 4.6e-32) {
tmp = -(sqrt((-16.0 * (F * (A * (C * C))))) / ((B * B) - (4.0 * (A * C))));
} else if (B <= 1.25e+58) {
tmp = (-2.0 * t_0) / B;
} else {
tmp = -sqrt((2.0 * (F / B)));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order 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((f * c))
if (b <= (-2d+51)) then
tmp = 2.0d0 * ((1.0d0 / b) * t_0)
else if (b <= 4.6d-32) then
tmp = -(sqrt(((-16.0d0) * (f * (a * (c * c))))) / ((b * b) - (4.0d0 * (a * c))))
else if (b <= 1.25d+58) then
tmp = ((-2.0d0) * t_0) / b
else
tmp = -sqrt((2.0d0 * (f / b)))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt((F * C));
double tmp;
if (B <= -2e+51) {
tmp = 2.0 * ((1.0 / B) * t_0);
} else if (B <= 4.6e-32) {
tmp = -(Math.sqrt((-16.0 * (F * (A * (C * C))))) / ((B * B) - (4.0 * (A * C))));
} else if (B <= 1.25e+58) {
tmp = (-2.0 * t_0) / B;
} else {
tmp = -Math.sqrt((2.0 * (F / B)));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((F * C)) tmp = 0 if B <= -2e+51: tmp = 2.0 * ((1.0 / B) * t_0) elif B <= 4.6e-32: tmp = -(math.sqrt((-16.0 * (F * (A * (C * C))))) / ((B * B) - (4.0 * (A * C)))) elif B <= 1.25e+58: tmp = (-2.0 * t_0) / B else: tmp = -math.sqrt((2.0 * (F / B))) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(F * C)) tmp = 0.0 if (B <= -2e+51) tmp = Float64(2.0 * Float64(Float64(1.0 / B) * t_0)); elseif (B <= 4.6e-32) tmp = Float64(-Float64(sqrt(Float64(-16.0 * Float64(F * Float64(A * Float64(C * C))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))); elseif (B <= 1.25e+58) tmp = Float64(Float64(-2.0 * t_0) / B); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt((F * C));
tmp = 0.0;
if (B <= -2e+51)
tmp = 2.0 * ((1.0 / B) * t_0);
elseif (B <= 4.6e-32)
tmp = -(sqrt((-16.0 * (F * (A * (C * C))))) / ((B * B) - (4.0 * (A * C))));
elseif (B <= 1.25e+58)
tmp = (-2.0 * t_0) / B;
else
tmp = -sqrt((2.0 * (F / B)));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(F * C), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -2e+51], N[(2.0 * N[(N[(1.0 / B), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 4.6e-32], (-N[(N[Sqrt[N[(-16.0 * N[(F * N[(A * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[B, 1.25e+58], N[(N[(-2.0 * t$95$0), $MachinePrecision] / B), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{F \cdot C}\\
\mathbf{if}\;B \leq -2 \cdot 10^{+51}:\\
\;\;\;\;2 \cdot \left(\frac{1}{B} \cdot t_0\right)\\
\mathbf{elif}\;B \leq 4.6 \cdot 10^{-32}:\\
\;\;\;\;-\frac{\sqrt{-16 \cdot \left(F \cdot \left(A \cdot \left(C \cdot C\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B \leq 1.25 \cdot 10^{+58}:\\
\;\;\;\;\frac{-2 \cdot t_0}{B}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\end{array}
\end{array}
if B < -2e51Initial program 9.0%
associate-*l*9.0%
unpow29.0%
+-commutative9.0%
unpow29.0%
associate-*l*9.0%
unpow29.0%
Simplified9.0%
Taylor expanded in A around -inf 1.3%
Taylor expanded in B around -inf 5.4%
if -2e51 < B < 4.6000000000000001e-32Initial program 21.7%
associate-*l*21.7%
unpow221.7%
+-commutative21.7%
unpow221.7%
associate-*l*21.7%
unpow221.7%
Simplified21.7%
Taylor expanded in A around -inf 20.1%
Taylor expanded in B around 0 12.9%
associate-*r*14.3%
unpow214.3%
Simplified14.3%
if 4.6000000000000001e-32 < B < 1.24999999999999996e58Initial program 55.6%
associate-*l*55.6%
unpow255.6%
+-commutative55.6%
unpow255.6%
associate-*l*55.6%
unpow255.6%
Simplified55.6%
Taylor expanded in A around -inf 10.6%
Taylor expanded in B around inf 25.3%
pow125.3%
*-commutative25.3%
un-div-inv25.4%
*-commutative25.4%
Applied egg-rr25.4%
unpow125.4%
associate-*l/25.4%
Simplified25.4%
if 1.24999999999999996e58 < B Initial program 6.9%
Simplified8.7%
Taylor expanded in A around 0 16.5%
mul-1-neg16.5%
*-commutative16.5%
distribute-rgt-neg-in16.5%
*-commutative16.5%
unpow216.5%
unpow216.5%
hypot-def41.8%
Simplified41.8%
Taylor expanded in C around 0 34.2%
mul-1-neg34.2%
Simplified34.2%
pow134.2%
sqrt-unprod34.4%
Applied egg-rr34.4%
unpow134.4%
Simplified34.4%
Final simplification16.7%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= C 4.1e-59) (- (sqrt (* 2.0 (/ F B)))) (/ (* -2.0 (pow (* F C) 0.5)) B)))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (C <= 4.1e-59) {
tmp = -sqrt((2.0 * (F / B)));
} else {
tmp = (-2.0 * pow((F * C), 0.5)) / B;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order 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 <= 4.1d-59) then
tmp = -sqrt((2.0d0 * (f / b)))
else
tmp = ((-2.0d0) * ((f * c) ** 0.5d0)) / b
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (C <= 4.1e-59) {
tmp = -Math.sqrt((2.0 * (F / B)));
} else {
tmp = (-2.0 * Math.pow((F * C), 0.5)) / B;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if C <= 4.1e-59: tmp = -math.sqrt((2.0 * (F / B))) else: tmp = (-2.0 * math.pow((F * C), 0.5)) / B return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (C <= 4.1e-59) tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B)))); else tmp = Float64(Float64(-2.0 * (Float64(F * C) ^ 0.5)) / B); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (C <= 4.1e-59)
tmp = -sqrt((2.0 * (F / B)));
else
tmp = (-2.0 * ((F * C) ^ 0.5)) / B;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[C, 4.1e-59], (-N[Sqrt[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(N[(-2.0 * N[Power[N[(F * C), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 4.1 \cdot 10^{-59}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot {\left(F \cdot C\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if C < 4.0999999999999996e-59Initial program 16.4%
Simplified19.6%
Taylor expanded in A around 0 9.7%
mul-1-neg9.7%
*-commutative9.7%
distribute-rgt-neg-in9.7%
*-commutative9.7%
unpow29.7%
unpow29.7%
hypot-def15.1%
Simplified15.1%
Taylor expanded in C around 0 13.3%
mul-1-neg13.3%
Simplified13.3%
pow113.3%
sqrt-unprod13.4%
Applied egg-rr13.4%
unpow113.4%
Simplified13.4%
if 4.0999999999999996e-59 < C Initial program 20.0%
associate-*l*20.0%
unpow220.0%
+-commutative20.0%
unpow220.0%
associate-*l*20.0%
unpow220.0%
Simplified20.0%
Taylor expanded in A around -inf 31.9%
Taylor expanded in B around inf 11.0%
pow111.0%
*-commutative11.0%
un-div-inv11.0%
*-commutative11.0%
Applied egg-rr11.0%
unpow111.0%
associate-*l/11.0%
Simplified11.0%
pow1/211.1%
Applied egg-rr11.1%
Final simplification12.8%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= C 9.2e-61) (- (sqrt (* 2.0 (/ F B)))) (/ (* -2.0 (sqrt (* F C))) B)))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (C <= 9.2e-61) {
tmp = -sqrt((2.0 * (F / B)));
} else {
tmp = (-2.0 * sqrt((F * C))) / B;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order 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 <= 9.2d-61) then
tmp = -sqrt((2.0d0 * (f / b)))
else
tmp = ((-2.0d0) * sqrt((f * c))) / b
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (C <= 9.2e-61) {
tmp = -Math.sqrt((2.0 * (F / B)));
} else {
tmp = (-2.0 * Math.sqrt((F * C))) / B;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if C <= 9.2e-61: tmp = -math.sqrt((2.0 * (F / B))) else: tmp = (-2.0 * math.sqrt((F * C))) / B return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (C <= 9.2e-61) tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B)))); else tmp = Float64(Float64(-2.0 * sqrt(Float64(F * C))) / B); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (C <= 9.2e-61)
tmp = -sqrt((2.0 * (F / B)));
else
tmp = (-2.0 * sqrt((F * C))) / B;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[C, 9.2e-61], (-N[Sqrt[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(N[(-2.0 * N[Sqrt[N[(F * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 9.2 \cdot 10^{-61}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \sqrt{F \cdot C}}{B}\\
\end{array}
\end{array}
if C < 9.19999999999999967e-61Initial program 16.4%
Simplified19.6%
Taylor expanded in A around 0 9.7%
mul-1-neg9.7%
*-commutative9.7%
distribute-rgt-neg-in9.7%
*-commutative9.7%
unpow29.7%
unpow29.7%
hypot-def15.1%
Simplified15.1%
Taylor expanded in C around 0 13.3%
mul-1-neg13.3%
Simplified13.3%
pow113.3%
sqrt-unprod13.4%
Applied egg-rr13.4%
unpow113.4%
Simplified13.4%
if 9.19999999999999967e-61 < C Initial program 20.0%
associate-*l*20.0%
unpow220.0%
+-commutative20.0%
unpow220.0%
associate-*l*20.0%
unpow220.0%
Simplified20.0%
Taylor expanded in A around -inf 31.9%
Taylor expanded in B around inf 11.0%
pow111.0%
*-commutative11.0%
un-div-inv11.0%
*-commutative11.0%
Applied egg-rr11.0%
unpow111.0%
associate-*l/11.0%
Simplified11.0%
Final simplification12.8%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (- (sqrt (* 2.0 (/ F B)))))
assert(A < C);
double code(double A, double B, double C, double F) {
return -sqrt((2.0 * (F / B)));
}
NOTE: A and C should be sorted in increasing order 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
assert A < C;
public static double code(double A, double B, double C, double F) {
return -Math.sqrt((2.0 * (F / B)));
}
[A, C] = sort([A, C]) def code(A, B, C, F): return -math.sqrt((2.0 * (F / B)))
A, C = sort([A, C]) function code(A, B, C, F) return Float64(-sqrt(Float64(2.0 * Float64(F / B)))) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -sqrt((2.0 * (F / B)));
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := (-N[Sqrt[N[(2.0 * N[(F / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
-\sqrt{2 \cdot \frac{F}{B}}
\end{array}
Initial program 17.3%
Simplified21.8%
Taylor expanded in A around 0 9.5%
mul-1-neg9.5%
*-commutative9.5%
distribute-rgt-neg-in9.5%
*-commutative9.5%
unpow29.5%
unpow29.5%
hypot-def15.1%
Simplified15.1%
Taylor expanded in C around 0 11.0%
mul-1-neg11.0%
Simplified11.0%
pow111.0%
sqrt-unprod11.0%
Applied egg-rr11.0%
unpow111.0%
Simplified11.0%
Final simplification11.0%
herbie shell --seed 2023178
(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))))