
(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 21 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}
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
(t_1 (+ A (+ C (hypot B_m (- A C)))))
(t_2 (- t_0))
(t_3 (* (* 4.0 A) C))
(t_4
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_3) F))
(+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
(- t_3 (pow B_m 2.0)))))
(if (<= t_4 (- INFINITY))
(* (sqrt (* F (/ t_1 (fma -4.0 (* A C) (pow B_m 2.0))))) (- (sqrt 2.0)))
(if (<= t_4 -5e-179)
(/ (sqrt (* (* F t_0) (* 2.0 t_1))) t_2)
(if (<= t_4 INFINITY)
(/
(*
(sqrt (* t_0 (* 2.0 F)))
(sqrt (fma C 2.0 (* -0.5 (/ (pow B_m 2.0) A)))))
t_2)
(*
(* (sqrt (+ C (hypot B_m C))) (sqrt F))
(/ -1.0 (* B_m (pow 2.0 -0.5)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = A + (C + hypot(B_m, (A - C)));
double t_2 = -t_0;
double t_3 = (4.0 * A) * C;
double t_4 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_3) * F)) * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_3 - pow(B_m, 2.0));
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = sqrt((F * (t_1 / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -sqrt(2.0);
} else if (t_4 <= -5e-179) {
tmp = sqrt(((F * t_0) * (2.0 * t_1))) / t_2;
} else if (t_4 <= ((double) INFINITY)) {
tmp = (sqrt((t_0 * (2.0 * F))) * sqrt(fma(C, 2.0, (-0.5 * (pow(B_m, 2.0) / A))))) / t_2;
} else {
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-1.0 / (B_m * pow(2.0, -0.5)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) t_2 = Float64(-t_0) t_3 = Float64(Float64(4.0 * A) * C) t_4 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_3) * F)) * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_3 - (B_m ^ 2.0))) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(sqrt(Float64(F * Float64(t_1 / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-sqrt(2.0))); elseif (t_4 <= -5e-179) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(2.0 * t_1))) / t_2); elseif (t_4 <= Inf) tmp = Float64(Float64(sqrt(Float64(t_0 * Float64(2.0 * F))) * sqrt(fma(C, 2.0, Float64(-0.5 * Float64((B_m ^ 2.0) / A))))) / t_2); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B_m, C))) * sqrt(F)) * Float64(-1.0 / Float64(B_m * (2.0 ^ -0.5)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-t$95$0)}, Block[{t$95$3 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$3), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$3 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[Sqrt[N[(F * N[(t$95$1 / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$4, -5e-179], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(N[(N[Sqrt[N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(C * 2.0 + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(B$95$m * N[Power[2.0, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\\
t_2 := -t\_0\\
t_3 := \left(4 \cdot A\right) \cdot C\\
t_4 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_3\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_3 - {B\_m}^{2}}\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\sqrt{F \cdot \frac{t\_1}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;t\_4 \leq -5 \cdot 10^{-179}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(2 \cdot t\_1\right)}}{t\_2}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\frac{\sqrt{t\_0 \cdot \left(2 \cdot F\right)} \cdot \sqrt{\mathsf{fma}\left(C, 2, -0.5 \cdot \frac{{B\_m}^{2}}{A}\right)}}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -inf.0Initial program 3.3%
Taylor expanded in F around 0 14.9%
mul-1-neg14.9%
Simplified65.6%
if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -4.9999999999999998e-179Initial program 96.9%
Simplified96.9%
if -4.9999999999999998e-179 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < +inf.0Initial program 19.1%
Simplified29.1%
*-un-lft-identity29.1%
Applied egg-rr32.3%
*-lft-identity32.3%
Simplified32.3%
Taylor expanded in A around -inf 25.1%
pow1/225.2%
associate-*r*25.5%
unpow-prod-down28.5%
*-commutative28.5%
pow1/228.5%
+-commutative28.5%
*-commutative28.5%
fma-define28.5%
Applied egg-rr28.5%
unpow1/228.5%
Simplified28.5%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) Initial program 0.0%
Taylor expanded in A around 0 1.8%
mul-1-neg1.8%
unpow21.8%
unpow21.8%
hypot-define20.6%
Simplified20.6%
pow1/220.6%
*-commutative20.6%
unpow-prod-down29.5%
pow1/229.5%
pow1/229.5%
Applied egg-rr29.5%
clear-num29.5%
inv-pow29.5%
Applied egg-rr29.5%
unpow-129.5%
Simplified29.5%
div-inv29.5%
pow1/229.5%
pow-flip29.6%
metadata-eval29.6%
Applied egg-rr29.6%
Final simplification46.1%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 0.0)
(/
(sqrt (* t_0 (* (* 2.0 F) (+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C)))))
(- t_0))
(if (<= (pow B_m 2.0) 2e+69)
(/
(* (sqrt (* F t_0)) (- (sqrt (* 2.0 (+ A (+ C (hypot (- A C) B_m)))))))
t_0)
(*
(* (sqrt (+ C (hypot B_m C))) (sqrt F))
(/ -1.0 (* B_m (pow 2.0 -0.5))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 0.0) {
tmp = sqrt((t_0 * ((2.0 * F) * ((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C))))) / -t_0;
} else if (pow(B_m, 2.0) <= 2e+69) {
tmp = (sqrt((F * t_0)) * -sqrt((2.0 * (A + (C + hypot((A - C), B_m)))))) / t_0;
} else {
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-1.0 / (B_m * pow(2.0, -0.5)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 0.0) tmp = Float64(sqrt(Float64(t_0 * Float64(Float64(2.0 * F) * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C))))) / Float64(-t_0)); elseif ((B_m ^ 2.0) <= 2e+69) tmp = Float64(Float64(sqrt(Float64(F * t_0)) * Float64(-sqrt(Float64(2.0 * Float64(A + Float64(C + hypot(Float64(A - C), B_m))))))) / t_0); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B_m, C))) * sqrt(F)) * Float64(-1.0 / Float64(B_m * (2.0 ^ -0.5)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 0.0], N[(N[Sqrt[N[(t$95$0 * N[(N[(2.0 * F), $MachinePrecision] * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+69], N[(N[(N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(B$95$m * N[Power[2.0, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 0:\\
\;\;\;\;\frac{\sqrt{t\_0 \cdot \left(\left(2 \cdot F\right) \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{A} + 2 \cdot C\right)\right)}}{-t\_0}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+69}:\\
\;\;\;\;\frac{\sqrt{F \cdot t\_0} \cdot \left(-\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)\right)}\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 0.0Initial program 19.7%
Simplified29.3%
*-un-lft-identity29.3%
Applied egg-rr32.0%
*-lft-identity32.0%
Simplified32.0%
Taylor expanded in A around -inf 21.0%
if 0.0 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e69Initial program 31.9%
Simplified38.3%
sqrt-prod49.8%
*-commutative49.8%
hypot-undefine37.5%
unpow237.5%
unpow237.5%
+-commutative37.5%
unpow237.5%
unpow237.5%
hypot-define49.8%
Applied egg-rr49.8%
if 2.0000000000000001e69 < (pow.f64 B #s(literal 2 binary64)) Initial program 10.7%
Taylor expanded in A around 0 8.9%
mul-1-neg8.9%
unpow28.9%
unpow28.9%
hypot-define27.7%
Simplified27.7%
pow1/227.7%
*-commutative27.7%
unpow-prod-down38.7%
pow1/238.7%
pow1/238.7%
Applied egg-rr38.7%
clear-num38.7%
inv-pow38.7%
Applied egg-rr38.7%
unpow-138.7%
Simplified38.7%
div-inv38.7%
pow1/238.7%
pow-flip38.8%
metadata-eval38.8%
Applied egg-rr38.8%
Final simplification37.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
(t_1 (fma B_m B_m (* -4.0 (* A C)))))
(if (<= (pow B_m 2.0) 0.0)
(/
-1.0
(/
t_1
(sqrt (* 2.0 (* t_1 (* F (fma 2.0 C (* -0.5 (/ (pow B_m 2.0) A)))))))))
(if (<= (pow B_m 2.0) 2e+69)
(/
(* (sqrt (* F t_0)) (- (sqrt (* 2.0 (+ A (+ C (hypot (- A C) B_m)))))))
t_0)
(*
(* (sqrt (+ C (hypot B_m C))) (sqrt F))
(/ -1.0 (* B_m (pow 2.0 -0.5))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = fma(B_m, B_m, (-4.0 * (A * C)));
double tmp;
if (pow(B_m, 2.0) <= 0.0) {
tmp = -1.0 / (t_1 / sqrt((2.0 * (t_1 * (F * fma(2.0, C, (-0.5 * (pow(B_m, 2.0) / A))))))));
} else if (pow(B_m, 2.0) <= 2e+69) {
tmp = (sqrt((F * t_0)) * -sqrt((2.0 * (A + (C + hypot((A - C), B_m)))))) / t_0;
} else {
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-1.0 / (B_m * pow(2.0, -0.5)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = fma(B_m, B_m, Float64(-4.0 * Float64(A * C))) tmp = 0.0 if ((B_m ^ 2.0) <= 0.0) tmp = Float64(-1.0 / Float64(t_1 / sqrt(Float64(2.0 * Float64(t_1 * Float64(F * fma(2.0, C, Float64(-0.5 * Float64((B_m ^ 2.0) / A))))))))); elseif ((B_m ^ 2.0) <= 2e+69) tmp = Float64(Float64(sqrt(Float64(F * t_0)) * Float64(-sqrt(Float64(2.0 * Float64(A + Float64(C + hypot(Float64(A - C), B_m))))))) / t_0); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B_m, C))) * sqrt(F)) * Float64(-1.0 / Float64(B_m * (2.0 ^ -0.5)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 0.0], N[(-1.0 / N[(t$95$1 / N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(2.0 * C + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+69], N[(N[(N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(B$95$m * N[Power[2.0, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 0:\\
\;\;\;\;\frac{-1}{\frac{t\_1}{\sqrt{2 \cdot \left(t\_1 \cdot \left(F \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{{B\_m}^{2}}{A}\right)\right)\right)}}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+69}:\\
\;\;\;\;\frac{\sqrt{F \cdot t\_0} \cdot \left(-\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)\right)}\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 0.0Initial program 19.7%
Taylor expanded in A around -inf 19.6%
clear-num19.7%
inv-pow19.7%
Applied egg-rr19.7%
unpow-119.7%
unpow219.7%
fma-neg19.7%
distribute-lft-neg-in19.7%
metadata-eval19.7%
*-commutative19.7%
associate-*l*19.5%
*-commutative19.5%
Simplified21.1%
if 0.0 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e69Initial program 31.9%
Simplified38.3%
sqrt-prod49.8%
*-commutative49.8%
hypot-undefine37.5%
unpow237.5%
unpow237.5%
+-commutative37.5%
unpow237.5%
unpow237.5%
hypot-define49.8%
Applied egg-rr49.8%
if 2.0000000000000001e69 < (pow.f64 B #s(literal 2 binary64)) Initial program 10.7%
Taylor expanded in A around 0 8.9%
mul-1-neg8.9%
unpow28.9%
unpow28.9%
hypot-define27.7%
Simplified27.7%
pow1/227.7%
*-commutative27.7%
unpow-prod-down38.7%
pow1/238.7%
pow1/238.7%
Applied egg-rr38.7%
clear-num38.7%
inv-pow38.7%
Applied egg-rr38.7%
unpow-138.7%
Simplified38.7%
div-inv38.7%
pow1/238.7%
pow-flip38.8%
metadata-eval38.8%
Applied egg-rr38.8%
Final simplification37.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0
(/
(sqrt (* -16.0 (* A (* F (pow C 2.0)))))
(- (fma B_m B_m (* A (* C -4.0))))))
(t_1 (/ (sqrt (* 2.0 (* F (+ C (hypot B_m C))))) (- B_m))))
(if (<= (pow B_m 2.0) 2e-234)
t_0
(if (<= (pow B_m 2.0) 1.0)
t_1
(if (<= (pow B_m 2.0) 2e+69)
t_0
(if (<= (pow B_m 2.0) 5e+151)
t_1
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C)))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt((-16.0 * (A * (F * pow(C, 2.0))))) / -fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
double tmp;
if (pow(B_m, 2.0) <= 2e-234) {
tmp = t_0;
} else if (pow(B_m, 2.0) <= 1.0) {
tmp = t_1;
} else if (pow(B_m, 2.0) <= 2e+69) {
tmp = t_0;
} else if (pow(B_m, 2.0) <= 5e+151) {
tmp = t_1;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(sqrt(Float64(-16.0 * Float64(A * Float64(F * (C ^ 2.0))))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))) t_1 = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(B_m, C))))) / Float64(-B_m)) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-234) tmp = t_0; elseif ((B_m ^ 2.0) <= 1.0) tmp = t_1; elseif ((B_m ^ 2.0) <= 2e+69) tmp = t_0; elseif ((B_m ^ 2.0) <= 5e+151) tmp = t_1; else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[N[(-16.0 * N[(A * N[(F * N[Power[C, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-234], t$95$0, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1.0], t$95$1, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+69], t$95$0, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+151], t$95$1, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{-16 \cdot \left(A \cdot \left(F \cdot {C}^{2}\right)\right)}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
t_1 := \frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-234}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;{B\_m}^{2} \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+69}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+151}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-234 or 1 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e69Initial program 22.5%
Simplified31.5%
*-un-lft-identity31.5%
Applied egg-rr32.5%
*-lft-identity32.5%
Simplified32.5%
Taylor expanded in A around -inf 14.5%
if 1.9999999999999999e-234 < (pow.f64 B #s(literal 2 binary64)) < 1 or 2.0000000000000001e69 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000002e151Initial program 32.2%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
unpow221.9%
unpow221.9%
hypot-define23.8%
Simplified23.8%
associate-*l/23.8%
pow1/223.8%
pow1/223.8%
pow-prod-down23.9%
Applied egg-rr23.9%
unpow1/223.9%
Simplified23.9%
if 5.0000000000000002e151 < (pow.f64 B #s(literal 2 binary64)) Initial program 8.1%
Taylor expanded in A around 0 7.9%
mul-1-neg7.9%
unpow27.9%
unpow27.9%
hypot-define28.5%
Simplified28.5%
pow1/228.5%
*-commutative28.5%
unpow-prod-down41.2%
pow1/241.2%
pow1/241.2%
Applied egg-rr41.2%
Taylor expanded in C around 0 36.6%
Final simplification25.2%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* F (pow C 2.0)))
(t_1 (- (fma B_m B_m (* A (* C -4.0)))))
(t_2 (/ (sqrt (* 2.0 (* F (+ C (hypot B_m C))))) (- B_m))))
(if (<= (pow B_m 2.0) 2e-234)
(/ (sqrt (* (* A -16.0) t_0)) t_1)
(if (<= (pow B_m 2.0) 1.0)
t_2
(if (<= (pow B_m 2.0) 2e+69)
(/ (sqrt (* -16.0 (* A t_0))) t_1)
(if (<= (pow B_m 2.0) 5e+151)
t_2
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C)))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = F * pow(C, 2.0);
double t_1 = -fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
double tmp;
if (pow(B_m, 2.0) <= 2e-234) {
tmp = sqrt(((A * -16.0) * t_0)) / t_1;
} else if (pow(B_m, 2.0) <= 1.0) {
tmp = t_2;
} else if (pow(B_m, 2.0) <= 2e+69) {
tmp = sqrt((-16.0 * (A * t_0))) / t_1;
} else if (pow(B_m, 2.0) <= 5e+151) {
tmp = t_2;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(F * (C ^ 2.0)) t_1 = Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0)))) t_2 = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(B_m, C))))) / Float64(-B_m)) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-234) tmp = Float64(sqrt(Float64(Float64(A * -16.0) * t_0)) / t_1); elseif ((B_m ^ 2.0) <= 1.0) tmp = t_2; elseif ((B_m ^ 2.0) <= 2e+69) tmp = Float64(sqrt(Float64(-16.0 * Float64(A * t_0))) / t_1); elseif ((B_m ^ 2.0) <= 5e+151) tmp = t_2; else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(F * N[Power[C, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, Block[{t$95$2 = N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-234], N[(N[Sqrt[N[(N[(A * -16.0), $MachinePrecision] * t$95$0), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1.0], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+69], N[(N[Sqrt[N[(-16.0 * N[(A * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+151], t$95$2, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := F \cdot {C}^{2}\\
t_1 := -\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := \frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-234}:\\
\;\;\;\;\frac{\sqrt{\left(A \cdot -16\right) \cdot t\_0}}{t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 1:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+69}:\\
\;\;\;\;\frac{\sqrt{-16 \cdot \left(A \cdot t\_0\right)}}{t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+151}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-234Initial program 20.4%
Simplified30.2%
*-un-lft-identity30.2%
Applied egg-rr31.3%
*-lft-identity31.3%
Simplified31.3%
Taylor expanded in A around -inf 20.3%
Taylor expanded in B around 0 13.7%
associate-*r*13.8%
Simplified13.8%
if 1.9999999999999999e-234 < (pow.f64 B #s(literal 2 binary64)) < 1 or 2.0000000000000001e69 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000002e151Initial program 32.2%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
unpow221.9%
unpow221.9%
hypot-define23.8%
Simplified23.8%
associate-*l/23.8%
pow1/223.8%
pow1/223.8%
pow-prod-down23.9%
Applied egg-rr23.9%
unpow1/223.9%
Simplified23.9%
if 1 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e69Initial program 41.0%
Simplified43.0%
*-un-lft-identity43.0%
Applied egg-rr43.0%
*-lft-identity43.0%
Simplified43.0%
Taylor expanded in A around -inf 21.9%
if 5.0000000000000002e151 < (pow.f64 B #s(literal 2 binary64)) Initial program 8.1%
Taylor expanded in A around 0 7.9%
mul-1-neg7.9%
unpow27.9%
unpow27.9%
hypot-define28.5%
Simplified28.5%
pow1/228.5%
*-commutative28.5%
unpow-prod-down41.2%
pow1/241.2%
pow1/241.2%
Applied egg-rr41.2%
Taylor expanded in C around 0 36.6%
Final simplification25.2%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C))
(t_1 (* -0.5 (/ (pow B_m 2.0) A)))
(t_2 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 1.95e-222)
(/ (sqrt (* t_2 (* (* 2.0 F) (+ t_1 (* 2.0 C))))) (- t_2))
(if (<= B_m 6.5e-194)
(*
(sqrt (* F (/ (fma 2.0 C t_1) (fma B_m B_m (* -4.0 (* A C))))))
(- (sqrt 2.0)))
(if (<= B_m 5.5e-85)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 C)))
(- t_0 (pow B_m 2.0)))
(*
(* (sqrt (+ C (hypot B_m C))) (sqrt F))
(/ -1.0 (* B_m (pow 2.0 -0.5)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = -0.5 * (pow(B_m, 2.0) / A);
double t_2 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 1.95e-222) {
tmp = sqrt((t_2 * ((2.0 * F) * (t_1 + (2.0 * C))))) / -t_2;
} else if (B_m <= 6.5e-194) {
tmp = sqrt((F * (fma(2.0, C, t_1) / fma(B_m, B_m, (-4.0 * (A * C)))))) * -sqrt(2.0);
} else if (B_m <= 5.5e-85) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - pow(B_m, 2.0));
} else {
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-1.0 / (B_m * pow(2.0, -0.5)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(-0.5 * Float64((B_m ^ 2.0) / A)) t_2 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 1.95e-222) tmp = Float64(sqrt(Float64(t_2 * Float64(Float64(2.0 * F) * Float64(t_1 + Float64(2.0 * C))))) / Float64(-t_2)); elseif (B_m <= 6.5e-194) tmp = Float64(sqrt(Float64(F * Float64(fma(2.0, C, t_1) / fma(B_m, B_m, Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(2.0))); elseif (B_m <= 5.5e-85) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B_m, C))) * sqrt(F)) * Float64(-1.0 / Float64(B_m * (2.0 ^ -0.5)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 1.95e-222], N[(N[Sqrt[N[(t$95$2 * N[(N[(2.0 * F), $MachinePrecision] * N[(t$95$1 + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$2)), $MachinePrecision], If[LessEqual[B$95$m, 6.5e-194], N[(N[Sqrt[N[(F * N[(N[(2.0 * C + t$95$1), $MachinePrecision] / N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[B$95$m, 5.5e-85], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(B$95$m * N[Power[2.0, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := -0.5 \cdot \frac{{B\_m}^{2}}{A}\\
t_2 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 1.95 \cdot 10^{-222}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(\left(2 \cdot F\right) \cdot \left(t\_1 + 2 \cdot C\right)\right)}}{-t\_2}\\
\mathbf{elif}\;B\_m \leq 6.5 \cdot 10^{-194}:\\
\;\;\;\;\sqrt{F \cdot \frac{\mathsf{fma}\left(2, C, t\_1\right)}{\mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;B\_m \leq 5.5 \cdot 10^{-85}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\
\end{array}
\end{array}
if B < 1.95e-222Initial program 17.4%
Simplified23.9%
*-un-lft-identity23.9%
Applied egg-rr24.5%
*-lft-identity24.5%
Simplified24.5%
Taylor expanded in A around -inf 15.4%
if 1.95e-222 < B < 6.50000000000000019e-194Initial program 17.6%
Taylor expanded in A around -inf 17.1%
Taylor expanded in F around 0 16.9%
mul-1-neg16.9%
distribute-rgt-neg-in16.9%
associate-/l*16.9%
+-commutative16.9%
fma-undefine16.9%
unpow216.9%
fma-neg16.9%
distribute-lft-neg-in16.9%
metadata-eval16.9%
*-commutative16.9%
Simplified16.9%
if 6.50000000000000019e-194 < B < 5.4999999999999997e-85Initial program 15.8%
Taylor expanded in A around -inf 23.5%
if 5.4999999999999997e-85 < B Initial program 23.6%
Taylor expanded in A around 0 22.3%
mul-1-neg22.3%
unpow222.3%
unpow222.3%
hypot-define49.1%
Simplified49.1%
pow1/249.1%
*-commutative49.1%
unpow-prod-down66.5%
pow1/266.5%
pow1/266.5%
Applied egg-rr66.5%
clear-num66.5%
inv-pow66.5%
Applied egg-rr66.5%
unpow-166.5%
Simplified66.5%
div-inv66.5%
pow1/266.5%
pow-flip66.7%
metadata-eval66.7%
Applied egg-rr66.7%
Final simplification31.6%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C))
(t_1 (- t_0 (pow B_m 2.0)))
(t_2 (+ C (hypot B_m C)))
(t_3 (* 2.0 (* (- (pow B_m 2.0) t_0) F))))
(if (<= B_m 4.9e-85)
(/ (sqrt (* t_3 (* 2.0 C))) t_1)
(if (<= B_m 1.75e-7)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(fma -4.0 (* A C) (pow B_m 2.0)))))
(- (sqrt 2.0)))
(if (<= B_m 6.6e+36)
(/ (sqrt (* t_3 (+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C)))) t_1)
(if (<= B_m 1.6e+84)
(/
(* (* B_m (sqrt 2.0)) (sqrt (* F t_2)))
(- (fma B_m B_m (* A (* C -4.0)))))
(* (* (sqrt t_2) (sqrt F)) (/ -1.0 (* B_m (pow 2.0 -0.5))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = t_0 - pow(B_m, 2.0);
double t_2 = C + hypot(B_m, C);
double t_3 = 2.0 * ((pow(B_m, 2.0) - t_0) * F);
double tmp;
if (B_m <= 4.9e-85) {
tmp = sqrt((t_3 * (2.0 * C))) / t_1;
} else if (B_m <= 1.75e-7) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -sqrt(2.0);
} else if (B_m <= 6.6e+36) {
tmp = sqrt((t_3 * ((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C)))) / t_1;
} else if (B_m <= 1.6e+84) {
tmp = ((B_m * sqrt(2.0)) * sqrt((F * t_2))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = (sqrt(t_2) * sqrt(F)) * (-1.0 / (B_m * pow(2.0, -0.5)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(t_0 - (B_m ^ 2.0)) t_2 = Float64(C + hypot(B_m, C)) t_3 = Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) tmp = 0.0 if (B_m <= 4.9e-85) tmp = Float64(sqrt(Float64(t_3 * Float64(2.0 * C))) / t_1); elseif (B_m <= 1.75e-7) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-sqrt(2.0))); elseif (B_m <= 6.6e+36) tmp = Float64(sqrt(Float64(t_3 * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C)))) / t_1); elseif (B_m <= 1.6e+84) tmp = Float64(Float64(Float64(B_m * sqrt(2.0)) * sqrt(Float64(F * t_2))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); else tmp = Float64(Float64(sqrt(t_2) * sqrt(F)) * Float64(-1.0 / Float64(B_m * (2.0 ^ -0.5)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 4.9e-85], N[(N[Sqrt[N[(t$95$3 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 1.75e-7], N[(N[Sqrt[N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[B$95$m, 6.6e+36], N[(N[Sqrt[N[(t$95$3 * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 1.6e+84], N[(N[(N[(B$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(F * t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[(N[Sqrt[t$95$2], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(B$95$m * N[Power[2.0, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := t\_0 - {B\_m}^{2}\\
t_2 := C + \mathsf{hypot}\left(B\_m, C\right)\\
t_3 := 2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\\
\mathbf{if}\;B\_m \leq 4.9 \cdot 10^{-85}:\\
\;\;\;\;\frac{\sqrt{t\_3 \cdot \left(2 \cdot C\right)}}{t\_1}\\
\mathbf{elif}\;B\_m \leq 1.75 \cdot 10^{-7}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;B\_m \leq 6.6 \cdot 10^{+36}:\\
\;\;\;\;\frac{\sqrt{t\_3 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{A} + 2 \cdot C\right)}}{t\_1}\\
\mathbf{elif}\;B\_m \leq 1.6 \cdot 10^{+84}:\\
\;\;\;\;\frac{\left(B\_m \cdot \sqrt{2}\right) \cdot \sqrt{F \cdot t\_2}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{t\_2} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\
\end{array}
\end{array}
if B < 4.90000000000000015e-85Initial program 17.2%
Taylor expanded in A around -inf 14.8%
if 4.90000000000000015e-85 < B < 1.74999999999999992e-7Initial program 55.5%
Taylor expanded in F around 0 56.6%
mul-1-neg56.6%
Simplified64.1%
if 1.74999999999999992e-7 < B < 6.5999999999999997e36Initial program 33.9%
Taylor expanded in A around -inf 33.9%
if 6.5999999999999997e36 < B < 1.60000000000000005e84Initial program 50.9%
Simplified66.7%
*-un-lft-identity66.7%
Applied egg-rr67.1%
*-lft-identity67.1%
Simplified67.1%
Taylor expanded in A around 0 67.4%
unpow267.4%
unpow267.4%
hypot-undefine83.2%
Simplified83.2%
if 1.60000000000000005e84 < B Initial program 8.5%
Taylor expanded in A around 0 10.6%
mul-1-neg10.6%
unpow210.6%
unpow210.6%
hypot-define50.7%
Simplified50.7%
pow1/250.7%
*-commutative50.7%
unpow-prod-down76.1%
pow1/276.1%
pow1/276.1%
Applied egg-rr76.1%
clear-num76.2%
inv-pow76.2%
Applied egg-rr76.2%
unpow-176.2%
Simplified76.2%
div-inv76.1%
pow1/276.1%
pow-flip76.4%
metadata-eval76.4%
Applied egg-rr76.4%
Final simplification31.7%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 2e-234)
(/
(sqrt (* (* 2.0 (* -4.0 (* A (* C F)))) (+ (+ A C) (* C (- 1.0 (/ A C))))))
(- (* (* 4.0 A) C) (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 5e+151)
(/ (sqrt (* 2.0 (* F (+ C (hypot B_m C))))) (- B_m))
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 2e-234) {
tmp = sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 5e+151) {
tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (Math.pow(B_m, 2.0) <= 2e-234) {
tmp = Math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - Math.pow(B_m, 2.0));
} else if (Math.pow(B_m, 2.0) <= 5e+151) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(B_m, C))))) / -B_m;
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt(F) * -Math.sqrt((B_m + C)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if math.pow(B_m, 2.0) <= 2e-234: tmp = math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - math.pow(B_m, 2.0)) elif math.pow(B_m, 2.0) <= 5e+151: tmp = math.sqrt((2.0 * (F * (C + math.hypot(B_m, C))))) / -B_m else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt(F) * -math.sqrt((B_m + C))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-234) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F)))) * Float64(Float64(A + C) + Float64(C * Float64(1.0 - Float64(A / C)))))) / Float64(Float64(Float64(4.0 * A) * C) - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 5e+151) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(B_m, C))))) / Float64(-B_m)); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if ((B_m ^ 2.0) <= 2e-234)
tmp = sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - (B_m ^ 2.0));
elseif ((B_m ^ 2.0) <= 5e+151)
tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
else
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-234], N[(N[Sqrt[N[(N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[(C * N[(1.0 - N[(A / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+151], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-234}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right) \cdot \left(\left(A + C\right) + C \cdot \left(1 - \frac{A}{C}\right)\right)}}{\left(4 \cdot A\right) \cdot C - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-234Initial program 20.4%
Taylor expanded in C around inf 14.8%
associate-*r/14.8%
mul-1-neg14.8%
Simplified14.8%
Taylor expanded in B around 0 13.8%
if 1.9999999999999999e-234 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000002e151Initial program 33.5%
Taylor expanded in A around 0 18.9%
mul-1-neg18.9%
unpow218.9%
unpow218.9%
hypot-define20.6%
Simplified20.6%
associate-*l/20.6%
pow1/220.6%
pow1/220.6%
pow-prod-down20.6%
Applied egg-rr20.6%
unpow1/220.6%
Simplified20.6%
if 5.0000000000000002e151 < (pow.f64 B #s(literal 2 binary64)) Initial program 8.1%
Taylor expanded in A around 0 7.9%
mul-1-neg7.9%
unpow27.9%
unpow27.9%
hypot-define28.5%
Simplified28.5%
pow1/228.5%
*-commutative28.5%
unpow-prod-down41.2%
pow1/241.2%
pow1/241.2%
Applied egg-rr41.2%
Taylor expanded in C around 0 36.6%
Final simplification24.4%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 2e-234)
(/
(sqrt (* (* 2.0 (* -4.0 (* A (* C F)))) (+ (+ A C) (* C (- 1.0 (/ A C))))))
(- (* (* 4.0 A) C) (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 5e+151)
(/ (sqrt (* 2.0 (* F (+ C (hypot B_m C))))) (- B_m))
(* (- (sqrt 2.0)) (/ (sqrt F) (sqrt B_m))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 2e-234) {
tmp = sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 5e+151) {
tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
} else {
tmp = -sqrt(2.0) * (sqrt(F) / sqrt(B_m));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (Math.pow(B_m, 2.0) <= 2e-234) {
tmp = Math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - Math.pow(B_m, 2.0));
} else if (Math.pow(B_m, 2.0) <= 5e+151) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(B_m, C))))) / -B_m;
} else {
tmp = -Math.sqrt(2.0) * (Math.sqrt(F) / Math.sqrt(B_m));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if math.pow(B_m, 2.0) <= 2e-234: tmp = math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - math.pow(B_m, 2.0)) elif math.pow(B_m, 2.0) <= 5e+151: tmp = math.sqrt((2.0 * (F * (C + math.hypot(B_m, C))))) / -B_m else: tmp = -math.sqrt(2.0) * (math.sqrt(F) / math.sqrt(B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-234) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F)))) * Float64(Float64(A + C) + Float64(C * Float64(1.0 - Float64(A / C)))))) / Float64(Float64(Float64(4.0 * A) * C) - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 5e+151) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(B_m, C))))) / Float64(-B_m)); else tmp = Float64(Float64(-sqrt(2.0)) * Float64(sqrt(F) / sqrt(B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if ((B_m ^ 2.0) <= 2e-234)
tmp = sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - (B_m ^ 2.0));
elseif ((B_m ^ 2.0) <= 5e+151)
tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
else
tmp = -sqrt(2.0) * (sqrt(F) / sqrt(B_m));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-234], N[(N[Sqrt[N[(N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[(C * N[(1.0 - N[(A / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+151], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[((-N[Sqrt[2.0], $MachinePrecision]) * N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-234}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right) \cdot \left(\left(A + C\right) + C \cdot \left(1 - \frac{A}{C}\right)\right)}}{\left(4 \cdot A\right) \cdot C - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\left(-\sqrt{2}\right) \cdot \frac{\sqrt{F}}{\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-234Initial program 20.4%
Taylor expanded in C around inf 14.8%
associate-*r/14.8%
mul-1-neg14.8%
Simplified14.8%
Taylor expanded in B around 0 13.8%
if 1.9999999999999999e-234 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000002e151Initial program 33.5%
Taylor expanded in A around 0 18.9%
mul-1-neg18.9%
unpow218.9%
unpow218.9%
hypot-define20.6%
Simplified20.6%
associate-*l/20.6%
pow1/220.6%
pow1/220.6%
pow-prod-down20.6%
Applied egg-rr20.6%
unpow1/220.6%
Simplified20.6%
if 5.0000000000000002e151 < (pow.f64 B #s(literal 2 binary64)) Initial program 8.1%
Taylor expanded in B around inf 25.5%
mul-1-neg25.5%
Simplified25.5%
sqrt-div36.4%
Applied egg-rr36.4%
Final simplification24.4%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C)))
(if (<= B_m 9e-85)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 C)))
(- t_0 (pow B_m 2.0)))
(*
(* (sqrt (+ C (hypot B_m C))) (sqrt F))
(/ -1.0 (* B_m (pow 2.0 -0.5)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (B_m <= 9e-85) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - pow(B_m, 2.0));
} else {
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-1.0 / (B_m * pow(2.0, -0.5)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (B_m <= 9e-85) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - Math.pow(B_m, 2.0));
} else {
tmp = (Math.sqrt((C + Math.hypot(B_m, C))) * Math.sqrt(F)) * (-1.0 / (B_m * Math.pow(2.0, -0.5)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = (4.0 * A) * C tmp = 0 if B_m <= 9e-85: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - math.pow(B_m, 2.0)) else: tmp = (math.sqrt((C + math.hypot(B_m, C))) * math.sqrt(F)) * (-1.0 / (B_m * math.pow(2.0, -0.5))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if (B_m <= 9e-85) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B_m, C))) * sqrt(F)) * Float64(-1.0 / Float64(B_m * (2.0 ^ -0.5)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = (4.0 * A) * C;
tmp = 0.0;
if (B_m <= 9e-85)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - (B_m ^ 2.0));
else
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-1.0 / (B_m * (2.0 ^ -0.5)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[B$95$m, 9e-85], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(B$95$m * N[Power[2.0, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;B\_m \leq 9 \cdot 10^{-85}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\
\end{array}
\end{array}
if B < 9.00000000000000008e-85Initial program 17.2%
Taylor expanded in A around -inf 14.8%
if 9.00000000000000008e-85 < B Initial program 23.6%
Taylor expanded in A around 0 22.3%
mul-1-neg22.3%
unpow222.3%
unpow222.3%
hypot-define49.1%
Simplified49.1%
pow1/249.1%
*-commutative49.1%
unpow-prod-down66.5%
pow1/266.5%
pow1/266.5%
Applied egg-rr66.5%
clear-num66.5%
inv-pow66.5%
Applied egg-rr66.5%
unpow-166.5%
Simplified66.5%
div-inv66.5%
pow1/266.5%
pow-flip66.7%
metadata-eval66.7%
Applied egg-rr66.7%
Final simplification30.4%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C)))
(if (<= B_m 9e-85)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 C)))
(- t_0 (pow B_m 2.0)))
(* (* (sqrt (+ C (hypot B_m C))) (sqrt F)) (/ -1.0 (/ B_m (sqrt 2.0)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (B_m <= 9e-85) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - pow(B_m, 2.0));
} else {
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-1.0 / (B_m / sqrt(2.0)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (B_m <= 9e-85) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - Math.pow(B_m, 2.0));
} else {
tmp = (Math.sqrt((C + Math.hypot(B_m, C))) * Math.sqrt(F)) * (-1.0 / (B_m / Math.sqrt(2.0)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = (4.0 * A) * C tmp = 0 if B_m <= 9e-85: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - math.pow(B_m, 2.0)) else: tmp = (math.sqrt((C + math.hypot(B_m, C))) * math.sqrt(F)) * (-1.0 / (B_m / math.sqrt(2.0))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if (B_m <= 9e-85) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B_m, C))) * sqrt(F)) * Float64(-1.0 / Float64(B_m / sqrt(2.0)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = (4.0 * A) * C;
tmp = 0.0;
if (B_m <= 9e-85)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - (B_m ^ 2.0));
else
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-1.0 / (B_m / sqrt(2.0)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[B$95$m, 9e-85], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(B$95$m / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;B\_m \leq 9 \cdot 10^{-85}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{\frac{B\_m}{\sqrt{2}}}\\
\end{array}
\end{array}
if B < 9.00000000000000008e-85Initial program 17.2%
Taylor expanded in A around -inf 14.8%
if 9.00000000000000008e-85 < B Initial program 23.6%
Taylor expanded in A around 0 22.3%
mul-1-neg22.3%
unpow222.3%
unpow222.3%
hypot-define49.1%
Simplified49.1%
pow1/249.1%
*-commutative49.1%
unpow-prod-down66.5%
pow1/266.5%
pow1/266.5%
Applied egg-rr66.5%
clear-num66.5%
inv-pow66.5%
Applied egg-rr66.5%
unpow-166.5%
Simplified66.5%
Final simplification30.3%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C)))
(if (<= B_m 9e-85)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 C)))
(- t_0 (pow B_m 2.0)))
(* (* (sqrt (+ C (hypot B_m C))) (sqrt F)) (/ (sqrt 2.0) (- B_m))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (B_m <= 9e-85) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - pow(B_m, 2.0));
} else {
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (B_m <= 9e-85) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - Math.pow(B_m, 2.0));
} else {
tmp = (Math.sqrt((C + Math.hypot(B_m, C))) * Math.sqrt(F)) * (Math.sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = (4.0 * A) * C tmp = 0 if B_m <= 9e-85: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - math.pow(B_m, 2.0)) else: tmp = (math.sqrt((C + math.hypot(B_m, C))) * math.sqrt(F)) * (math.sqrt(2.0) / -B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if (B_m <= 9e-85) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(B_m, C))) * sqrt(F)) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = (4.0 * A) * C;
tmp = 0.0;
if (B_m <= 9e-85)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - (B_m ^ 2.0));
else
tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (sqrt(2.0) / -B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[B$95$m, 9e-85], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;B\_m \leq 9 \cdot 10^{-85}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 9.00000000000000008e-85Initial program 17.2%
Taylor expanded in A around -inf 14.8%
if 9.00000000000000008e-85 < B Initial program 23.6%
Taylor expanded in A around 0 22.3%
mul-1-neg22.3%
unpow222.3%
unpow222.3%
hypot-define49.1%
Simplified49.1%
pow1/249.1%
*-commutative49.1%
unpow-prod-down66.5%
pow1/266.5%
pow1/266.5%
Applied egg-rr66.5%
Final simplification30.3%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C))
(t_1
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 C)))
(- t_0 (pow B_m 2.0))))
(t_2 (/ (sqrt (* 2.0 (* F (+ C (hypot B_m C))))) (- B_m))))
(if (<= B_m 9e-85)
t_1
(if (<= B_m 6.6)
t_2
(if (<= B_m 8.5e+34)
t_1
(if (<= B_m 1.9e+76)
t_2
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C)))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - pow(B_m, 2.0));
double t_2 = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
double tmp;
if (B_m <= 9e-85) {
tmp = t_1;
} else if (B_m <= 6.6) {
tmp = t_2;
} else if (B_m <= 8.5e+34) {
tmp = t_1;
} else if (B_m <= 1.9e+76) {
tmp = t_2;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - Math.pow(B_m, 2.0));
double t_2 = Math.sqrt((2.0 * (F * (C + Math.hypot(B_m, C))))) / -B_m;
double tmp;
if (B_m <= 9e-85) {
tmp = t_1;
} else if (B_m <= 6.6) {
tmp = t_2;
} else if (B_m <= 8.5e+34) {
tmp = t_1;
} else if (B_m <= 1.9e+76) {
tmp = t_2;
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt(F) * -Math.sqrt((B_m + C)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = (4.0 * A) * C t_1 = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - math.pow(B_m, 2.0)) t_2 = math.sqrt((2.0 * (F * (C + math.hypot(B_m, C))))) / -B_m tmp = 0 if B_m <= 9e-85: tmp = t_1 elif B_m <= 6.6: tmp = t_2 elif B_m <= 8.5e+34: tmp = t_1 elif B_m <= 1.9e+76: tmp = t_2 else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt(F) * -math.sqrt((B_m + C))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))) t_2 = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(B_m, C))))) / Float64(-B_m)) tmp = 0.0 if (B_m <= 9e-85) tmp = t_1; elseif (B_m <= 6.6) tmp = t_2; elseif (B_m <= 8.5e+34) tmp = t_1; elseif (B_m <= 1.9e+76) tmp = t_2; else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = (4.0 * A) * C;
t_1 = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - (B_m ^ 2.0));
t_2 = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
tmp = 0.0;
if (B_m <= 9e-85)
tmp = t_1;
elseif (B_m <= 6.6)
tmp = t_2;
elseif (B_m <= 8.5e+34)
tmp = t_1;
elseif (B_m <= 1.9e+76)
tmp = t_2;
else
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]}, If[LessEqual[B$95$m, 9e-85], t$95$1, If[LessEqual[B$95$m, 6.6], t$95$2, If[LessEqual[B$95$m, 8.5e+34], t$95$1, If[LessEqual[B$95$m, 1.9e+76], t$95$2, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0 - {B\_m}^{2}}\\
t_2 := \frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\mathbf{if}\;B\_m \leq 9 \cdot 10^{-85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;B\_m \leq 6.6:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;B\_m \leq 8.5 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;B\_m \leq 1.9 \cdot 10^{+76}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if B < 9.00000000000000008e-85 or 6.5999999999999996 < B < 8.5000000000000003e34Initial program 17.9%
Taylor expanded in A around -inf 15.0%
if 9.00000000000000008e-85 < B < 6.5999999999999996 or 8.5000000000000003e34 < B < 1.90000000000000012e76Initial program 49.9%
Taylor expanded in A around 0 45.0%
mul-1-neg45.0%
unpow245.0%
unpow245.0%
hypot-define49.5%
Simplified49.5%
associate-*l/49.5%
pow1/249.5%
pow1/249.5%
pow-prod-down49.6%
Applied egg-rr49.6%
unpow1/249.6%
Simplified49.6%
if 1.90000000000000012e76 < B Initial program 10.2%
Taylor expanded in A around 0 14.1%
mul-1-neg14.1%
unpow214.1%
unpow214.1%
hypot-define52.6%
Simplified52.6%
pow1/252.6%
*-commutative52.6%
unpow-prod-down77.1%
pow1/277.1%
pow1/277.1%
Applied egg-rr77.1%
Taylor expanded in C around 0 70.9%
Final simplification29.1%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= F -3.85e-286)
(/
(sqrt (* (* 2.0 (* -4.0 (* A (* C F)))) (+ (+ A C) (* C (- 1.0 (/ A C))))))
(- (* (* 4.0 A) C) (pow B_m 2.0)))
(if (<= F 3.15e-21)
(/ (sqrt (* 2.0 (* F (+ C (hypot B_m C))))) (- B_m))
(- (sqrt (* 2.0 (/ F B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -3.85e-286) {
tmp = sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - pow(B_m, 2.0));
} else if (F <= 3.15e-21) {
tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
} else {
tmp = -sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -3.85e-286) {
tmp = Math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - Math.pow(B_m, 2.0));
} else if (F <= 3.15e-21) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(B_m, C))))) / -B_m;
} else {
tmp = -Math.sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= -3.85e-286: tmp = math.sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - math.pow(B_m, 2.0)) elif F <= 3.15e-21: tmp = math.sqrt((2.0 * (F * (C + math.hypot(B_m, C))))) / -B_m else: tmp = -math.sqrt((2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= -3.85e-286) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F)))) * Float64(Float64(A + C) + Float64(C * Float64(1.0 - Float64(A / C)))))) / Float64(Float64(Float64(4.0 * A) * C) - (B_m ^ 2.0))); elseif (F <= 3.15e-21) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(B_m, C))))) / Float64(-B_m)); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= -3.85e-286)
tmp = sqrt(((2.0 * (-4.0 * (A * (C * F)))) * ((A + C) + (C * (1.0 - (A / C)))))) / (((4.0 * A) * C) - (B_m ^ 2.0));
elseif (F <= 3.15e-21)
tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
else
tmp = -sqrt((2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -3.85e-286], N[(N[Sqrt[N[(N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[(C * N[(1.0 - N[(A / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.15e-21], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.85 \cdot 10^{-286}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right) \cdot \left(\left(A + C\right) + C \cdot \left(1 - \frac{A}{C}\right)\right)}}{\left(4 \cdot A\right) \cdot C - {B\_m}^{2}}\\
\mathbf{elif}\;F \leq 3.15 \cdot 10^{-21}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if F < -3.8499999999999998e-286Initial program 31.4%
Taylor expanded in C around inf 22.6%
associate-*r/22.6%
mul-1-neg22.6%
Simplified22.6%
Taylor expanded in B around 0 19.7%
if -3.8499999999999998e-286 < F < 3.15e-21Initial program 15.8%
Taylor expanded in A around 0 12.0%
mul-1-neg12.0%
unpow212.0%
unpow212.0%
hypot-define27.3%
Simplified27.3%
associate-*l/27.3%
pow1/227.3%
pow1/227.3%
pow-prod-down27.4%
Applied egg-rr27.4%
unpow1/227.4%
Simplified27.4%
if 3.15e-21 < F Initial program 18.8%
Taylor expanded in B around inf 20.8%
mul-1-neg20.8%
Simplified20.8%
pow120.8%
sqrt-unprod20.9%
Applied egg-rr20.9%
unpow120.9%
Simplified20.9%
Final simplification23.6%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= F 4.6e-22) (/ (sqrt (* 2.0 (* F (+ C (hypot B_m C))))) (- B_m)) (- (sqrt (* 2.0 (/ F B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 4.6e-22) {
tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
} else {
tmp = -sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 4.6e-22) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(B_m, C))))) / -B_m;
} else {
tmp = -Math.sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 4.6e-22: tmp = math.sqrt((2.0 * (F * (C + math.hypot(B_m, C))))) / -B_m else: tmp = -math.sqrt((2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 4.6e-22) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(B_m, C))))) / Float64(-B_m)); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 4.6e-22)
tmp = sqrt((2.0 * (F * (C + hypot(B_m, C))))) / -B_m;
else
tmp = -sqrt((2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 4.6e-22], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 4.6 \cdot 10^{-22}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if F < 4.5999999999999996e-22Initial program 19.4%
Taylor expanded in A around 0 9.4%
mul-1-neg9.4%
unpow29.4%
unpow29.4%
hypot-define21.1%
Simplified21.1%
associate-*l/21.1%
pow1/221.1%
pow1/221.2%
pow-prod-down21.3%
Applied egg-rr21.3%
unpow1/221.2%
Simplified21.2%
if 4.5999999999999996e-22 < F Initial program 18.8%
Taylor expanded in B around inf 20.8%
mul-1-neg20.8%
Simplified20.8%
pow120.8%
sqrt-unprod20.9%
Applied egg-rr20.9%
unpow120.9%
Simplified20.9%
Final simplification21.1%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= F 1.7e-20) (* (sqrt (* F (+ B_m C))) (/ (sqrt 2.0) (- B_m))) (- (sqrt (* 2.0 (/ F B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.7e-20) {
tmp = sqrt((F * (B_m + C))) * (sqrt(2.0) / -B_m);
} else {
tmp = -sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 1.7d-20) then
tmp = sqrt((f * (b_m + c))) * (sqrt(2.0d0) / -b_m)
else
tmp = -sqrt((2.0d0 * (f / b_m)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.7e-20) {
tmp = Math.sqrt((F * (B_m + C))) * (Math.sqrt(2.0) / -B_m);
} else {
tmp = -Math.sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 1.7e-20: tmp = math.sqrt((F * (B_m + C))) * (math.sqrt(2.0) / -B_m) else: tmp = -math.sqrt((2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 1.7e-20) tmp = Float64(sqrt(Float64(F * Float64(B_m + C))) * Float64(sqrt(2.0) / Float64(-B_m))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 1.7e-20)
tmp = sqrt((F * (B_m + C))) * (sqrt(2.0) / -B_m);
else
tmp = -sqrt((2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 1.7e-20], N[(N[Sqrt[N[(F * N[(B$95$m + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.7 \cdot 10^{-20}:\\
\;\;\;\;\sqrt{F \cdot \left(B\_m + C\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if F < 1.6999999999999999e-20Initial program 19.4%
Taylor expanded in A around 0 9.4%
mul-1-neg9.4%
unpow29.4%
unpow29.4%
hypot-define21.1%
Simplified21.1%
Taylor expanded in C around 0 17.3%
distribute-rgt-out17.3%
Simplified17.3%
if 1.6999999999999999e-20 < F Initial program 18.8%
Taylor expanded in B around inf 20.8%
mul-1-neg20.8%
Simplified20.8%
pow120.8%
sqrt-unprod20.9%
Applied egg-rr20.9%
unpow120.9%
Simplified20.9%
Final simplification18.9%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= F 1.15e-24) (* (/ (sqrt 2.0) B_m) (- (sqrt (* B_m F)))) (- (sqrt (* 2.0 (/ F B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.15e-24) {
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
} else {
tmp = -sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 1.15d-24) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((b_m * f))
else
tmp = -sqrt((2.0d0 * (f / b_m)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.15e-24) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((B_m * F));
} else {
tmp = -Math.sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 1.15e-24: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((B_m * F)) else: tmp = -math.sqrt((2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 1.15e-24) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(B_m * F)))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 1.15e-24)
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
else
tmp = -sqrt((2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 1.15e-24], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.15 \cdot 10^{-24}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{B\_m \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if F < 1.1500000000000001e-24Initial program 19.4%
Taylor expanded in A around 0 9.4%
mul-1-neg9.4%
unpow29.4%
unpow29.4%
hypot-define21.1%
Simplified21.1%
Taylor expanded in C around 0 18.4%
if 1.1500000000000001e-24 < F Initial program 18.8%
Taylor expanded in B around inf 20.8%
mul-1-neg20.8%
Simplified20.8%
pow120.8%
sqrt-unprod20.9%
Applied egg-rr20.9%
unpow120.9%
Simplified20.9%
Final simplification19.5%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= C 2.2e+162) (- (pow (fabs (* 2.0 (/ F B_m))) 0.5)) (* (/ 2.0 B_m) (- (sqrt (* C F))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 2.2e+162) {
tmp = -pow(fabs((2.0 * (F / B_m))), 0.5);
} else {
tmp = (2.0 / B_m) * -sqrt((C * F));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 2.2d+162) then
tmp = -(abs((2.0d0 * (f / b_m))) ** 0.5d0)
else
tmp = (2.0d0 / b_m) * -sqrt((c * f))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 2.2e+162) {
tmp = -Math.pow(Math.abs((2.0 * (F / B_m))), 0.5);
} else {
tmp = (2.0 / B_m) * -Math.sqrt((C * F));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= 2.2e+162: tmp = -math.pow(math.fabs((2.0 * (F / B_m))), 0.5) else: tmp = (2.0 / B_m) * -math.sqrt((C * F)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= 2.2e+162) tmp = Float64(-(abs(Float64(2.0 * Float64(F / B_m))) ^ 0.5)); else tmp = Float64(Float64(2.0 / B_m) * Float64(-sqrt(Float64(C * F)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= 2.2e+162)
tmp = -(abs((2.0 * (F / B_m))) ^ 0.5);
else
tmp = (2.0 / B_m) * -sqrt((C * F));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 2.2e+162], (-N[Power[N[Abs[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.5], $MachinePrecision]), N[(N[(2.0 / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 2.2 \cdot 10^{+162}:\\
\;\;\;\;-{\left(\left|2 \cdot \frac{F}{B\_m}\right|\right)}^{0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{B\_m} \cdot \left(-\sqrt{C \cdot F}\right)\\
\end{array}
\end{array}
if C < 2.2000000000000002e162Initial program 20.7%
Taylor expanded in B around inf 16.1%
mul-1-neg16.1%
Simplified16.1%
sqrt-unprod16.2%
pow1/216.4%
Applied egg-rr16.4%
add-sqr-sqrt16.2%
unpow1/216.2%
unpow1/216.4%
pow-prod-down16.4%
pow216.4%
*-commutative16.4%
associate-*r/16.4%
Applied egg-rr16.4%
unpow1/216.4%
unpow216.4%
rem-sqrt-square29.7%
associate-*r/29.6%
Simplified29.6%
if 2.2000000000000002e162 < C Initial program 1.8%
Taylor expanded in A around 0 1.2%
mul-1-neg1.2%
unpow21.2%
unpow21.2%
hypot-define15.6%
Simplified15.6%
pow1/215.9%
*-commutative15.9%
unpow-prod-down15.7%
pow1/215.7%
pow1/215.7%
Applied egg-rr15.7%
Taylor expanded in B around 0 11.5%
unpow211.5%
rem-square-sqrt11.7%
Simplified11.7%
Final simplification28.1%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= C 3e+164) (- (sqrt (/ (* 2.0 F) B_m))) (* (/ 2.0 B_m) (- (sqrt (* C F))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 3e+164) {
tmp = -sqrt(((2.0 * F) / B_m));
} else {
tmp = (2.0 / B_m) * -sqrt((C * F));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 3d+164) then
tmp = -sqrt(((2.0d0 * f) / b_m))
else
tmp = (2.0d0 / b_m) * -sqrt((c * f))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 3e+164) {
tmp = -Math.sqrt(((2.0 * F) / B_m));
} else {
tmp = (2.0 / B_m) * -Math.sqrt((C * F));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= 3e+164: tmp = -math.sqrt(((2.0 * F) / B_m)) else: tmp = (2.0 / B_m) * -math.sqrt((C * F)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= 3e+164) tmp = Float64(-sqrt(Float64(Float64(2.0 * F) / B_m))); else tmp = Float64(Float64(2.0 / B_m) * Float64(-sqrt(Float64(C * F)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= 3e+164)
tmp = -sqrt(((2.0 * F) / B_m));
else
tmp = (2.0 / B_m) * -sqrt((C * F));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 3e+164], (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision]), N[(N[(2.0 / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 3 \cdot 10^{+164}:\\
\;\;\;\;-\sqrt{\frac{2 \cdot F}{B\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{B\_m} \cdot \left(-\sqrt{C \cdot F}\right)\\
\end{array}
\end{array}
if C < 3.00000000000000001e164Initial program 20.7%
Taylor expanded in B around inf 16.1%
mul-1-neg16.1%
Simplified16.1%
sqrt-unprod16.2%
pow1/216.4%
Applied egg-rr16.4%
*-un-lft-identity16.4%
unpow1/216.2%
*-commutative16.2%
associate-*r/16.2%
Applied egg-rr16.2%
*-lft-identity16.2%
Simplified16.2%
if 3.00000000000000001e164 < C Initial program 1.8%
Taylor expanded in A around 0 1.2%
mul-1-neg1.2%
unpow21.2%
unpow21.2%
hypot-define15.6%
Simplified15.6%
pow1/215.9%
*-commutative15.9%
unpow-prod-down15.7%
pow1/215.7%
pow1/215.7%
Applied egg-rr15.7%
Taylor expanded in B around 0 11.5%
unpow211.5%
rem-square-sqrt11.7%
Simplified11.7%
Final simplification15.8%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (sqrt (* 2.0 (/ F B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((2.0 * (F / B_m)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((2.0d0 * (f / b_m)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((2.0 * (F / B_m)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((2.0 * (F / B_m)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((2.0 * (F / B_m)));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{2 \cdot \frac{F}{B\_m}}
\end{array}
Initial program 19.1%
Taylor expanded in B around inf 15.0%
mul-1-neg15.0%
Simplified15.0%
pow115.0%
sqrt-unprod15.0%
Applied egg-rr15.0%
unpow115.0%
Simplified15.0%
Final simplification15.0%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (sqrt (/ (* 2.0 F) B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt(((2.0 * F) / B_m));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt(((2.0d0 * f) / b_m))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt(((2.0 * F) / B_m));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt(((2.0 * F) / B_m))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(Float64(2.0 * F) / B_m))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt(((2.0 * F) / B_m));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{\frac{2 \cdot F}{B\_m}}
\end{array}
Initial program 19.1%
Taylor expanded in B around inf 15.0%
mul-1-neg15.0%
Simplified15.0%
sqrt-unprod15.0%
pow1/215.2%
Applied egg-rr15.2%
*-un-lft-identity15.2%
unpow1/215.0%
*-commutative15.0%
associate-*r/15.0%
Applied egg-rr15.0%
*-lft-identity15.0%
Simplified15.0%
Final simplification15.0%
herbie shell --seed 2024071
(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))))