
(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 (+ (+ A C) (hypot (- A C) B)))
(t_1 (fma B B (* A (* C -4.0))))
(t_2 (* F t_1))
(t_3 (- (pow B 2.0) (* (* 4.0 A) C)))
(t_4
(/
(-
(sqrt
(*
(* 2.0 (* t_3 F))
(+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
t_3)))
(if (<= t_4 -5e-222)
(/ (* (sqrt t_0) (* (pow (* 2.0 t_1) 0.5) (- (sqrt F)))) t_1)
(if (<= t_4 1e-56)
(/
(- (sqrt (* t_2 (* 2.0 (+ A (+ A (* -0.5 (/ (pow B 2.0) C))))))))
t_1)
(if (<= t_4 INFINITY)
(/ (* (sqrt (* 2.0 t_0)) (- (sqrt t_2))) t_1)
(*
(* (sqrt F) (sqrt (+ A (hypot B A))))
(* (sqrt 2.0) (/ -1.0 B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (A + C) + hypot((A - C), B);
double t_1 = fma(B, B, (A * (C * -4.0)));
double t_2 = F * t_1;
double t_3 = pow(B, 2.0) - ((4.0 * A) * C);
double t_4 = -sqrt(((2.0 * (t_3 * F)) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_3;
double tmp;
if (t_4 <= -5e-222) {
tmp = (sqrt(t_0) * (pow((2.0 * t_1), 0.5) * -sqrt(F))) / t_1;
} else if (t_4 <= 1e-56) {
tmp = -sqrt((t_2 * (2.0 * (A + (A + (-0.5 * (pow(B, 2.0) / C))))))) / t_1;
} else if (t_4 <= ((double) INFINITY)) {
tmp = (sqrt((2.0 * t_0)) * -sqrt(t_2)) / t_1;
} else {
tmp = (sqrt(F) * sqrt((A + hypot(B, A)))) * (sqrt(2.0) * (-1.0 / B));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(A + C) + hypot(Float64(A - C), B)) t_1 = fma(B, B, Float64(A * Float64(C * -4.0))) t_2 = Float64(F * t_1) t_3 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_4 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_3 * F)) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_3) tmp = 0.0 if (t_4 <= -5e-222) tmp = Float64(Float64(sqrt(t_0) * Float64((Float64(2.0 * t_1) ^ 0.5) * Float64(-sqrt(F)))) / t_1); elseif (t_4 <= 1e-56) tmp = Float64(Float64(-sqrt(Float64(t_2 * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B ^ 2.0) / C)))))))) / t_1); elseif (t_4 <= Inf) tmp = Float64(Float64(sqrt(Float64(2.0 * t_0)) * Float64(-sqrt(t_2))) / t_1); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(A + hypot(B, A)))) * Float64(sqrt(2.0) * Float64(-1.0 / B))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(F * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$3 * 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$3), $MachinePrecision]}, If[LessEqual[t$95$4, -5e-222], N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * N[(N[Power[N[(2.0 * t$95$1), $MachinePrecision], 0.5], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$4, 1e-56], N[((-N[Sqrt[N[(t$95$2 * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[Power[B, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(N[(N[Sqrt[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[t$95$2], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\\
t_1 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := F \cdot t_1\\
t_3 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_4 := \frac{-\sqrt{\left(2 \cdot \left(t_3 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_3}\\
\mathbf{if}\;t_4 \leq -5 \cdot 10^{-222}:\\
\;\;\;\;\frac{\sqrt{t_0} \cdot \left({\left(2 \cdot t_1\right)}^{0.5} \cdot \left(-\sqrt{F}\right)\right)}{t_1}\\
\mathbf{elif}\;t_4 \leq 10^{-56}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B}^{2}}{C}\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;\frac{\sqrt{2 \cdot t_0} \cdot \left(-\sqrt{t_2}\right)}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{A + \mathsf{hypot}\left(B, A\right)}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B}\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))) < -5.00000000000000008e-222Initial program 42.0%
Simplified52.7%
pow1/252.7%
associate-*r*52.7%
unpow-prod-down63.9%
*-commutative63.9%
pow1/263.9%
associate-+r+62.9%
hypot-udef49.6%
unpow249.6%
unpow249.6%
+-commutative49.6%
+-commutative49.6%
Applied egg-rr62.9%
associate-*l*62.9%
unpow-prod-down77.1%
pow1/277.1%
Applied egg-rr77.1%
if -5.00000000000000008e-222 < (/.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))) < 1e-56Initial program 10.0%
Simplified15.0%
Taylor expanded in C around -inf 37.8%
if 1e-56 < (/.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 50.1%
Simplified63.9%
sqrt-prod91.0%
*-commutative91.0%
associate-+r+91.0%
hypot-udef56.9%
unpow256.9%
unpow256.9%
+-commutative56.9%
+-commutative56.9%
unpow256.9%
unpow256.9%
hypot-def91.0%
Applied egg-rr91.0%
+-commutative91.0%
Simplified91.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))) Initial program 0.0%
Taylor expanded in C around 0 1.7%
mul-1-neg1.7%
distribute-rgt-neg-in1.7%
+-commutative1.7%
unpow21.7%
unpow21.7%
hypot-def14.7%
Simplified14.7%
pow1/214.7%
*-commutative14.7%
unpow-prod-down21.9%
pow1/221.9%
pow1/221.9%
Applied egg-rr21.9%
div-inv21.9%
Applied egg-rr21.9%
Final simplification46.9%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ A (hypot B A)))
(t_1 (fma B B (* A (* C -4.0))))
(t_2 (- (pow B 2.0) (* (* 4.0 A) C)))
(t_3 (* 2.0 (* t_2 F))))
(if (<= (pow B 2.0) 2e-280)
(/ (- (sqrt (* (* 2.0 (* F t_1)) (* 2.0 A)))) t_1)
(if (<= (pow B 2.0) 2e-167)
(/ (- (sqrt (* t_3 (* 2.0 C)))) t_2)
(if (<= (pow B 2.0) 1e-62)
(/ (- (sqrt (* t_3 t_0))) t_2)
(* (* (sqrt F) (sqrt t_0)) (* (sqrt 2.0) (/ -1.0 B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = A + hypot(B, A);
double t_1 = fma(B, B, (A * (C * -4.0)));
double t_2 = pow(B, 2.0) - ((4.0 * A) * C);
double t_3 = 2.0 * (t_2 * F);
double tmp;
if (pow(B, 2.0) <= 2e-280) {
tmp = -sqrt(((2.0 * (F * t_1)) * (2.0 * A))) / t_1;
} else if (pow(B, 2.0) <= 2e-167) {
tmp = -sqrt((t_3 * (2.0 * C))) / t_2;
} else if (pow(B, 2.0) <= 1e-62) {
tmp = -sqrt((t_3 * t_0)) / t_2;
} else {
tmp = (sqrt(F) * sqrt(t_0)) * (sqrt(2.0) * (-1.0 / B));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = Float64(A + hypot(B, A)) t_1 = fma(B, B, Float64(A * Float64(C * -4.0))) t_2 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_3 = Float64(2.0 * Float64(t_2 * F)) tmp = 0.0 if ((B ^ 2.0) <= 2e-280) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(2.0 * A)))) / t_1); elseif ((B ^ 2.0) <= 2e-167) tmp = Float64(Float64(-sqrt(Float64(t_3 * Float64(2.0 * C)))) / t_2); elseif ((B ^ 2.0) <= 1e-62) tmp = Float64(Float64(-sqrt(Float64(t_3 * t_0))) / t_2); else tmp = Float64(Float64(sqrt(F) * sqrt(t_0)) * Float64(sqrt(2.0) * Float64(-1.0 / B))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(A * N[(C * -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[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-280], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-167], N[((-N[Sqrt[N[(t$95$3 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e-62], N[((-N[Sqrt[N[(t$95$3 * t$95$0), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := A + \mathsf{hypot}\left(B, A\right)\\
t_1 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_3 := 2 \cdot \left(t_2 \cdot F\right)\\
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{-280}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(2 \cdot A\right)}}{t_1}\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-167}:\\
\;\;\;\;\frac{-\sqrt{t_3 \cdot \left(2 \cdot C\right)}}{t_2}\\
\mathbf{elif}\;{B}^{2} \leq 10^{-62}:\\
\;\;\;\;\frac{-\sqrt{t_3 \cdot t_0}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{t_0}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.9999999999999999e-280Initial program 17.3%
Simplified28.5%
pow1/228.5%
associate-*r*28.5%
unpow-prod-down30.4%
*-commutative30.4%
pow1/230.4%
associate-+r+28.9%
hypot-udef20.0%
unpow220.0%
unpow220.0%
+-commutative20.0%
+-commutative20.0%
Applied egg-rr28.9%
Taylor expanded in A around inf 22.5%
expm1-log1p-u21.9%
expm1-udef9.5%
pow1/29.5%
pow-prod-down11.4%
*-commutative11.4%
Applied egg-rr11.4%
expm1-def25.3%
expm1-log1p26.1%
unpow1/226.1%
Simplified26.1%
if 1.9999999999999999e-280 < (pow.f64 B 2) < 2e-167Initial program 27.4%
Taylor expanded in A around -inf 30.3%
if 2e-167 < (pow.f64 B 2) < 1e-62Initial program 40.0%
Taylor expanded in C around 0 36.5%
+-commutative36.5%
unpow236.5%
unpow236.5%
hypot-def41.3%
Simplified41.3%
if 1e-62 < (pow.f64 B 2) Initial program 13.2%
Taylor expanded in C around 0 10.2%
mul-1-neg10.2%
distribute-rgt-neg-in10.2%
+-commutative10.2%
unpow210.2%
unpow210.2%
hypot-def21.4%
Simplified21.4%
pow1/221.4%
*-commutative21.4%
unpow-prod-down32.1%
pow1/232.1%
pow1/232.1%
Applied egg-rr32.1%
div-inv32.0%
Applied egg-rr32.0%
Final simplification31.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))) (t_1 (- (pow B 2.0) (* (* 4.0 A) C))))
(if (<= (pow B 2.0) 2e-280)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 A)))) t_0)
(if (<= (pow B 2.0) 1e-264)
(/ (- (sqrt (* (* 2.0 (* t_1 F)) (* 2.0 C)))) t_1)
(if (<= (pow B 2.0) 4e-221)
(/ (* (sqrt (* F (* 2.0 t_0))) (- (sqrt (* 2.0 A)))) t_0)
(* (* (sqrt F) (sqrt (+ A (hypot B A)))) (/ (- (sqrt 2.0)) B)))))))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 = pow(B, 2.0) - ((4.0 * A) * C);
double tmp;
if (pow(B, 2.0) <= 2e-280) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * A))) / t_0;
} else if (pow(B, 2.0) <= 1e-264) {
tmp = -sqrt(((2.0 * (t_1 * F)) * (2.0 * C))) / t_1;
} else if (pow(B, 2.0) <= 4e-221) {
tmp = (sqrt((F * (2.0 * t_0))) * -sqrt((2.0 * A))) / t_0;
} else {
tmp = (sqrt(F) * sqrt((A + hypot(B, A)))) * (-sqrt(2.0) / B);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) tmp = 0.0 if ((B ^ 2.0) <= 2e-280) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * A)))) / t_0); elseif ((B ^ 2.0) <= 1e-264) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_1 * F)) * Float64(2.0 * C)))) / t_1); elseif ((B ^ 2.0) <= 4e-221) tmp = Float64(Float64(sqrt(Float64(F * Float64(2.0 * t_0))) * Float64(-sqrt(Float64(2.0 * A)))) / t_0); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(A + hypot(B, A)))) * Float64(Float64(-sqrt(2.0)) / B)); 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[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-280], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e-264], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 4e-221], N[(N[(N[Sqrt[N[(F * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * A), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $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 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{-280}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot A\right)}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 10^{-264}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_1 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_1}\\
\mathbf{elif}\;{B}^{2} \leq 4 \cdot 10^{-221}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(2 \cdot t_0\right)} \cdot \left(-\sqrt{2 \cdot A}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{A + \mathsf{hypot}\left(B, A\right)}\right) \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.9999999999999999e-280Initial program 17.3%
Simplified28.5%
pow1/228.5%
associate-*r*28.5%
unpow-prod-down30.4%
*-commutative30.4%
pow1/230.4%
associate-+r+28.9%
hypot-udef20.0%
unpow220.0%
unpow220.0%
+-commutative20.0%
+-commutative20.0%
Applied egg-rr28.9%
Taylor expanded in A around inf 22.5%
expm1-log1p-u21.9%
expm1-udef9.5%
pow1/29.5%
pow-prod-down11.4%
*-commutative11.4%
Applied egg-rr11.4%
expm1-def25.3%
expm1-log1p26.1%
unpow1/226.1%
Simplified26.1%
if 1.9999999999999999e-280 < (pow.f64 B 2) < 1e-264Initial program 30.3%
Taylor expanded in A around -inf 58.4%
if 1e-264 < (pow.f64 B 2) < 4.00000000000000007e-221Initial program 30.7%
Simplified34.3%
pow1/234.3%
associate-*r*34.3%
unpow-prod-down39.9%
*-commutative39.9%
pow1/239.9%
associate-+r+37.8%
hypot-udef29.9%
unpow229.9%
unpow229.9%
+-commutative29.9%
+-commutative29.9%
Applied egg-rr37.8%
Taylor expanded in A around inf 37.4%
unpow1/237.4%
associate-*l*37.5%
Applied egg-rr37.5%
if 4.00000000000000007e-221 < (pow.f64 B 2) Initial program 17.7%
Taylor expanded in C around 0 10.8%
mul-1-neg10.8%
distribute-rgt-neg-in10.8%
+-commutative10.8%
unpow210.8%
unpow210.8%
hypot-def19.6%
Simplified19.6%
pow1/219.6%
*-commutative19.6%
unpow-prod-down27.9%
pow1/227.9%
pow1/227.9%
Applied egg-rr27.9%
Final simplification28.7%
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 (/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 A)))) t_0))
(t_2 (- (pow B 2.0) (* (* 4.0 A) C))))
(if (<= (pow B 2.0) 2e-280)
t_1
(if (<= (pow B 2.0) 2e-175)
(/ (- (sqrt (* (* 2.0 (* t_2 F)) (* 2.0 C)))) t_2)
(if (<= (pow B 2.0) 1.5e-137)
t_1
(* (* (sqrt F) (sqrt (+ A (hypot B A)))) (/ (- (sqrt 2.0)) B)))))))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 = -sqrt(((2.0 * (F * t_0)) * (2.0 * A))) / t_0;
double t_2 = pow(B, 2.0) - ((4.0 * A) * C);
double tmp;
if (pow(B, 2.0) <= 2e-280) {
tmp = t_1;
} else if (pow(B, 2.0) <= 2e-175) {
tmp = -sqrt(((2.0 * (t_2 * F)) * (2.0 * C))) / t_2;
} else if (pow(B, 2.0) <= 1.5e-137) {
tmp = t_1;
} else {
tmp = (sqrt(F) * sqrt((A + hypot(B, A)))) * (-sqrt(2.0) / B);
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * A)))) / t_0) t_2 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) tmp = 0.0 if ((B ^ 2.0) <= 2e-280) tmp = t_1; elseif ((B ^ 2.0) <= 2e-175) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(2.0 * C)))) / t_2); elseif ((B ^ 2.0) <= 1.5e-137) tmp = t_1; else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(A + hypot(B, A)))) * Float64(Float64(-sqrt(2.0)) / B)); 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[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-280], t$95$1, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-175], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1.5e-137], t$95$1, N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $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 := \frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot A\right)}}{t_0}\\
t_2 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{-280}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-175}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_2}\\
\mathbf{elif}\;{B}^{2} \leq 1.5 \cdot 10^{-137}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{A + \mathsf{hypot}\left(B, A\right)}\right) \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.9999999999999999e-280 or 2e-175 < (pow.f64 B 2) < 1.4999999999999999e-137Initial program 17.8%
Simplified27.8%
pow1/227.8%
associate-*r*27.8%
unpow-prod-down30.3%
*-commutative30.3%
pow1/230.3%
associate-+r+29.0%
hypot-udef21.4%
unpow221.4%
unpow221.4%
+-commutative21.4%
+-commutative21.4%
Applied egg-rr29.0%
Taylor expanded in A around inf 22.2%
expm1-log1p-u21.7%
expm1-udef8.3%
pow1/28.3%
pow-prod-down10.1%
*-commutative10.1%
Applied egg-rr10.1%
expm1-def26.1%
expm1-log1p26.8%
unpow1/226.8%
Simplified26.8%
if 1.9999999999999999e-280 < (pow.f64 B 2) < 2e-175Initial program 28.6%
Taylor expanded in A around -inf 31.9%
if 1.4999999999999999e-137 < (pow.f64 B 2) Initial program 17.0%
Taylor expanded in C around 0 10.4%
mul-1-neg10.4%
distribute-rgt-neg-in10.4%
+-commutative10.4%
unpow210.4%
unpow210.4%
hypot-def20.3%
Simplified20.3%
pow1/220.4%
*-commutative20.4%
unpow-prod-down29.8%
pow1/229.8%
pow1/229.8%
Applied egg-rr29.8%
Final simplification29.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 6e+57)
(/
(* (sqrt (* 2.0 (+ (+ A C) (hypot (- A C) B)))) (- (sqrt (* F t_0))))
t_0)
(* (* (sqrt F) (sqrt (+ A (hypot B A)))) (* (sqrt 2.0) (/ -1.0 B))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 6e+57) {
tmp = (sqrt((2.0 * ((A + C) + hypot((A - C), B)))) * -sqrt((F * t_0))) / t_0;
} else {
tmp = (sqrt(F) * sqrt((A + hypot(B, A)))) * (sqrt(2.0) * (-1.0 / B));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 6e+57) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(Float64(A + C) + hypot(Float64(A - C), B)))) * Float64(-sqrt(Float64(F * t_0)))) / t_0); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(A + hypot(B, A)))) * Float64(sqrt(2.0) * Float64(-1.0 / B))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 6e+57], N[(N[(N[Sqrt[N[(2.0 * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 6 \cdot 10^{+57}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right)} \cdot \left(-\sqrt{F \cdot t_0}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{A + \mathsf{hypot}\left(B, A\right)}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.9999999999999999e57Initial program 24.9%
Simplified32.8%
sqrt-prod36.5%
*-commutative36.5%
associate-+r+35.2%
hypot-udef26.2%
unpow226.2%
unpow226.2%
+-commutative26.2%
+-commutative26.2%
unpow226.2%
unpow226.2%
hypot-def35.2%
Applied egg-rr35.2%
+-commutative35.2%
Simplified35.2%
if 5.9999999999999999e57 < (pow.f64 B 2) Initial program 9.5%
Taylor expanded in C around 0 9.6%
mul-1-neg9.6%
distribute-rgt-neg-in9.6%
+-commutative9.6%
unpow29.6%
unpow29.6%
hypot-def23.7%
Simplified23.7%
pow1/223.7%
*-commutative23.7%
unpow-prod-down37.4%
pow1/237.4%
pow1/237.4%
Applied egg-rr37.4%
div-inv37.4%
Applied egg-rr37.4%
Final simplification36.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 6e+57)
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ (+ A C) (hypot (- A C) B))))))) t_0)
(* (* (sqrt F) (sqrt (+ A (hypot B A)))) (* (sqrt 2.0) (/ -1.0 B))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 6e+57) {
tmp = -sqrt((2.0 * (t_0 * (F * ((A + C) + hypot((A - C), B)))))) / t_0;
} else {
tmp = (sqrt(F) * sqrt((A + hypot(B, A)))) * (sqrt(2.0) * (-1.0 / B));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 6e+57) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(Float64(A + C) + hypot(Float64(A - C), B))))))) / t_0); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(A + hypot(B, A)))) * Float64(sqrt(2.0) * Float64(-1.0 / B))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 6e+57], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 6 \cdot 10^{+57}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{A + \mathsf{hypot}\left(B, A\right)}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.9999999999999999e57Initial program 24.9%
expm1-log1p-u11.3%
expm1-udef4.5%
Applied egg-rr5.6%
expm1-def16.5%
expm1-log1p31.0%
distribute-neg-frac31.0%
Simplified30.7%
if 5.9999999999999999e57 < (pow.f64 B 2) Initial program 9.5%
Taylor expanded in C around 0 9.6%
mul-1-neg9.6%
distribute-rgt-neg-in9.6%
+-commutative9.6%
unpow29.6%
unpow29.6%
hypot-def23.7%
Simplified23.7%
pow1/223.7%
*-commutative23.7%
unpow-prod-down37.4%
pow1/237.4%
pow1/237.4%
Applied egg-rr37.4%
div-inv37.4%
Applied egg-rr37.4%
Final simplification33.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 6e+57)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A (+ C (hypot B (- A C)))))))) t_0)
(* (* (sqrt F) (sqrt (+ A (hypot B A)))) (* (sqrt 2.0) (/ -1.0 B))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 6e+57) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + (C + hypot(B, (A - C))))))) / t_0;
} else {
tmp = (sqrt(F) * sqrt((A + hypot(B, A)))) * (sqrt(2.0) * (-1.0 / B));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 6e+57) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + Float64(C + hypot(B, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(A + hypot(B, A)))) * Float64(sqrt(2.0) * Float64(-1.0 / B))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 6e+57], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 6 \cdot 10^{+57}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{A + \mathsf{hypot}\left(B, A\right)}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.9999999999999999e57Initial program 24.9%
Simplified32.8%
if 5.9999999999999999e57 < (pow.f64 B 2) Initial program 9.5%
Taylor expanded in C around 0 9.6%
mul-1-neg9.6%
distribute-rgt-neg-in9.6%
+-commutative9.6%
unpow29.6%
unpow29.6%
hypot-def23.7%
Simplified23.7%
pow1/223.7%
*-commutative23.7%
unpow-prod-down37.4%
pow1/237.4%
pow1/237.4%
Applied egg-rr37.4%
div-inv37.4%
Applied egg-rr37.4%
Final simplification34.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= F 1.4e-301)
(/ 1.0 (/ t_0 (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 A))))))
(if (<= F 1.7e+27)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ C (hypot B C))))))
(* (sqrt 2.0) (- (sqrt (/ F B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (F <= 1.4e-301) {
tmp = 1.0 / (t_0 / -sqrt(((2.0 * (F * t_0)) * (2.0 * A))));
} else if (F <= 1.7e+27) {
tmp = (sqrt(2.0) / B) * -sqrt((F * (C + hypot(B, C))));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (F <= 1.4e-301) tmp = Float64(1.0 / Float64(t_0 / Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * A)))))); elseif (F <= 1.7e+27) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(C + hypot(B, C)))))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, 1.4e-301], N[(1.0 / N[(t$95$0 / (-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.7e+27], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;F \leq 1.4 \cdot 10^{-301}:\\
\;\;\;\;\frac{1}{\frac{t_0}{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot A\right)}}}\\
\mathbf{elif}\;F \leq 1.7 \cdot 10^{+27}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 1.4000000000000001e-301Initial program 35.1%
Simplified46.2%
pow1/246.2%
associate-*r*46.2%
unpow-prod-down60.7%
*-commutative60.7%
pow1/260.7%
associate-+r+60.7%
hypot-udef38.6%
unpow238.6%
unpow238.6%
+-commutative38.6%
+-commutative38.6%
Applied egg-rr60.7%
Taylor expanded in A around inf 39.1%
clear-num39.3%
inv-pow39.3%
pow1/239.3%
pow-prod-down32.1%
*-commutative32.1%
Applied egg-rr32.1%
unpow-132.1%
unpow1/232.1%
Simplified32.1%
if 1.4000000000000001e-301 < F < 1.7e27Initial program 18.7%
Taylor expanded in A around 0 9.0%
mul-1-neg9.0%
distribute-rgt-neg-in9.0%
unpow29.0%
unpow29.0%
hypot-def20.4%
Simplified20.4%
if 1.7e27 < F Initial program 14.5%
Taylor expanded in C around 0 8.5%
mul-1-neg8.5%
distribute-rgt-neg-in8.5%
+-commutative8.5%
unpow28.5%
unpow28.5%
hypot-def9.8%
Simplified9.8%
Taylor expanded in A around 0 19.2%
associate-*r*19.2%
mul-1-neg19.2%
Simplified19.2%
Final simplification21.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= F 1.46e-301)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 A)))) t_0)
(if (<= F 1.16e+27)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ C (hypot B C))))))
(* (sqrt 2.0) (- (sqrt (/ F B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (F <= 1.46e-301) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * A))) / t_0;
} else if (F <= 1.16e+27) {
tmp = (sqrt(2.0) / B) * -sqrt((F * (C + hypot(B, C))));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (F <= 1.46e-301) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * A)))) / t_0); elseif (F <= 1.16e+27) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(C + hypot(B, C)))))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, 1.46e-301], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 1.16e+27], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;F \leq 1.46 \cdot 10^{-301}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot A\right)}}{t_0}\\
\mathbf{elif}\;F \leq 1.16 \cdot 10^{+27}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 1.46000000000000002e-301Initial program 35.1%
Simplified46.2%
pow1/246.2%
associate-*r*46.2%
unpow-prod-down60.7%
*-commutative60.7%
pow1/260.7%
associate-+r+60.7%
hypot-udef38.6%
unpow238.6%
unpow238.6%
+-commutative38.6%
+-commutative38.6%
Applied egg-rr60.7%
Taylor expanded in A around inf 39.1%
expm1-log1p-u37.6%
expm1-udef23.1%
pow1/223.1%
pow-prod-down16.4%
*-commutative16.4%
Applied egg-rr16.4%
expm1-def31.0%
expm1-log1p32.0%
unpow1/232.0%
Simplified32.0%
if 1.46000000000000002e-301 < F < 1.16e27Initial program 18.7%
Taylor expanded in A around 0 9.0%
mul-1-neg9.0%
distribute-rgt-neg-in9.0%
unpow29.0%
unpow29.0%
hypot-def20.4%
Simplified20.4%
if 1.16e27 < F Initial program 14.5%
Taylor expanded in C around 0 8.5%
mul-1-neg8.5%
distribute-rgt-neg-in8.5%
+-commutative8.5%
unpow28.5%
unpow28.5%
hypot-def9.8%
Simplified9.8%
Taylor expanded in A around 0 19.2%
associate-*r*19.2%
mul-1-neg19.2%
Simplified19.2%
Final simplification21.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F -5e-311)
(/
(* (sqrt (* 2.0 A)) (- (pow (* 2.0 (* -4.0 (* A (* C F)))) 0.5)))
(fma B B (* A (* C -4.0))))
(if (<= F 3.4e+24)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ C (hypot B C))))))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -5e-311) {
tmp = (sqrt((2.0 * A)) * -pow((2.0 * (-4.0 * (A * (C * F)))), 0.5)) / fma(B, B, (A * (C * -4.0)));
} else if (F <= 3.4e+24) {
tmp = (sqrt(2.0) / B) * -sqrt((F * (C + hypot(B, C))));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= -5e-311) tmp = Float64(Float64(sqrt(Float64(2.0 * A)) * Float64(-(Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F)))) ^ 0.5))) / fma(B, B, Float64(A * Float64(C * -4.0)))); elseif (F <= 3.4e+24) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(C + hypot(B, C)))))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, -5e-311], N[(N[(N[Sqrt[N[(2.0 * A), $MachinePrecision]], $MachinePrecision] * (-N[Power[N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision] / N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.4e+24], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{\sqrt{2 \cdot A} \cdot \left(-{\left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}^{0.5}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;F \leq 3.4 \cdot 10^{+24}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -5.00000000000023e-311Initial program 37.7%
Simplified45.7%
pow1/245.7%
associate-*r*45.7%
unpow-prod-down61.4%
*-commutative61.4%
pow1/261.4%
associate-+r+61.4%
hypot-udef41.5%
unpow241.5%
unpow241.5%
+-commutative41.5%
+-commutative41.5%
Applied egg-rr61.4%
Taylor expanded in A around inf 38.0%
Taylor expanded in B around 0 31.6%
*-commutative31.6%
Simplified31.6%
if -5.00000000000023e-311 < F < 3.4000000000000001e24Initial program 18.5%
Taylor expanded in A around 0 8.9%
mul-1-neg8.9%
distribute-rgt-neg-in8.9%
unpow28.9%
unpow28.9%
hypot-def20.1%
Simplified20.1%
if 3.4000000000000001e24 < F Initial program 14.5%
Taylor expanded in C around 0 8.5%
mul-1-neg8.5%
distribute-rgt-neg-in8.5%
+-commutative8.5%
unpow28.5%
unpow28.5%
hypot-def9.8%
Simplified9.8%
Taylor expanded in A around 0 19.2%
associate-*r*19.2%
mul-1-neg19.2%
Simplified19.2%
Final simplification20.8%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= F 1.25e+73) (* (/ (sqrt 2.0) B) (- (sqrt (* F (+ A (hypot B A)))))) (* (sqrt 2.0) (- (sqrt (/ F B))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 1.25e+73) {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A + hypot(B, A))));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 1.25e+73) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A + Math.hypot(B, A))));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 1.25e+73: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A + math.hypot(B, A)))) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 1.25e+73) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A + hypot(B, A)))))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 1.25e+73) tmp = (sqrt(2.0) / B) * -sqrt((F * (A + hypot(B, A)))); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 1.25e+73], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.25 \cdot 10^{+73}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 1.24999999999999994e73Initial program 20.2%
Taylor expanded in C around 0 7.6%
mul-1-neg7.6%
distribute-rgt-neg-in7.6%
+-commutative7.6%
unpow27.6%
unpow27.6%
hypot-def16.8%
Simplified16.8%
if 1.24999999999999994e73 < F Initial program 15.8%
Taylor expanded in C around 0 8.4%
mul-1-neg8.4%
distribute-rgt-neg-in8.4%
+-commutative8.4%
unpow28.4%
unpow28.4%
hypot-def8.7%
Simplified8.7%
Taylor expanded in A around 0 19.8%
associate-*r*19.8%
mul-1-neg19.8%
Simplified19.8%
Final simplification17.9%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= F 1.4e+24) (* (/ (sqrt 2.0) B) (- (sqrt (* F (+ C (hypot B C)))))) (* (sqrt 2.0) (- (sqrt (/ F B))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 1.4e+24) {
tmp = (sqrt(2.0) / B) * -sqrt((F * (C + hypot(B, C))));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 1.4e+24) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (C + Math.hypot(B, C))));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 1.4e+24: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (C + math.hypot(B, C)))) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 1.4e+24) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(C + hypot(B, C)))))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 1.4e+24) tmp = (sqrt(2.0) / B) * -sqrt((F * (C + hypot(B, C)))); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 1.4e+24], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.4 \cdot 10^{+24}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 1.4000000000000001e24Initial program 21.6%
Taylor expanded in A around 0 7.5%
mul-1-neg7.5%
distribute-rgt-neg-in7.5%
unpow27.5%
unpow27.5%
hypot-def16.9%
Simplified16.9%
if 1.4000000000000001e24 < F Initial program 14.5%
Taylor expanded in C around 0 8.5%
mul-1-neg8.5%
distribute-rgt-neg-in8.5%
+-commutative8.5%
unpow28.5%
unpow28.5%
hypot-def9.8%
Simplified9.8%
Taylor expanded in A around 0 19.2%
associate-*r*19.2%
mul-1-neg19.2%
Simplified19.2%
Final simplification17.9%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= F 1.6e-6) (* (/ (sqrt 2.0) B) (- (sqrt (* B F)))) (* (sqrt 2.0) (- (sqrt (/ F B))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 1.6e-6) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 1.6d-6) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 1.6e-6) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 1.6e-6: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 1.6e-6) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 1.6e-6) tmp = (sqrt(2.0) / B) * -sqrt((B * F)); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 1.6e-6], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 1.5999999999999999e-6Initial program 23.0%
Taylor expanded in C around 0 7.9%
mul-1-neg7.9%
distribute-rgt-neg-in7.9%
+-commutative7.9%
unpow27.9%
unpow27.9%
hypot-def17.7%
Simplified17.7%
Taylor expanded in A around 0 15.8%
*-commutative15.8%
Simplified15.8%
if 1.5999999999999999e-6 < F Initial program 13.9%
Taylor expanded in C around 0 7.8%
mul-1-neg7.8%
distribute-rgt-neg-in7.8%
+-commutative7.8%
unpow27.8%
unpow27.8%
hypot-def9.9%
Simplified9.9%
Taylor expanded in A around 0 17.8%
associate-*r*17.8%
mul-1-neg17.8%
Simplified17.8%
Final simplification16.7%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (sqrt 2.0) (- (sqrt (/ F B)))))
B = abs(B);
double code(double A, double B, double C, double F) {
return sqrt(2.0) * -sqrt((F / B));
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt(2.0d0) * -sqrt((f / b))
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return Math.sqrt(2.0) * -Math.sqrt((F / B));
}
B = abs(B) def code(A, B, C, F): return math.sqrt(2.0) * -math.sqrt((F / B))
B = abs(B) function code(A, B, C, F) return Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = sqrt(2.0) * -sqrt((F / B)); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)
\end{array}
Initial program 18.6%
Taylor expanded in C around 0 7.9%
mul-1-neg7.9%
distribute-rgt-neg-in7.9%
+-commutative7.9%
unpow27.9%
unpow27.9%
hypot-def13.9%
Simplified13.9%
Taylor expanded in A around 0 13.4%
associate-*r*13.4%
mul-1-neg13.4%
Simplified13.4%
Final simplification13.4%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (pow (* A F) 0.5) (/ (- 2.0) B)))
B = abs(B);
double code(double A, double B, double C, double F) {
return pow((A * F), 0.5) * (-2.0 / B);
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = ((a * f) ** 0.5d0) * (-2.0d0 / b)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return Math.pow((A * F), 0.5) * (-2.0 / B);
}
B = abs(B) def code(A, B, C, F): return math.pow((A * F), 0.5) * (-2.0 / B)
B = abs(B) function code(A, B, C, F) return Float64((Float64(A * F) ^ 0.5) * Float64(Float64(-2.0) / B)) end
B = abs(B) function tmp = code(A, B, C, F) tmp = ((A * F) ^ 0.5) * (-2.0 / B); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] * N[((-2.0) / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
{\left(A \cdot F\right)}^{0.5} \cdot \frac{-2}{B}
\end{array}
Initial program 18.6%
Taylor expanded in C around 0 7.9%
mul-1-neg7.9%
distribute-rgt-neg-in7.9%
+-commutative7.9%
unpow27.9%
unpow27.9%
hypot-def13.9%
Simplified13.9%
Taylor expanded in B around 0 2.5%
associate-*r*2.5%
mul-1-neg2.5%
*-commutative2.5%
unpow22.5%
rem-square-sqrt2.5%
Simplified2.5%
pow1/22.6%
*-commutative2.6%
Applied egg-rr2.6%
Final simplification2.6%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (sqrt (* A F)) (/ (- 2.0) B)))
B = abs(B);
double code(double A, double B, double C, double F) {
return sqrt((A * F)) * (-2.0 / B);
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((a * f)) * (-2.0d0 / b)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return Math.sqrt((A * F)) * (-2.0 / B);
}
B = abs(B) def code(A, B, C, F): return math.sqrt((A * F)) * (-2.0 / B)
B = abs(B) function code(A, B, C, F) return Float64(sqrt(Float64(A * F)) * Float64(Float64(-2.0) / B)) end
B = abs(B) function tmp = code(A, B, C, F) tmp = sqrt((A * F)) * (-2.0 / B); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[((-2.0) / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\sqrt{A \cdot F} \cdot \frac{-2}{B}
\end{array}
Initial program 18.6%
Taylor expanded in C around 0 7.9%
mul-1-neg7.9%
distribute-rgt-neg-in7.9%
+-commutative7.9%
unpow27.9%
unpow27.9%
hypot-def13.9%
Simplified13.9%
Taylor expanded in B around 0 2.5%
associate-*r*2.5%
mul-1-neg2.5%
*-commutative2.5%
unpow22.5%
rem-square-sqrt2.5%
Simplified2.5%
Final simplification2.5%
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(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[(N[(2.0 * (-N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\frac{2 \cdot \left(-\sqrt{A \cdot F}\right)}{B}
\end{array}
Initial program 18.6%
Taylor expanded in C around 0 7.9%
mul-1-neg7.9%
distribute-rgt-neg-in7.9%
+-commutative7.9%
unpow27.9%
unpow27.9%
hypot-def13.9%
Simplified13.9%
Taylor expanded in B around 0 2.5%
associate-*r*2.5%
mul-1-neg2.5%
*-commutative2.5%
unpow22.5%
rem-square-sqrt2.5%
Simplified2.5%
associate-*r/2.5%
*-commutative2.5%
Applied egg-rr2.5%
Final simplification2.5%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (/ 2.0 B) (sqrt (* A F))))
B = abs(B);
double code(double A, double B, double C, double F) {
return (2.0 / B) * sqrt((A * F));
}
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 / b) * sqrt((a * f))
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return (2.0 / B) * Math.sqrt((A * F));
}
B = abs(B) def code(A, B, C, F): return (2.0 / B) * math.sqrt((A * F))
B = abs(B) function code(A, B, C, F) return Float64(Float64(2.0 / B) * sqrt(Float64(A * F))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = (2.0 / B) * sqrt((A * F)); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[(2.0 / B), $MachinePrecision] * N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\frac{2}{B} \cdot \sqrt{A \cdot F}
\end{array}
Initial program 18.6%
Simplified24.1%
pow1/224.1%
associate-*r*24.1%
unpow-prod-down28.5%
*-commutative28.5%
pow1/228.5%
associate-+r+27.7%
hypot-udef21.3%
unpow221.3%
unpow221.3%
+-commutative21.3%
+-commutative21.3%
Applied egg-rr27.7%
Taylor expanded in A around inf 13.8%
Taylor expanded in B around -inf 3.4%
unpow23.4%
rem-square-sqrt3.4%
Simplified3.4%
Final simplification3.4%
herbie shell --seed 2023318
(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))))