
(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 20 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
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* 2.0 (fma (* A C) -4.0 (* B B))))
(t_1 (fma B B (* C (* A -4.0))))
(t_2 (- (pow B 2.0) (* (* 4.0 A) C)))
(t_3
(/
(-
(sqrt
(*
(* 2.0 (* t_2 F))
(+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
t_2)))
(if (<= t_3 (- INFINITY))
(/ (* (sqrt (* F t_0)) (- (sqrt (+ C C)))) t_1)
(if (<= t_3 -2e-212)
(/ (- (sqrt (* 2.0 (* t_1 (* F (+ A (+ C (hypot B (- C A))))))))) t_1)
(if (<= t_3 0.0)
(/
(*
(sqrt (* 2.0 (* t_1 (+ C (+ C (* -0.5 (/ (pow B 2.0) A)))))))
(- (sqrt F)))
(- (* B B) (* 4.0 (* A C))))
(if (<= t_3 INFINITY)
(/ (* (sqrt (* t_0 (* 2.0 F))) (- (sqrt C))) t_1)
(* (/ (sqrt (+ C (hypot C B))) B) (- (sqrt (* 2.0 F))))))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = 2.0 * fma((A * C), -4.0, (B * B));
double t_1 = fma(B, B, (C * (A * -4.0)));
double t_2 = pow(B, 2.0) - ((4.0 * A) * C);
double t_3 = -sqrt(((2.0 * (t_2 * F)) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_2;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = (sqrt((F * t_0)) * -sqrt((C + C))) / t_1;
} else if (t_3 <= -2e-212) {
tmp = -sqrt((2.0 * (t_1 * (F * (A + (C + hypot(B, (C - A)))))))) / t_1;
} else if (t_3 <= 0.0) {
tmp = (sqrt((2.0 * (t_1 * (C + (C + (-0.5 * (pow(B, 2.0) / A))))))) * -sqrt(F)) / ((B * B) - (4.0 * (A * C)));
} else if (t_3 <= ((double) INFINITY)) {
tmp = (sqrt((t_0 * (2.0 * F))) * -sqrt(C)) / t_1;
} else {
tmp = (sqrt((C + hypot(C, B))) / B) * -sqrt((2.0 * F));
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(2.0 * fma(Float64(A * C), -4.0, Float64(B * B))) t_1 = fma(B, B, Float64(C * Float64(A * -4.0))) t_2 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_3 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_2) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(Float64(sqrt(Float64(F * t_0)) * Float64(-sqrt(Float64(C + C)))) / t_1); elseif (t_3 <= -2e-212) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(F * Float64(A + Float64(C + hypot(B, Float64(C - A))))))))) / t_1); elseif (t_3 <= 0.0) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(C + Float64(C + Float64(-0.5 * Float64((B ^ 2.0) / A))))))) * Float64(-sqrt(F))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); elseif (t_3 <= Inf) tmp = Float64(Float64(sqrt(Float64(t_0 * Float64(2.0 * F))) * Float64(-sqrt(C))) / t_1); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B))) / B) * Float64(-sqrt(Float64(2.0 * F)))); end return tmp end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(2.0 * N[(N[(A * C), $MachinePrecision] * -4.0 + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$3, -2e-212], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(C - A), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(C + N[(C + N[(-0.5 * N[(N[Power[B, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(N[Sqrt[N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[C], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := 2 \cdot \mathsf{fma}\left(A \cdot C, -4, B \cdot B\right)\\
t_1 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_2 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_3 := \frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_2}\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;\frac{\sqrt{F \cdot t_0} \cdot \left(-\sqrt{C + C}\right)}{t_1}\\
\mathbf{elif}\;t_3 \leq -2 \cdot 10^{-212}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + \left(C + \mathsf{hypot}\left(B, C - A\right)\right)\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;t_3 \leq 0:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(t_1 \cdot \left(C + \left(C + -0.5 \cdot \frac{{B}^{2}}{A}\right)\right)\right)} \cdot \left(-\sqrt{F}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;\frac{\sqrt{t_0 \cdot \left(2 \cdot F\right)} \cdot \left(-\sqrt{C}\right)}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{C + \mathsf{hypot}\left(C, B\right)}}{B} \cdot \left(-\sqrt{2 \cdot F}\right)\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -inf.0Initial program 3.0%
Simplified16.8%
Taylor expanded in A around -inf 3.5%
Applied egg-rr12.0%
if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -1.99999999999999991e-212Initial program 98.3%
Simplified98.5%
if -1.99999999999999991e-212 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -0.0Initial program 3.6%
Simplified3.6%
Applied egg-rr8.2%
Taylor expanded in A around -inf 27.8%
if -0.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0Initial program 36.4%
Simplified40.1%
Taylor expanded in A around -inf 23.4%
associate-*r*23.4%
associate-*r*23.4%
associate-*r*23.6%
sqrt-prod34.2%
fma-udef34.2%
+-commutative34.2%
associate-*r*34.2%
*-commutative34.2%
fma-def34.2%
*-commutative34.2%
Applied egg-rr34.2%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 0.0%
Simplified0.0%
Taylor expanded in A around 0 2.0%
associate-*r*2.0%
mul-1-neg2.0%
unpow22.0%
unpow22.0%
hypot-def16.1%
Simplified16.1%
distribute-lft-neg-out16.1%
associate-*l/16.0%
sqrt-unprod16.0%
hypot-udef2.0%
+-commutative2.0%
hypot-def16.0%
Applied egg-rr16.0%
associate-*r*16.0%
*-commutative16.0%
sqrt-prod24.0%
*-commutative24.0%
Applied egg-rr24.0%
associate-*l/24.1%
Applied egg-rr24.1%
Final simplification36.4%
NOTE: B should be positive before calling this function
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 (fma B B (* C (* A -4.0)))))
(if (<= B 9e-231)
(/ (- (sqrt (* 2.0 (* t_1 (* F (* 2.0 C)))))) t_1)
(if (<= B 2.65e-131)
(/
(*
(sqrt (* (* 2.0 (fma (* A C) -4.0 (* B B))) (* 2.0 F)))
(- (sqrt C)))
t_1)
(if (<= B 1.9e-45)
(/ (* (sqrt (* 2.0 (* (+ C C) t_1))) (- (sqrt F))) t_0)
(if (<= B 1.15e+29)
(/
(*
(sqrt (* F t_1))
(- (sqrt (* 2.0 (+ C (+ A (hypot B (- A C))))))))
t_0)
(/ (* (sqrt (+ C (hypot C B))) (- (sqrt (* 2.0 F)))) B)))))))B = abs(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 = fma(B, B, (C * (A * -4.0)));
double tmp;
if (B <= 9e-231) {
tmp = -sqrt((2.0 * (t_1 * (F * (2.0 * C))))) / t_1;
} else if (B <= 2.65e-131) {
tmp = (sqrt(((2.0 * fma((A * C), -4.0, (B * B))) * (2.0 * F))) * -sqrt(C)) / t_1;
} else if (B <= 1.9e-45) {
tmp = (sqrt((2.0 * ((C + C) * t_1))) * -sqrt(F)) / t_0;
} else if (B <= 1.15e+29) {
tmp = (sqrt((F * t_1)) * -sqrt((2.0 * (C + (A + hypot(B, (A - C))))))) / t_0;
} else {
tmp = (sqrt((C + hypot(C, B))) * -sqrt((2.0 * F))) / B;
}
return tmp;
}
B = abs(B) 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 = fma(B, B, Float64(C * Float64(A * -4.0))) tmp = 0.0 if (B <= 9e-231) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(F * Float64(2.0 * C)))))) / t_1); elseif (B <= 2.65e-131) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * fma(Float64(A * C), -4.0, Float64(B * B))) * Float64(2.0 * F))) * Float64(-sqrt(C))) / t_1); elseif (B <= 1.9e-45) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(Float64(C + C) * t_1))) * Float64(-sqrt(F))) / t_0); elseif (B <= 1.15e+29) tmp = Float64(Float64(sqrt(Float64(F * t_1)) * Float64(-sqrt(Float64(2.0 * Float64(C + Float64(A + hypot(B, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(Float64(2.0 * F)))) / B); end return tmp end
NOTE: B should be positive before calling this function
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[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 9e-231], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 2.65e-131], N[(N[(N[Sqrt[N[(N[(2.0 * N[(N[(A * C), $MachinePrecision] * -4.0 + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[C], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B, 1.9e-45], N[(N[(N[Sqrt[N[(2.0 * N[(N[(C + C), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 1.15e+29], N[(N[(N[Sqrt[N[(F * t$95$1), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;B \leq 9 \cdot 10^{-231}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(2 \cdot C\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 2.65 \cdot 10^{-131}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \mathsf{fma}\left(A \cdot C, -4, B \cdot B\right)\right) \cdot \left(2 \cdot F\right)} \cdot \left(-\sqrt{C}\right)}{t_1}\\
\mathbf{elif}\;B \leq 1.9 \cdot 10^{-45}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left(C + C\right) \cdot t_1\right)} \cdot \left(-\sqrt{F}\right)}{t_0}\\
\mathbf{elif}\;B \leq 1.15 \cdot 10^{+29}:\\
\;\;\;\;\frac{\sqrt{F \cdot t_1} \cdot \left(-\sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{2 \cdot F}\right)}{B}\\
\end{array}
\end{array}
if B < 8.9999999999999996e-231Initial program 25.4%
Simplified29.6%
Taylor expanded in A around -inf 12.1%
if 8.9999999999999996e-231 < B < 2.65000000000000009e-131Initial program 9.6%
Simplified13.6%
Taylor expanded in A around -inf 2.5%
associate-*r*2.5%
associate-*r*2.5%
associate-*r*6.0%
sqrt-prod11.0%
fma-udef11.0%
+-commutative11.0%
associate-*r*11.0%
*-commutative11.0%
fma-def11.0%
*-commutative11.0%
Applied egg-rr11.0%
if 2.65000000000000009e-131 < B < 1.89999999999999999e-45Initial program 15.9%
Simplified15.9%
Applied egg-rr23.9%
Taylor expanded in A around -inf 14.4%
if 1.89999999999999999e-45 < B < 1.1500000000000001e29Initial program 47.1%
Simplified47.1%
Applied egg-rr53.4%
if 1.1500000000000001e29 < B Initial program 12.1%
Simplified12.1%
Taylor expanded in A around 0 20.8%
associate-*r*20.8%
mul-1-neg20.8%
unpow220.8%
unpow220.8%
hypot-def47.7%
Simplified47.7%
distribute-lft-neg-out47.7%
associate-*l/47.7%
sqrt-unprod47.7%
hypot-udef20.9%
+-commutative20.9%
hypot-def47.7%
Applied egg-rr47.7%
associate-*r*47.7%
*-commutative47.7%
sqrt-prod64.3%
*-commutative64.3%
Applied egg-rr64.3%
Final simplification25.3%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* A -4.0)))))
(if (<= B 6.2e-231)
(/ (- (sqrt (* 2.0 (* t_0 (* F (* 2.0 C)))))) t_0)
(if (<= B 1.5e-131)
(/
(* (sqrt (* F (* 2.0 (fma (* A C) -4.0 (* B B))))) (- (sqrt (+ C C))))
t_0)
(if (<= B 2e-45)
(/
(* (sqrt (* 2.0 (* (+ C C) t_0))) (- (sqrt F)))
(- (* B B) (* 4.0 (* A C))))
(/ (* (sqrt (+ C (hypot C B))) (- (sqrt (* 2.0 F)))) B))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (A * -4.0)));
double tmp;
if (B <= 6.2e-231) {
tmp = -sqrt((2.0 * (t_0 * (F * (2.0 * C))))) / t_0;
} else if (B <= 1.5e-131) {
tmp = (sqrt((F * (2.0 * fma((A * C), -4.0, (B * B))))) * -sqrt((C + C))) / t_0;
} else if (B <= 2e-45) {
tmp = (sqrt((2.0 * ((C + C) * t_0))) * -sqrt(F)) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (sqrt((C + hypot(C, B))) * -sqrt((2.0 * F))) / B;
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(A * -4.0))) tmp = 0.0 if (B <= 6.2e-231) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(2.0 * C)))))) / t_0); elseif (B <= 1.5e-131) tmp = Float64(Float64(sqrt(Float64(F * Float64(2.0 * fma(Float64(A * C), -4.0, Float64(B * B))))) * Float64(-sqrt(Float64(C + C)))) / t_0); elseif (B <= 2e-45) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(Float64(C + C) * t_0))) * Float64(-sqrt(F))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(Float64(2.0 * F)))) / B); end return tmp end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 6.2e-231], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.5e-131], N[(N[(N[Sqrt[N[(F * N[(2.0 * N[(N[(A * C), $MachinePrecision] * -4.0 + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 2e-45], N[(N[(N[Sqrt[N[(2.0 * N[(N[(C + C), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;B \leq 6.2 \cdot 10^{-231}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(2 \cdot C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.5 \cdot 10^{-131}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(2 \cdot \mathsf{fma}\left(A \cdot C, -4, B \cdot B\right)\right)} \cdot \left(-\sqrt{C + C}\right)}{t_0}\\
\mathbf{elif}\;B \leq 2 \cdot 10^{-45}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left(C + C\right) \cdot t_0\right)} \cdot \left(-\sqrt{F}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{2 \cdot F}\right)}{B}\\
\end{array}
\end{array}
if B < 6.19999999999999976e-231Initial program 25.4%
Simplified29.6%
Taylor expanded in A around -inf 12.1%
if 6.19999999999999976e-231 < B < 1.49999999999999998e-131Initial program 9.6%
Simplified13.6%
Taylor expanded in A around -inf 2.5%
Applied egg-rr11.1%
if 1.49999999999999998e-131 < B < 1.99999999999999997e-45Initial program 15.9%
Simplified15.9%
Applied egg-rr23.9%
Taylor expanded in A around -inf 14.4%
if 1.99999999999999997e-45 < B Initial program 19.8%
Simplified19.8%
Taylor expanded in A around 0 25.1%
associate-*r*25.1%
mul-1-neg25.1%
unpow225.1%
unpow225.1%
hypot-def46.2%
Simplified46.2%
distribute-lft-neg-out46.2%
associate-*l/46.2%
sqrt-unprod46.2%
hypot-udef25.2%
+-commutative25.2%
hypot-def46.2%
Applied egg-rr46.2%
associate-*r*46.2%
*-commutative46.2%
sqrt-prod59.2%
*-commutative59.2%
Applied egg-rr59.2%
Final simplification24.6%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* A -4.0)))))
(if (<= B 9.5e-231)
(/ (- (sqrt (* 2.0 (* t_0 (* F (* 2.0 C)))))) t_0)
(if (<= B 2.95e-130)
(/
(*
(sqrt (* (* 2.0 (fma (* A C) -4.0 (* B B))) (* 2.0 F)))
(- (sqrt C)))
t_0)
(if (<= B 1.35e-45)
(/
(* (sqrt (* 2.0 (* (+ C C) t_0))) (- (sqrt F)))
(- (* B B) (* 4.0 (* A C))))
(/ (* (sqrt (+ C (hypot C B))) (- (sqrt (* 2.0 F)))) B))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (A * -4.0)));
double tmp;
if (B <= 9.5e-231) {
tmp = -sqrt((2.0 * (t_0 * (F * (2.0 * C))))) / t_0;
} else if (B <= 2.95e-130) {
tmp = (sqrt(((2.0 * fma((A * C), -4.0, (B * B))) * (2.0 * F))) * -sqrt(C)) / t_0;
} else if (B <= 1.35e-45) {
tmp = (sqrt((2.0 * ((C + C) * t_0))) * -sqrt(F)) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (sqrt((C + hypot(C, B))) * -sqrt((2.0 * F))) / B;
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(A * -4.0))) tmp = 0.0 if (B <= 9.5e-231) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(2.0 * C)))))) / t_0); elseif (B <= 2.95e-130) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * fma(Float64(A * C), -4.0, Float64(B * B))) * Float64(2.0 * F))) * Float64(-sqrt(C))) / t_0); elseif (B <= 1.35e-45) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(Float64(C + C) * t_0))) * Float64(-sqrt(F))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(Float64(2.0 * F)))) / B); end return tmp end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 9.5e-231], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.95e-130], N[(N[(N[Sqrt[N[(N[(2.0 * N[(N[(A * C), $MachinePrecision] * -4.0 + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[C], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 1.35e-45], N[(N[(N[Sqrt[N[(2.0 * N[(N[(C + C), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;B \leq 9.5 \cdot 10^{-231}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(2 \cdot C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.95 \cdot 10^{-130}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \mathsf{fma}\left(A \cdot C, -4, B \cdot B\right)\right) \cdot \left(2 \cdot F\right)} \cdot \left(-\sqrt{C}\right)}{t_0}\\
\mathbf{elif}\;B \leq 1.35 \cdot 10^{-45}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left(C + C\right) \cdot t_0\right)} \cdot \left(-\sqrt{F}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{2 \cdot F}\right)}{B}\\
\end{array}
\end{array}
if B < 9.4999999999999995e-231Initial program 25.4%
Simplified29.6%
Taylor expanded in A around -inf 12.1%
if 9.4999999999999995e-231 < B < 2.9500000000000001e-130Initial program 9.6%
Simplified13.6%
Taylor expanded in A around -inf 2.5%
associate-*r*2.5%
associate-*r*2.5%
associate-*r*6.0%
sqrt-prod11.0%
fma-udef11.0%
+-commutative11.0%
associate-*r*11.0%
*-commutative11.0%
fma-def11.0%
*-commutative11.0%
Applied egg-rr11.0%
if 2.9500000000000001e-130 < B < 1.34999999999999992e-45Initial program 15.9%
Simplified15.9%
Applied egg-rr23.9%
Taylor expanded in A around -inf 14.4%
if 1.34999999999999992e-45 < B Initial program 19.8%
Simplified19.8%
Taylor expanded in A around 0 25.1%
associate-*r*25.1%
mul-1-neg25.1%
unpow225.1%
unpow225.1%
hypot-def46.2%
Simplified46.2%
distribute-lft-neg-out46.2%
associate-*l/46.2%
sqrt-unprod46.2%
hypot-udef25.2%
+-commutative25.2%
hypot-def46.2%
Applied egg-rr46.2%
associate-*r*46.2%
*-commutative46.2%
sqrt-prod59.2%
*-commutative59.2%
Applied egg-rr59.2%
Final simplification24.6%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* A -4.0)))))
(if (<= B 1.26e-145)
(/ (- (sqrt (* 2.0 (* t_0 (* F (* 2.0 C)))))) t_0)
(if (<= B 3.1e-46)
(/
(* (sqrt (* 2.0 (* (+ C C) t_0))) (- (sqrt F)))
(- (* B B) (* 4.0 (* A C))))
(/ (* (sqrt (+ C (hypot C B))) (- (sqrt (* 2.0 F)))) B)))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (A * -4.0)));
double tmp;
if (B <= 1.26e-145) {
tmp = -sqrt((2.0 * (t_0 * (F * (2.0 * C))))) / t_0;
} else if (B <= 3.1e-46) {
tmp = (sqrt((2.0 * ((C + C) * t_0))) * -sqrt(F)) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (sqrt((C + hypot(C, B))) * -sqrt((2.0 * F))) / B;
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(A * -4.0))) tmp = 0.0 if (B <= 1.26e-145) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(2.0 * C)))))) / t_0); elseif (B <= 3.1e-46) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(Float64(C + C) * t_0))) * Float64(-sqrt(F))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(Float64(2.0 * F)))) / B); end return tmp end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.26e-145], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 3.1e-46], N[(N[(N[Sqrt[N[(2.0 * N[(N[(C + C), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;B \leq 1.26 \cdot 10^{-145}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(2 \cdot C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 3.1 \cdot 10^{-46}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left(C + C\right) \cdot t_0\right)} \cdot \left(-\sqrt{F}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{2 \cdot F}\right)}{B}\\
\end{array}
\end{array}
if B < 1.2599999999999999e-145Initial program 23.5%
Simplified27.6%
Taylor expanded in A around -inf 10.8%
if 1.2599999999999999e-145 < B < 3.1000000000000001e-46Initial program 12.8%
Simplified12.8%
Applied egg-rr19.5%
Taylor expanded in A around -inf 11.5%
if 3.1000000000000001e-46 < B Initial program 19.8%
Simplified19.8%
Taylor expanded in A around 0 25.1%
associate-*r*25.1%
mul-1-neg25.1%
unpow225.1%
unpow225.1%
hypot-def46.2%
Simplified46.2%
distribute-lft-neg-out46.2%
associate-*l/46.2%
sqrt-unprod46.2%
hypot-udef25.2%
+-commutative25.2%
hypot-def46.2%
Applied egg-rr46.2%
associate-*r*46.2%
*-commutative46.2%
sqrt-prod59.2%
*-commutative59.2%
Applied egg-rr59.2%
Final simplification23.7%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B 7.4e-44)
(/
(- (sqrt (* 2.0 (* 2.0 (* C (* F (+ (pow B 2.0) (* -4.0 (* A C)))))))))
(fma B B (* C (* A -4.0))))
(/ (* (sqrt (+ C (hypot C B))) (- (sqrt (* 2.0 F)))) B)))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 7.4e-44) {
tmp = -sqrt((2.0 * (2.0 * (C * (F * (pow(B, 2.0) + (-4.0 * (A * C)))))))) / fma(B, B, (C * (A * -4.0)));
} else {
tmp = (sqrt((C + hypot(C, B))) * -sqrt((2.0 * F))) / B;
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 7.4e-44) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(2.0 * Float64(C * Float64(F * Float64((B ^ 2.0) + Float64(-4.0 * Float64(A * C))))))))) / fma(B, B, Float64(C * Float64(A * -4.0)))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(Float64(2.0 * F)))) / B); end return tmp end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, 7.4e-44], N[((-N[Sqrt[N[(2.0 * N[(2.0 * N[(C * N[(F * N[(N[Power[B, 2.0], $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 7.4 \cdot 10^{-44}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(2 \cdot \left(C \cdot \left(F \cdot \left({B}^{2} + -4 \cdot \left(A \cdot C\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{2 \cdot F}\right)}{B}\\
\end{array}
\end{array}
if B < 7.4e-44Initial program 22.4%
Simplified26.5%
Taylor expanded in A around -inf 10.9%
Taylor expanded in F around 0 11.4%
if 7.4e-44 < B Initial program 19.8%
Simplified19.8%
Taylor expanded in A around 0 25.1%
associate-*r*25.1%
mul-1-neg25.1%
unpow225.1%
unpow225.1%
hypot-def46.2%
Simplified46.2%
distribute-lft-neg-out46.2%
associate-*l/46.2%
sqrt-unprod46.2%
hypot-udef25.2%
+-commutative25.2%
hypot-def46.2%
Applied egg-rr46.2%
associate-*r*46.2%
*-commutative46.2%
sqrt-prod59.2%
*-commutative59.2%
Applied egg-rr59.2%
Final simplification24.1%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* A -4.0)))))
(if (<= B 6e-44)
(/ (- (sqrt (* 2.0 (* t_0 (* F (* 2.0 C)))))) t_0)
(/ (* (sqrt (+ C (hypot C B))) (- (sqrt (* 2.0 F)))) B))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (A * -4.0)));
double tmp;
if (B <= 6e-44) {
tmp = -sqrt((2.0 * (t_0 * (F * (2.0 * C))))) / t_0;
} else {
tmp = (sqrt((C + hypot(C, B))) * -sqrt((2.0 * F))) / B;
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(A * -4.0))) tmp = 0.0 if (B <= 6e-44) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(2.0 * C)))))) / t_0); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(Float64(2.0 * F)))) / B); end return tmp end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 6e-44], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;B \leq 6 \cdot 10^{-44}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(2 \cdot C\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{2 \cdot F}\right)}{B}\\
\end{array}
\end{array}
if B < 6.0000000000000005e-44Initial program 22.4%
Simplified26.5%
Taylor expanded in A around -inf 10.9%
if 6.0000000000000005e-44 < B Initial program 19.8%
Simplified19.8%
Taylor expanded in A around 0 25.1%
associate-*r*25.1%
mul-1-neg25.1%
unpow225.1%
unpow225.1%
hypot-def46.2%
Simplified46.2%
distribute-lft-neg-out46.2%
associate-*l/46.2%
sqrt-unprod46.2%
hypot-udef25.2%
+-commutative25.2%
hypot-def46.2%
Applied egg-rr46.2%
associate-*r*46.2%
*-commutative46.2%
sqrt-prod59.2%
*-commutative59.2%
Applied egg-rr59.2%
Final simplification23.7%
NOTE: B should be positive before calling this function
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 (+ C C))) (t_1 (* C (* A -4.0))))
(if (<= B 5.4e-45)
(/ (- (sqrt (* 2.0 (+ (* t_1 t_0) (* (* B B) t_0))))) (fma B B t_1))
(* (/ (sqrt (* 2.0 (+ C (hypot C B)))) B) (- (sqrt F))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * (C + C);
double t_1 = C * (A * -4.0);
double tmp;
if (B <= 5.4e-45) {
tmp = -sqrt((2.0 * ((t_1 * t_0) + ((B * B) * t_0)))) / fma(B, B, t_1);
} else {
tmp = (sqrt((2.0 * (C + hypot(C, B)))) / B) * -sqrt(F);
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(C + C)) t_1 = Float64(C * Float64(A * -4.0)) tmp = 0.0 if (B <= 5.4e-45) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_1 * t_0) + Float64(Float64(B * B) * t_0))))) / fma(B, B, t_1)); else tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(C + hypot(C, B)))) / B) * Float64(-sqrt(F))); end return tmp end
NOTE: B should be positive before calling this function
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[(C + C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 5.4e-45], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$1 * t$95$0), $MachinePrecision] + N[(N[(B * B), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B * B + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(2.0 * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(C + C\right)\\
t_1 := C \cdot \left(A \cdot -4\right)\\
\mathbf{if}\;B \leq 5.4 \cdot 10^{-45}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot t_0 + \left(B \cdot B\right) \cdot t_0\right)}}{\mathsf{fma}\left(B, B, t_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}}{B} \cdot \left(-\sqrt{F}\right)\\
\end{array}
\end{array}
if B < 5.3999999999999997e-45Initial program 22.4%
Simplified26.5%
Taylor expanded in A around -inf 10.9%
*-commutative10.9%
associate-*r*10.9%
*-commutative10.9%
*-commutative10.9%
metadata-eval10.9%
fma-def10.9%
cancel-sign-sub-inv10.9%
cancel-sign-sub-inv10.9%
distribute-lft-in10.8%
+-commutative10.8%
count-210.8%
metadata-eval10.8%
*-commutative10.8%
*-commutative10.8%
associate-*r*10.8%
*-commutative10.8%
count-210.8%
Applied egg-rr10.8%
if 5.3999999999999997e-45 < B Initial program 19.8%
Simplified19.8%
Taylor expanded in A around 0 25.1%
associate-*r*25.1%
mul-1-neg25.1%
unpow225.1%
unpow225.1%
hypot-def46.2%
Simplified46.2%
distribute-lft-neg-out46.2%
associate-*l/46.2%
sqrt-unprod46.2%
hypot-udef25.2%
+-commutative25.2%
hypot-def46.2%
Applied egg-rr46.2%
sqrt-prod46.2%
*-commutative46.2%
sqrt-unprod59.1%
associate-*l/59.1%
associate-*r*59.0%
associate-*l/59.1%
sqrt-unprod57.9%
*-commutative57.9%
Applied egg-rr57.9%
Final simplification23.3%
NOTE: B should be positive before calling this function
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 (+ C C))) (t_1 (* C (* A -4.0))))
(if (<= B 1.05e-44)
(/ (- (sqrt (* 2.0 (+ (* t_1 t_0) (* (* B B) t_0))))) (fma B B t_1))
(* (/ (sqrt (+ C (hypot C B))) B) (- (sqrt (* 2.0 F)))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * (C + C);
double t_1 = C * (A * -4.0);
double tmp;
if (B <= 1.05e-44) {
tmp = -sqrt((2.0 * ((t_1 * t_0) + ((B * B) * t_0)))) / fma(B, B, t_1);
} else {
tmp = (sqrt((C + hypot(C, B))) / B) * -sqrt((2.0 * F));
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(C + C)) t_1 = Float64(C * Float64(A * -4.0)) tmp = 0.0 if (B <= 1.05e-44) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_1 * t_0) + Float64(Float64(B * B) * t_0))))) / fma(B, B, t_1)); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B))) / B) * Float64(-sqrt(Float64(2.0 * F)))); end return tmp end
NOTE: B should be positive before calling this function
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[(C + C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.05e-44], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$1 * t$95$0), $MachinePrecision] + N[(N[(B * B), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B * B + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(C + C\right)\\
t_1 := C \cdot \left(A \cdot -4\right)\\
\mathbf{if}\;B \leq 1.05 \cdot 10^{-44}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot t_0 + \left(B \cdot B\right) \cdot t_0\right)}}{\mathsf{fma}\left(B, B, t_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{C + \mathsf{hypot}\left(C, B\right)}}{B} \cdot \left(-\sqrt{2 \cdot F}\right)\\
\end{array}
\end{array}
if B < 1.05000000000000001e-44Initial program 22.4%
Simplified26.5%
Taylor expanded in A around -inf 10.9%
*-commutative10.9%
associate-*r*10.9%
*-commutative10.9%
*-commutative10.9%
metadata-eval10.9%
fma-def10.9%
cancel-sign-sub-inv10.9%
cancel-sign-sub-inv10.9%
distribute-lft-in10.8%
+-commutative10.8%
count-210.8%
metadata-eval10.8%
*-commutative10.8%
*-commutative10.8%
associate-*r*10.8%
*-commutative10.8%
count-210.8%
Applied egg-rr10.8%
if 1.05000000000000001e-44 < B Initial program 19.8%
Simplified19.8%
Taylor expanded in A around 0 25.1%
associate-*r*25.1%
mul-1-neg25.1%
unpow225.1%
unpow225.1%
hypot-def46.2%
Simplified46.2%
distribute-lft-neg-out46.2%
associate-*l/46.2%
sqrt-unprod46.2%
hypot-udef25.2%
+-commutative25.2%
hypot-def46.2%
Applied egg-rr46.2%
associate-*r*46.2%
*-commutative46.2%
sqrt-prod59.2%
*-commutative59.2%
Applied egg-rr59.2%
associate-*l/59.2%
Applied egg-rr59.2%
Final simplification23.6%
NOTE: B should be positive before calling this function
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 (+ C C))) (t_1 (* C (* A -4.0))))
(if (<= B 2.3e-44)
(/ (- (sqrt (* 2.0 (+ (* t_1 t_0) (* (* B B) t_0))))) (fma B B t_1))
(/ (* (sqrt (+ C (hypot C B))) (- (sqrt (* 2.0 F)))) B))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * (C + C);
double t_1 = C * (A * -4.0);
double tmp;
if (B <= 2.3e-44) {
tmp = -sqrt((2.0 * ((t_1 * t_0) + ((B * B) * t_0)))) / fma(B, B, t_1);
} else {
tmp = (sqrt((C + hypot(C, B))) * -sqrt((2.0 * F))) / B;
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(C + C)) t_1 = Float64(C * Float64(A * -4.0)) tmp = 0.0 if (B <= 2.3e-44) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_1 * t_0) + Float64(Float64(B * B) * t_0))))) / fma(B, B, t_1)); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B))) * Float64(-sqrt(Float64(2.0 * F)))) / B); end return tmp end
NOTE: B should be positive before calling this function
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[(C + C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 2.3e-44], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$1 * t$95$0), $MachinePrecision] + N[(N[(B * B), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B * B + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(C + C\right)\\
t_1 := C \cdot \left(A \cdot -4\right)\\
\mathbf{if}\;B \leq 2.3 \cdot 10^{-44}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot t_0 + \left(B \cdot B\right) \cdot t_0\right)}}{\mathsf{fma}\left(B, B, t_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{2 \cdot F}\right)}{B}\\
\end{array}
\end{array}
if B < 2.29999999999999998e-44Initial program 22.4%
Simplified26.5%
Taylor expanded in A around -inf 10.9%
*-commutative10.9%
associate-*r*10.9%
*-commutative10.9%
*-commutative10.9%
metadata-eval10.9%
fma-def10.9%
cancel-sign-sub-inv10.9%
cancel-sign-sub-inv10.9%
distribute-lft-in10.8%
+-commutative10.8%
count-210.8%
metadata-eval10.8%
*-commutative10.8%
*-commutative10.8%
associate-*r*10.8%
*-commutative10.8%
count-210.8%
Applied egg-rr10.8%
if 2.29999999999999998e-44 < B Initial program 19.8%
Simplified19.8%
Taylor expanded in A around 0 25.1%
associate-*r*25.1%
mul-1-neg25.1%
unpow225.1%
unpow225.1%
hypot-def46.2%
Simplified46.2%
distribute-lft-neg-out46.2%
associate-*l/46.2%
sqrt-unprod46.2%
hypot-udef25.2%
+-commutative25.2%
hypot-def46.2%
Applied egg-rr46.2%
associate-*r*46.2%
*-commutative46.2%
sqrt-prod59.2%
*-commutative59.2%
Applied egg-rr59.2%
Final simplification23.6%
NOTE: B should be positive before calling this function
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 (+ C C))) (t_1 (* C (* A -4.0))))
(if (<= B 5.5e-44)
(/ (- (sqrt (* 2.0 (+ (* t_1 t_0) (* (* B B) t_0))))) (fma B B t_1))
(if (<= B 1.45e+146)
(/ (- (sqrt (* 2.0 (* F (+ C (hypot C B)))))) B)
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt B))))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * (C + C);
double t_1 = C * (A * -4.0);
double tmp;
if (B <= 5.5e-44) {
tmp = -sqrt((2.0 * ((t_1 * t_0) + ((B * B) * t_0)))) / fma(B, B, t_1);
} else if (B <= 1.45e+146) {
tmp = -sqrt((2.0 * (F * (C + hypot(C, B))))) / B;
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt(B));
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(C + C)) t_1 = Float64(C * Float64(A * -4.0)) tmp = 0.0 if (B <= 5.5e-44) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_1 * t_0) + Float64(Float64(B * B) * t_0))))) / fma(B, B, t_1)); elseif (B <= 1.45e+146) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(C, B)))))) / B); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(B)))); end return tmp end
NOTE: B should be positive before calling this function
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[(C + C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 5.5e-44], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$1 * t$95$0), $MachinePrecision] + N[(N[(B * B), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B * B + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.45e+146], N[((-N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / B), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[B], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(C + C\right)\\
t_1 := C \cdot \left(A \cdot -4\right)\\
\mathbf{if}\;B \leq 5.5 \cdot 10^{-44}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot t_0 + \left(B \cdot B\right) \cdot t_0\right)}}{\mathsf{fma}\left(B, B, t_1\right)}\\
\mathbf{elif}\;B \leq 1.45 \cdot 10^{+146}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)\right)}}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B}\right)\right)\\
\end{array}
\end{array}
if B < 5.49999999999999993e-44Initial program 22.4%
Simplified26.5%
Taylor expanded in A around -inf 10.9%
*-commutative10.9%
associate-*r*10.9%
*-commutative10.9%
*-commutative10.9%
metadata-eval10.9%
fma-def10.9%
cancel-sign-sub-inv10.9%
cancel-sign-sub-inv10.9%
distribute-lft-in10.8%
+-commutative10.8%
count-210.8%
metadata-eval10.8%
*-commutative10.8%
*-commutative10.8%
associate-*r*10.8%
*-commutative10.8%
count-210.8%
Applied egg-rr10.8%
if 5.49999999999999993e-44 < B < 1.4499999999999999e146Initial program 33.6%
Simplified33.6%
Taylor expanded in A around 0 41.5%
associate-*r*41.5%
mul-1-neg41.5%
unpow241.5%
unpow241.5%
hypot-def45.0%
Simplified45.0%
distribute-lft-neg-out45.0%
associate-*l/45.1%
sqrt-unprod45.1%
hypot-udef41.7%
+-commutative41.7%
hypot-def45.1%
Applied egg-rr45.1%
if 1.4499999999999999e146 < B Initial program 3.3%
Simplified3.3%
Taylor expanded in A around 0 5.4%
associate-*r*5.4%
mul-1-neg5.4%
unpow25.4%
unpow25.4%
hypot-def47.6%
Simplified47.6%
Taylor expanded in C around 0 47.9%
sqrt-prod73.4%
Applied egg-rr73.4%
Final simplification23.3%
NOTE: B should be positive before calling this function
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 (+ C C))) (t_1 (* C (* A -4.0))))
(if (<= B 3.6e-44)
(/ (- (sqrt (* 2.0 (+ (* t_1 t_0) (* (* B B) t_0))))) (fma B B t_1))
(/ (/ -1.0 B) (pow (* 2.0 (* F (+ C (hypot B C)))) -0.5)))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * (C + C);
double t_1 = C * (A * -4.0);
double tmp;
if (B <= 3.6e-44) {
tmp = -sqrt((2.0 * ((t_1 * t_0) + ((B * B) * t_0)))) / fma(B, B, t_1);
} else {
tmp = (-1.0 / B) / pow((2.0 * (F * (C + hypot(B, C)))), -0.5);
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(C + C)) t_1 = Float64(C * Float64(A * -4.0)) tmp = 0.0 if (B <= 3.6e-44) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_1 * t_0) + Float64(Float64(B * B) * t_0))))) / fma(B, B, t_1)); else tmp = Float64(Float64(-1.0 / B) / (Float64(2.0 * Float64(F * Float64(C + hypot(B, C)))) ^ -0.5)); end return tmp end
NOTE: B should be positive before calling this function
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[(C + C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 3.6e-44], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$1 * t$95$0), $MachinePrecision] + N[(N[(B * B), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B * B + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / B), $MachinePrecision] / N[Power[N[(2.0 * N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(C + C\right)\\
t_1 := C \cdot \left(A \cdot -4\right)\\
\mathbf{if}\;B \leq 3.6 \cdot 10^{-44}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot t_0 + \left(B \cdot B\right) \cdot t_0\right)}}{\mathsf{fma}\left(B, B, t_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{B}}{{\left(2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)\right)\right)}^{-0.5}}\\
\end{array}
\end{array}
if B < 3.5999999999999999e-44Initial program 22.4%
Simplified26.5%
Taylor expanded in A around -inf 10.9%
*-commutative10.9%
associate-*r*10.9%
*-commutative10.9%
*-commutative10.9%
metadata-eval10.9%
fma-def10.9%
cancel-sign-sub-inv10.9%
cancel-sign-sub-inv10.9%
distribute-lft-in10.8%
+-commutative10.8%
count-210.8%
metadata-eval10.8%
*-commutative10.8%
*-commutative10.8%
associate-*r*10.8%
*-commutative10.8%
count-210.8%
Applied egg-rr10.8%
if 3.5999999999999999e-44 < B Initial program 19.8%
Simplified19.8%
Taylor expanded in A around 0 25.1%
associate-*r*25.1%
mul-1-neg25.1%
unpow225.1%
unpow225.1%
hypot-def46.2%
Simplified46.2%
distribute-lft-neg-out46.2%
associate-*l/46.2%
sqrt-unprod46.2%
hypot-udef25.2%
+-commutative25.2%
hypot-def46.2%
Applied egg-rr46.2%
associate-*r*46.2%
*-commutative46.2%
sqrt-prod59.2%
*-commutative59.2%
Applied egg-rr59.2%
sqrt-prod46.2%
clear-num46.2%
inv-pow46.2%
div-inv46.2%
unpow-prod-down46.2%
inv-pow46.2%
pow1/246.2%
pow-flip46.2%
metadata-eval46.2%
Applied egg-rr46.2%
*-commutative46.2%
unpow-146.2%
associate-*l/46.3%
*-lft-identity46.3%
*-commutative46.3%
*-commutative46.3%
hypot-def25.1%
unpow225.1%
unpow225.1%
+-commutative25.1%
associate-*r*25.1%
unpow225.1%
unpow225.1%
hypot-def46.3%
Simplified46.3%
Final simplification20.2%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B 6.6e-44)
(/
(sqrt (* 2.0 (* F (* (fma (* A C) -4.0 (* B B)) (+ C C)))))
(- (* (* 4.0 A) C) (* B B)))
(/ (/ -1.0 B) (pow (* 2.0 (* F (+ C (hypot B C)))) -0.5))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 6.6e-44) {
tmp = sqrt((2.0 * (F * (fma((A * C), -4.0, (B * B)) * (C + C))))) / (((4.0 * A) * C) - (B * B));
} else {
tmp = (-1.0 / B) / pow((2.0 * (F * (C + hypot(B, C)))), -0.5);
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 6.6e-44) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(fma(Float64(A * C), -4.0, Float64(B * B)) * Float64(C + C))))) / Float64(Float64(Float64(4.0 * A) * C) - Float64(B * B))); else tmp = Float64(Float64(-1.0 / B) / (Float64(2.0 * Float64(F * Float64(C + hypot(B, C)))) ^ -0.5)); end return tmp end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, 6.6e-44], N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(N[(A * C), $MachinePrecision] * -4.0 + N[(B * B), $MachinePrecision]), $MachinePrecision] * N[(C + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision] - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / B), $MachinePrecision] / N[Power[N[(2.0 * N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 6.6 \cdot 10^{-44}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(\mathsf{fma}\left(A \cdot C, -4, B \cdot B\right) \cdot \left(C + C\right)\right)\right)}}{\left(4 \cdot A\right) \cdot C - B \cdot B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{B}}{{\left(2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)\right)\right)}^{-0.5}}\\
\end{array}
\end{array}
if B < 6.60000000000000011e-44Initial program 22.4%
Simplified26.5%
Taylor expanded in A around -inf 10.9%
frac-2neg10.9%
distribute-frac-neg10.9%
neg-sub010.9%
Applied egg-rr10.7%
sub0-neg10.7%
mul-1-neg10.7%
associate-*r/10.7%
neg-mul-110.7%
Simplified10.7%
if 6.60000000000000011e-44 < B Initial program 19.8%
Simplified19.8%
Taylor expanded in A around 0 25.1%
associate-*r*25.1%
mul-1-neg25.1%
unpow225.1%
unpow225.1%
hypot-def46.2%
Simplified46.2%
distribute-lft-neg-out46.2%
associate-*l/46.2%
sqrt-unprod46.2%
hypot-udef25.2%
+-commutative25.2%
hypot-def46.2%
Applied egg-rr46.2%
associate-*r*46.2%
*-commutative46.2%
sqrt-prod59.2%
*-commutative59.2%
Applied egg-rr59.2%
sqrt-prod46.2%
clear-num46.2%
inv-pow46.2%
div-inv46.2%
unpow-prod-down46.2%
inv-pow46.2%
pow1/246.2%
pow-flip46.2%
metadata-eval46.2%
Applied egg-rr46.2%
*-commutative46.2%
unpow-146.2%
associate-*l/46.3%
*-lft-identity46.3%
*-commutative46.3%
*-commutative46.3%
hypot-def25.1%
unpow225.1%
unpow225.1%
+-commutative25.1%
associate-*r*25.1%
unpow225.1%
unpow225.1%
hypot-def46.3%
Simplified46.3%
Final simplification20.2%
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= B 1.35e-63) (/ (- (sqrt (* (* A (* F (* C C))) -16.0))) (fma A (* C -4.0) (* B B))) (/ (/ -1.0 B) (pow (* 2.0 (* F (+ C (hypot B C)))) -0.5))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 1.35e-63) {
tmp = -sqrt(((A * (F * (C * C))) * -16.0)) / fma(A, (C * -4.0), (B * B));
} else {
tmp = (-1.0 / B) / pow((2.0 * (F * (C + hypot(B, C)))), -0.5);
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 1.35e-63) tmp = Float64(Float64(-sqrt(Float64(Float64(A * Float64(F * Float64(C * C))) * -16.0))) / fma(A, Float64(C * -4.0), Float64(B * B))); else tmp = Float64(Float64(-1.0 / B) / (Float64(2.0 * Float64(F * Float64(C + hypot(B, C)))) ^ -0.5)); end return tmp end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, 1.35e-63], N[((-N[Sqrt[N[(N[(A * N[(F * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -16.0), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / B), $MachinePrecision] / N[Power[N[(2.0 * N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.35 \cdot 10^{-63}:\\
\;\;\;\;\frac{-\sqrt{\left(A \cdot \left(F \cdot \left(C \cdot C\right)\right)\right) \cdot -16}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{B}}{{\left(2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)\right)\right)}^{-0.5}}\\
\end{array}
\end{array}
if B < 1.3500000000000001e-63Initial program 22.5%
Simplified20.1%
Taylor expanded in A around -inf 8.7%
*-commutative8.7%
*-commutative8.7%
unpow28.7%
Simplified8.7%
if 1.3500000000000001e-63 < B Initial program 19.5%
Simplified19.5%
Taylor expanded in A around 0 24.7%
associate-*r*24.7%
mul-1-neg24.7%
unpow224.7%
unpow224.7%
hypot-def45.6%
Simplified45.6%
distribute-lft-neg-out45.6%
associate-*l/45.6%
sqrt-unprod45.6%
hypot-udef24.8%
+-commutative24.8%
hypot-def45.6%
Applied egg-rr45.6%
associate-*r*45.6%
*-commutative45.6%
sqrt-prod58.4%
*-commutative58.4%
Applied egg-rr58.4%
sqrt-prod45.6%
clear-num45.6%
inv-pow45.6%
div-inv45.6%
unpow-prod-down45.6%
inv-pow45.6%
pow1/245.6%
pow-flip45.6%
metadata-eval45.6%
Applied egg-rr45.6%
*-commutative45.6%
unpow-145.6%
associate-*l/45.7%
*-lft-identity45.7%
*-commutative45.7%
*-commutative45.7%
hypot-def24.8%
unpow224.8%
unpow224.8%
+-commutative24.8%
associate-*r*24.8%
unpow224.8%
unpow224.8%
hypot-def45.7%
Simplified45.7%
Final simplification18.7%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B 2.7e-61)
(/
(- (sqrt (* 2.0 (* -8.0 (* F (* A (* C C)))))))
(- (* B B) (* 4.0 (* A C))))
(/ (/ -1.0 B) (pow (* 2.0 (* F (+ C (hypot B C)))) -0.5))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 2.7e-61) {
tmp = -sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (-1.0 / B) / pow((2.0 * (F * (C + hypot(B, C)))), -0.5);
}
return tmp;
}
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 2.7e-61) {
tmp = -Math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (-1.0 / B) / Math.pow((2.0 * (F * (C + Math.hypot(B, C)))), -0.5);
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= 2.7e-61: tmp = -math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C))) else: tmp = (-1.0 / B) / math.pow((2.0 * (F * (C + math.hypot(B, C)))), -0.5) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 2.7e-61) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(-8.0 * Float64(F * Float64(A * Float64(C * C))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(Float64(-1.0 / B) / (Float64(2.0 * Float64(F * Float64(C + hypot(B, C)))) ^ -0.5)); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= 2.7e-61)
tmp = -sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
else
tmp = (-1.0 / B) / ((2.0 * (F * (C + hypot(B, C)))) ^ -0.5);
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, 2.7e-61], N[((-N[Sqrt[N[(2.0 * N[(-8.0 * N[(F * N[(A * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / B), $MachinePrecision] / N[Power[N[(2.0 * N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.7 \cdot 10^{-61}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(-8 \cdot \left(F \cdot \left(A \cdot \left(C \cdot C\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{B}}{{\left(2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)\right)\right)}^{-0.5}}\\
\end{array}
\end{array}
if B < 2.69999999999999993e-61Initial program 22.5%
Simplified22.5%
Taylor expanded in C around inf 9.0%
add-cbrt-cube_binary646.1%
Applied rewrite-once6.1%
associate-*l*6.1%
associate-+l+6.1%
count-26.1%
associate-*l*6.1%
count-26.1%
associate-+l+6.1%
+-commutative6.1%
+-commutative6.1%
Simplified6.1%
Taylor expanded in C around inf 8.7%
associate-*r*8.9%
unpow28.9%
Simplified8.9%
if 2.69999999999999993e-61 < B Initial program 19.5%
Simplified19.5%
Taylor expanded in A around 0 24.7%
associate-*r*24.7%
mul-1-neg24.7%
unpow224.7%
unpow224.7%
hypot-def45.6%
Simplified45.6%
distribute-lft-neg-out45.6%
associate-*l/45.6%
sqrt-unprod45.6%
hypot-udef24.8%
+-commutative24.8%
hypot-def45.6%
Applied egg-rr45.6%
associate-*r*45.6%
*-commutative45.6%
sqrt-prod58.4%
*-commutative58.4%
Applied egg-rr58.4%
sqrt-prod45.6%
clear-num45.6%
inv-pow45.6%
div-inv45.6%
unpow-prod-down45.6%
inv-pow45.6%
pow1/245.6%
pow-flip45.6%
metadata-eval45.6%
Applied egg-rr45.6%
*-commutative45.6%
unpow-145.6%
associate-*l/45.7%
*-lft-identity45.7%
*-commutative45.7%
*-commutative45.7%
hypot-def24.8%
unpow224.8%
unpow224.8%
+-commutative24.8%
associate-*r*24.8%
unpow224.8%
unpow224.8%
hypot-def45.7%
Simplified45.7%
Final simplification18.8%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B 9.2e-61)
(/
(- (sqrt (* 2.0 (* -8.0 (* F (* A (* C C)))))))
(- (* B B) (* 4.0 (* A C))))
(/ (- (sqrt (* 2.0 (* F (+ C (hypot C B)))))) B)))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 9.2e-61) {
tmp = -sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -sqrt((2.0 * (F * (C + hypot(C, B))))) / B;
}
return tmp;
}
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 9.2e-61) {
tmp = -Math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -Math.sqrt((2.0 * (F * (C + Math.hypot(C, B))))) / B;
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= 9.2e-61: tmp = -math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C))) else: tmp = -math.sqrt((2.0 * (F * (C + math.hypot(C, B))))) / B return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 9.2e-61) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(-8.0 * Float64(F * Float64(A * Float64(C * C))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(C, B)))))) / B); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= 9.2e-61)
tmp = -sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
else
tmp = -sqrt((2.0 * (F * (C + hypot(C, B))))) / B;
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, 9.2e-61], N[((-N[Sqrt[N[(2.0 * N[(-8.0 * N[(F * N[(A * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / B), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 9.2 \cdot 10^{-61}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(-8 \cdot \left(F \cdot \left(A \cdot \left(C \cdot C\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)\right)}}{B}\\
\end{array}
\end{array}
if B < 9.19999999999999967e-61Initial program 22.5%
Simplified22.5%
Taylor expanded in C around inf 9.0%
add-cbrt-cube_binary646.1%
Applied rewrite-once6.1%
associate-*l*6.1%
associate-+l+6.1%
count-26.1%
associate-*l*6.1%
count-26.1%
associate-+l+6.1%
+-commutative6.1%
+-commutative6.1%
Simplified6.1%
Taylor expanded in C around inf 8.7%
associate-*r*8.9%
unpow28.9%
Simplified8.9%
if 9.19999999999999967e-61 < B Initial program 19.5%
Simplified19.5%
Taylor expanded in A around 0 24.7%
associate-*r*24.7%
mul-1-neg24.7%
unpow224.7%
unpow224.7%
hypot-def45.6%
Simplified45.6%
distribute-lft-neg-out45.6%
associate-*l/45.6%
sqrt-unprod45.6%
hypot-udef24.8%
+-commutative24.8%
hypot-def45.6%
Applied egg-rr45.6%
Final simplification18.8%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B 1.05e-59)
(/
(- (sqrt (* 2.0 (* -8.0 (* F (* A (* C C)))))))
(- (* B B) (* 4.0 (* A C))))
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ B C)))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 1.05e-59) {
tmp = -sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + C)));
}
return tmp;
}
NOTE: B should be positive before calling this function
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.05d-59) then
tmp = -sqrt((2.0d0 * ((-8.0d0) * (f * (a * (c * c)))))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = (sqrt(2.0d0) / b) * -sqrt((f * (b + c)))
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 1.05e-59) {
tmp = -Math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (B + C)));
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= 1.05e-59: tmp = -math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C))) else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (B + C))) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 1.05e-59) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(-8.0 * Float64(F * Float64(A * Float64(C * C))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(B + C))))); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= 1.05e-59)
tmp = -sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + C)));
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, 1.05e-59], N[((-N[Sqrt[N[(2.0 * N[(-8.0 * N[(F * N[(A * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.05 \cdot 10^{-59}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(-8 \cdot \left(F \cdot \left(A \cdot \left(C \cdot C\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(B + C\right)}\right)\\
\end{array}
\end{array}
if B < 1.04999999999999998e-59Initial program 22.5%
Simplified22.5%
Taylor expanded in C around inf 9.0%
add-cbrt-cube_binary646.1%
Applied rewrite-once6.1%
associate-*l*6.1%
associate-+l+6.1%
count-26.1%
associate-*l*6.1%
count-26.1%
associate-+l+6.1%
+-commutative6.1%
+-commutative6.1%
Simplified6.1%
Taylor expanded in C around inf 8.7%
associate-*r*8.9%
unpow28.9%
Simplified8.9%
if 1.04999999999999998e-59 < B Initial program 19.5%
Simplified19.5%
Taylor expanded in A around 0 24.7%
associate-*r*24.7%
mul-1-neg24.7%
unpow224.7%
unpow224.7%
hypot-def45.6%
Simplified45.6%
Taylor expanded in C around 0 40.9%
Final simplification17.5%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B 2.6e-61)
(/
(- (sqrt (* 2.0 (* -8.0 (* F (* A (* C C)))))))
(- (* B B) (* 4.0 (* A C))))
(/ (sqrt (* 2.0 (* B F))) (- B))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 2.6e-61) {
tmp = -sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = sqrt((2.0 * (B * F))) / -B;
}
return tmp;
}
NOTE: B should be positive before calling this function
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.6d-61) then
tmp = -sqrt((2.0d0 * ((-8.0d0) * (f * (a * (c * c)))))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = sqrt((2.0d0 * (b * f))) / -b
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 2.6e-61) {
tmp = -Math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = Math.sqrt((2.0 * (B * F))) / -B;
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= 2.6e-61: tmp = -math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C))) else: tmp = math.sqrt((2.0 * (B * F))) / -B return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 2.6e-61) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(-8.0 * Float64(F * Float64(A * Float64(C * C))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(sqrt(Float64(2.0 * Float64(B * F))) / Float64(-B)); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= 2.6e-61)
tmp = -sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) / ((B * B) - (4.0 * (A * C)));
else
tmp = sqrt((2.0 * (B * F))) / -B;
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, 2.6e-61], N[((-N[Sqrt[N[(2.0 * N[(-8.0 * N[(F * N[(A * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(B * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B)), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.6 \cdot 10^{-61}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(-8 \cdot \left(F \cdot \left(A \cdot \left(C \cdot C\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(B \cdot F\right)}}{-B}\\
\end{array}
\end{array}
if B < 2.6000000000000001e-61Initial program 22.5%
Simplified22.5%
Taylor expanded in C around inf 9.0%
add-cbrt-cube_binary646.1%
Applied rewrite-once6.1%
associate-*l*6.1%
associate-+l+6.1%
count-26.1%
associate-*l*6.1%
count-26.1%
associate-+l+6.1%
+-commutative6.1%
+-commutative6.1%
Simplified6.1%
Taylor expanded in C around inf 8.7%
associate-*r*8.9%
unpow28.9%
Simplified8.9%
if 2.6000000000000001e-61 < B Initial program 19.5%
Simplified19.5%
Taylor expanded in A around 0 24.7%
associate-*r*24.7%
mul-1-neg24.7%
unpow224.7%
unpow224.7%
hypot-def45.6%
Simplified45.6%
Taylor expanded in C around 0 41.9%
distribute-lft-neg-out41.9%
neg-sub041.9%
cancel-sign-sub-inv41.9%
frac-2neg41.9%
distribute-frac-neg41.9%
remove-double-neg41.9%
associate-*l/41.9%
sqrt-unprod41.9%
*-commutative41.9%
Applied egg-rr41.9%
+-lft-identity41.9%
*-commutative41.9%
Simplified41.9%
Final simplification17.8%
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (/ (* 2.0 (- (sqrt (* C F)))) B))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
return (2.0 * -sqrt((C * F))) / B;
}
NOTE: B should be positive before calling this function
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 = (2.0d0 * -sqrt((c * f))) / b
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
return (2.0 * -Math.sqrt((C * F))) / B;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): return (2.0 * -math.sqrt((C * F))) / B
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) return Float64(Float64(2.0 * Float64(-sqrt(Float64(C * F)))) / B) end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = (2.0 * -sqrt((C * F))) / B;
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[(2.0 * (-N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{2 \cdot \left(-\sqrt{C \cdot F}\right)}{B}
\end{array}
Initial program 21.7%
Simplified21.7%
Taylor expanded in A around 0 9.0%
associate-*r*9.0%
mul-1-neg9.0%
unpow29.0%
unpow29.0%
hypot-def15.1%
Simplified15.1%
distribute-lft-neg-out15.1%
associate-*l/15.1%
sqrt-unprod15.1%
hypot-udef9.0%
+-commutative9.0%
hypot-def15.1%
Applied egg-rr15.1%
Taylor expanded in B around 0 2.5%
*-commutative2.5%
unpow22.5%
rem-square-sqrt2.6%
*-commutative2.6%
Simplified2.6%
Final simplification2.6%
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (/ (sqrt (* 2.0 (* B F))) (- B)))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
return sqrt((2.0 * (B * F))) / -B;
}
NOTE: B should be positive before calling this function
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 * (b * f))) / -b
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
return Math.sqrt((2.0 * (B * F))) / -B;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): return math.sqrt((2.0 * (B * F))) / -B
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) return Float64(sqrt(Float64(2.0 * Float64(B * F))) / Float64(-B)) end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = sqrt((2.0 * (B * F))) / -B;
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[Sqrt[N[(2.0 * N[(B * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B)), $MachinePrecision]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{\sqrt{2 \cdot \left(B \cdot F\right)}}{-B}
\end{array}
Initial program 21.7%
Simplified21.7%
Taylor expanded in A around 0 9.0%
associate-*r*9.0%
mul-1-neg9.0%
unpow29.0%
unpow29.0%
hypot-def15.1%
Simplified15.1%
Taylor expanded in C around 0 13.6%
distribute-lft-neg-out13.6%
neg-sub013.6%
cancel-sign-sub-inv13.6%
frac-2neg13.6%
distribute-frac-neg13.6%
remove-double-neg13.6%
associate-*l/13.6%
sqrt-unprod13.6%
*-commutative13.6%
Applied egg-rr13.6%
+-lft-identity13.6%
*-commutative13.6%
Simplified13.6%
Final simplification13.6%
herbie shell --seed 2023297
(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))))