
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* -4.0 (* A C)))))
(if (<= B 5.7e+65)
(/
(sqrt (+ A (+ C (hypot B (- A C)))))
(/ t_0 (- (sqrt (* 2.0 (* t_0 F))))))
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (sqrt F)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (-4.0 * (A * C)));
double tmp;
if (B <= 5.7e+65) {
tmp = sqrt((A + (C + hypot(B, (A - C))))) / (t_0 / -sqrt((2.0 * (t_0 * F))));
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (B <= 5.7e+65) tmp = Float64(sqrt(Float64(A + Float64(C + hypot(B, Float64(A - C))))) / Float64(t_0 / Float64(-sqrt(Float64(2.0 * Float64(t_0 * F)))))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-sqrt(F)))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 5.7e+65], N[(N[Sqrt[N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 / (-N[Sqrt[N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\\
\mathbf{if}\;B \leq 5.7 \cdot 10^{+65}:\\
\;\;\;\;\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}}{\frac{t_0}{-\sqrt{2 \cdot \left(t_0 \cdot F\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 5.6999999999999999e65Initial program 23.2%
associate-*l*23.2%
unpow223.2%
+-commutative23.2%
unpow223.2%
associate-*l*23.2%
unpow223.2%
Simplified23.2%
sqrt-prod25.5%
*-commutative25.5%
*-commutative25.5%
associate-+l+25.8%
unpow225.8%
hypot-udef38.9%
associate-+r+38.4%
+-commutative38.4%
associate-+r+38.9%
Applied egg-rr38.9%
*-commutative38.9%
fma-neg38.9%
*-commutative38.9%
*-commutative38.9%
distribute-rgt-neg-in38.9%
*-commutative38.9%
metadata-eval38.9%
associate-*r*38.9%
associate-+r+38.4%
+-commutative38.4%
Simplified38.4%
add-cube-cbrt37.8%
fma-def37.8%
fma-def37.8%
Applied egg-rr37.8%
div-inv37.8%
Applied egg-rr38.9%
associate-*r/38.9%
*-rgt-identity38.9%
associate-/l*39.0%
*-commutative39.0%
*-commutative39.0%
Simplified39.0%
if 5.6999999999999999e65 < B Initial program 11.1%
Simplified15.3%
Taylor expanded in C around 0 19.0%
mul-1-neg19.0%
unpow219.0%
unpow219.0%
Simplified19.0%
sqrt-prod27.0%
hypot-udef78.2%
Applied egg-rr78.2%
Final simplification46.3%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= B 3.1e+66)
(/
(*
(sqrt (+ (hypot B (- A C)) (+ A C)))
(- (sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))))
(- (* B B) (* (* A C) 4.0)))
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (sqrt F))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 3.1e+66) {
tmp = (sqrt((hypot(B, (A - C)) + (A + C))) * -sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 3.1e+66) {
tmp = (Math.sqrt((Math.hypot(B, (A - C)) + (A + C))) * -Math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt((A + Math.hypot(B, A))) * -Math.sqrt(F));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if B <= 3.1e+66: tmp = (math.sqrt((math.hypot(B, (A - C)) + (A + C))) * -math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - ((A * C) * 4.0)) else: tmp = (math.sqrt(2.0) / B) * (math.sqrt((A + math.hypot(B, A))) * -math.sqrt(F)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (B <= 3.1e+66) tmp = Float64(Float64(sqrt(Float64(hypot(B, Float64(A - C)) + Float64(A + C))) * Float64(-sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-sqrt(F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (B <= 3.1e+66) tmp = (sqrt((hypot(B, (A - C)) + (A + C))) * -sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - ((A * C) * 4.0)); else tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[B, 3.1e+66], N[(N[(N[Sqrt[N[(N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 3.1 \cdot 10^{+66}:\\
\;\;\;\;\frac{\sqrt{\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)}\right)}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 3.10000000000000019e66Initial program 23.2%
associate-*l*23.2%
unpow223.2%
+-commutative23.2%
unpow223.2%
associate-*l*23.2%
unpow223.2%
Simplified23.2%
sqrt-prod25.5%
*-commutative25.5%
*-commutative25.5%
associate-+l+25.8%
unpow225.8%
hypot-udef38.9%
associate-+r+38.4%
+-commutative38.4%
associate-+r+38.9%
Applied egg-rr38.9%
*-commutative38.9%
fma-neg38.9%
*-commutative38.9%
*-commutative38.9%
distribute-rgt-neg-in38.9%
*-commutative38.9%
metadata-eval38.9%
associate-*r*38.9%
associate-+r+38.4%
+-commutative38.4%
Simplified38.4%
if 3.10000000000000019e66 < B Initial program 11.1%
Simplified15.3%
Taylor expanded in C around 0 19.0%
mul-1-neg19.0%
unpow219.0%
unpow219.0%
Simplified19.0%
sqrt-prod27.0%
hypot-udef78.2%
Applied egg-rr78.2%
Final simplification45.8%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F 1.8e-234)
(/
(*
(sqrt (+ (hypot B (- A C)) (+ A C)))
(- (sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))))
(- (* B B) (* (* A C) 4.0)))
(if (<= F 8.2e+17)
(* (sqrt (* F (+ C (hypot B C)))) (/ (- (sqrt 2.0)) B))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 1.8e-234) {
tmp = (sqrt((hypot(B, (A - C)) + (A + C))) * -sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - ((A * C) * 4.0));
} else if (F <= 8.2e+17) {
tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B);
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 1.8e-234) {
tmp = (Math.sqrt((Math.hypot(B, (A - C)) + (A + C))) * -Math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - ((A * C) * 4.0));
} else if (F <= 8.2e+17) {
tmp = Math.sqrt((F * (C + Math.hypot(B, C)))) * (-Math.sqrt(2.0) / B);
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 1.8e-234: tmp = (math.sqrt((math.hypot(B, (A - C)) + (A + C))) * -math.sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - ((A * C) * 4.0)) elif F <= 8.2e+17: tmp = math.sqrt((F * (C + math.hypot(B, C)))) * (-math.sqrt(2.0) / B) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 1.8e-234) tmp = Float64(Float64(sqrt(Float64(hypot(B, Float64(A - C)) + Float64(A + C))) * Float64(-sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))); elseif (F <= 8.2e+17) tmp = Float64(sqrt(Float64(F * Float64(C + hypot(B, C)))) * Float64(Float64(-sqrt(2.0)) / B)); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 1.8e-234) tmp = (sqrt((hypot(B, (A - C)) + (A + C))) * -sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - ((A * C) * 4.0)); elseif (F <= 8.2e+17) tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 1.8e-234], N[(N[(N[Sqrt[N[(N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 8.2e+17], N[(N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.8 \cdot 10^{-234}:\\
\;\;\;\;\frac{\sqrt{\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)}\right)}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{elif}\;F \leq 8.2 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 1.7999999999999999e-234Initial program 35.2%
associate-*l*35.2%
unpow235.2%
+-commutative35.2%
unpow235.2%
associate-*l*35.2%
unpow235.2%
Simplified35.2%
sqrt-prod36.0%
*-commutative36.0%
*-commutative36.0%
associate-+l+35.9%
unpow235.9%
hypot-udef57.4%
associate-+r+57.3%
+-commutative57.3%
associate-+r+57.4%
Applied egg-rr57.4%
*-commutative57.4%
fma-neg57.4%
*-commutative57.4%
*-commutative57.4%
distribute-rgt-neg-in57.4%
*-commutative57.4%
metadata-eval57.4%
associate-*r*57.4%
associate-+r+57.3%
+-commutative57.3%
Simplified57.3%
if 1.7999999999999999e-234 < F < 8.2e17Initial program 20.8%
Simplified29.4%
Taylor expanded in A around 0 13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
*-commutative13.8%
unpow213.8%
unpow213.8%
hypot-def33.5%
Simplified33.5%
if 8.2e17 < F Initial program 12.4%
Simplified13.9%
Taylor expanded in C around 0 8.2%
*-commutative8.2%
unpow28.2%
unpow28.2%
hypot-def8.7%
Simplified8.7%
Taylor expanded in A around 0 20.7%
mul-1-neg20.7%
Simplified20.7%
Final simplification34.3%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* A C) 4.0))))
(if (<= A -1.2e-48)
(*
-0.5
(* (sqrt 2.0) (sqrt (/ F (/ A (fma 0.5 (/ (* B B) (* A A)) -2.0))))))
(if (<= A 6.6e-244)
(* (sqrt 2.0) (- (sqrt (/ F B))))
(if (<= A 4.2e+89)
(/ (- (sqrt (* 2.0 (* (+ C (+ A (hypot B (- A C)))) (* F t_0))))) t_0)
(/
(*
(sqrt (+ C (+ A A)))
(- (sqrt (* (fma B B (* -4.0 (* A C))) (* 2.0 F)))))
t_0))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (A <= -1.2e-48) {
tmp = -0.5 * (sqrt(2.0) * sqrt((F / (A / fma(0.5, ((B * B) / (A * A)), -2.0)))));
} else if (A <= 6.6e-244) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else if (A <= 4.2e+89) {
tmp = -sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else {
tmp = (sqrt((C + (A + A))) * -sqrt((fma(B, B, (-4.0 * (A * C))) * (2.0 * F)))) / t_0;
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) tmp = 0.0 if (A <= -1.2e-48) tmp = Float64(-0.5 * Float64(sqrt(2.0) * sqrt(Float64(F / Float64(A / fma(0.5, Float64(Float64(B * B) / Float64(A * A)), -2.0)))))); elseif (A <= 6.6e-244) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); elseif (A <= 4.2e+89) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + hypot(B, Float64(A - C)))) * Float64(F * t_0))))) / t_0); else tmp = Float64(Float64(sqrt(Float64(C + Float64(A + A))) * Float64(-sqrt(Float64(fma(B, B, Float64(-4.0 * Float64(A * C))) * Float64(2.0 * F))))) / t_0); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -1.2e-48], N[(-0.5 * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F / N[(A / N[(0.5 * N[(N[(B * B), $MachinePrecision] / N[(A * A), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 6.6e-244], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[A, 4.2e+89], N[((-N[Sqrt[N[(2.0 * N[(N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
\mathbf{if}\;A \leq -1.2 \cdot 10^{-48}:\\
\;\;\;\;-0.5 \cdot \left(\sqrt{2} \cdot \sqrt{\frac{F}{\frac{A}{\mathsf{fma}\left(0.5, \frac{B \cdot B}{A \cdot A}, -2\right)}}}\right)\\
\mathbf{elif}\;A \leq 6.6 \cdot 10^{-244}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{elif}\;A \leq 4.2 \cdot 10^{+89}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{C + \left(A + A\right)} \cdot \left(-\sqrt{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right) \cdot \left(2 \cdot F\right)}\right)}{t_0}\\
\end{array}
\end{array}
if A < -1.2e-48Initial 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 3.1%
associate-+r+3.1%
mul-1-neg3.1%
unsub-neg3.1%
distribute-lft-out3.1%
*-commutative3.1%
unpow23.1%
times-frac3.0%
unpow23.0%
unpow23.0%
Simplified3.0%
Taylor expanded in C around -inf 32.8%
associate-/l*32.8%
fma-neg32.8%
unpow232.8%
unpow232.8%
metadata-eval32.8%
Simplified32.8%
if -1.2e-48 < A < 6.60000000000000052e-244Initial program 25.9%
Simplified32.2%
Taylor expanded in C around 0 17.0%
*-commutative17.0%
unpow217.0%
unpow217.0%
hypot-def17.2%
Simplified17.2%
Taylor expanded in A around 0 38.8%
mul-1-neg38.8%
Simplified38.8%
if 6.60000000000000052e-244 < A < 4.19999999999999972e89Initial program 42.1%
associate-*l*42.1%
unpow242.1%
+-commutative42.1%
unpow242.1%
associate-*l*42.1%
unpow242.1%
Simplified42.1%
distribute-frac-neg42.1%
Applied egg-rr43.5%
if 4.19999999999999972e89 < A Initial program 12.5%
associate-*l*12.5%
unpow212.5%
+-commutative12.5%
unpow212.5%
associate-*l*12.5%
unpow212.5%
Simplified12.5%
Taylor expanded in A around inf 29.0%
sqrt-prod53.1%
*-commutative53.1%
cancel-sign-sub-inv53.1%
metadata-eval53.1%
fma-def53.1%
+-commutative53.1%
Applied egg-rr53.1%
associate-*r*53.1%
associate-+r+53.1%
Simplified53.1%
Final simplification40.8%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* A C) 4.0))) (t_1 (hypot B (- A C))))
(if (<= F -2.8e-180)
(/
(* (sqrt (+ t_1 (+ A C))) (- (sqrt (* 2.0 (* -4.0 (* A (* C F)))))))
t_0)
(if (<= F 1.05e-234)
(/ (- (sqrt (* 2.0 (* (+ C (+ A t_1)) (* F t_0))))) t_0)
(if (<= F 3.2e+19)
(* (sqrt (* F (+ C (hypot B C)))) (/ (- (sqrt 2.0)) B))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double t_1 = hypot(B, (A - C));
double tmp;
if (F <= -2.8e-180) {
tmp = (sqrt((t_1 + (A + C))) * -sqrt((2.0 * (-4.0 * (A * (C * F)))))) / t_0;
} else if (F <= 1.05e-234) {
tmp = -sqrt((2.0 * ((C + (A + t_1)) * (F * t_0)))) / t_0;
} else if (F <= 3.2e+19) {
tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B);
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double t_1 = Math.hypot(B, (A - C));
double tmp;
if (F <= -2.8e-180) {
tmp = (Math.sqrt((t_1 + (A + C))) * -Math.sqrt((2.0 * (-4.0 * (A * (C * F)))))) / t_0;
} else if (F <= 1.05e-234) {
tmp = -Math.sqrt((2.0 * ((C + (A + t_1)) * (F * t_0)))) / t_0;
} else if (F <= 3.2e+19) {
tmp = Math.sqrt((F * (C + Math.hypot(B, C)))) * (-Math.sqrt(2.0) / B);
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) t_1 = math.hypot(B, (A - C)) tmp = 0 if F <= -2.8e-180: tmp = (math.sqrt((t_1 + (A + C))) * -math.sqrt((2.0 * (-4.0 * (A * (C * F)))))) / t_0 elif F <= 1.05e-234: tmp = -math.sqrt((2.0 * ((C + (A + t_1)) * (F * t_0)))) / t_0 elif F <= 3.2e+19: tmp = math.sqrt((F * (C + math.hypot(B, C)))) * (-math.sqrt(2.0) / B) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) t_1 = hypot(B, Float64(A - C)) tmp = 0.0 if (F <= -2.8e-180) tmp = Float64(Float64(sqrt(Float64(t_1 + Float64(A + C))) * Float64(-sqrt(Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F))))))) / t_0); elseif (F <= 1.05e-234) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + t_1)) * Float64(F * t_0))))) / t_0); elseif (F <= 3.2e+19) tmp = Float64(sqrt(Float64(F * Float64(C + hypot(B, C)))) * Float64(Float64(-sqrt(2.0)) / B)); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - ((A * C) * 4.0); t_1 = hypot(B, (A - C)); tmp = 0.0; if (F <= -2.8e-180) tmp = (sqrt((t_1 + (A + C))) * -sqrt((2.0 * (-4.0 * (A * (C * F)))))) / t_0; elseif (F <= 1.05e-234) tmp = -sqrt((2.0 * ((C + (A + t_1)) * (F * t_0)))) / t_0; elseif (F <= 3.2e+19) tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[F, -2.8e-180], N[(N[(N[Sqrt[N[(t$95$1 + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[F, 1.05e-234], N[((-N[Sqrt[N[(2.0 * N[(N[(C + N[(A + t$95$1), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 3.2e+19], N[(N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
t_1 := \mathsf{hypot}\left(B, A - C\right)\\
\mathbf{if}\;F \leq -2.8 \cdot 10^{-180}:\\
\;\;\;\;\frac{\sqrt{t_1 + \left(A + C\right)} \cdot \left(-\sqrt{2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)}\right)}{t_0}\\
\mathbf{elif}\;F \leq 1.05 \cdot 10^{-234}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(C + \left(A + t_1\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{elif}\;F \leq 3.2 \cdot 10^{+19}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -2.79999999999999997e-180Initial program 39.1%
associate-*l*39.1%
unpow239.1%
+-commutative39.1%
unpow239.1%
associate-*l*39.1%
unpow239.1%
Simplified39.1%
sqrt-prod40.7%
*-commutative40.7%
*-commutative40.7%
associate-+l+40.7%
unpow240.7%
hypot-udef68.4%
associate-+r+68.4%
+-commutative68.4%
associate-+r+68.4%
Applied egg-rr68.4%
*-commutative68.4%
fma-neg68.4%
*-commutative68.4%
*-commutative68.4%
distribute-rgt-neg-in68.4%
*-commutative68.4%
metadata-eval68.4%
associate-*r*68.4%
associate-+r+68.4%
+-commutative68.4%
Simplified68.4%
Taylor expanded in B around 0 63.5%
if -2.79999999999999997e-180 < F < 1.04999999999999996e-234Initial program 30.2%
associate-*l*30.2%
unpow230.2%
+-commutative30.2%
unpow230.2%
associate-*l*30.2%
unpow230.2%
Simplified30.2%
distribute-frac-neg30.2%
Applied egg-rr44.4%
if 1.04999999999999996e-234 < F < 3.2e19Initial program 20.8%
Simplified29.4%
Taylor expanded in A around 0 13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
*-commutative13.8%
unpow213.8%
unpow213.8%
hypot-def33.5%
Simplified33.5%
if 3.2e19 < F Initial program 12.4%
Simplified13.9%
Taylor expanded in C around 0 8.2%
*-commutative8.2%
unpow28.2%
unpow28.2%
hypot-def8.7%
Simplified8.7%
Taylor expanded in A around 0 20.7%
mul-1-neg20.7%
Simplified20.7%
Final simplification33.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* A C) 4.0))))
(if (<= F 3.9e-235)
(/ (- (sqrt (* 2.0 (* (+ C (+ A (hypot B (- A C)))) (* F t_0))))) t_0)
(if (<= F 3.2e+18)
(* (sqrt (* F (+ C (hypot B C)))) (/ (- (sqrt 2.0)) B))
(* (sqrt 2.0) (- (sqrt (/ F B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (F <= 3.9e-235) {
tmp = -sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 3.2e+18) {
tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B);
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (F <= 3.9e-235) {
tmp = -Math.sqrt((2.0 * ((C + (A + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 3.2e+18) {
tmp = Math.sqrt((F * (C + Math.hypot(B, C)))) * (-Math.sqrt(2.0) / B);
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) tmp = 0 if F <= 3.9e-235: tmp = -math.sqrt((2.0 * ((C + (A + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 elif F <= 3.2e+18: tmp = math.sqrt((F * (C + math.hypot(B, C)))) * (-math.sqrt(2.0) / B) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) tmp = 0.0 if (F <= 3.9e-235) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + hypot(B, Float64(A - C)))) * Float64(F * t_0))))) / t_0); elseif (F <= 3.2e+18) tmp = Float64(sqrt(Float64(F * Float64(C + hypot(B, C)))) * Float64(Float64(-sqrt(2.0)) / B)); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - ((A * C) * 4.0); tmp = 0.0; if (F <= 3.9e-235) tmp = -sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_0)))) / t_0; elseif (F <= 3.2e+18) tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, 3.9e-235], N[((-N[Sqrt[N[(2.0 * N[(N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 3.2e+18], N[(N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
\mathbf{if}\;F \leq 3.9 \cdot 10^{-235}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{elif}\;F \leq 3.2 \cdot 10^{+18}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 3.8999999999999997e-235Initial program 35.2%
associate-*l*35.2%
unpow235.2%
+-commutative35.2%
unpow235.2%
associate-*l*35.2%
unpow235.2%
Simplified35.2%
distribute-frac-neg35.2%
Applied egg-rr45.6%
if 3.8999999999999997e-235 < F < 3.2e18Initial program 20.8%
Simplified29.4%
Taylor expanded in A around 0 13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
*-commutative13.8%
unpow213.8%
unpow213.8%
hypot-def33.5%
Simplified33.5%
if 3.2e18 < F Initial program 12.4%
Simplified13.9%
Taylor expanded in C around 0 8.2%
*-commutative8.2%
unpow28.2%
unpow28.2%
hypot-def8.7%
Simplified8.7%
Taylor expanded in A around 0 20.7%
mul-1-neg20.7%
Simplified20.7%
Final simplification31.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* (* A C) 4.0)) (t_1 (- (* B B) t_0)))
(if (<= F -2.75e+137)
(/ (- (sqrt (* (- (- A C) (+ A C)) (* 2.0 (* F (- t_0 (* B B))))))) t_1)
(if (<= F 3.8e-232)
(- (/ (sqrt (* (* 2.0 (* F t_1)) (+ (hypot B A) (+ A C)))) t_1))
(if (<= F 3e-30)
(* (sqrt (* B F)) (/ (- (sqrt 2.0)) B))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (A * C) * 4.0;
double t_1 = (B * B) - t_0;
double tmp;
if (F <= -2.75e+137) {
tmp = -sqrt((((A - C) - (A + C)) * (2.0 * (F * (t_0 - (B * B)))))) / t_1;
} else if (F <= 3.8e-232) {
tmp = -(sqrt(((2.0 * (F * t_1)) * (hypot(B, A) + (A + C)))) / t_1);
} else if (F <= 3e-30) {
tmp = sqrt((B * F)) * (-sqrt(2.0) / B);
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (A * C) * 4.0;
double t_1 = (B * B) - t_0;
double tmp;
if (F <= -2.75e+137) {
tmp = -Math.sqrt((((A - C) - (A + C)) * (2.0 * (F * (t_0 - (B * B)))))) / t_1;
} else if (F <= 3.8e-232) {
tmp = -(Math.sqrt(((2.0 * (F * t_1)) * (Math.hypot(B, A) + (A + C)))) / t_1);
} else if (F <= 3e-30) {
tmp = Math.sqrt((B * F)) * (-Math.sqrt(2.0) / B);
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (A * C) * 4.0 t_1 = (B * B) - t_0 tmp = 0 if F <= -2.75e+137: tmp = -math.sqrt((((A - C) - (A + C)) * (2.0 * (F * (t_0 - (B * B)))))) / t_1 elif F <= 3.8e-232: tmp = -(math.sqrt(((2.0 * (F * t_1)) * (math.hypot(B, A) + (A + C)))) / t_1) elif F <= 3e-30: tmp = math.sqrt((B * F)) * (-math.sqrt(2.0) / B) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(A * C) * 4.0) t_1 = Float64(Float64(B * B) - t_0) tmp = 0.0 if (F <= -2.75e+137) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(A - C) - Float64(A + C)) * Float64(2.0 * Float64(F * Float64(t_0 - Float64(B * B))))))) / t_1); elseif (F <= 3.8e-232) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(hypot(B, A) + Float64(A + C)))) / t_1)); elseif (F <= 3e-30) tmp = Float64(sqrt(Float64(B * F)) * Float64(Float64(-sqrt(2.0)) / B)); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (A * C) * 4.0; t_1 = (B * B) - t_0; tmp = 0.0; if (F <= -2.75e+137) tmp = -sqrt((((A - C) - (A + C)) * (2.0 * (F * (t_0 - (B * B)))))) / t_1; elseif (F <= 3.8e-232) tmp = -(sqrt(((2.0 * (F * t_1)) * (hypot(B, A) + (A + C)))) / t_1); elseif (F <= 3e-30) tmp = sqrt((B * F)) * (-sqrt(2.0) / B); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[F, -2.75e+137], N[((-N[Sqrt[N[(N[(N[(A - C), $MachinePrecision] - N[(A + C), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[F, 3.8e-232], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), If[LessEqual[F, 3e-30], N[(N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \left(A \cdot C\right) \cdot 4\\
t_1 := B \cdot B - t_0\\
\mathbf{if}\;F \leq -2.75 \cdot 10^{+137}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(A - C\right) - \left(A + C\right)\right) \cdot \left(2 \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;F \leq 3.8 \cdot 10^{-232}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(\mathsf{hypot}\left(B, A\right) + \left(A + C\right)\right)}}{t_1}\\
\mathbf{elif}\;F \leq 3 \cdot 10^{-30}:\\
\;\;\;\;\sqrt{B \cdot F} \cdot \frac{-\sqrt{2}}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -2.7500000000000001e137Initial program 61.0%
associate-*l*61.0%
unpow261.0%
+-commutative61.0%
unpow261.0%
associate-*l*61.0%
unpow261.0%
Simplified61.0%
Taylor expanded in A around -inf 50.7%
mul-1-neg50.7%
sub-neg50.7%
Simplified50.7%
if -2.7500000000000001e137 < F < 3.8000000000000001e-232Initial program 23.6%
associate-*l*23.6%
unpow223.6%
+-commutative23.6%
unpow223.6%
associate-*l*23.6%
unpow223.6%
Simplified23.6%
Taylor expanded in C around 0 19.9%
unpow219.9%
unpow219.9%
hypot-def29.8%
Simplified29.8%
if 3.8000000000000001e-232 < F < 2.9999999999999999e-30Initial program 25.1%
Simplified34.4%
Taylor expanded in C around 0 15.6%
mul-1-neg15.6%
unpow215.6%
unpow215.6%
Simplified15.6%
Taylor expanded in A around 0 28.6%
if 2.9999999999999999e-30 < F Initial program 11.7%
Simplified13.9%
Taylor expanded in C around 0 7.3%
*-commutative7.3%
unpow27.3%
unpow27.3%
hypot-def8.0%
Simplified8.0%
Taylor expanded in A around 0 22.2%
mul-1-neg22.2%
Simplified22.2%
Final simplification27.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* A C) 4.0))))
(if (<= F 3.2e-235)
(/ (- (sqrt (* 2.0 (* (+ C (+ A (hypot B (- A C)))) (* F t_0))))) t_0)
(if (<= F 5e-31)
(* (sqrt (* B F)) (/ (- (sqrt 2.0)) B))
(* (sqrt 2.0) (- (sqrt (/ F B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (F <= 3.2e-235) {
tmp = -sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 5e-31) {
tmp = sqrt((B * F)) * (-sqrt(2.0) / B);
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (F <= 3.2e-235) {
tmp = -Math.sqrt((2.0 * ((C + (A + Math.hypot(B, (A - C)))) * (F * t_0)))) / t_0;
} else if (F <= 5e-31) {
tmp = Math.sqrt((B * F)) * (-Math.sqrt(2.0) / B);
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) tmp = 0 if F <= 3.2e-235: tmp = -math.sqrt((2.0 * ((C + (A + math.hypot(B, (A - C)))) * (F * t_0)))) / t_0 elif F <= 5e-31: tmp = math.sqrt((B * F)) * (-math.sqrt(2.0) / B) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) tmp = 0.0 if (F <= 3.2e-235) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + hypot(B, Float64(A - C)))) * Float64(F * t_0))))) / t_0); elseif (F <= 5e-31) tmp = Float64(sqrt(Float64(B * F)) * Float64(Float64(-sqrt(2.0)) / B)); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - ((A * C) * 4.0); tmp = 0.0; if (F <= 3.2e-235) tmp = -sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_0)))) / t_0; elseif (F <= 5e-31) tmp = sqrt((B * F)) * (-sqrt(2.0) / B); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, 3.2e-235], N[((-N[Sqrt[N[(2.0 * N[(N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 5e-31], N[(N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
\mathbf{if}\;F \leq 3.2 \cdot 10^{-235}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-31}:\\
\;\;\;\;\sqrt{B \cdot F} \cdot \frac{-\sqrt{2}}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 3.2000000000000001e-235Initial program 35.2%
associate-*l*35.2%
unpow235.2%
+-commutative35.2%
unpow235.2%
associate-*l*35.2%
unpow235.2%
Simplified35.2%
distribute-frac-neg35.2%
Applied egg-rr45.6%
if 3.2000000000000001e-235 < F < 5e-31Initial program 24.5%
Simplified33.4%
Taylor expanded in C around 0 15.2%
mul-1-neg15.2%
unpow215.2%
unpow215.2%
Simplified15.2%
Taylor expanded in A around 0 27.8%
if 5e-31 < F Initial program 11.7%
Simplified13.9%
Taylor expanded in C around 0 7.3%
*-commutative7.3%
unpow27.3%
unpow27.3%
hypot-def8.0%
Simplified8.0%
Taylor expanded in A around 0 22.2%
mul-1-neg22.2%
Simplified22.2%
Final simplification29.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* (* A C) 4.0))
(t_1 (* 2.0 (* F (- t_0 (* B B)))))
(t_2 (- (* B B) t_0)))
(if (<= F -6.8e+137)
(/ (- (sqrt (* (- (- A C) (+ A C)) t_1))) t_2)
(if (<= F 2.05e-251)
(/ (- (sqrt (* (- (- C A) (+ A C)) t_1))) t_2)
(if (<= F 6e-31)
(* (sqrt (* B F)) (/ (- (sqrt 2.0)) B))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (A * C) * 4.0;
double t_1 = 2.0 * (F * (t_0 - (B * B)));
double t_2 = (B * B) - t_0;
double tmp;
if (F <= -6.8e+137) {
tmp = -sqrt((((A - C) - (A + C)) * t_1)) / t_2;
} else if (F <= 2.05e-251) {
tmp = -sqrt((((C - A) - (A + C)) * t_1)) / t_2;
} else if (F <= 6e-31) {
tmp = sqrt((B * F)) * (-sqrt(2.0) / B);
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (a * c) * 4.0d0
t_1 = 2.0d0 * (f * (t_0 - (b * b)))
t_2 = (b * b) - t_0
if (f <= (-6.8d+137)) then
tmp = -sqrt((((a - c) - (a + c)) * t_1)) / t_2
else if (f <= 2.05d-251) then
tmp = -sqrt((((c - a) - (a + c)) * t_1)) / t_2
else if (f <= 6d-31) then
tmp = sqrt((b * f)) * (-sqrt(2.0d0) / b)
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (A * C) * 4.0;
double t_1 = 2.0 * (F * (t_0 - (B * B)));
double t_2 = (B * B) - t_0;
double tmp;
if (F <= -6.8e+137) {
tmp = -Math.sqrt((((A - C) - (A + C)) * t_1)) / t_2;
} else if (F <= 2.05e-251) {
tmp = -Math.sqrt((((C - A) - (A + C)) * t_1)) / t_2;
} else if (F <= 6e-31) {
tmp = Math.sqrt((B * F)) * (-Math.sqrt(2.0) / B);
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (A * C) * 4.0 t_1 = 2.0 * (F * (t_0 - (B * B))) t_2 = (B * B) - t_0 tmp = 0 if F <= -6.8e+137: tmp = -math.sqrt((((A - C) - (A + C)) * t_1)) / t_2 elif F <= 2.05e-251: tmp = -math.sqrt((((C - A) - (A + C)) * t_1)) / t_2 elif F <= 6e-31: tmp = math.sqrt((B * F)) * (-math.sqrt(2.0) / B) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(A * C) * 4.0) t_1 = Float64(2.0 * Float64(F * Float64(t_0 - Float64(B * B)))) t_2 = Float64(Float64(B * B) - t_0) tmp = 0.0 if (F <= -6.8e+137) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(A - C) - Float64(A + C)) * t_1))) / t_2); elseif (F <= 2.05e-251) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(C - A) - Float64(A + C)) * t_1))) / t_2); elseif (F <= 6e-31) tmp = Float64(sqrt(Float64(B * F)) * Float64(Float64(-sqrt(2.0)) / B)); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (A * C) * 4.0; t_1 = 2.0 * (F * (t_0 - (B * B))); t_2 = (B * B) - t_0; tmp = 0.0; if (F <= -6.8e+137) tmp = -sqrt((((A - C) - (A + C)) * t_1)) / t_2; elseif (F <= 2.05e-251) tmp = -sqrt((((C - A) - (A + C)) * t_1)) / t_2; elseif (F <= 6e-31) tmp = sqrt((B * F)) * (-sqrt(2.0) / B); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[F, -6.8e+137], N[((-N[Sqrt[N[(N[(N[(A - C), $MachinePrecision] - N[(A + C), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[F, 2.05e-251], N[((-N[Sqrt[N[(N[(N[(C - A), $MachinePrecision] - N[(A + C), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[F, 6e-31], N[(N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \left(A \cdot C\right) \cdot 4\\
t_1 := 2 \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\\
t_2 := B \cdot B - t_0\\
\mathbf{if}\;F \leq -6.8 \cdot 10^{+137}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(A - C\right) - \left(A + C\right)\right) \cdot t_1}}{t_2}\\
\mathbf{elif}\;F \leq 2.05 \cdot 10^{-251}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(C - A\right) - \left(A + C\right)\right) \cdot t_1}}{t_2}\\
\mathbf{elif}\;F \leq 6 \cdot 10^{-31}:\\
\;\;\;\;\sqrt{B \cdot F} \cdot \frac{-\sqrt{2}}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -6.79999999999999973e137Initial program 61.0%
associate-*l*61.0%
unpow261.0%
+-commutative61.0%
unpow261.0%
associate-*l*61.0%
unpow261.0%
Simplified61.0%
Taylor expanded in A around -inf 50.7%
mul-1-neg50.7%
sub-neg50.7%
Simplified50.7%
if -6.79999999999999973e137 < F < 2.0499999999999999e-251Initial program 22.0%
associate-*l*22.0%
unpow222.0%
+-commutative22.0%
unpow222.0%
associate-*l*22.0%
unpow222.0%
Simplified22.0%
Taylor expanded in B around 0 25.3%
if 2.0499999999999999e-251 < F < 5.99999999999999962e-31Initial program 26.1%
Simplified36.0%
Taylor expanded in C around 0 14.5%
mul-1-neg14.5%
unpow214.5%
unpow214.5%
Simplified14.5%
Taylor expanded in A around 0 26.2%
if 5.99999999999999962e-31 < F Initial program 11.7%
Simplified13.9%
Taylor expanded in C around 0 7.3%
*-commutative7.3%
unpow27.3%
unpow27.3%
hypot-def8.0%
Simplified8.0%
Taylor expanded in A around 0 22.2%
mul-1-neg22.2%
Simplified22.2%
Final simplification26.0%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* (* A C) 4.0))
(t_1 (* 2.0 (* F (- t_0 (* B B)))))
(t_2 (- (* B B) t_0)))
(if (<= F -1.8e+136)
(/ (- (sqrt (* (- (- A C) (+ A C)) t_1))) t_2)
(if (<= F 1.12e-248)
(/ (- (sqrt (* (- (- C A) (+ A C)) t_1))) t_2)
(* (sqrt 2.0) (- (sqrt (/ F B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (A * C) * 4.0;
double t_1 = 2.0 * (F * (t_0 - (B * B)));
double t_2 = (B * B) - t_0;
double tmp;
if (F <= -1.8e+136) {
tmp = -sqrt((((A - C) - (A + C)) * t_1)) / t_2;
} else if (F <= 1.12e-248) {
tmp = -sqrt((((C - A) - (A + C)) * t_1)) / t_2;
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (a * c) * 4.0d0
t_1 = 2.0d0 * (f * (t_0 - (b * b)))
t_2 = (b * b) - t_0
if (f <= (-1.8d+136)) then
tmp = -sqrt((((a - c) - (a + c)) * t_1)) / t_2
else if (f <= 1.12d-248) then
tmp = -sqrt((((c - a) - (a + c)) * t_1)) / t_2
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (A * C) * 4.0;
double t_1 = 2.0 * (F * (t_0 - (B * B)));
double t_2 = (B * B) - t_0;
double tmp;
if (F <= -1.8e+136) {
tmp = -Math.sqrt((((A - C) - (A + C)) * t_1)) / t_2;
} else if (F <= 1.12e-248) {
tmp = -Math.sqrt((((C - A) - (A + C)) * t_1)) / t_2;
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (A * C) * 4.0 t_1 = 2.0 * (F * (t_0 - (B * B))) t_2 = (B * B) - t_0 tmp = 0 if F <= -1.8e+136: tmp = -math.sqrt((((A - C) - (A + C)) * t_1)) / t_2 elif F <= 1.12e-248: tmp = -math.sqrt((((C - A) - (A + C)) * t_1)) / t_2 else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(A * C) * 4.0) t_1 = Float64(2.0 * Float64(F * Float64(t_0 - Float64(B * B)))) t_2 = Float64(Float64(B * B) - t_0) tmp = 0.0 if (F <= -1.8e+136) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(A - C) - Float64(A + C)) * t_1))) / t_2); elseif (F <= 1.12e-248) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(C - A) - Float64(A + C)) * t_1))) / t_2); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (A * C) * 4.0; t_1 = 2.0 * (F * (t_0 - (B * B))); t_2 = (B * B) - t_0; tmp = 0.0; if (F <= -1.8e+136) tmp = -sqrt((((A - C) - (A + C)) * t_1)) / t_2; elseif (F <= 1.12e-248) tmp = -sqrt((((C - A) - (A + C)) * t_1)) / t_2; else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[F, -1.8e+136], N[((-N[Sqrt[N[(N[(N[(A - C), $MachinePrecision] - N[(A + C), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[F, 1.12e-248], N[((-N[Sqrt[N[(N[(N[(C - A), $MachinePrecision] - N[(A + C), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \left(A \cdot C\right) \cdot 4\\
t_1 := 2 \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\\
t_2 := B \cdot B - t_0\\
\mathbf{if}\;F \leq -1.8 \cdot 10^{+136}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(A - C\right) - \left(A + C\right)\right) \cdot t_1}}{t_2}\\
\mathbf{elif}\;F \leq 1.12 \cdot 10^{-248}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(C - A\right) - \left(A + C\right)\right) \cdot t_1}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -1.80000000000000003e136Initial program 61.0%
associate-*l*61.0%
unpow261.0%
+-commutative61.0%
unpow261.0%
associate-*l*61.0%
unpow261.0%
Simplified61.0%
Taylor expanded in A around -inf 50.7%
mul-1-neg50.7%
sub-neg50.7%
Simplified50.7%
if -1.80000000000000003e136 < F < 1.12e-248Initial program 22.0%
associate-*l*22.0%
unpow222.0%
+-commutative22.0%
unpow222.0%
associate-*l*22.0%
unpow222.0%
Simplified22.0%
Taylor expanded in B around 0 25.3%
if 1.12e-248 < F Initial program 16.6%
Simplified21.4%
Taylor expanded in C around 0 9.6%
*-commutative9.6%
unpow29.6%
unpow29.6%
hypot-def11.0%
Simplified11.0%
Taylor expanded in A around 0 19.6%
mul-1-neg19.6%
Simplified19.6%
Final simplification23.0%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* (* A C) 4.0)) (t_1 (- (* B B) t_0)))
(if (<= A 1.6e-35)
(/ (- (sqrt (* (- (- A C) (+ A C)) (* 2.0 (* F (- t_0 (* B B))))))) t_1)
(/
(-
(sqrt
(*
(* 2.0 (* F t_1))
(- (+ A C) (- (+ C (* 0.5 (/ (- (* 0.0 (+ C C)) (* B B)) A))) A)))))
t_1))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (A * C) * 4.0;
double t_1 = (B * B) - t_0;
double tmp;
if (A <= 1.6e-35) {
tmp = -sqrt((((A - C) - (A + C)) * (2.0 * (F * (t_0 - (B * B)))))) / t_1;
} else {
tmp = -sqrt(((2.0 * (F * t_1)) * ((A + C) - ((C + (0.5 * (((0.0 * (C + C)) - (B * B)) / A))) - A)))) / t_1;
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (a * c) * 4.0d0
t_1 = (b * b) - t_0
if (a <= 1.6d-35) then
tmp = -sqrt((((a - c) - (a + c)) * (2.0d0 * (f * (t_0 - (b * b)))))) / t_1
else
tmp = -sqrt(((2.0d0 * (f * t_1)) * ((a + c) - ((c + (0.5d0 * (((0.0d0 * (c + c)) - (b * b)) / a))) - a)))) / t_1
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (A * C) * 4.0;
double t_1 = (B * B) - t_0;
double tmp;
if (A <= 1.6e-35) {
tmp = -Math.sqrt((((A - C) - (A + C)) * (2.0 * (F * (t_0 - (B * B)))))) / t_1;
} else {
tmp = -Math.sqrt(((2.0 * (F * t_1)) * ((A + C) - ((C + (0.5 * (((0.0 * (C + C)) - (B * B)) / A))) - A)))) / t_1;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (A * C) * 4.0 t_1 = (B * B) - t_0 tmp = 0 if A <= 1.6e-35: tmp = -math.sqrt((((A - C) - (A + C)) * (2.0 * (F * (t_0 - (B * B)))))) / t_1 else: tmp = -math.sqrt(((2.0 * (F * t_1)) * ((A + C) - ((C + (0.5 * (((0.0 * (C + C)) - (B * B)) / A))) - A)))) / t_1 return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(A * C) * 4.0) t_1 = Float64(Float64(B * B) - t_0) tmp = 0.0 if (A <= 1.6e-35) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(A - C) - Float64(A + C)) * Float64(2.0 * Float64(F * Float64(t_0 - Float64(B * B))))))) / t_1); else tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(Float64(A + C) - Float64(Float64(C + Float64(0.5 * Float64(Float64(Float64(0.0 * Float64(C + C)) - Float64(B * B)) / A))) - A))))) / t_1); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (A * C) * 4.0; t_1 = (B * B) - t_0; tmp = 0.0; if (A <= 1.6e-35) tmp = -sqrt((((A - C) - (A + C)) * (2.0 * (F * (t_0 - (B * B)))))) / t_1; else tmp = -sqrt(((2.0 * (F * t_1)) * ((A + C) - ((C + (0.5 * (((0.0 * (C + C)) - (B * B)) / A))) - A)))) / t_1; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[A, 1.6e-35], N[((-N[Sqrt[N[(N[(N[(A - C), $MachinePrecision] - N[(A + C), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[(N[(C + N[(0.5 * N[(N[(N[(0.0 * N[(C + C), $MachinePrecision]), $MachinePrecision] - N[(B * B), $MachinePrecision]), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \left(A \cdot C\right) \cdot 4\\
t_1 := B \cdot B - t_0\\
\mathbf{if}\;A \leq 1.6 \cdot 10^{-35}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(A - C\right) - \left(A + C\right)\right) \cdot \left(2 \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(\left(A + C\right) - \left(\left(C + 0.5 \cdot \frac{0 \cdot \left(C + C\right) - B \cdot B}{A}\right) - A\right)\right)}}{t_1}\\
\end{array}
\end{array}
if A < 1.5999999999999999e-35Initial program 20.4%
associate-*l*20.4%
unpow220.4%
+-commutative20.4%
unpow220.4%
associate-*l*20.4%
unpow220.4%
Simplified20.4%
Taylor expanded in A around -inf 12.9%
mul-1-neg12.9%
sub-neg12.9%
Simplified12.9%
if 1.5999999999999999e-35 < A Initial program 22.2%
associate-*l*22.2%
unpow222.2%
+-commutative22.2%
unpow222.2%
associate-*l*22.2%
unpow222.2%
Simplified22.2%
Taylor expanded in A around inf 27.1%
+-commutative27.1%
mul-1-neg27.1%
unsub-neg27.1%
associate--l+27.1%
unpow227.1%
unpow227.1%
unpow227.1%
difference-of-squares27.3%
distribute-rgt1-in27.3%
metadata-eval27.3%
mul0-lft27.3%
mul-1-neg27.3%
Simplified27.3%
Final simplification17.3%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* (* A C) 4.0))
(t_1 (* 2.0 (* F (- t_0 (* B B)))))
(t_2 (- (* B B) t_0)))
(if (<= A 2.5e-35)
(/ (- (sqrt (* (- (- A C) (+ A C)) t_1))) t_2)
(/ (- (sqrt (* (- (- C A) (+ A C)) t_1))) t_2))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (A * C) * 4.0;
double t_1 = 2.0 * (F * (t_0 - (B * B)));
double t_2 = (B * B) - t_0;
double tmp;
if (A <= 2.5e-35) {
tmp = -sqrt((((A - C) - (A + C)) * t_1)) / t_2;
} else {
tmp = -sqrt((((C - A) - (A + C)) * t_1)) / t_2;
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (a * c) * 4.0d0
t_1 = 2.0d0 * (f * (t_0 - (b * b)))
t_2 = (b * b) - t_0
if (a <= 2.5d-35) then
tmp = -sqrt((((a - c) - (a + c)) * t_1)) / t_2
else
tmp = -sqrt((((c - a) - (a + c)) * t_1)) / t_2
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (A * C) * 4.0;
double t_1 = 2.0 * (F * (t_0 - (B * B)));
double t_2 = (B * B) - t_0;
double tmp;
if (A <= 2.5e-35) {
tmp = -Math.sqrt((((A - C) - (A + C)) * t_1)) / t_2;
} else {
tmp = -Math.sqrt((((C - A) - (A + C)) * t_1)) / t_2;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (A * C) * 4.0 t_1 = 2.0 * (F * (t_0 - (B * B))) t_2 = (B * B) - t_0 tmp = 0 if A <= 2.5e-35: tmp = -math.sqrt((((A - C) - (A + C)) * t_1)) / t_2 else: tmp = -math.sqrt((((C - A) - (A + C)) * t_1)) / t_2 return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(A * C) * 4.0) t_1 = Float64(2.0 * Float64(F * Float64(t_0 - Float64(B * B)))) t_2 = Float64(Float64(B * B) - t_0) tmp = 0.0 if (A <= 2.5e-35) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(A - C) - Float64(A + C)) * t_1))) / t_2); else tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(C - A) - Float64(A + C)) * t_1))) / t_2); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (A * C) * 4.0; t_1 = 2.0 * (F * (t_0 - (B * B))); t_2 = (B * B) - t_0; tmp = 0.0; if (A <= 2.5e-35) tmp = -sqrt((((A - C) - (A + C)) * t_1)) / t_2; else tmp = -sqrt((((C - A) - (A + C)) * t_1)) / t_2; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[A, 2.5e-35], N[((-N[Sqrt[N[(N[(N[(A - C), $MachinePrecision] - N[(A + C), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], N[((-N[Sqrt[N[(N[(N[(C - A), $MachinePrecision] - N[(A + C), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \left(A \cdot C\right) \cdot 4\\
t_1 := 2 \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\\
t_2 := B \cdot B - t_0\\
\mathbf{if}\;A \leq 2.5 \cdot 10^{-35}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(A - C\right) - \left(A + C\right)\right) \cdot t_1}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(C - A\right) - \left(A + C\right)\right) \cdot t_1}}{t_2}\\
\end{array}
\end{array}
if A < 2.49999999999999982e-35Initial program 20.4%
associate-*l*20.4%
unpow220.4%
+-commutative20.4%
unpow220.4%
associate-*l*20.4%
unpow220.4%
Simplified20.4%
Taylor expanded in A around -inf 12.9%
mul-1-neg12.9%
sub-neg12.9%
Simplified12.9%
if 2.49999999999999982e-35 < A Initial program 22.2%
associate-*l*22.2%
unpow222.2%
+-commutative22.2%
unpow222.2%
associate-*l*22.2%
unpow222.2%
Simplified22.2%
Taylor expanded in B around 0 27.3%
Final simplification17.3%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (let* ((t_0 (- (* B B) (* (* A C) 4.0)))) (/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A (+ A C))))) t_0)))
B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
return -sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b * b) - ((a * c) * 4.0d0)
code = -sqrt(((2.0d0 * (f * t_0)) * (a + (a + c)))) / t_0
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
return -Math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) return -math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + Float64(A + C))))) / t_0) end
B = abs(B) function tmp = code(A, B, C, F) t_0 = (B * B) - ((A * C) * 4.0); tmp = -sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{t_0}
\end{array}
\end{array}
Initial program 21.0%
associate-*l*21.0%
unpow221.0%
+-commutative21.0%
unpow221.0%
associate-*l*21.0%
unpow221.0%
Simplified21.0%
Taylor expanded in A around inf 10.5%
Final simplification10.5%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (sqrt (* A F)) (- (/ 2.0 B))))
B = abs(B);
double code(double A, double B, double C, double F) {
return sqrt((A * F)) * -(2.0 / B);
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((a * f)) * -(2.0d0 / b)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return Math.sqrt((A * F)) * -(2.0 / B);
}
B = abs(B) def code(A, B, C, F): return math.sqrt((A * F)) * -(2.0 / B)
B = abs(B) function code(A, B, C, F) return Float64(sqrt(Float64(A * F)) * Float64(-Float64(2.0 / B))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = sqrt((A * F)) * -(2.0 / B); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * (-N[(2.0 / B), $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\sqrt{A \cdot F} \cdot \left(-\frac{2}{B}\right)
\end{array}
Initial program 21.0%
associate-*l*21.0%
unpow221.0%
+-commutative21.0%
unpow221.0%
associate-*l*21.0%
unpow221.0%
Simplified21.0%
Taylor expanded in A around inf 10.5%
Taylor expanded in C around 0 2.4%
mul-1-neg2.4%
unpow22.4%
rem-square-sqrt2.4%
Simplified2.4%
Final simplification2.4%
herbie shell --seed 2023200
(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))))