
(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 13 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 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_2
(/
(-
(sqrt
(*
(* 2.0 (* t_1 F))
(- (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))))))
t_1))
(t_3 (- (pow B_m 2.0) (* 4.0 (* A C)))))
(if (<= t_2 (- INFINITY))
(-
0.0
(*
(pow 1.0 0.3333333333333333)
(*
(pow
(exp
(*
0.16666666666666666
(+ (log (/ 1.0 C)) (log (* -0.25 (/ (* F (+ A A)) A))))))
3.0)
(sqrt 2.0))))
(if (<= t_2 -1e-187)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A (- C (hypot B_m (- A C)))))))) t_0)
(if (<= t_2 2e+162)
(/
(-
(sqrt
(*
(* 2.0 (* F t_3))
(+
A
(+
A
(*
-0.5
(/ (+ (pow A 2.0) (- (pow B_m 2.0) (pow (- A) 2.0))) C)))))))
t_3)
(*
(/ (sqrt 2.0) B_m)
(-
(exp (* (- (log (- (hypot B_m A) A)) (log (/ -1.0 F))) 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 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_2 = -sqrt(((2.0 * (t_1 * F)) * ((A + C) - sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_1;
double t_3 = pow(B_m, 2.0) - (4.0 * (A * C));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = 0.0 - (pow(1.0, 0.3333333333333333) * (pow(exp((0.16666666666666666 * (log((1.0 / C)) + log((-0.25 * ((F * (A + A)) / A)))))), 3.0) * sqrt(2.0)));
} else if (t_2 <= -1e-187) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + (C - hypot(B_m, (A - C))))))) / t_0;
} else if (t_2 <= 2e+162) {
tmp = -sqrt(((2.0 * (F * t_3)) * (A + (A + (-0.5 * ((pow(A, 2.0) + (pow(B_m, 2.0) - pow(-A, 2.0))) / C)))))) / t_3;
} else {
tmp = (sqrt(2.0) / B_m) * -exp(((log((hypot(B_m, A) - A)) - log((-1.0 / F))) * 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((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_2 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_1 * F)) * Float64(Float64(A + C) - sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_1) t_3 = Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(0.0 - Float64((1.0 ^ 0.3333333333333333) * Float64((exp(Float64(0.16666666666666666 * Float64(log(Float64(1.0 / C)) + log(Float64(-0.25 * Float64(Float64(F * Float64(A + A)) / A)))))) ^ 3.0) * sqrt(2.0)))); elseif (t_2 <= -1e-187) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C)))))))) / t_0); elseif (t_2 <= 2e+162) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_3)) * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64((A ^ 2.0) + Float64((B_m ^ 2.0) - (Float64(-A) ^ 2.0))) / C))))))) / t_3); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-exp(Float64(Float64(log(Float64(hypot(B_m, A) - A)) - log(Float64(-1.0 / F))) * 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[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$1 * 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]) / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(0.0 - N[(N[Power[1.0, 0.3333333333333333], $MachinePrecision] * N[(N[Power[N[Exp[N[(0.16666666666666666 * N[(N[Log[N[(1.0 / C), $MachinePrecision]], $MachinePrecision] + N[Log[N[(-0.25 * N[(N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e-187], N[((-N[Sqrt[N[(N[(F * t$95$0), $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$0), $MachinePrecision], If[LessEqual[t$95$2, 2e+162], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + N[(-0.5 * N[(N[(N[Power[A, 2.0], $MachinePrecision] + N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[Power[(-A), 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Exp[N[(N[(N[Log[N[(N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision] - A), $MachinePrecision]], $MachinePrecision] - N[Log[N[(-1.0 / F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $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 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_2 := \frac{-\sqrt{\left(2 \cdot \left(t\_1 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_1}\\
t_3 := {B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;0 - {1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(\frac{1}{C}\right) + \log \left(-0.25 \cdot \frac{F \cdot \left(A + A\right)}{A}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-187}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t\_0\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_0}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+162}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t\_3\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B\_m}^{2} - {\left(-A\right)}^{2}\right)}{C}\right)\right)}}{t\_3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-e^{\left(\log \left(\mathsf{hypot}\left(B\_m, A\right) - A\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right)\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -inf.0Initial program 3.2%
Simplified15.5%
add-cube-cbrt15.4%
pow315.4%
Applied egg-rr14.9%
Taylor expanded in C around inf 17.4%
if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -1e-187Initial program 97.9%
Simplified97.9%
if -1e-187 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < 1.9999999999999999e162Initial program 15.5%
Simplified18.5%
Taylor expanded in C around inf 31.7%
associate--l+31.7%
mul-1-neg31.7%
Simplified31.7%
if 1.9999999999999999e162 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 0.3%
Simplified1.5%
Taylor expanded in C around 0 2.0%
mul-1-neg2.0%
distribute-rgt-neg-in2.0%
*-commutative2.0%
unpow22.0%
unpow22.0%
hypot-def18.2%
Simplified18.2%
pow1/218.2%
pow-to-exp17.3%
Applied egg-rr17.3%
Taylor expanded in F around -inf 1.9%
mul-1-neg1.9%
unsub-neg1.9%
mul-1-neg1.9%
+-commutative1.9%
unpow21.9%
unpow21.9%
hypot-def26.4%
Simplified26.4%
Final simplification34.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 (* F (+ A A)))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2
(-
0.0
(*
(pow 1.0 0.3333333333333333)
(*
(pow
(exp
(*
0.16666666666666666
(+ (log (/ 1.0 C)) (log (* -0.25 (/ t_0 A))))))
3.0)
(sqrt 2.0))))))
(if (<= (pow B_m 2.0) 5e-68)
(/ (- (sqrt (* -8.0 (* (* A C) t_0)))) (fma A (* C -4.0) (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 2e-7)
t_2
(if (<= (pow B_m 2.0) 2e+84)
(/
(- (sqrt (* (* F t_1) (* 2.0 (+ A (- C (hypot B_m (- A C))))))))
t_1)
(if (<= (pow B_m 2.0) 1e+186)
t_2
(*
(/ (sqrt 2.0) B_m)
(-
(exp
(* (- (log (- (hypot B_m A) A)) (log (/ -1.0 F))) 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 = F * (A + A);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = 0.0 - (pow(1.0, 0.3333333333333333) * (pow(exp((0.16666666666666666 * (log((1.0 / C)) + log((-0.25 * (t_0 / A)))))), 3.0) * sqrt(2.0)));
double tmp;
if (pow(B_m, 2.0) <= 5e-68) {
tmp = -sqrt((-8.0 * ((A * C) * t_0))) / fma(A, (C * -4.0), pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 2e-7) {
tmp = t_2;
} else if (pow(B_m, 2.0) <= 2e+84) {
tmp = -sqrt(((F * t_1) * (2.0 * (A + (C - hypot(B_m, (A - C))))))) / t_1;
} else if (pow(B_m, 2.0) <= 1e+186) {
tmp = t_2;
} else {
tmp = (sqrt(2.0) / B_m) * -exp(((log((hypot(B_m, A) - A)) - log((-1.0 / F))) * 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(F * Float64(A + A)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(0.0 - Float64((1.0 ^ 0.3333333333333333) * Float64((exp(Float64(0.16666666666666666 * Float64(log(Float64(1.0 / C)) + log(Float64(-0.25 * Float64(t_0 / A)))))) ^ 3.0) * sqrt(2.0)))) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-68) tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(Float64(A * C) * t_0)))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 2e-7) tmp = t_2; elseif ((B_m ^ 2.0) <= 2e+84) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_1) * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C)))))))) / t_1); elseif ((B_m ^ 2.0) <= 1e+186) tmp = t_2; else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-exp(Float64(Float64(log(Float64(hypot(B_m, A) - A)) - log(Float64(-1.0 / F))) * 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[(F * N[(A + A), $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[(0.0 - N[(N[Power[1.0, 0.3333333333333333], $MachinePrecision] * N[(N[Power[N[Exp[N[(0.16666666666666666 * N[(N[Log[N[(1.0 / C), $MachinePrecision]], $MachinePrecision] + N[Log[N[(-0.25 * N[(t$95$0 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-68], N[((-N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-7], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+84], 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], 1e+186], t$95$2, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Exp[N[(N[(N[Log[N[(N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision] - A), $MachinePrecision]], $MachinePrecision] - N[Log[N[(-1.0 / F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $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 \left(A + A\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := 0 - {1}^{0.3333333333333333} \cdot \left({\left(e^{0.16666666666666666 \cdot \left(\log \left(\frac{1}{C}\right) + \log \left(-0.25 \cdot \frac{t\_0}{A}\right)\right)}\right)}^{3} \cdot \sqrt{2}\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-68}:\\
\;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot t\_0\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+84}:\\
\;\;\;\;\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}\;{B\_m}^{2} \leq 10^{+186}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-e^{\left(\log \left(\mathsf{hypot}\left(B\_m, A\right) - A\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999971e-68Initial program 15.3%
Simplified20.2%
Taylor expanded in C around inf 16.3%
associate-*r*17.1%
*-commutative17.1%
mul-1-neg17.1%
Simplified17.1%
if 4.99999999999999971e-68 < (pow.f64 B 2) < 1.9999999999999999e-7 or 2.00000000000000012e84 < (pow.f64 B 2) < 9.9999999999999998e185Initial program 23.2%
Simplified24.6%
add-cube-cbrt24.1%
pow324.1%
Applied egg-rr23.3%
Taylor expanded in C around inf 27.1%
if 1.9999999999999999e-7 < (pow.f64 B 2) < 2.00000000000000012e84Initial program 43.5%
Simplified50.7%
if 9.9999999999999998e185 < (pow.f64 B 2) Initial program 8.1%
Simplified1.0%
Taylor expanded in C around 0 9.8%
mul-1-neg9.8%
distribute-rgt-neg-in9.8%
*-commutative9.8%
unpow29.8%
unpow29.8%
hypot-def30.7%
Simplified30.7%
pow1/230.7%
pow-to-exp28.9%
Applied egg-rr28.9%
Taylor expanded in F around -inf 12.4%
mul-1-neg12.4%
unsub-neg12.4%
mul-1-neg12.4%
+-commutative12.4%
unpow212.4%
unpow212.4%
hypot-def44.2%
Simplified44.2%
Final simplification29.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 (fma B_m B_m (* A (* C -4.0)))) (t_1 (* F (+ A A))))
(if (<= (pow B_m 2.0) 5e-68)
(/ (- (sqrt (* -8.0 (* (* A C) t_1)))) (fma A (* C -4.0) (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 2e-7)
(*
(pow
(pow (exp 0.16666666666666666) (- (log (* -0.25 (/ t_1 A))) (log C)))
3.0)
(- (sqrt 2.0)))
(if (<= (pow B_m 2.0) 5e+168)
(/
(- (sqrt (* (* F t_0) (* 2.0 (+ A (- C (hypot B_m (- A C))))))))
t_0)
(*
(/ (sqrt 2.0) B_m)
(-
(exp (* (- (log (- (hypot B_m A) A)) (log (/ -1.0 F))) 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 = F * (A + A);
double tmp;
if (pow(B_m, 2.0) <= 5e-68) {
tmp = -sqrt((-8.0 * ((A * C) * t_1))) / fma(A, (C * -4.0), pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 2e-7) {
tmp = pow(pow(exp(0.16666666666666666), (log((-0.25 * (t_1 / A))) - log(C))), 3.0) * -sqrt(2.0);
} else if (pow(B_m, 2.0) <= 5e+168) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + (C - hypot(B_m, (A - C))))))) / t_0;
} else {
tmp = (sqrt(2.0) / B_m) * -exp(((log((hypot(B_m, A) - A)) - log((-1.0 / F))) * 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(F * Float64(A + A)) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-68) tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(Float64(A * C) * t_1)))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 2e-7) tmp = Float64(((exp(0.16666666666666666) ^ Float64(log(Float64(-0.25 * Float64(t_1 / A))) - log(C))) ^ 3.0) * Float64(-sqrt(2.0))); elseif ((B_m ^ 2.0) <= 5e+168) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-exp(Float64(Float64(log(Float64(hypot(B_m, A) - A)) - log(Float64(-1.0 / F))) * 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[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-68], N[((-N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-7], N[(N[Power[N[Power[N[Exp[0.16666666666666666], $MachinePrecision], N[(N[Log[N[(-0.25 * N[(t$95$1 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[Log[C], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+168], N[((-N[Sqrt[N[(N[(F * t$95$0), $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$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Exp[N[(N[(N[Log[N[(N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision] - A), $MachinePrecision]], $MachinePrecision] - N[Log[N[(-1.0 / F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $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 := F \cdot \left(A + A\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-68}:\\
\;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot t\_1\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;{\left({\left(e^{0.16666666666666666}\right)}^{\left(\log \left(-0.25 \cdot \frac{t\_1}{A}\right) - \log C\right)}\right)}^{3} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+168}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t\_0\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-e^{\left(\log \left(\mathsf{hypot}\left(B\_m, A\right) - A\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999971e-68Initial program 15.3%
Simplified20.2%
Taylor expanded in C around inf 16.3%
associate-*r*17.1%
*-commutative17.1%
mul-1-neg17.1%
Simplified17.1%
if 4.99999999999999971e-68 < (pow.f64 B 2) < 1.9999999999999999e-7Initial program 17.3%
Simplified18.9%
add-cube-cbrt18.6%
pow318.6%
Applied egg-rr17.1%
Taylor expanded in C around inf 30.8%
pow-base-130.8%
associate-*r*30.8%
metadata-eval30.8%
Simplified29.8%
if 1.9999999999999999e-7 < (pow.f64 B 2) < 4.99999999999999967e168Initial program 38.3%
Simplified43.3%
if 4.99999999999999967e168 < (pow.f64 B 2) Initial program 8.8%
Simplified2.2%
Taylor expanded in C around 0 9.3%
mul-1-neg9.3%
distribute-rgt-neg-in9.3%
*-commutative9.3%
unpow29.3%
unpow29.3%
hypot-def28.9%
Simplified28.9%
pow1/228.9%
pow-to-exp27.2%
Applied egg-rr27.2%
Taylor expanded in F around -inf 11.7%
mul-1-neg11.7%
unsub-neg11.7%
mul-1-neg11.7%
+-commutative11.7%
unpow211.7%
unpow211.7%
hypot-def41.5%
Simplified41.5%
Final simplification29.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 (<= (pow B_m 2.0) 5e+19)
(/
(- (sqrt (* -8.0 (* (* A C) (* F (+ A A))))))
(fma A (* C -4.0) (pow B_m 2.0)))
(*
(/ (sqrt 2.0) B_m)
(- (exp (* (- (log (- (hypot B_m A) A)) (log (/ -1.0 F))) 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 tmp;
if (pow(B_m, 2.0) <= 5e+19) {
tmp = -sqrt((-8.0 * ((A * C) * (F * (A + A))))) / fma(A, (C * -4.0), pow(B_m, 2.0));
} else {
tmp = (sqrt(2.0) / B_m) * -exp(((log((hypot(B_m, A) - A)) - log((-1.0 / F))) * 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) tmp = 0.0 if ((B_m ^ 2.0) <= 5e+19) tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A)))))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-exp(Float64(Float64(log(Float64(hypot(B_m, A) - A)) - log(Float64(-1.0 / F))) * 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_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+19], N[((-N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Exp[N[(N[(N[Log[N[(N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision] - A), $MachinePrecision]], $MachinePrecision] - N[Log[N[(-1.0 / F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $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 5 \cdot 10^{+19}:\\
\;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-e^{\left(\log \left(\mathsf{hypot}\left(B\_m, A\right) - A\right) - \log \left(\frac{-1}{F}\right)\right) \cdot 0.5}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5e19Initial program 15.8%
Simplified20.5%
Taylor expanded in C around inf 15.4%
associate-*r*16.1%
*-commutative16.1%
mul-1-neg16.1%
Simplified16.1%
if 5e19 < (pow.f64 B 2) Initial program 16.7%
Simplified12.1%
Taylor expanded in C around 0 9.4%
mul-1-neg9.4%
distribute-rgt-neg-in9.4%
*-commutative9.4%
unpow29.4%
unpow29.4%
hypot-def24.1%
Simplified24.1%
pow1/224.1%
pow-to-exp22.7%
Applied egg-rr22.7%
Taylor expanded in F around -inf 11.1%
mul-1-neg11.1%
unsub-neg11.1%
mul-1-neg11.1%
+-commutative11.1%
unpow211.1%
unpow211.1%
hypot-def33.4%
Simplified33.4%
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 2.0) B_m)))
(if (<= B_m 3.5e-32)
(/
(- (sqrt (* -8.0 (* (* A C) (* F (+ A A))))))
(fma A (* C -4.0) (pow B_m 2.0)))
(if (<= B_m 2.15e+197)
(* t_0 (- (sqrt (* F (- A (hypot A B_m))))))
(* t_0 (- (exp (* 0.5 (- (log (- F)) (log (/ 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 t_0 = sqrt(2.0) / B_m;
double tmp;
if (B_m <= 3.5e-32) {
tmp = -sqrt((-8.0 * ((A * C) * (F * (A + A))))) / fma(A, (C * -4.0), pow(B_m, 2.0));
} else if (B_m <= 2.15e+197) {
tmp = t_0 * -sqrt((F * (A - hypot(A, B_m))));
} else {
tmp = t_0 * -exp((0.5 * (log(-F) - log((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) t_0 = Float64(sqrt(2.0) / B_m) tmp = 0.0 if (B_m <= 3.5e-32) tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A)))))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0))); elseif (B_m <= 2.15e+197) tmp = Float64(t_0 * Float64(-sqrt(Float64(F * Float64(A - hypot(A, B_m)))))); else tmp = Float64(t_0 * Float64(-exp(Float64(0.5 * Float64(log(Float64(-F)) - log(Float64(1.0 / B_m))))))); 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[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, If[LessEqual[B$95$m, 3.5e-32], N[((-N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2.15e+197], N[(t$95$0 * (-N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(t$95$0 * (-N[Exp[N[(0.5 * N[(N[Log[(-F)], $MachinePrecision] - N[Log[N[(1.0 / B$95$m), $MachinePrecision]], $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{2}}{B\_m}\\
\mathbf{if}\;B\_m \leq 3.5 \cdot 10^{-32}:\\
\;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{elif}\;B\_m \leq 2.15 \cdot 10^{+197}:\\
\;\;\;\;t\_0 \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(-e^{0.5 \cdot \left(\log \left(-F\right) - \log \left(\frac{1}{B\_m}\right)\right)}\right)\\
\end{array}
\end{array}
if B < 3.4999999999999999e-32Initial program 17.5%
Simplified19.9%
Taylor expanded in C around inf 12.6%
associate-*r*13.2%
*-commutative13.2%
mul-1-neg13.2%
Simplified13.2%
if 3.4999999999999999e-32 < B < 2.14999999999999998e197Initial program 19.8%
Simplified13.1%
Taylor expanded in C around 0 26.0%
mul-1-neg26.0%
distribute-rgt-neg-in26.0%
*-commutative26.0%
unpow226.0%
unpow226.0%
hypot-def34.2%
Simplified34.2%
if 2.14999999999999998e197 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 2.4%
mul-1-neg2.4%
distribute-rgt-neg-in2.4%
*-commutative2.4%
unpow22.4%
unpow22.4%
hypot-def53.1%
Simplified53.1%
pow1/253.1%
pow-to-exp50.2%
Applied egg-rr50.2%
Taylor expanded in B around inf 83.2%
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
(if (<= B_m 2.15e-33)
(/
(- (sqrt (* -8.0 (* A (* C (* F (+ A A)))))))
(fma A (* C -4.0) (pow B_m 2.0)))
(/ (* (sqrt 2.0) (- (sqrt (* F (- A (hypot A B_m)))))) 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 <= 2.15e-33) {
tmp = -sqrt((-8.0 * (A * (C * (F * (A + A)))))) / fma(A, (C * -4.0), pow(B_m, 2.0));
} else {
tmp = (sqrt(2.0) * -sqrt((F * (A - hypot(A, B_m))))) / 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.15e-33) tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(A * Float64(C * Float64(F * Float64(A + A))))))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0))); else tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A - hypot(A, B_m)))))) / B_m); 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_] := If[LessEqual[B$95$m, 2.15e-33], N[((-N[Sqrt[N[(-8.0 * N[(A * N[(C * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 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}\;B\_m \leq 2.15 \cdot 10^{-33}:\\
\;\;\;\;\frac{-\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A + A\right)\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right)}{B\_m}\\
\end{array}
\end{array}
if B < 2.15000000000000015e-33Initial program 17.5%
Simplified19.9%
Taylor expanded in C around inf 12.6%
*-commutative12.6%
cancel-sign-sub-inv12.6%
metadata-eval12.6%
*-lft-identity12.6%
Simplified12.6%
if 2.15000000000000015e-33 < B Initial program 13.2%
Simplified8.7%
Taylor expanded in C around 0 18.1%
mul-1-neg18.1%
distribute-rgt-neg-in18.1%
*-commutative18.1%
unpow218.1%
unpow218.1%
hypot-def40.5%
Simplified40.5%
associate-*l/40.5%
Applied egg-rr40.5%
Final simplification20.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
(if (<= B_m 6e-33)
(/
(- (sqrt (* -8.0 (* (* A C) (* F (+ A A))))))
(fma A (* C -4.0) (pow B_m 2.0)))
(/ (* (sqrt 2.0) (- (sqrt (* F (- A (hypot A B_m)))))) 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 <= 6e-33) {
tmp = -sqrt((-8.0 * ((A * C) * (F * (A + A))))) / fma(A, (C * -4.0), pow(B_m, 2.0));
} else {
tmp = (sqrt(2.0) * -sqrt((F * (A - hypot(A, B_m))))) / 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 <= 6e-33) tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A)))))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0))); else tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A - hypot(A, B_m)))))) / B_m); 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_] := If[LessEqual[B$95$m, 6e-33], N[((-N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 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}\;B\_m \leq 6 \cdot 10^{-33}:\\
\;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right)}{B\_m}\\
\end{array}
\end{array}
if B < 6.0000000000000003e-33Initial program 17.5%
Simplified19.9%
Taylor expanded in C around inf 12.6%
associate-*r*13.2%
*-commutative13.2%
mul-1-neg13.2%
Simplified13.2%
if 6.0000000000000003e-33 < B Initial program 13.2%
Simplified8.7%
Taylor expanded in C around 0 18.1%
mul-1-neg18.1%
distribute-rgt-neg-in18.1%
*-commutative18.1%
unpow218.1%
unpow218.1%
hypot-def40.5%
Simplified40.5%
associate-*l/40.5%
Applied egg-rr40.5%
Final simplification21.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
(if (<= B_m 3.2e-85)
(/
(- (sqrt (* -16.0 (* (pow A 2.0) (* C F)))))
(- (pow B_m 2.0) (* 4.0 (* A C))))
(/ (* (sqrt 2.0) (- (sqrt (* F (- A (hypot A B_m)))))) 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 <= 3.2e-85) {
tmp = -sqrt((-16.0 * (pow(A, 2.0) * (C * F)))) / (pow(B_m, 2.0) - (4.0 * (A * C)));
} else {
tmp = (sqrt(2.0) * -sqrt((F * (A - hypot(A, B_m))))) / 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 (B_m <= 3.2e-85) {
tmp = -Math.sqrt((-16.0 * (Math.pow(A, 2.0) * (C * F)))) / (Math.pow(B_m, 2.0) - (4.0 * (A * C)));
} else {
tmp = (Math.sqrt(2.0) * -Math.sqrt((F * (A - Math.hypot(A, B_m))))) / 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 <= 3.2e-85: tmp = -math.sqrt((-16.0 * (math.pow(A, 2.0) * (C * F)))) / (math.pow(B_m, 2.0) - (4.0 * (A * C))) else: tmp = (math.sqrt(2.0) * -math.sqrt((F * (A - math.hypot(A, B_m))))) / 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 <= 3.2e-85) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64((A ^ 2.0) * Float64(C * F))))) / Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A - hypot(A, B_m)))))) / 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 <= 3.2e-85)
tmp = -sqrt((-16.0 * ((A ^ 2.0) * (C * F)))) / ((B_m ^ 2.0) - (4.0 * (A * C)));
else
tmp = (sqrt(2.0) * -sqrt((F * (A - hypot(A, B_m))))) / 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, 3.2e-85], N[((-N[Sqrt[N[(-16.0 * N[(N[Power[A, 2.0], $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 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}\;B\_m \leq 3.2 \cdot 10^{-85}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)}}{{B\_m}^{2} - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right)}{B\_m}\\
\end{array}
\end{array}
if B < 3.20000000000000027e-85Initial program 17.5%
Simplified18.4%
Taylor expanded in C around 0 13.5%
mul-1-neg13.5%
unpow213.5%
unpow213.5%
hypot-def15.1%
Simplified15.1%
Taylor expanded in A around -inf 6.2%
if 3.20000000000000027e-85 < B Initial program 13.8%
Simplified13.8%
Taylor expanded in C around 0 18.3%
mul-1-neg18.3%
distribute-rgt-neg-in18.3%
*-commutative18.3%
unpow218.3%
unpow218.3%
hypot-def38.4%
Simplified38.4%
associate-*l/38.5%
Applied egg-rr38.5%
Final simplification17.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 (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- C (hypot 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) {
return (sqrt(2.0) / B_m) * -sqrt((F * (C - hypot(B_m, C))));
}
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) / B_m) * -Math.sqrt((F * (C - Math.hypot(B_m, C))));
}
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) / B_m) * -math.sqrt((F * (C - math.hypot(B_m, C))))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C - hypot(B_m, C)))))) 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) / B_m) * -sqrt((F * (C - hypot(B_m, C))));
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[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 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])\\
\\
\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)}\right)
\end{array}
Initial program 16.2%
Simplified16.6%
Taylor expanded in A around 0 8.6%
mul-1-neg8.6%
*-commutative8.6%
distribute-rgt-neg-in8.6%
*-commutative8.6%
unpow28.6%
unpow28.6%
hypot-def16.1%
Simplified16.1%
Final simplification16.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 (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot A 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) / B_m) * -sqrt((F * (A - hypot(A, B_m))));
}
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) / B_m) * -Math.sqrt((F * (A - Math.hypot(A, 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) / B_m) * -math.sqrt((F * (A - math.hypot(A, 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(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(A, 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) / B_m) * -sqrt((F * (A - hypot(A, 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[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 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])\\
\\
\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right)
\end{array}
Initial program 16.2%
Simplified16.6%
Taylor expanded in C around 0 7.7%
mul-1-neg7.7%
distribute-rgt-neg-in7.7%
*-commutative7.7%
unpow27.7%
unpow27.7%
hypot-def15.1%
Simplified15.1%
Final simplification15.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 (/ (* (sqrt 2.0) (- (sqrt (* F (- A (hypot A B_m)))))) 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 * (A - hypot(A, B_m))))) / B_m;
}
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 * (A - Math.hypot(A, B_m))))) / 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 * (A - math.hypot(A, B_m))))) / 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(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A - hypot(A, B_m)))))) / 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 * (A - hypot(A, B_m))))) / 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[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 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])\\
\\
\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}\right)}{B\_m}
\end{array}
Initial program 16.2%
Simplified16.6%
Taylor expanded in C around 0 7.7%
mul-1-neg7.7%
distribute-rgt-neg-in7.7%
*-commutative7.7%
unpow27.7%
unpow27.7%
hypot-def15.1%
Simplified15.1%
associate-*l/15.1%
Applied egg-rr15.1%
Final simplification15.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 (* -2.0 (* (/ 1.0 B_m) (pow (* C F) 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) {
return -2.0 * ((1.0 / B_m) * pow((C * F), 0.5));
}
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 = (-2.0d0) * ((1.0d0 / b_m) * ((c * f) ** 0.5d0))
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 -2.0 * ((1.0 / B_m) * Math.pow((C * F), 0.5));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -2.0 * ((1.0 / B_m) * math.pow((C * F), 0.5))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-2.0 * Float64(Float64(1.0 / B_m) * (Float64(C * F) ^ 0.5))) 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 = -2.0 * ((1.0 / B_m) * ((C * F) ^ 0.5));
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[(-2.0 * N[(N[(1.0 / B$95$m), $MachinePrecision] * N[Power[N[(C * F), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-2 \cdot \left(\frac{1}{B\_m} \cdot {\left(C \cdot F\right)}^{0.5}\right)
\end{array}
Initial program 16.2%
Simplified16.6%
Taylor expanded in A around inf 14.6%
cancel-sign-sub-inv14.6%
metadata-eval14.6%
*-lft-identity14.6%
Simplified14.6%
Taylor expanded in A around 0 3.1%
pow1/23.2%
*-commutative3.2%
Applied egg-rr3.2%
Final simplification3.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 (* -2.0 (/ (sqrt (* C 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 -2.0 * (sqrt((C * 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 = (-2.0d0) * (sqrt((c * 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 -2.0 * (Math.sqrt((C * 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 -2.0 * (math.sqrt((C * 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(-2.0 * Float64(sqrt(Float64(C * 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 = -2.0 * (sqrt((C * 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[(-2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $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])\\
\\
-2 \cdot \frac{\sqrt{C \cdot F}}{B\_m}
\end{array}
Initial program 16.2%
Simplified16.6%
Taylor expanded in B around 0 11.5%
Taylor expanded in A around 0 3.1%
associate-*l/3.1%
*-commutative3.1%
*-lft-identity3.1%
Simplified3.1%
Final simplification3.1%
herbie shell --seed 2024027
(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))))