
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0))))
(t_1 (hypot B (- A C)))
(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 0.0)
(/ (* (sqrt t_0) (* (sqrt (+ A (+ C t_1))) (- (sqrt (* 2.0 F))))) t_2)
(if (<= t_3 INFINITY)
(/ (- (* (sqrt (+ C (+ A t_1))) (sqrt (* 2.0 (* F t_0))))) t_2)
(* (sqrt (/ F B)) (- (sqrt 2.0)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double t_1 = hypot(B, (A - C));
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 <= 0.0) {
tmp = (sqrt(t_0) * (sqrt((A + (C + t_1))) * -sqrt((2.0 * F)))) / t_2;
} else if (t_3 <= ((double) INFINITY)) {
tmp = -(sqrt((C + (A + t_1))) * sqrt((2.0 * (F * t_0)))) / t_2;
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = hypot(B, Float64(A - C)) 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 <= 0.0) tmp = Float64(Float64(sqrt(t_0) * Float64(sqrt(Float64(A + Float64(C + t_1))) * Float64(-sqrt(Float64(2.0 * F))))) / t_2); elseif (t_3 <= Inf) tmp = Float64(Float64(-Float64(sqrt(Float64(C + Float64(A + t_1))) * sqrt(Float64(2.0 * Float64(F * t_0))))) / t_2); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $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, 0.0], N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * N[(N[Sqrt[N[(A + N[(C + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[((-N[(N[Sqrt[N[(C + N[(A + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]) / t$95$2), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \mathsf{hypot}\left(B, A - C\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 0:\\
\;\;\;\;\frac{\sqrt{t_0} \cdot \left(\sqrt{A + \left(C + t_1\right)} \cdot \left(-\sqrt{2 \cdot F}\right)\right)}{t_2}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;\frac{-\sqrt{C + \left(A + t_1\right)} \cdot \sqrt{2 \cdot \left(F \cdot t_0\right)}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\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))) < -0.0Initial program 25.2%
Applied egg-rr48.1%
*-commutative48.1%
associate-*r*48.1%
+-commutative48.1%
Simplified48.1%
*-commutative48.1%
sqrt-prod59.1%
*-commutative59.1%
+-commutative59.1%
associate-+l+59.4%
*-commutative59.4%
Applied egg-rr59.4%
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 29.7%
Applied egg-rr71.7%
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%
Taylor expanded in C around 0 0.5%
associate-*l*0.5%
+-commutative0.5%
Simplified0.5%
Taylor expanded in A around 0 12.4%
mul-1-neg12.4%
Simplified12.4%
Final simplification41.5%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* A -4.0))))
(t_1 (sqrt (* 2.0 F)))
(t_2 (+ A (+ C (hypot B (- A C)))))
(t_3 (sqrt t_2))
(t_4 (- (pow B 2.0) (* (* 4.0 A) C))))
(if (<= (pow B 2.0) 5e-307)
(/ (- (sqrt (* (* (* 2.0 F) t_0) t_2))) t_0)
(if (<= (pow B 2.0) 2e-259)
(/ (* (sqrt (fma B B (* A (* C -4.0)))) (* t_1 (- (sqrt (+ A A))))) t_4)
(if (<= (pow B 2.0) 2e-92)
(/ (* B (* t_3 (- t_1))) t_4)
(if (<= (pow B 2.0) 0.005)
(/
(* (sqrt (+ (* A 0.0) (* 2.0 C))) (- (sqrt (* 2.0 (* F t_0)))))
t_0)
(if (<= (pow B 2.0) 1e+271)
(/ (* (* t_3 t_1) (- (- B) (* -2.0 (/ (* A C) B)))) t_4)
(* (sqrt (/ F B)) (- (sqrt 2.0))))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (A * -4.0)));
double t_1 = sqrt((2.0 * F));
double t_2 = A + (C + hypot(B, (A - C)));
double t_3 = sqrt(t_2);
double t_4 = pow(B, 2.0) - ((4.0 * A) * C);
double tmp;
if (pow(B, 2.0) <= 5e-307) {
tmp = -sqrt((((2.0 * F) * t_0) * t_2)) / t_0;
} else if (pow(B, 2.0) <= 2e-259) {
tmp = (sqrt(fma(B, B, (A * (C * -4.0)))) * (t_1 * -sqrt((A + A)))) / t_4;
} else if (pow(B, 2.0) <= 2e-92) {
tmp = (B * (t_3 * -t_1)) / t_4;
} else if (pow(B, 2.0) <= 0.005) {
tmp = (sqrt(((A * 0.0) + (2.0 * C))) * -sqrt((2.0 * (F * t_0)))) / t_0;
} else if (pow(B, 2.0) <= 1e+271) {
tmp = ((t_3 * t_1) * (-B - (-2.0 * ((A * C) / B)))) / t_4;
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(A * -4.0))) t_1 = sqrt(Float64(2.0 * F)) t_2 = Float64(A + Float64(C + hypot(B, Float64(A - C)))) t_3 = sqrt(t_2) t_4 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) tmp = 0.0 if ((B ^ 2.0) <= 5e-307) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * F) * t_0) * t_2))) / t_0); elseif ((B ^ 2.0) <= 2e-259) tmp = Float64(Float64(sqrt(fma(B, B, Float64(A * Float64(C * -4.0)))) * Float64(t_1 * Float64(-sqrt(Float64(A + A))))) / t_4); elseif ((B ^ 2.0) <= 2e-92) tmp = Float64(Float64(B * Float64(t_3 * Float64(-t_1))) / t_4); elseif ((B ^ 2.0) <= 0.005) tmp = Float64(Float64(sqrt(Float64(Float64(A * 0.0) + Float64(2.0 * C))) * Float64(-sqrt(Float64(2.0 * Float64(F * t_0))))) / t_0); elseif ((B ^ 2.0) <= 1e+271) tmp = Float64(Float64(Float64(t_3 * t_1) * Float64(Float64(-B) - Float64(-2.0 * Float64(Float64(A * C) / B)))) / t_4); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); 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[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[t$95$2], $MachinePrecision]}, Block[{t$95$4 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-307], N[((-N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-259], N[(N[(N[Sqrt[N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * (-N[Sqrt[N[(A + A), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-92], N[(N[(B * N[(t$95$3 * (-t$95$1)), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 0.005], N[(N[(N[Sqrt[N[(N[(A * 0.0), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+271], N[(N[(N[(t$95$3 * t$95$1), $MachinePrecision] * N[((-B) - N[(-2.0 * N[(N[(A * C), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_1 := \sqrt{2 \cdot F}\\
t_2 := A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\\
t_3 := \sqrt{t_2}\\
t_4 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-307}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot F\right) \cdot t_0\right) \cdot t_2}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-259}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \cdot \left(t_1 \cdot \left(-\sqrt{A + A}\right)\right)}{t_4}\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-92}:\\
\;\;\;\;\frac{B \cdot \left(t_3 \cdot \left(-t_1\right)\right)}{t_4}\\
\mathbf{elif}\;{B}^{2} \leq 0.005:\\
\;\;\;\;\frac{\sqrt{A \cdot 0 + 2 \cdot C} \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_0\right)}\right)}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 10^{+271}:\\
\;\;\;\;\frac{\left(t_3 \cdot t_1\right) \cdot \left(\left(-B\right) - -2 \cdot \frac{A \cdot C}{B}\right)}{t_4}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.00000000000000014e-307Initial program 16.3%
Simplified28.7%
if 5.00000000000000014e-307 < (pow.f64 B 2) < 2.0000000000000001e-259Initial program 11.3%
Applied egg-rr7.0%
*-commutative7.0%
associate-*r*7.0%
+-commutative7.0%
Simplified7.0%
*-commutative7.0%
sqrt-prod31.6%
*-commutative31.6%
+-commutative31.6%
associate-+l+32.8%
*-commutative32.8%
Applied egg-rr32.8%
Taylor expanded in B around 0 48.7%
if 2.0000000000000001e-259 < (pow.f64 B 2) < 1.99999999999999998e-92Initial program 24.3%
Applied egg-rr36.2%
*-commutative36.2%
associate-*r*36.2%
+-commutative36.2%
Simplified36.2%
*-commutative36.2%
sqrt-prod45.8%
*-commutative45.8%
+-commutative45.8%
associate-+l+47.0%
*-commutative47.0%
Applied egg-rr47.0%
Taylor expanded in B around inf 21.8%
if 1.99999999999999998e-92 < (pow.f64 B 2) < 0.0050000000000000001Initial program 12.1%
Simplified22.7%
Taylor expanded in C around inf 12.7%
sqrt-prod30.2%
*-commutative30.2%
associate-+r+44.9%
+-commutative44.9%
*-commutative44.9%
*-un-lft-identity44.9%
metadata-eval44.9%
distribute-rgt-out44.9%
metadata-eval44.9%
metadata-eval44.9%
associate-*r*44.9%
*-commutative44.9%
*-commutative44.9%
Applied egg-rr44.9%
if 0.0050000000000000001 < (pow.f64 B 2) < 9.99999999999999953e270Initial program 26.8%
Applied egg-rr48.4%
*-commutative48.4%
associate-*r*48.4%
+-commutative48.4%
Simplified48.4%
*-commutative48.4%
sqrt-prod62.1%
*-commutative62.1%
+-commutative62.1%
associate-+l+61.9%
*-commutative61.9%
Applied egg-rr61.9%
Taylor expanded in B around inf 32.2%
if 9.99999999999999953e270 < (pow.f64 B 2) Initial program 3.1%
Taylor expanded in C around 0 3.1%
associate-*l*3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
Simplified21.9%
Final simplification29.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (* 2.0 F)))
(t_1 (- (pow B 2.0) (* (* 4.0 A) C)))
(t_2 (+ A (+ C (hypot B (- A C)))))
(t_3 (fma B B (* C (* A -4.0))))
(t_4 (sqrt t_2)))
(if (<= (pow B 2.0) 1e-270)
(/ (- (sqrt (* (* (* 2.0 F) t_3) t_2))) t_3)
(if (<= (pow B 2.0) 2e-92)
(/ (* B (* t_4 (- t_0))) t_1)
(if (<= (pow B 2.0) 0.005)
(/
(* (sqrt (+ (* A 0.0) (* 2.0 C))) (- (sqrt (* 2.0 (* F t_3)))))
t_3)
(if (<= (pow B 2.0) 1e+271)
(/ (* (* t_4 t_0) (- (- B) (* -2.0 (/ (* A C) B)))) t_1)
(* (sqrt (/ F B)) (- (sqrt 2.0)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((2.0 * F));
double t_1 = pow(B, 2.0) - ((4.0 * A) * C);
double t_2 = A + (C + hypot(B, (A - C)));
double t_3 = fma(B, B, (C * (A * -4.0)));
double t_4 = sqrt(t_2);
double tmp;
if (pow(B, 2.0) <= 1e-270) {
tmp = -sqrt((((2.0 * F) * t_3) * t_2)) / t_3;
} else if (pow(B, 2.0) <= 2e-92) {
tmp = (B * (t_4 * -t_0)) / t_1;
} else if (pow(B, 2.0) <= 0.005) {
tmp = (sqrt(((A * 0.0) + (2.0 * C))) * -sqrt((2.0 * (F * t_3)))) / t_3;
} else if (pow(B, 2.0) <= 1e+271) {
tmp = ((t_4 * t_0) * (-B - (-2.0 * ((A * C) / B)))) / t_1;
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = sqrt(Float64(2.0 * F)) t_1 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_2 = Float64(A + Float64(C + hypot(B, Float64(A - C)))) t_3 = fma(B, B, Float64(C * Float64(A * -4.0))) t_4 = sqrt(t_2) tmp = 0.0 if ((B ^ 2.0) <= 1e-270) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * F) * t_3) * t_2))) / t_3); elseif ((B ^ 2.0) <= 2e-92) tmp = Float64(Float64(B * Float64(t_4 * Float64(-t_0))) / t_1); elseif ((B ^ 2.0) <= 0.005) tmp = Float64(Float64(sqrt(Float64(Float64(A * 0.0) + Float64(2.0 * C))) * Float64(-sqrt(Float64(2.0 * Float64(F * t_3))))) / t_3); elseif ((B ^ 2.0) <= 1e+271) tmp = Float64(Float64(Float64(t_4 * t_0) * Float64(Float64(-B) - Float64(-2.0 * Float64(Float64(A * C) / B)))) / t_1); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[t$95$2], $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e-270], N[((-N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$2), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-92], N[(N[(B * N[(t$95$4 * (-t$95$0)), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 0.005], N[(N[(N[Sqrt[N[(N[(A * 0.0), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+271], N[(N[(N[(t$95$4 * t$95$0), $MachinePrecision] * N[((-B) - N[(-2.0 * N[(N[(A * C), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \sqrt{2 \cdot F}\\
t_1 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_2 := A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\\
t_3 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_4 := \sqrt{t_2}\\
\mathbf{if}\;{B}^{2} \leq 10^{-270}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot F\right) \cdot t_3\right) \cdot t_2}}{t_3}\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-92}:\\
\;\;\;\;\frac{B \cdot \left(t_4 \cdot \left(-t_0\right)\right)}{t_1}\\
\mathbf{elif}\;{B}^{2} \leq 0.005:\\
\;\;\;\;\frac{\sqrt{A \cdot 0 + 2 \cdot C} \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_3\right)}\right)}{t_3}\\
\mathbf{elif}\;{B}^{2} \leq 10^{+271}:\\
\;\;\;\;\frac{\left(t_4 \cdot t_0\right) \cdot \left(\left(-B\right) - -2 \cdot \frac{A \cdot C}{B}\right)}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1e-270Initial program 15.7%
Simplified26.8%
if 1e-270 < (pow.f64 B 2) < 1.99999999999999998e-92Initial program 23.8%
Applied egg-rr35.2%
*-commutative35.2%
associate-*r*35.3%
+-commutative35.3%
Simplified35.3%
*-commutative35.3%
sqrt-prod44.5%
*-commutative44.5%
+-commutative44.5%
associate-+l+46.1%
*-commutative46.1%
Applied egg-rr46.1%
Taylor expanded in B around inf 21.3%
if 1.99999999999999998e-92 < (pow.f64 B 2) < 0.0050000000000000001Initial program 12.1%
Simplified22.7%
Taylor expanded in C around inf 12.7%
sqrt-prod30.2%
*-commutative30.2%
associate-+r+44.9%
+-commutative44.9%
*-commutative44.9%
*-un-lft-identity44.9%
metadata-eval44.9%
distribute-rgt-out44.9%
metadata-eval44.9%
metadata-eval44.9%
associate-*r*44.9%
*-commutative44.9%
*-commutative44.9%
Applied egg-rr44.9%
if 0.0050000000000000001 < (pow.f64 B 2) < 9.99999999999999953e270Initial program 26.8%
Applied egg-rr48.4%
*-commutative48.4%
associate-*r*48.4%
+-commutative48.4%
Simplified48.4%
*-commutative48.4%
sqrt-prod62.1%
*-commutative62.1%
+-commutative62.1%
associate-+l+61.9%
*-commutative61.9%
Applied egg-rr61.9%
Taylor expanded in B around inf 32.2%
if 9.99999999999999953e270 < (pow.f64 B 2) Initial program 3.1%
Taylor expanded in C around 0 3.1%
associate-*l*3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
Simplified21.9%
Final simplification27.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* A -4.0))))
(t_1
(/
(* (sqrt (+ (* A 0.0) (* 2.0 C))) (- (sqrt (* 2.0 (* F t_0)))))
t_0))
(t_2
(/
(* B (* (sqrt (+ A (+ C (hypot B (- A C))))) (- (sqrt (* 2.0 F)))))
(- (pow B 2.0) (* (* 4.0 A) C)))))
(if (<= (pow B 2.0) 4e-289)
t_1
(if (<= (pow B 2.0) 2e-92)
t_2
(if (<= (pow B 2.0) 0.005)
t_1
(if (<= (pow B 2.0) 1e+271)
t_2
(* (sqrt (/ F B)) (- (sqrt 2.0)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (A * -4.0)));
double t_1 = (sqrt(((A * 0.0) + (2.0 * C))) * -sqrt((2.0 * (F * t_0)))) / t_0;
double t_2 = (B * (sqrt((A + (C + hypot(B, (A - C))))) * -sqrt((2.0 * F)))) / (pow(B, 2.0) - ((4.0 * A) * C));
double tmp;
if (pow(B, 2.0) <= 4e-289) {
tmp = t_1;
} else if (pow(B, 2.0) <= 2e-92) {
tmp = t_2;
} else if (pow(B, 2.0) <= 0.005) {
tmp = t_1;
} else if (pow(B, 2.0) <= 1e+271) {
tmp = t_2;
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(A * -4.0))) t_1 = Float64(Float64(sqrt(Float64(Float64(A * 0.0) + Float64(2.0 * C))) * Float64(-sqrt(Float64(2.0 * Float64(F * t_0))))) / t_0) t_2 = Float64(Float64(B * Float64(sqrt(Float64(A + Float64(C + hypot(B, Float64(A - C))))) * Float64(-sqrt(Float64(2.0 * F))))) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))) tmp = 0.0 if ((B ^ 2.0) <= 4e-289) tmp = t_1; elseif ((B ^ 2.0) <= 2e-92) tmp = t_2; elseif ((B ^ 2.0) <= 0.005) tmp = t_1; elseif ((B ^ 2.0) <= 1e+271) tmp = t_2; else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); 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[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(N[(A * 0.0), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * N[(N[Sqrt[N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 4e-289], t$95$1, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-92], t$95$2, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 0.005], t$95$1, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+271], t$95$2, N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_1 := \frac{\sqrt{A \cdot 0 + 2 \cdot C} \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_0\right)}\right)}{t_0}\\
t_2 := \frac{B \cdot \left(\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(-\sqrt{2 \cdot F}\right)\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{if}\;{B}^{2} \leq 4 \cdot 10^{-289}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-92}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;{B}^{2} \leq 0.005:\\
\;\;\;\;t_1\\
\mathbf{elif}\;{B}^{2} \leq 10^{+271}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4e-289 or 1.99999999999999998e-92 < (pow.f64 B 2) < 0.0050000000000000001Initial program 15.3%
Simplified26.4%
Taylor expanded in C around inf 16.6%
sqrt-prod21.6%
*-commutative21.6%
associate-+r+30.7%
+-commutative30.7%
*-commutative30.7%
*-un-lft-identity30.7%
metadata-eval30.7%
distribute-rgt-out30.7%
metadata-eval30.7%
metadata-eval30.7%
associate-*r*30.7%
*-commutative30.7%
*-commutative30.7%
Applied egg-rr30.7%
if 4e-289 < (pow.f64 B 2) < 1.99999999999999998e-92 or 0.0050000000000000001 < (pow.f64 B 2) < 9.99999999999999953e270Initial program 25.0%
Applied egg-rr42.2%
*-commutative42.2%
associate-*r*42.2%
+-commutative42.2%
Simplified42.2%
*-commutative42.2%
sqrt-prod54.9%
*-commutative54.9%
+-commutative54.9%
associate-+l+55.6%
*-commutative55.6%
Applied egg-rr55.6%
Taylor expanded in B around inf 27.0%
if 9.99999999999999953e270 < (pow.f64 B 2) Initial program 3.1%
Taylor expanded in C around 0 3.1%
associate-*l*3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
Simplified21.9%
Final simplification27.0%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* A -4.0))))
(t_1 (+ A (+ C (hypot B (- A C)))))
(t_2
(/
(* B (* (sqrt t_1) (- (sqrt (* 2.0 F)))))
(- (pow B 2.0) (* (* 4.0 A) C)))))
(if (<= (pow B 2.0) 1e-270)
(/ (- (sqrt (* (* (* 2.0 F) t_0) t_1))) t_0)
(if (<= (pow B 2.0) 2e-92)
t_2
(if (<= (pow B 2.0) 0.005)
(/
(* (sqrt (+ (* A 0.0) (* 2.0 C))) (- (sqrt (* 2.0 (* F t_0)))))
t_0)
(if (<= (pow B 2.0) 1e+271)
t_2
(* (sqrt (/ F B)) (- (sqrt 2.0)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (A * -4.0)));
double t_1 = A + (C + hypot(B, (A - C)));
double t_2 = (B * (sqrt(t_1) * -sqrt((2.0 * F)))) / (pow(B, 2.0) - ((4.0 * A) * C));
double tmp;
if (pow(B, 2.0) <= 1e-270) {
tmp = -sqrt((((2.0 * F) * t_0) * t_1)) / t_0;
} else if (pow(B, 2.0) <= 2e-92) {
tmp = t_2;
} else if (pow(B, 2.0) <= 0.005) {
tmp = (sqrt(((A * 0.0) + (2.0 * C))) * -sqrt((2.0 * (F * t_0)))) / t_0;
} else if (pow(B, 2.0) <= 1e+271) {
tmp = t_2;
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(A * -4.0))) t_1 = Float64(A + Float64(C + hypot(B, Float64(A - C)))) t_2 = Float64(Float64(B * Float64(sqrt(t_1) * Float64(-sqrt(Float64(2.0 * F))))) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))) tmp = 0.0 if ((B ^ 2.0) <= 1e-270) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * F) * t_0) * t_1))) / t_0); elseif ((B ^ 2.0) <= 2e-92) tmp = t_2; elseif ((B ^ 2.0) <= 0.005) tmp = Float64(Float64(sqrt(Float64(Float64(A * 0.0) + Float64(2.0 * C))) * Float64(-sqrt(Float64(2.0 * Float64(F * t_0))))) / t_0); elseif ((B ^ 2.0) <= 1e+271) tmp = t_2; else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); 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[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * N[(N[Sqrt[t$95$1], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e-270], N[((-N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-92], t$95$2, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 0.005], N[(N[(N[Sqrt[N[(N[(A * 0.0), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+271], t$95$2, N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_1 := A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\\
t_2 := \frac{B \cdot \left(\sqrt{t_1} \cdot \left(-\sqrt{2 \cdot F}\right)\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{if}\;{B}^{2} \leq 10^{-270}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot F\right) \cdot t_0\right) \cdot t_1}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-92}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;{B}^{2} \leq 0.005:\\
\;\;\;\;\frac{\sqrt{A \cdot 0 + 2 \cdot C} \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_0\right)}\right)}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 10^{+271}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1e-270Initial program 15.7%
Simplified26.8%
if 1e-270 < (pow.f64 B 2) < 1.99999999999999998e-92 or 0.0050000000000000001 < (pow.f64 B 2) < 9.99999999999999953e270Initial program 25.7%
Applied egg-rr43.6%
*-commutative43.6%
associate-*r*43.6%
+-commutative43.6%
Simplified43.6%
*-commutative43.6%
sqrt-prod55.7%
*-commutative55.7%
+-commutative55.7%
associate-+l+56.1%
*-commutative56.1%
Applied egg-rr56.1%
Taylor expanded in B around inf 27.9%
if 1.99999999999999998e-92 < (pow.f64 B 2) < 0.0050000000000000001Initial program 12.1%
Simplified22.7%
Taylor expanded in C around inf 12.7%
sqrt-prod30.2%
*-commutative30.2%
associate-+r+44.9%
+-commutative44.9%
*-commutative44.9%
*-un-lft-identity44.9%
metadata-eval44.9%
distribute-rgt-out44.9%
metadata-eval44.9%
metadata-eval44.9%
associate-*r*44.9%
*-commutative44.9%
*-commutative44.9%
Applied egg-rr44.9%
if 9.99999999999999953e270 < (pow.f64 B 2) Initial program 3.1%
Taylor expanded in C around 0 3.1%
associate-*l*3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
Simplified21.9%
Final simplification27.3%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* A -4.0)))))
(if (or (<= (pow B 2.0) 5e-211)
(and (not (<= (pow B 2.0) 2e-58)) (<= (pow B 2.0) 0.005)))
(/ (- (sqrt (* (* (* 2.0 F) t_0) (* 2.0 C)))) t_0)
(* (sqrt (/ F B)) (- (sqrt 2.0))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (A * -4.0)));
double tmp;
if ((pow(B, 2.0) <= 5e-211) || (!(pow(B, 2.0) <= 2e-58) && (pow(B, 2.0) <= 0.005))) {
tmp = -sqrt((((2.0 * F) * t_0) * (2.0 * C))) / t_0;
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(A * -4.0))) tmp = 0.0 if (((B ^ 2.0) <= 5e-211) || (!((B ^ 2.0) <= 2e-58) && ((B ^ 2.0) <= 0.005))) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * F) * t_0) * Float64(2.0 * C)))) / t_0); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); 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[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-211], And[N[Not[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-58]], $MachinePrecision], LessEqual[N[Power[B, 2.0], $MachinePrecision], 0.005]]], N[((-N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-211} \lor \neg \left({B}^{2} \leq 2 \cdot 10^{-58}\right) \land {B}^{2} \leq 0.005:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot F\right) \cdot t_0\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.0000000000000002e-211 or 2.0000000000000001e-58 < (pow.f64 B 2) < 0.0050000000000000001Initial program 16.6%
Simplified27.4%
Taylor expanded in C around inf 17.6%
Taylor expanded in A around 0 25.9%
if 5.0000000000000002e-211 < (pow.f64 B 2) < 2.0000000000000001e-58 or 0.0050000000000000001 < (pow.f64 B 2) Initial program 14.6%
Taylor expanded in C around 0 12.2%
associate-*l*12.2%
+-commutative12.2%
Simplified12.2%
Taylor expanded in A around 0 19.8%
mul-1-neg19.8%
Simplified19.8%
Final simplification22.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* A -4.0))))
(t_1 (/ (- (sqrt (* (* (* 2.0 F) t_0) (* 2.0 C)))) t_0)))
(if (<= (pow B 2.0) 2e-272)
t_1
(if (<= (pow B 2.0) 5e-72)
(/
(* (sqrt (* (* 2.0 F) (+ C (+ A (hypot B (- A C)))))) (- B))
(- (pow B 2.0) (* (* 4.0 A) C)))
(if (<= (pow B 2.0) 0.005) t_1 (* (sqrt (/ F B)) (- (sqrt 2.0))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (A * -4.0)));
double t_1 = -sqrt((((2.0 * F) * t_0) * (2.0 * C))) / t_0;
double tmp;
if (pow(B, 2.0) <= 2e-272) {
tmp = t_1;
} else if (pow(B, 2.0) <= 5e-72) {
tmp = (sqrt(((2.0 * F) * (C + (A + hypot(B, (A - C)))))) * -B) / (pow(B, 2.0) - ((4.0 * A) * C));
} else if (pow(B, 2.0) <= 0.005) {
tmp = t_1;
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(A * -4.0))) t_1 = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * F) * t_0) * Float64(2.0 * C)))) / t_0) tmp = 0.0 if ((B ^ 2.0) <= 2e-272) tmp = t_1; elseif ((B ^ 2.0) <= 5e-72) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * F) * Float64(C + Float64(A + hypot(B, Float64(A - C)))))) * Float64(-B)) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))); elseif ((B ^ 2.0) <= 0.005) tmp = t_1; else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); 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[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-272], t$95$1, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-72], N[(N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-B)), $MachinePrecision] / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 0.005], t$95$1, N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_1 := \frac{-\sqrt{\left(\left(2 \cdot F\right) \cdot t_0\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{-272}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;{B}^{2} \leq 5 \cdot 10^{-72}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-B\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{elif}\;{B}^{2} \leq 0.005:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.99999999999999986e-272 or 4.9999999999999996e-72 < (pow.f64 B 2) < 0.0050000000000000001Initial program 14.6%
Simplified26.1%
Taylor expanded in C around inf 16.8%
Taylor expanded in A around 0 25.6%
if 1.99999999999999986e-272 < (pow.f64 B 2) < 4.9999999999999996e-72Initial program 23.5%
Applied egg-rr36.5%
*-commutative36.5%
associate-*r*36.6%
+-commutative36.6%
Simplified36.6%
Taylor expanded in B around inf 15.6%
if 0.0050000000000000001 < (pow.f64 B 2) Initial program 13.6%
Taylor expanded in C around 0 13.0%
associate-*l*13.1%
+-commutative13.1%
Simplified13.1%
Taylor expanded in A around 0 22.6%
mul-1-neg22.6%
Simplified22.6%
Final simplification22.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= (pow B 2.0) 1e+195)
(/
(-
(*
(sqrt (+ C (+ A (hypot B (- A C)))))
(sqrt (* 2.0 (* F (fma B B (* A (* C -4.0))))))))
(- (pow B 2.0) (* (* 4.0 A) C)))
(* (sqrt (/ F B)) (- (sqrt 2.0)))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 1e+195) {
tmp = -(sqrt((C + (A + hypot(B, (A - C))))) * sqrt((2.0 * (F * fma(B, B, (A * (C * -4.0))))))) / (pow(B, 2.0) - ((4.0 * A) * C));
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 1e+195) tmp = Float64(Float64(-Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * sqrt(Float64(2.0 * Float64(F * fma(B, B, Float64(A * Float64(C * -4.0)))))))) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); end return tmp end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+195], N[((-N[(N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(F * N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 10^{+195}:\\
\;\;\;\;\frac{-\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.99999999999999977e194Initial program 20.2%
Applied egg-rr36.7%
if 9.99999999999999977e194 < (pow.f64 B 2) Initial program 5.5%
Taylor expanded in C around 0 8.8%
associate-*l*8.8%
+-commutative8.8%
Simplified8.8%
Taylor expanded in A around 0 24.4%
mul-1-neg24.4%
Simplified24.4%
Final simplification32.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* A -4.0)))))
(if (<= (pow B 2.0) 4e-289)
(/ (- (sqrt (* (* (* 2.0 F) t_0) (* 2.0 C)))) t_0)
(if (<= (pow B 2.0) 1e+271)
(/
(* B (* (sqrt (+ A (+ C (hypot B (- A C))))) (- (sqrt (* 2.0 F)))))
(- (pow B 2.0) (* (* 4.0 A) C)))
(* (sqrt (/ F B)) (- (sqrt 2.0)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (A * -4.0)));
double tmp;
if (pow(B, 2.0) <= 4e-289) {
tmp = -sqrt((((2.0 * F) * t_0) * (2.0 * C))) / t_0;
} else if (pow(B, 2.0) <= 1e+271) {
tmp = (B * (sqrt((A + (C + hypot(B, (A - C))))) * -sqrt((2.0 * F)))) / (pow(B, 2.0) - ((4.0 * A) * C));
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(A * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 4e-289) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * F) * t_0) * Float64(2.0 * C)))) / t_0); elseif ((B ^ 2.0) <= 1e+271) tmp = Float64(Float64(B * Float64(sqrt(Float64(A + Float64(C + hypot(B, Float64(A - C))))) * Float64(-sqrt(Float64(2.0 * F))))) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); 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[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 4e-289], N[((-N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+271], N[(N[(B * N[(N[Sqrt[N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 4 \cdot 10^{-289}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot F\right) \cdot t_0\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 10^{+271}:\\
\;\;\;\;\frac{B \cdot \left(\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(-\sqrt{2 \cdot F}\right)\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4e-289Initial program 16.2%
Simplified27.4%
Taylor expanded in C around inf 17.7%
Taylor expanded in A around 0 24.9%
if 4e-289 < (pow.f64 B 2) < 9.99999999999999953e270Initial program 22.5%
Applied egg-rr38.6%
*-commutative38.6%
associate-*r*38.6%
+-commutative38.6%
Simplified38.6%
*-commutative38.6%
sqrt-prod49.0%
*-commutative49.0%
+-commutative49.0%
associate-+l+49.0%
*-commutative49.0%
Applied egg-rr49.0%
Taylor expanded in B around inf 23.3%
if 9.99999999999999953e270 < (pow.f64 B 2) Initial program 3.1%
Taylor expanded in C around 0 3.1%
associate-*l*3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
Simplified21.9%
Final simplification23.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= (pow B 2.0) 2e+214)
(-
(/
(sqrt (* 2.0 (* F (+ A (+ C (hypot B (- A C)))))))
(sqrt (fma B B (* -4.0 (* A C))))))
(* (sqrt (/ F B)) (- (sqrt 2.0)))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 2e+214) {
tmp = -(sqrt((2.0 * (F * (A + (C + hypot(B, (A - C))))))) / sqrt(fma(B, B, (-4.0 * (A * C)))));
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 2e+214) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(F * Float64(A + Float64(C + hypot(B, Float64(A - C))))))) / sqrt(fma(B, B, Float64(-4.0 * Float64(A * C)))))); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); end return tmp end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e+214], (-N[(N[Sqrt[N[(2.0 * N[(F * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{+214}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\sqrt{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.9999999999999999e214Initial program 19.8%
Applied egg-rr28.6%
*-commutative28.6%
associate-*r*28.6%
+-commutative28.6%
Simplified28.6%
Applied egg-rr28.3%
associate-*r/28.3%
distribute-frac-neg28.3%
*-inverses28.6%
metadata-eval28.6%
neg-mul-128.6%
distribute-frac-neg28.6%
Simplified28.6%
if 1.9999999999999999e214 < (pow.f64 B 2) Initial program 5.6%
Taylor expanded in C around 0 7.9%
associate-*l*7.9%
+-commutative7.9%
Simplified7.9%
Taylor expanded in A around 0 24.2%
mul-1-neg24.2%
Simplified24.2%
Final simplification27.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= (pow B 2.0) 2e+214)
(/
(- (sqrt (* (* 2.0 F) (+ C (+ A (hypot B (- A C)))))))
(sqrt (fma B B (* A (* C -4.0)))))
(* (sqrt (/ F B)) (- (sqrt 2.0)))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 2e+214) {
tmp = -sqrt(((2.0 * F) * (C + (A + hypot(B, (A - C)))))) / sqrt(fma(B, B, (A * (C * -4.0))));
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 2e+214) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * F) * Float64(C + Float64(A + hypot(B, Float64(A - C))))))) / sqrt(fma(B, B, Float64(A * Float64(C * -4.0))))); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); end return tmp end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e+214], N[((-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[Sqrt[N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{+214}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot F\right) \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.9999999999999999e214Initial program 19.8%
Applied egg-rr28.6%
*-commutative28.6%
associate-*r*28.6%
+-commutative28.6%
Simplified28.6%
*-commutative28.6%
sqrt-prod35.8%
*-commutative35.8%
+-commutative35.8%
associate-+l+35.9%
*-commutative35.9%
Applied egg-rr35.9%
Applied egg-rr28.9%
sub0-neg28.9%
distribute-frac-neg28.9%
Simplified28.9%
if 1.9999999999999999e214 < (pow.f64 B 2) Initial program 5.6%
Taylor expanded in C around 0 7.9%
associate-*l*7.9%
+-commutative7.9%
Simplified7.9%
Taylor expanded in A around 0 24.2%
mul-1-neg24.2%
Simplified24.2%
Final simplification27.5%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= F -5e-310)
(/
(- (sqrt (* (* -8.0 (* A (* C F))) (+ A (- (* 2.0 C) A)))))
(fma B B (* C (* A -4.0))))
(if (<= F 4.2e-37)
(* (sqrt (* F (+ A (+ B (* 0.5 (/ (pow A 2.0) B)))))) (/ t_0 B))
(* (sqrt (/ F B)) t_0)))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (F <= -5e-310) {
tmp = -sqrt(((-8.0 * (A * (C * F))) * (A + ((2.0 * C) - A)))) / fma(B, B, (C * (A * -4.0)));
} else if (F <= 4.2e-37) {
tmp = sqrt((F * (A + (B + (0.5 * (pow(A, 2.0) / B)))))) * (t_0 / B);
} else {
tmp = sqrt((F / B)) * t_0;
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (F <= -5e-310) tmp = Float64(Float64(-sqrt(Float64(Float64(-8.0 * Float64(A * Float64(C * F))) * Float64(A + Float64(Float64(2.0 * C) - A))))) / fma(B, B, Float64(C * Float64(A * -4.0)))); elseif (F <= 4.2e-37) tmp = Float64(sqrt(Float64(F * Float64(A + Float64(B + Float64(0.5 * Float64((A ^ 2.0) / B)))))) * Float64(t_0 / B)); else tmp = Float64(sqrt(Float64(F / B)) * 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[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, -5e-310], N[((-N[Sqrt[N[(N[(-8.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + N[(N[(2.0 * C), $MachinePrecision] - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.2e-37], N[(N[Sqrt[N[(F * N[(A + N[(B + N[(0.5 * N[(N[Power[A, 2.0], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{\left(-8 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right) \cdot \left(A + \left(2 \cdot C - A\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{-37}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \left(B + 0.5 \cdot \frac{{A}^{2}}{B}\right)\right)} \cdot \frac{t_0}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 18.9%
Simplified31.8%
Taylor expanded in C around inf 25.1%
Taylor expanded in B around 0 25.2%
if -4.999999999999985e-310 < F < 4.2000000000000002e-37Initial program 14.5%
Simplified20.7%
Taylor expanded in B around inf 7.3%
associate-+r+7.3%
+-commutative7.3%
associate-*r/7.3%
Simplified7.3%
Taylor expanded in C around 0 15.1%
mul-1-neg15.1%
Simplified15.1%
if 4.2000000000000002e-37 < F Initial program 15.3%
Taylor expanded in C around 0 8.5%
associate-*l*8.5%
+-commutative8.5%
Simplified8.5%
Taylor expanded in A around 0 15.2%
mul-1-neg15.2%
Simplified15.2%
Final simplification16.3%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= (pow B 2.0) 5e-211) (/ (sqrt (* A (* -16.0 (* F (* A C))))) (- (fma B B (* -4.0 (* A C))))) (* (sqrt (/ F B)) (- (sqrt 2.0)))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 5e-211) {
tmp = sqrt((A * (-16.0 * (F * (A * C))))) / -fma(B, B, (-4.0 * (A * C)));
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 5e-211) tmp = Float64(sqrt(Float64(A * Float64(-16.0 * Float64(F * Float64(A * C))))) / Float64(-fma(B, B, Float64(-4.0 * Float64(A * C))))); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); end return tmp end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-211], N[(N[Sqrt[N[(A * N[(-16.0 * N[(F * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-211}:\\
\;\;\;\;\frac{\sqrt{A \cdot \left(-16 \cdot \left(F \cdot \left(A \cdot C\right)\right)\right)}}{-\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.0000000000000002e-211Initial program 17.5%
Taylor expanded in A around inf 19.7%
frac-2neg19.7%
remove-double-neg19.7%
div-inv19.7%
Applied egg-rr19.7%
associate-*r/19.7%
*-rgt-identity19.7%
associate-*l*19.7%
associate-*r*19.7%
associate-*r*19.7%
Simplified19.7%
Taylor expanded in B around 0 17.6%
associate-*r*19.6%
Simplified19.6%
if 5.0000000000000002e-211 < (pow.f64 B 2) Initial program 14.3%
Taylor expanded in C around 0 12.0%
associate-*l*12.0%
+-commutative12.0%
Simplified12.0%
Taylor expanded in A around 0 18.4%
mul-1-neg18.4%
Simplified18.4%
Final simplification18.8%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= B 1.75e-105) (/ (sqrt (* A (* (* A (* C F)) -16.0))) (- (fma B B (* -4.0 (* A C))))) (* (sqrt (/ F B)) (- (sqrt 2.0)))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 1.75e-105) {
tmp = sqrt((A * ((A * (C * F)) * -16.0))) / -fma(B, B, (-4.0 * (A * C)));
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (B <= 1.75e-105) tmp = Float64(sqrt(Float64(A * Float64(Float64(A * Float64(C * F)) * -16.0))) / Float64(-fma(B, B, Float64(-4.0 * Float64(A * C))))); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); end return tmp end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[B, 1.75e-105], N[(N[Sqrt[N[(A * N[(N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision] * -16.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.75 \cdot 10^{-105}:\\
\;\;\;\;\frac{\sqrt{A \cdot \left(\left(A \cdot \left(C \cdot F\right)\right) \cdot -16\right)}}{-\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < 1.75e-105Initial program 13.9%
Taylor expanded in A around inf 12.1%
frac-2neg12.1%
remove-double-neg12.1%
div-inv12.0%
Applied egg-rr12.0%
associate-*r/12.1%
*-rgt-identity12.1%
associate-*l*12.1%
associate-*r*12.1%
associate-*r*12.1%
Simplified12.1%
Taylor expanded in B around 0 10.5%
if 1.75e-105 < B Initial program 18.8%
Taylor expanded in C around 0 24.4%
associate-*l*24.5%
+-commutative24.5%
Simplified24.5%
Taylor expanded in A around 0 37.5%
mul-1-neg37.5%
Simplified37.5%
Final simplification18.8%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= A 1.95e+95) (* (sqrt (/ F B)) (- (sqrt 2.0))) (* -2.0 (/ (sqrt A) (/ B (sqrt F))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (A <= 1.95e+95) {
tmp = sqrt((F / B)) * -sqrt(2.0);
} else {
tmp = -2.0 * (sqrt(A) / (B / sqrt(F)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (a <= 1.95d+95) then
tmp = sqrt((f / b)) * -sqrt(2.0d0)
else
tmp = (-2.0d0) * (sqrt(a) / (b / sqrt(f)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (A <= 1.95e+95) {
tmp = Math.sqrt((F / B)) * -Math.sqrt(2.0);
} else {
tmp = -2.0 * (Math.sqrt(A) / (B / Math.sqrt(F)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if A <= 1.95e+95: tmp = math.sqrt((F / B)) * -math.sqrt(2.0) else: tmp = -2.0 * (math.sqrt(A) / (B / math.sqrt(F))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (A <= 1.95e+95) tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); else tmp = Float64(-2.0 * Float64(sqrt(A) / Float64(B / sqrt(F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (A <= 1.95e+95) tmp = sqrt((F / B)) * -sqrt(2.0); else tmp = -2.0 * (sqrt(A) / (B / sqrt(F))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[A, 1.95e+95], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(-2.0 * N[(N[Sqrt[A], $MachinePrecision] / N[(B / N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq 1.95 \cdot 10^{+95}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{A}}{\frac{B}{\sqrt{F}}}\\
\end{array}
\end{array}
if A < 1.9499999999999999e95Initial program 16.5%
Taylor expanded in C around 0 9.7%
associate-*l*9.7%
+-commutative9.7%
Simplified9.7%
Taylor expanded in A around 0 14.2%
mul-1-neg14.2%
Simplified14.2%
if 1.9499999999999999e95 < A Initial program 7.9%
Taylor expanded in A around inf 14.2%
Taylor expanded in B around inf 5.3%
un-div-inv5.3%
sqrt-prod13.8%
associate-/l*13.7%
Applied egg-rr13.7%
Final simplification14.2%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (sqrt (/ F B)) (- (sqrt 2.0))))
B = abs(B);
double code(double A, double B, double C, double F) {
return sqrt((F / B)) * -sqrt(2.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
code = sqrt((f / b)) * -sqrt(2.0d0)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return Math.sqrt((F / B)) * -Math.sqrt(2.0);
}
B = abs(B) def code(A, B, C, F): return math.sqrt((F / B)) * -math.sqrt(2.0)
B = abs(B) function code(A, B, C, F) return Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = sqrt((F / B)) * -sqrt(2.0); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)
\end{array}
Initial program 15.4%
Taylor expanded in C around 0 9.0%
associate-*l*9.0%
+-commutative9.0%
Simplified9.0%
Taylor expanded in A around 0 12.9%
mul-1-neg12.9%
Simplified12.9%
Final simplification12.9%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* -2.0 (* (pow (* A F) 0.5) (/ 1.0 B))))
B = abs(B);
double code(double A, double B, double C, double F) {
return -2.0 * (pow((A * F), 0.5) * (1.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 = (-2.0d0) * (((a * f) ** 0.5d0) * (1.0d0 / b))
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return -2.0 * (Math.pow((A * F), 0.5) * (1.0 / B));
}
B = abs(B) def code(A, B, C, F): return -2.0 * (math.pow((A * F), 0.5) * (1.0 / B))
B = abs(B) function code(A, B, C, F) return Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) * Float64(1.0 / B))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = -2.0 * (((A * F) ^ 0.5) * (1.0 / B)); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
-2 \cdot \left({\left(A \cdot F\right)}^{0.5} \cdot \frac{1}{B}\right)
\end{array}
Initial program 15.4%
Taylor expanded in A around inf 9.6%
Taylor expanded in B around inf 2.5%
pow1/22.7%
Applied egg-rr2.7%
Final simplification2.7%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* -2.0 (/ (sqrt (* A F)) B)))
B = abs(B);
double code(double A, double B, double C, double F) {
return -2.0 * (sqrt((A * F)) / B);
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (-2.0d0) * (sqrt((a * f)) / b)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return -2.0 * (Math.sqrt((A * F)) / B);
}
B = abs(B) def code(A, B, C, F): return -2.0 * (math.sqrt((A * F)) / B)
B = abs(B) function code(A, B, C, F) return Float64(-2.0 * Float64(sqrt(Float64(A * F)) / B)) end
B = abs(B) function tmp = code(A, B, C, F) tmp = -2.0 * (sqrt((A * F)) / B); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
-2 \cdot \frac{\sqrt{A \cdot F}}{B}
\end{array}
Initial program 15.4%
Taylor expanded in A around inf 9.6%
frac-2neg9.6%
remove-double-neg9.6%
div-inv9.6%
Applied egg-rr9.6%
associate-*r/9.6%
*-rgt-identity9.6%
associate-*l*9.6%
associate-*r*9.6%
associate-*r*9.6%
Simplified9.6%
Taylor expanded in B around inf 2.5%
associate-*r/2.5%
*-rgt-identity2.5%
Simplified2.5%
Final simplification2.5%
herbie shell --seed 2023301
(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))))