
(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 12 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 C (* A -4.0) (pow B_m 2.0)))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2 (* (sqrt 2.0) (- (sqrt (* F (/ -0.5 C))))))
(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))
t_2
(if (<= t_4 -1e-174)
(/ (sqrt (* (* F t_1) (* 2.0 (+ A (- C (hypot B_m (- A C))))))) (- t_1))
(if (<= t_4 0.0)
t_2
(if (<= t_4 INFINITY)
(/
(* (sqrt (* (- (+ A C) (hypot (- A C) B_m)) (* 2.0 t_0))) (sqrt F))
(- t_0))
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A))))))))))))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(C, (A * -4.0), pow(B_m, 2.0));
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
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 = t_2;
} else if (t_4 <= -1e-174) {
tmp = sqrt(((F * t_1) * (2.0 * (A + (C - hypot(B_m, (A - C))))))) / -t_1;
} else if (t_4 <= 0.0) {
tmp = t_2;
} else if (t_4 <= ((double) INFINITY)) {
tmp = (sqrt((((A + C) - hypot((A - C), B_m)) * (2.0 * t_0))) * sqrt(F)) / -t_0;
} else {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
}
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(C, Float64(A * -4.0), (B_m ^ 2.0)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(-0.5 / C))))) 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 = t_2; elseif (t_4 <= -1e-174) tmp = Float64(sqrt(Float64(Float64(F * t_1) * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C))))))) / Float64(-t_1)); elseif (t_4 <= 0.0) tmp = t_2; elseif (t_4 <= Inf) tmp = Float64(Float64(sqrt(Float64(Float64(Float64(A + C) - hypot(Float64(A - C), B_m)) * Float64(2.0 * t_0))) * sqrt(F)) / Float64(-t_0)); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A)))))); 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[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 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[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, 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)], t$95$2, If[LessEqual[t$95$4, -1e-174], N[(N[Sqrt[N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[t$95$4, 0.0], t$95$2, If[LessEqual[t$95$4, Infinity], N[(N[(N[Sqrt[N[(N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $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(C, A \cdot -4, {B\_m}^{2}\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := \sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{-0.5}{C}}\right)\\
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:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq -1 \cdot 10^{-174}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_1\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{-t\_1}\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\left(\left(A + C\right) - \mathsf{hypot}\left(A - C, B\_m\right)\right) \cdot \left(2 \cdot t\_0\right)} \cdot \sqrt{F}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\
\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.0 or -1e-174 < (/.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))) < 0.0Initial program 3.2%
Taylor expanded in F around 0 20.6%
mul-1-neg20.6%
*-commutative20.6%
associate-/l*25.3%
associate--l+26.9%
unpow226.9%
unpow226.9%
hypot-undefine34.1%
cancel-sign-sub-inv34.1%
Simplified34.1%
Taylor expanded in A around -inf 31.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))) < -1e-174Initial program 99.6%
Simplified99.6%
if 0.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))) < +inf.0Initial program 31.5%
Simplified40.5%
pow1/240.5%
*-commutative40.5%
unpow-prod-down62.8%
Applied egg-rr62.8%
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 C around 0 2.6%
mul-1-neg2.6%
+-commutative2.6%
unpow22.6%
unpow22.6%
hypot-define14.1%
Simplified14.1%
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 (- t_0))
(t_2 (* F 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 2.0) (- (sqrt (* F (/ -0.5 C)))))
(if (<= t_4 -1e-174)
(/ (sqrt (* t_2 (* 2.0 (+ A (- C (hypot B_m (- A C))))))) t_1)
(if (<= t_4 INFINITY)
(/
(sqrt (* t_2 (* 2.0 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))))
t_1)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A)))))))))))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 = -t_0;
double t_2 = F * 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(2.0) * -sqrt((F * (-0.5 / C)));
} else if (t_4 <= -1e-174) {
tmp = sqrt((t_2 * (2.0 * (A + (C - hypot(B_m, (A - C))))))) / t_1;
} else if (t_4 <= ((double) INFINITY)) {
tmp = sqrt((t_2 * (2.0 * (A + (A + (-0.5 * (pow(B_m, 2.0) / C))))))) / t_1;
} else {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
}
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(-t_0) t_2 = Float64(F * 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(2.0) * Float64(-sqrt(Float64(F * Float64(-0.5 / C))))); elseif (t_4 <= -1e-174) tmp = Float64(sqrt(Float64(t_2 * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C))))))) / t_1); elseif (t_4 <= Inf) tmp = Float64(sqrt(Float64(t_2 * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))))) / t_1); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A)))))); 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 = (-t$95$0)}, Block[{t$95$2 = N[(F * t$95$0), $MachinePrecision]}, 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[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$4, -1e-174], N[(N[Sqrt[N[(t$95$2 * N[(2.0 * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(N[Sqrt[N[(t$95$2 * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $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 := -t\_0\\
t_2 := F \cdot 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{2} \cdot \left(-\sqrt{F \cdot \frac{-0.5}{C}}\right)\\
\mathbf{elif}\;t\_4 \leq -1 \cdot 10^{-174}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_1}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\right)\right)}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\
\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.0%
Taylor expanded in F around 0 24.8%
mul-1-neg24.8%
*-commutative24.8%
associate-/l*29.1%
associate--l+29.1%
unpow229.1%
unpow229.1%
hypot-undefine42.4%
cancel-sign-sub-inv42.4%
Simplified42.4%
Taylor expanded in A around -inf 27.0%
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))) < -1e-174Initial program 99.6%
Simplified99.6%
if -1e-174 < (/.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 13.6%
Simplified23.7%
Taylor expanded in C around inf 27.6%
mul-1-neg27.6%
Simplified27.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))) Initial program 0.0%
Taylor expanded in C around 0 2.6%
mul-1-neg2.6%
+-commutative2.6%
unpow22.6%
unpow22.6%
hypot-define14.1%
Simplified14.1%
Final simplification32.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
(let* ((t_0 (* (* 4.0 A) C))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2 (* F t_1)))
(if (<= (pow B_m 2.0) 5e-278)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 2e-203)
(* (sqrt 2.0) (- (sqrt (* F (/ -0.5 C)))))
(if (<= (pow B_m 2.0) 1.8e-40)
(/ (sqrt (* t_2 (* 2.0 (+ A (- C (hypot B_m (- A C))))))) (- t_1))
(if (<= (pow B_m 2.0) 1e+37)
(* (sqrt (* F (* -0.5 (/ (pow B_m 2.0) C)))) (/ (sqrt 2.0) (- B_m)))
(if (<= (pow B_m 2.0) 1e+135)
(*
(sqrt (* t_2 (* 2.0 (- (+ A C) (hypot (- A C) B_m)))))
(/ -1.0 t_1))
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A)))))))))))))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 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = F * t_1;
double tmp;
if (pow(B_m, 2.0) <= 5e-278) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 2e-203) {
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
} else if (pow(B_m, 2.0) <= 1.8e-40) {
tmp = sqrt((t_2 * (2.0 * (A + (C - hypot(B_m, (A - C))))))) / -t_1;
} else if (pow(B_m, 2.0) <= 1e+37) {
tmp = sqrt((F * (-0.5 * (pow(B_m, 2.0) / C)))) * (sqrt(2.0) / -B_m);
} else if (pow(B_m, 2.0) <= 1e+135) {
tmp = sqrt((t_2 * (2.0 * ((A + C) - hypot((A - C), B_m))))) * (-1.0 / t_1);
} else {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
}
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 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(F * t_1) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-278) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 2e-203) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(-0.5 / C))))); elseif ((B_m ^ 2.0) <= 1.8e-40) tmp = Float64(sqrt(Float64(t_2 * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C))))))) / Float64(-t_1)); elseif ((B_m ^ 2.0) <= 1e+37) tmp = Float64(sqrt(Float64(F * Float64(-0.5 * Float64((B_m ^ 2.0) / C)))) * Float64(sqrt(2.0) / Float64(-B_m))); elseif ((B_m ^ 2.0) <= 1e+135) tmp = Float64(sqrt(Float64(t_2 * Float64(2.0 * Float64(Float64(A + C) - hypot(Float64(A - C), B_m))))) * Float64(-1.0 / t_1)); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A)))))); 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[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(F * t$95$1), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-278], 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 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-203], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1.8e-40], N[(N[Sqrt[N[(t$95$2 * N[(2.0 * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+37], N[(N[Sqrt[N[(F * N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+135], N[(N[Sqrt[N[(t$95$2 * N[(2.0 * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $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 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := F \cdot t\_1\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-278}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-203}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{-0.5}{C}}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 1.8 \cdot 10^{-40}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{-t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+37}:\\
\;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{C}\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+135}:\\
\;\;\;\;\sqrt{t\_2 \cdot \left(2 \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(A - C, B\_m\right)\right)\right)} \cdot \frac{-1}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.99999999999999985e-278Initial program 17.6%
Taylor expanded in A around -inf 14.6%
if 4.99999999999999985e-278 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e-203Initial program 9.1%
Taylor expanded in F around 0 8.7%
mul-1-neg8.7%
*-commutative8.7%
associate-/l*15.1%
associate--l+16.3%
unpow216.3%
unpow216.3%
hypot-undefine29.7%
cancel-sign-sub-inv29.7%
Simplified29.7%
Taylor expanded in A around -inf 21.6%
if 2.0000000000000001e-203 < (pow.f64 B #s(literal 2 binary64)) < 1.8e-40Initial program 45.6%
Simplified50.7%
if 1.8e-40 < (pow.f64 B #s(literal 2 binary64)) < 9.99999999999999954e36Initial program 17.5%
Taylor expanded in A around 0 10.3%
mul-1-neg10.3%
unpow210.3%
unpow210.3%
hypot-define11.1%
Simplified11.1%
Taylor expanded in C around inf 39.2%
if 9.99999999999999954e36 < (pow.f64 B #s(literal 2 binary64)) < 9.99999999999999962e134Initial program 57.8%
Simplified71.5%
div-inv71.4%
*-commutative71.4%
associate-+r-71.5%
hypot-undefine57.8%
unpow257.8%
unpow257.8%
+-commutative57.8%
unpow257.8%
unpow257.8%
hypot-define71.5%
Applied egg-rr71.5%
if 9.99999999999999962e134 < (pow.f64 B #s(literal 2 binary64)) Initial program 7.4%
Taylor expanded in C around 0 7.6%
mul-1-neg7.6%
+-commutative7.6%
unpow27.6%
unpow27.6%
hypot-define20.5%
Simplified20.5%
Final simplification26.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
(let* ((t_0 (* (* 4.0 A) C))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2
(/
(sqrt (* (* F t_1) (* 2.0 (+ A (- C (hypot B_m (- A C)))))))
(- t_1))))
(if (<= (pow B_m 2.0) 5e-278)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 2e-203)
(* (sqrt 2.0) (- (sqrt (* F (/ -0.5 C)))))
(if (<= (pow B_m 2.0) 1.8e-40)
t_2
(if (<= (pow B_m 2.0) 1e+37)
(* (sqrt (* F (* -0.5 (/ (pow B_m 2.0) C)))) (/ (sqrt 2.0) (- B_m)))
(if (<= (pow B_m 2.0) 1e+135)
t_2
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A)))))))))))))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 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = sqrt(((F * t_1) * (2.0 * (A + (C - hypot(B_m, (A - C))))))) / -t_1;
double tmp;
if (pow(B_m, 2.0) <= 5e-278) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 2e-203) {
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
} else if (pow(B_m, 2.0) <= 1.8e-40) {
tmp = t_2;
} else if (pow(B_m, 2.0) <= 1e+37) {
tmp = sqrt((F * (-0.5 * (pow(B_m, 2.0) / C)))) * (sqrt(2.0) / -B_m);
} else if (pow(B_m, 2.0) <= 1e+135) {
tmp = t_2;
} else {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
}
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 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(sqrt(Float64(Float64(F * t_1) * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C))))))) / Float64(-t_1)) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-278) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 2e-203) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(-0.5 / C))))); elseif ((B_m ^ 2.0) <= 1.8e-40) tmp = t_2; elseif ((B_m ^ 2.0) <= 1e+37) tmp = Float64(sqrt(Float64(F * Float64(-0.5 * Float64((B_m ^ 2.0) / C)))) * Float64(sqrt(2.0) / Float64(-B_m))); elseif ((B_m ^ 2.0) <= 1e+135) tmp = t_2; else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A)))))); 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[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-278], 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 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-203], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1.8e-40], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+37], N[(N[Sqrt[N[(F * N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+135], t$95$2, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $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 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := \frac{\sqrt{\left(F \cdot t\_1\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{-t\_1}\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-278}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-203}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{-0.5}{C}}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 1.8 \cdot 10^{-40}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+37}:\\
\;\;\;\;\sqrt{F \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{C}\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+135}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.99999999999999985e-278Initial program 17.6%
Taylor expanded in A around -inf 14.6%
if 4.99999999999999985e-278 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e-203Initial program 9.1%
Taylor expanded in F around 0 8.7%
mul-1-neg8.7%
*-commutative8.7%
associate-/l*15.1%
associate--l+16.3%
unpow216.3%
unpow216.3%
hypot-undefine29.7%
cancel-sign-sub-inv29.7%
Simplified29.7%
Taylor expanded in A around -inf 21.6%
if 2.0000000000000001e-203 < (pow.f64 B #s(literal 2 binary64)) < 1.8e-40 or 9.99999999999999954e36 < (pow.f64 B #s(literal 2 binary64)) < 9.99999999999999962e134Initial program 51.1%
Simplified60.2%
if 1.8e-40 < (pow.f64 B #s(literal 2 binary64)) < 9.99999999999999954e36Initial program 17.5%
Taylor expanded in A around 0 10.3%
mul-1-neg10.3%
unpow210.3%
unpow210.3%
hypot-define11.1%
Simplified11.1%
Taylor expanded in C around inf 39.2%
if 9.99999999999999962e134 < (pow.f64 B #s(literal 2 binary64)) Initial program 7.4%
Taylor expanded in C around 0 7.6%
mul-1-neg7.6%
+-commutative7.6%
unpow27.6%
unpow27.6%
hypot-define20.5%
Simplified20.5%
Final simplification26.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
(let* ((t_0 (* (* 4.0 A) C))
(t_1
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))))
(if (<= (pow B_m 2.0) 5e-278)
t_1
(if (<= (pow B_m 2.0) 1e-203)
(* (sqrt 2.0) (- (sqrt (* F (/ -0.5 C)))))
(if (<= (pow B_m 2.0) 2e+20)
t_1
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A)))))))))))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 * A))) / (t_0 - pow(B_m, 2.0));
double tmp;
if (pow(B_m, 2.0) <= 5e-278) {
tmp = t_1;
} else if (pow(B_m, 2.0) <= 1e-203) {
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
} else if (pow(B_m, 2.0) <= 2e+20) {
tmp = t_1;
} else {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
}
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 * A))) / (t_0 - Math.pow(B_m, 2.0));
double tmp;
if (Math.pow(B_m, 2.0) <= 5e-278) {
tmp = t_1;
} else if (Math.pow(B_m, 2.0) <= 1e-203) {
tmp = Math.sqrt(2.0) * -Math.sqrt((F * (-0.5 / C)));
} else if (Math.pow(B_m, 2.0) <= 2e+20) {
tmp = t_1;
} else {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (A - Math.hypot(B_m, A))));
}
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 * A))) / (t_0 - math.pow(B_m, 2.0)) tmp = 0 if math.pow(B_m, 2.0) <= 5e-278: tmp = t_1 elif math.pow(B_m, 2.0) <= 1e-203: tmp = math.sqrt(2.0) * -math.sqrt((F * (-0.5 / C))) elif math.pow(B_m, 2.0) <= 2e+20: tmp = t_1 else: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (A - math.hypot(B_m, A)))) 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 * A))) / Float64(t_0 - (B_m ^ 2.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-278) tmp = t_1; elseif ((B_m ^ 2.0) <= 1e-203) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(-0.5 / C))))); elseif ((B_m ^ 2.0) <= 2e+20) tmp = t_1; else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A)))))); 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 * A))) / (t_0 - (B_m ^ 2.0));
tmp = 0.0;
if ((B_m ^ 2.0) <= 5e-278)
tmp = t_1;
elseif ((B_m ^ 2.0) <= 1e-203)
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
elseif ((B_m ^ 2.0) <= 2e+20)
tmp = t_1;
else
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
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 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-278], t$95$1, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-203], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+20], t$95$1, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $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 A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-278}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{-203}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{-0.5}{C}}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.99999999999999985e-278 or 1e-203 < (pow.f64 B #s(literal 2 binary64)) < 2e20Initial program 24.2%
Taylor expanded in A around -inf 18.3%
if 4.99999999999999985e-278 < (pow.f64 B #s(literal 2 binary64)) < 1e-203Initial program 9.6%
Taylor expanded in F around 0 9.1%
mul-1-neg9.1%
*-commutative9.1%
associate-/l*16.0%
associate--l+16.0%
unpow216.0%
unpow216.0%
hypot-undefine30.4%
cancel-sign-sub-inv30.4%
Simplified30.4%
Taylor expanded in A around -inf 16.1%
if 2e20 < (pow.f64 B #s(literal 2 binary64)) Initial program 15.6%
Taylor expanded in C around 0 11.9%
mul-1-neg11.9%
+-commutative11.9%
unpow211.9%
unpow211.9%
hypot-define22.1%
Simplified22.1%
Final simplification20.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
(/
(sqrt (* -8.0 (* (* F (* A C)) (+ A A))))
(- (fma C (* A -4.0) (pow B_m 2.0))))))
(if (<= (pow B_m 2.0) 5e-278)
t_0
(if (<= (pow B_m 2.0) 1e-203)
(* (sqrt 2.0) (- (sqrt (* F (/ -0.5 C)))))
(if (<= (pow B_m 2.0) 1e-47)
t_0
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A)))))))))))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((-8.0 * ((F * (A * C)) * (A + A)))) / -fma(C, (A * -4.0), pow(B_m, 2.0));
double tmp;
if (pow(B_m, 2.0) <= 5e-278) {
tmp = t_0;
} else if (pow(B_m, 2.0) <= 1e-203) {
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
} else if (pow(B_m, 2.0) <= 1e-47) {
tmp = t_0;
} else {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
}
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(-8.0 * Float64(Float64(F * Float64(A * C)) * Float64(A + A)))) / Float64(-fma(C, Float64(A * -4.0), (B_m ^ 2.0)))) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-278) tmp = t_0; elseif ((B_m ^ 2.0) <= 1e-203) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(-0.5 / C))))); elseif ((B_m ^ 2.0) <= 1e-47) tmp = t_0; else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A)))))); 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[(-8.0 * N[(N[(F * N[(A * C), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-278], t$95$0, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-203], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-47], t$95$0, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $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{-8 \cdot \left(\left(F \cdot \left(A \cdot C\right)\right) \cdot \left(A + A\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-278}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{-203}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{-0.5}{C}}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{-47}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.99999999999999985e-278 or 1e-203 < (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999997e-48Initial program 23.3%
Simplified28.7%
Taylor expanded in C around inf 14.5%
associate-*r*15.4%
*-commutative15.4%
mul-1-neg15.4%
Simplified15.4%
distribute-frac-neg215.4%
associate-*r*16.3%
Applied egg-rr16.3%
if 4.99999999999999985e-278 < (pow.f64 B #s(literal 2 binary64)) < 1e-203Initial program 9.6%
Taylor expanded in F around 0 9.1%
mul-1-neg9.1%
*-commutative9.1%
associate-/l*16.0%
associate--l+16.0%
unpow216.0%
unpow216.0%
hypot-undefine30.4%
cancel-sign-sub-inv30.4%
Simplified30.4%
Taylor expanded in A around -inf 16.1%
if 9.9999999999999997e-48 < (pow.f64 B #s(literal 2 binary64)) Initial program 16.9%
Taylor expanded in C around 0 12.8%
mul-1-neg12.8%
+-commutative12.8%
unpow212.8%
unpow212.8%
hypot-define22.3%
Simplified22.3%
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 1.4e-91)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A))))))
(if (or (<= C 1.8e-18) (not (<= C 1.06e+49)))
(* (sqrt 2.0) (- (sqrt (* F (/ -0.5 C)))))
(/ (sqrt (* F (* 2.0 (- C (hypot B_m C))))) (- 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 (C <= 1.4e-91) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
} else if ((C <= 1.8e-18) || !(C <= 1.06e+49)) {
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
} else {
tmp = sqrt((F * (2.0 * (C - hypot(B_m, C))))) / -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 (C <= 1.4e-91) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (A - Math.hypot(B_m, A))));
} else if ((C <= 1.8e-18) || !(C <= 1.06e+49)) {
tmp = Math.sqrt(2.0) * -Math.sqrt((F * (-0.5 / C)));
} else {
tmp = Math.sqrt((F * (2.0 * (C - Math.hypot(B_m, C))))) / -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 C <= 1.4e-91: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (A - math.hypot(B_m, A)))) elif (C <= 1.8e-18) or not (C <= 1.06e+49): tmp = math.sqrt(2.0) * -math.sqrt((F * (-0.5 / C))) else: tmp = math.sqrt((F * (2.0 * (C - math.hypot(B_m, C))))) / -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 (C <= 1.4e-91) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A)))))); elseif ((C <= 1.8e-18) || !(C <= 1.06e+49)) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(-0.5 / C))))); else tmp = Float64(sqrt(Float64(F * Float64(2.0 * Float64(C - hypot(B_m, C))))) / 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)
tmp = 0.0;
if (C <= 1.4e-91)
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
elseif ((C <= 1.8e-18) || ~((C <= 1.06e+49)))
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
else
tmp = sqrt((F * (2.0 * (C - hypot(B_m, C))))) / -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[C, 1.4e-91], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[Or[LessEqual[C, 1.8e-18], N[Not[LessEqual[C, 1.06e+49]], $MachinePrecision]], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F * N[(2.0 * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $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 1.4 \cdot 10^{-91}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\
\mathbf{elif}\;C \leq 1.8 \cdot 10^{-18} \lor \neg \left(C \leq 1.06 \cdot 10^{+49}\right):\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{-0.5}{C}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(2 \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if C < 1.4e-91Initial program 25.2%
Taylor expanded in C around 0 11.0%
mul-1-neg11.0%
+-commutative11.0%
unpow211.0%
unpow211.0%
hypot-define15.6%
Simplified15.6%
if 1.4e-91 < C < 1.80000000000000005e-18 or 1.06e49 < C Initial program 3.1%
Taylor expanded in F around 0 4.8%
mul-1-neg4.8%
*-commutative4.8%
associate-/l*4.8%
associate--l+6.3%
unpow26.3%
unpow26.3%
hypot-undefine16.3%
cancel-sign-sub-inv16.3%
Simplified16.3%
Taylor expanded in A around -inf 45.8%
if 1.80000000000000005e-18 < C < 1.06e49Initial program 9.1%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
unpow221.9%
unpow221.9%
hypot-define41.9%
Simplified41.9%
associate-*l/41.8%
pow1/241.8%
pow1/241.8%
pow-prod-down42.0%
*-commutative42.0%
Applied egg-rr42.0%
unpow1/242.0%
associate-*r*42.0%
Simplified42.0%
Final simplification24.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
(*
(sqrt (* F (/ (+ (+ (/ A B_m) (/ C B_m)) -1.0) B_m)))
(- (sqrt 2.0))))
(t_1 (/ (sqrt (* F (* 2.0 (- C (hypot B_m C))))) (- B_m))))
(if (<= C 8e-135)
t_0
(if (<= C 4.3e-119)
t_1
(if (<= C 1.95e-75)
t_0
(if (or (<= C 1.6e-18) (not (<= C 1.06e+49)))
(* (sqrt 2.0) (- (sqrt (* F (/ -0.5 C)))))
t_1))))))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((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * -sqrt(2.0);
double t_1 = sqrt((F * (2.0 * (C - hypot(B_m, C))))) / -B_m;
double tmp;
if (C <= 8e-135) {
tmp = t_0;
} else if (C <= 4.3e-119) {
tmp = t_1;
} else if (C <= 1.95e-75) {
tmp = t_0;
} else if ((C <= 1.6e-18) || !(C <= 1.06e+49)) {
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
} else {
tmp = t_1;
}
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 = Math.sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * -Math.sqrt(2.0);
double t_1 = Math.sqrt((F * (2.0 * (C - Math.hypot(B_m, C))))) / -B_m;
double tmp;
if (C <= 8e-135) {
tmp = t_0;
} else if (C <= 4.3e-119) {
tmp = t_1;
} else if (C <= 1.95e-75) {
tmp = t_0;
} else if ((C <= 1.6e-18) || !(C <= 1.06e+49)) {
tmp = Math.sqrt(2.0) * -Math.sqrt((F * (-0.5 / C)));
} else {
tmp = t_1;
}
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 = math.sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * -math.sqrt(2.0) t_1 = math.sqrt((F * (2.0 * (C - math.hypot(B_m, C))))) / -B_m tmp = 0 if C <= 8e-135: tmp = t_0 elif C <= 4.3e-119: tmp = t_1 elif C <= 1.95e-75: tmp = t_0 elif (C <= 1.6e-18) or not (C <= 1.06e+49): tmp = math.sqrt(2.0) * -math.sqrt((F * (-0.5 / C))) else: tmp = t_1 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(F * Float64(Float64(Float64(Float64(A / B_m) + Float64(C / B_m)) + -1.0) / B_m))) * Float64(-sqrt(2.0))) t_1 = Float64(sqrt(Float64(F * Float64(2.0 * Float64(C - hypot(B_m, C))))) / Float64(-B_m)) tmp = 0.0 if (C <= 8e-135) tmp = t_0; elseif (C <= 4.3e-119) tmp = t_1; elseif (C <= 1.95e-75) tmp = t_0; elseif ((C <= 1.6e-18) || !(C <= 1.06e+49)) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(-0.5 / C))))); else tmp = t_1; 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 = sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * -sqrt(2.0);
t_1 = sqrt((F * (2.0 * (C - hypot(B_m, C))))) / -B_m;
tmp = 0.0;
if (C <= 8e-135)
tmp = t_0;
elseif (C <= 4.3e-119)
tmp = t_1;
elseif (C <= 1.95e-75)
tmp = t_0;
elseif ((C <= 1.6e-18) || ~((C <= 1.06e+49)))
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
else
tmp = t_1;
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[Sqrt[N[(F * N[(N[(N[(N[(A / B$95$m), $MachinePrecision] + N[(C / B$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(F * N[(2.0 * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]}, If[LessEqual[C, 8e-135], t$95$0, If[LessEqual[C, 4.3e-119], t$95$1, If[LessEqual[C, 1.95e-75], t$95$0, If[Or[LessEqual[C, 1.6e-18], N[Not[LessEqual[C, 1.06e+49]], $MachinePrecision]], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], t$95$1]]]]]]
\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 := \sqrt{F \cdot \frac{\left(\frac{A}{B\_m} + \frac{C}{B\_m}\right) + -1}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
t_1 := \frac{\sqrt{F \cdot \left(2 \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\mathbf{if}\;C \leq 8 \cdot 10^{-135}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;C \leq 4.3 \cdot 10^{-119}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;C \leq 1.95 \cdot 10^{-75}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;C \leq 1.6 \cdot 10^{-18} \lor \neg \left(C \leq 1.06 \cdot 10^{+49}\right):\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{-0.5}{C}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if C < 8.0000000000000003e-135 or 4.3e-119 < C < 1.9500000000000001e-75Initial program 24.3%
Taylor expanded in F around 0 22.3%
mul-1-neg22.3%
*-commutative22.3%
associate-/l*24.4%
associate--l+24.5%
unpow224.5%
unpow224.5%
hypot-undefine26.3%
cancel-sign-sub-inv26.3%
Simplified26.3%
Taylor expanded in B around inf 14.3%
if 8.0000000000000003e-135 < C < 4.3e-119 or 1.6e-18 < C < 1.06e49Initial program 17.9%
Taylor expanded in A around 0 27.9%
mul-1-neg27.9%
unpow227.9%
unpow227.9%
hypot-define44.1%
Simplified44.1%
associate-*l/44.2%
pow1/244.2%
pow1/244.2%
pow-prod-down44.4%
*-commutative44.4%
Applied egg-rr44.4%
unpow1/244.4%
associate-*r*44.4%
Simplified44.4%
if 1.9500000000000001e-75 < C < 1.6e-18 or 1.06e49 < C Initial program 3.2%
Taylor expanded in F around 0 4.9%
mul-1-neg4.9%
*-commutative4.9%
associate-/l*4.9%
associate--l+6.5%
unpow26.5%
unpow26.5%
hypot-undefine16.8%
cancel-sign-sub-inv16.8%
Simplified16.8%
Taylor expanded in A around -inf 45.6%
Final simplification23.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 (<= B_m 1.7e+19) (* (sqrt 2.0) (- (sqrt (* F (/ -0.5 C))))) (* (/ (sqrt 2.0) B_m) (- (sqrt (* 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 (B_m <= 1.7e+19) {
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
} else {
tmp = (sqrt(2.0) / B_m) * -sqrt((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 (b_m <= 1.7d+19) then
tmp = sqrt(2.0d0) * -sqrt((f * ((-0.5d0) / c)))
else
tmp = (sqrt(2.0d0) / b_m) * -sqrt((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 (B_m <= 1.7e+19) {
tmp = Math.sqrt(2.0) * -Math.sqrt((F * (-0.5 / C)));
} else {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((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 B_m <= 1.7e+19: tmp = math.sqrt(2.0) * -math.sqrt((F * (-0.5 / C))) else: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((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 (B_m <= 1.7e+19) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(-0.5 / C))))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * 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)
tmp = 0.0;
if (B_m <= 1.7e+19)
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
else
tmp = (sqrt(2.0) / B_m) * -sqrt((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[B$95$m, 1.7e+19], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[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}\;B\_m \leq 1.7 \cdot 10^{+19}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{-0.5}{C}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(-B\_m\right)}\right)\\
\end{array}
\end{array}
if B < 1.7e19Initial program 18.8%
Taylor expanded in F around 0 17.5%
mul-1-neg17.5%
*-commutative17.5%
associate-/l*19.4%
associate--l+20.1%
unpow220.1%
unpow220.1%
hypot-undefine23.9%
cancel-sign-sub-inv23.9%
Simplified23.9%
Taylor expanded in A around -inf 16.0%
if 1.7e19 < B Initial program 20.3%
Taylor expanded in A around 0 27.1%
mul-1-neg27.1%
unpow227.1%
unpow227.1%
hypot-define49.0%
Simplified49.0%
Taylor expanded in C around 0 46.1%
mul-1-neg46.1%
Simplified46.1%
Final simplification22.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 (<= B_m 5.5e+19) (* (sqrt 2.0) (- (sqrt (* F (/ -0.5 C))))) (* (sqrt 2.0) (- (sqrt (* F (/ -1.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 tmp;
if (B_m <= 5.5e+19) {
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
} else {
tmp = sqrt(2.0) * -sqrt((F * (-1.0 / 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 (b_m <= 5.5d+19) then
tmp = sqrt(2.0d0) * -sqrt((f * ((-0.5d0) / c)))
else
tmp = sqrt(2.0d0) * -sqrt((f * ((-1.0d0) / 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 (B_m <= 5.5e+19) {
tmp = Math.sqrt(2.0) * -Math.sqrt((F * (-0.5 / C)));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F * (-1.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): tmp = 0 if B_m <= 5.5e+19: tmp = math.sqrt(2.0) * -math.sqrt((F * (-0.5 / C))) else: tmp = math.sqrt(2.0) * -math.sqrt((F * (-1.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) tmp = 0.0 if (B_m <= 5.5e+19) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(-0.5 / C))))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(-1.0 / 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 <= 5.5e+19)
tmp = sqrt(2.0) * -sqrt((F * (-0.5 / C)));
else
tmp = sqrt(2.0) * -sqrt((F * (-1.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_] := If[LessEqual[B$95$m, 5.5e+19], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-1.0 / B$95$m), $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 \leq 5.5 \cdot 10^{+19}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{-0.5}{C}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{-1}{B\_m}}\right)\\
\end{array}
\end{array}
if B < 5.5e19Initial program 18.8%
Taylor expanded in F around 0 17.5%
mul-1-neg17.5%
*-commutative17.5%
associate-/l*19.4%
associate--l+20.1%
unpow220.1%
unpow220.1%
hypot-undefine23.9%
cancel-sign-sub-inv23.9%
Simplified23.9%
Taylor expanded in A around -inf 16.0%
if 5.5e19 < B Initial program 20.3%
Taylor expanded in F around 0 25.5%
mul-1-neg25.5%
*-commutative25.5%
associate-/l*25.5%
associate--l+25.5%
unpow225.5%
unpow225.5%
hypot-undefine30.4%
cancel-sign-sub-inv30.4%
Simplified30.4%
Taylor expanded in B around inf 38.9%
Final simplification20.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 (* (sqrt 2.0) (- (sqrt (* F (/ -1.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) {
return sqrt(2.0) * -sqrt((F * (-1.0 / 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) * -sqrt((f * ((-1.0d0) / 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) * -Math.sqrt((F * (-1.0 / 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) * -math.sqrt((F * (-1.0 / 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(2.0) * Float64(-sqrt(Float64(F * Float64(-1.0 / 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) * -sqrt((F * (-1.0 / 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[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(-1.0 / B$95$m), $MachinePrecision]), $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 \left(-\sqrt{F \cdot \frac{-1}{B\_m}}\right)
\end{array}
Initial program 19.1%
Taylor expanded in F around 0 19.2%
mul-1-neg19.2%
*-commutative19.2%
associate-/l*20.7%
associate--l+21.2%
unpow221.2%
unpow221.2%
hypot-undefine25.3%
cancel-sign-sub-inv25.3%
Simplified25.3%
Taylor expanded in B around inf 11.8%
Final simplification11.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 (/ F C)) (- (sqrt -1.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) {
return sqrt((F / C)) * -sqrt(-1.0);
}
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((f / c)) * -sqrt((-1.0d0))
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((F / C)) * -Math.sqrt(-1.0);
}
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((F / C)) * -math.sqrt(-1.0)
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(F / C)) * Float64(-sqrt(-1.0))) 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((F / C)) * -sqrt(-1.0);
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[(N[Sqrt[N[(F / C), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[-1.0], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{\frac{F}{C}} \cdot \left(-\sqrt{-1}\right)
\end{array}
Initial program 19.1%
Simplified19.9%
Taylor expanded in C around inf 9.5%
associate-*r*10.2%
*-commutative10.2%
mul-1-neg10.2%
Simplified10.2%
Taylor expanded in C around -inf 0.0%
mul-1-neg0.0%
Simplified0.0%
Final simplification0.0%
herbie shell --seed 2024067
(FPCore (A B C F)
:name "ABCF->ab-angle b"
: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))))