
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
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 (* C (* A -4.0))))
(t_1 (+ C (hypot B_m C)))
(t_2 (* C (* 4.0 A)))
(t_3 (- t_2 (pow B_m 2.0)))
(t_4 (- (pow B_m 2.0) t_2)))
(if (<= (pow B_m 2.0) 1e-321)
(/ (sqrt (* (* 2.0 t_4) (* 2.0 (* C F)))) t_3)
(if (<= (pow B_m 2.0) 4e-233)
(* (sqrt (* F (/ -0.5 A))) (- (sqrt 2.0)))
(if (<= (pow B_m 2.0) 1e-96)
(/ (sqrt (* (* 2.0 (* t_4 F)) t_1)) t_3)
(if (<= (pow B_m 2.0) 4e-18)
(/
(*
(sqrt (* 2.0 (* F (fma B_m B_m (* -4.0 (* A C))))))
(sqrt (+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C))))
(- (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 2e+98)
(*
(sqrt (* F (* 2.0 t_0)))
(/ (sqrt (+ (+ A C) (hypot (- A C) B_m))) (- t_0)))
(if (<= (pow B_m 2.0) 2e+265)
(/ (* (* (sqrt F) (sqrt t_1)) (* B_m (sqrt 2.0))) t_3)
(/ (sqrt (* 2.0 F)) (- (sqrt B_m)))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (C * (A * -4.0)));
double t_1 = C + hypot(B_m, C);
double t_2 = C * (4.0 * A);
double t_3 = t_2 - pow(B_m, 2.0);
double t_4 = pow(B_m, 2.0) - t_2;
double tmp;
if (pow(B_m, 2.0) <= 1e-321) {
tmp = sqrt(((2.0 * t_4) * (2.0 * (C * F)))) / t_3;
} else if (pow(B_m, 2.0) <= 4e-233) {
tmp = sqrt((F * (-0.5 / A))) * -sqrt(2.0);
} else if (pow(B_m, 2.0) <= 1e-96) {
tmp = sqrt(((2.0 * (t_4 * F)) * t_1)) / t_3;
} else if (pow(B_m, 2.0) <= 4e-18) {
tmp = (sqrt((2.0 * (F * fma(B_m, B_m, (-4.0 * (A * C)))))) * sqrt(((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C)))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else if (pow(B_m, 2.0) <= 2e+98) {
tmp = sqrt((F * (2.0 * t_0))) * (sqrt(((A + C) + hypot((A - C), B_m))) / -t_0);
} else if (pow(B_m, 2.0) <= 2e+265) {
tmp = ((sqrt(F) * sqrt(t_1)) * (B_m * sqrt(2.0))) / t_3;
} else {
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(C * Float64(A * -4.0))) t_1 = Float64(C + hypot(B_m, C)) t_2 = Float64(C * Float64(4.0 * A)) t_3 = Float64(t_2 - (B_m ^ 2.0)) t_4 = Float64((B_m ^ 2.0) - t_2) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-321) tmp = Float64(sqrt(Float64(Float64(2.0 * t_4) * Float64(2.0 * Float64(C * F)))) / t_3); elseif ((B_m ^ 2.0) <= 4e-233) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / A))) * Float64(-sqrt(2.0))); elseif ((B_m ^ 2.0) <= 1e-96) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(t_4 * F)) * t_1)) / t_3); elseif ((B_m ^ 2.0) <= 4e-18) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B_m, B_m, Float64(-4.0 * Float64(A * C)))))) * sqrt(Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C)))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif ((B_m ^ 2.0) <= 2e+98) tmp = Float64(sqrt(Float64(F * Float64(2.0 * t_0))) * Float64(sqrt(Float64(Float64(A + C) + hypot(Float64(A - C), B_m))) / Float64(-t_0))); elseif ((B_m ^ 2.0) <= 2e+265) tmp = Float64(Float64(Float64(sqrt(F) * sqrt(t_1)) * Float64(B_m * sqrt(2.0))) / t_3); else tmp = Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(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[(B$95$m * B$95$m + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(C * N[(4.0 * A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$2), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-321], N[(N[Sqrt[N[(N[(2.0 * t$95$4), $MachinePrecision] * N[(2.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-233], N[(N[Sqrt[N[(F * N[(-0.5 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-96], N[(N[Sqrt[N[(N[(2.0 * N[(t$95$4 * F), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-18], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+98], N[(N[Sqrt[N[(F * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+265], N[(N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision] * N[(B$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, C \cdot \left(A \cdot -4\right)\right)\\
t_1 := C + \mathsf{hypot}\left(B\_m, C\right)\\
t_2 := C \cdot \left(4 \cdot A\right)\\
t_3 := t\_2 - {B\_m}^{2}\\
t_4 := {B\_m}^{2} - t\_2\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-321}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot t\_4\right) \cdot \left(2 \cdot \left(C \cdot F\right)\right)}}{t\_3}\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{-233}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{A}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{-96}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(t\_4 \cdot F\right)\right) \cdot t\_1}}{t\_3}\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{-18}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \sqrt{-0.5 \cdot \frac{{B\_m}^{2}}{A} + 2 \cdot C}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+98}:\\
\;\;\;\;\sqrt{F \cdot \left(2 \cdot t\_0\right)} \cdot \frac{\sqrt{\left(A + C\right) + \mathsf{hypot}\left(A - C, B\_m\right)}}{-t\_0}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+265}:\\
\;\;\;\;\frac{\left(\sqrt{F} \cdot \sqrt{t\_1}\right) \cdot \left(B\_m \cdot \sqrt{2}\right)}{t\_3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.98013e-322Initial program 24.5%
Taylor expanded in A around -inf 30.4%
*-un-lft-identity30.4%
distribute-frac-neg30.4%
Applied egg-rr30.4%
*-lft-identity30.4%
distribute-neg-frac230.4%
associate-*l*30.5%
associate-*r/30.5%
Simplified30.5%
Taylor expanded in C around inf 30.5%
*-commutative30.5%
Simplified30.5%
if 9.98013e-322 < (pow.f64 B #s(literal 2 binary64)) < 3.99999999999999983e-233Initial program 8.9%
Taylor expanded in F around 0 9.6%
mul-1-neg9.6%
*-commutative9.6%
distribute-rgt-neg-in9.6%
associate-/l*9.6%
cancel-sign-sub-inv9.6%
metadata-eval9.6%
+-commutative9.6%
Simplified18.4%
Taylor expanded in A around -inf 18.4%
if 3.99999999999999983e-233 < (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999991e-97Initial program 52.9%
Taylor expanded in A around 0 44.5%
unpow244.5%
unpow244.5%
hypot-define49.5%
Simplified49.5%
if 9.9999999999999991e-97 < (pow.f64 B #s(literal 2 binary64)) < 4.0000000000000003e-18Initial program 22.2%
Simplified32.8%
associate-*r*32.8%
associate-+r+32.0%
hypot-undefine22.2%
unpow222.2%
unpow222.2%
+-commutative22.2%
sqrt-prod22.1%
*-commutative22.1%
associate-*r*22.1%
associate-+l+22.2%
Applied egg-rr43.0%
Taylor expanded in A around -inf 35.3%
if 4.0000000000000003e-18 < (pow.f64 B #s(literal 2 binary64)) < 2e98Initial program 31.5%
Simplified42.5%
associate-*r*42.5%
associate-+r+41.5%
hypot-undefine31.5%
unpow231.5%
unpow231.5%
+-commutative31.5%
sqrt-prod31.4%
*-commutative31.4%
associate-*r*31.4%
associate-+l+31.4%
Applied egg-rr65.3%
associate-/l*65.3%
associate-*l*65.3%
*-commutative65.3%
associate-*l*65.3%
*-commutative65.3%
*-commutative65.3%
associate-+r+65.1%
associate-*r*65.1%
*-commutative65.1%
associate-*l*65.1%
*-commutative65.1%
*-commutative65.1%
Applied egg-rr65.1%
if 2e98 < (pow.f64 B #s(literal 2 binary64)) < 2.00000000000000013e265Initial program 30.5%
Taylor expanded in A around 0 16.1%
*-commutative16.1%
unpow216.1%
unpow216.1%
hypot-define19.2%
Simplified19.2%
*-commutative19.2%
sqrt-prod30.1%
Applied egg-rr30.1%
if 2.00000000000000013e265 < (pow.f64 B #s(literal 2 binary64)) Initial program 1.7%
Taylor expanded in B around inf 26.4%
mul-1-neg26.4%
*-commutative26.4%
distribute-rgt-neg-in26.4%
Simplified26.4%
sqrt-div40.0%
Applied egg-rr40.0%
distribute-rgt-neg-out40.0%
sqrt-undiv26.4%
sqrt-prod26.6%
pow1/226.6%
neg-sub026.6%
pow1/226.6%
Applied egg-rr26.6%
neg-sub026.6%
associate-*r/26.6%
*-commutative26.6%
Simplified26.6%
sqrt-div40.1%
*-commutative40.1%
Applied egg-rr40.1%
*-commutative40.1%
Simplified40.1%
Final simplification36.4%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* C (* 4.0 A)))
(t_1
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_0) F))
(+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
(- t_0 (pow B_m 2.0)))))
(if (<= t_1 -2e-205)
(*
(*
(sqrt
(/ (+ (+ A C) (hypot B_m (- A C))) (fma -4.0 (* A C) (pow B_m 2.0))))
(sqrt F))
(- (sqrt 2.0)))
(if (<= t_1 INFINITY)
(/
(*
(sqrt (* 2.0 (* F (fma B_m B_m (* -4.0 (* A C))))))
(sqrt (+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C))))
(- (fma B_m B_m (* A (* C -4.0)))))
(/ (sqrt (* 2.0 F)) (- (sqrt B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = C * (4.0 * A);
double t_1 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_0 - pow(B_m, 2.0));
double tmp;
if (t_1 <= -2e-205) {
tmp = (sqrt((((A + C) + hypot(B_m, (A - C))) / fma(-4.0, (A * C), pow(B_m, 2.0)))) * sqrt(F)) * -sqrt(2.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (sqrt((2.0 * (F * fma(B_m, B_m, (-4.0 * (A * C)))))) * sqrt(((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C)))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(C * Float64(4.0 * A)) t_1 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_0 - (B_m ^ 2.0))) tmp = 0.0 if (t_1 <= -2e-205) tmp = Float64(Float64(sqrt(Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0)))) * sqrt(F)) * Float64(-sqrt(2.0))); elseif (t_1 <= Inf) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B_m, B_m, Float64(-4.0 * Float64(A * C)))))) * sqrt(Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C)))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); else tmp = Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(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[(C * N[(4.0 * A), $MachinePrecision]), $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[(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$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-205], N[(N[(N[Sqrt[N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := C \cdot \left(4 \cdot A\right)\\
t_1 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-205}:\\
\;\;\;\;\left(\sqrt{\frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \sqrt{F}\right) \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \sqrt{-0.5 \cdot \frac{{B\_m}^{2}}{A} + 2 \cdot C}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}\\
\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))) < -2e-205Initial program 43.5%
Taylor expanded in F around 0 44.3%
mul-1-neg44.3%
*-commutative44.3%
distribute-rgt-neg-in44.3%
associate-/l*52.9%
cancel-sign-sub-inv52.9%
metadata-eval52.9%
+-commutative52.9%
Simplified69.3%
pow1/269.3%
*-commutative69.3%
unpow-prod-down81.7%
pow1/281.7%
associate-+r+80.3%
pow1/280.3%
Applied egg-rr80.3%
if -2e-205 < (/.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 24.0%
Simplified31.2%
associate-*r*31.2%
associate-+r+29.6%
hypot-undefine24.0%
unpow224.0%
unpow224.0%
+-commutative24.0%
sqrt-prod25.4%
*-commutative25.4%
associate-*r*25.4%
associate-+l+26.1%
Applied egg-rr44.5%
Taylor expanded in A around -inf 42.9%
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 B around inf 15.7%
mul-1-neg15.7%
*-commutative15.7%
distribute-rgt-neg-in15.7%
Simplified15.7%
sqrt-div23.6%
Applied egg-rr23.6%
distribute-rgt-neg-out23.6%
sqrt-undiv15.7%
sqrt-prod15.8%
pow1/215.9%
neg-sub015.9%
pow1/215.8%
Applied egg-rr15.8%
neg-sub015.8%
associate-*r/15.8%
*-commutative15.8%
Simplified15.8%
sqrt-div23.7%
*-commutative23.7%
Applied egg-rr23.7%
*-commutative23.7%
Simplified23.7%
Final simplification47.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 (- (sqrt 2.0)))
(t_1 (* -4.0 (* A C)))
(t_2 (* C (* 4.0 A)))
(t_3
(/
(sqrt (* (* 2.0 (- (pow B_m 2.0) t_2)) (* 2.0 (* C F))))
(- t_2 (pow B_m 2.0)))))
(if (<= (pow B_m 2.0) 1e-321)
t_3
(if (<= (pow B_m 2.0) 1e-257)
(* (sqrt (* F (/ -0.5 A))) t_0)
(if (<= (pow B_m 2.0) 4e+18)
t_3
(if (<= (pow B_m 2.0) 2e+70)
(/
(* (sqrt (* 2.0 (* F (fma B_m B_m t_1)))) (sqrt (* 2.0 C)))
(- (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 2e+240)
(*
(sqrt
(* F (/ (+ A (+ C (hypot B_m (- A C)))) (+ (pow B_m 2.0) t_1))))
t_0)
(/ (sqrt (* 2.0 F)) (- (sqrt B_m))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double t_1 = -4.0 * (A * C);
double t_2 = C * (4.0 * A);
double t_3 = sqrt(((2.0 * (pow(B_m, 2.0) - t_2)) * (2.0 * (C * F)))) / (t_2 - pow(B_m, 2.0));
double tmp;
if (pow(B_m, 2.0) <= 1e-321) {
tmp = t_3;
} else if (pow(B_m, 2.0) <= 1e-257) {
tmp = sqrt((F * (-0.5 / A))) * t_0;
} else if (pow(B_m, 2.0) <= 4e+18) {
tmp = t_3;
} else if (pow(B_m, 2.0) <= 2e+70) {
tmp = (sqrt((2.0 * (F * fma(B_m, B_m, t_1)))) * sqrt((2.0 * C))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else if (pow(B_m, 2.0) <= 2e+240) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + t_1)))) * t_0;
} else {
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) t_1 = Float64(-4.0 * Float64(A * C)) t_2 = Float64(C * Float64(4.0 * A)) t_3 = Float64(sqrt(Float64(Float64(2.0 * Float64((B_m ^ 2.0) - t_2)) * Float64(2.0 * Float64(C * F)))) / Float64(t_2 - (B_m ^ 2.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-321) tmp = t_3; elseif ((B_m ^ 2.0) <= 1e-257) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / A))) * t_0); elseif ((B_m ^ 2.0) <= 4e+18) tmp = t_3; elseif ((B_m ^ 2.0) <= 2e+70) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B_m, B_m, t_1)))) * sqrt(Float64(2.0 * C))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif ((B_m ^ 2.0) <= 2e+240) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + t_1)))) * t_0); else tmp = Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(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[Sqrt[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(C * N[(4.0 * A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(N[(2.0 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$2 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-321], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-257], N[(N[Sqrt[N[(F * N[(-0.5 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+18], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+70], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B$95$m * B$95$m + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+240], N[(N[Sqrt[N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
t_1 := -4 \cdot \left(A \cdot C\right)\\
t_2 := C \cdot \left(4 \cdot A\right)\\
t_3 := \frac{\sqrt{\left(2 \cdot \left({B\_m}^{2} - t\_2\right)\right) \cdot \left(2 \cdot \left(C \cdot F\right)\right)}}{t\_2 - {B\_m}^{2}}\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-321}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{-257}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{A}} \cdot t\_0\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+18}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+70}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B\_m, B\_m, t\_1\right)\right)} \cdot \sqrt{2 \cdot C}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + t\_1}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.98013e-322 or 9.9999999999999998e-258 < (pow.f64 B #s(literal 2 binary64)) < 4e18Initial program 27.8%
Taylor expanded in A around -inf 28.5%
*-un-lft-identity28.5%
distribute-frac-neg28.5%
Applied egg-rr28.5%
*-lft-identity28.5%
distribute-neg-frac228.5%
associate-*l*29.4%
associate-*r/29.4%
Simplified29.4%
Taylor expanded in C around inf 27.5%
*-commutative27.5%
Simplified27.5%
if 9.98013e-322 < (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999998e-258Initial program 11.1%
Taylor expanded in F around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
associate-/l*5.8%
cancel-sign-sub-inv5.8%
metadata-eval5.8%
+-commutative5.8%
Simplified13.3%
Taylor expanded in A around -inf 20.6%
if 4e18 < (pow.f64 B #s(literal 2 binary64)) < 2.00000000000000015e70Initial program 24.6%
Simplified35.2%
associate-*r*35.2%
associate-+r+35.2%
hypot-undefine24.6%
unpow224.6%
unpow224.6%
+-commutative24.6%
sqrt-prod24.6%
*-commutative24.6%
associate-*r*24.6%
associate-+l+24.6%
Applied egg-rr77.8%
Taylor expanded in A around -inf 45.6%
if 2.00000000000000015e70 < (pow.f64 B #s(literal 2 binary64)) < 2.00000000000000003e240Initial program 36.0%
Taylor expanded in F around 0 41.9%
mul-1-neg41.9%
*-commutative41.9%
distribute-rgt-neg-in41.9%
associate-/l*53.9%
cancel-sign-sub-inv53.9%
metadata-eval53.9%
+-commutative53.9%
Simplified69.4%
fma-undefine69.4%
Applied egg-rr69.4%
if 2.00000000000000003e240 < (pow.f64 B #s(literal 2 binary64)) Initial program 3.1%
Taylor expanded in B around inf 25.8%
mul-1-neg25.8%
*-commutative25.8%
distribute-rgt-neg-in25.8%
Simplified25.8%
sqrt-div38.2%
Applied egg-rr38.2%
distribute-rgt-neg-out38.2%
sqrt-undiv25.8%
sqrt-prod26.0%
pow1/226.0%
neg-sub026.0%
pow1/226.0%
Applied egg-rr26.0%
neg-sub026.0%
associate-*r/26.0%
*-commutative26.0%
Simplified26.0%
sqrt-div38.4%
*-commutative38.4%
Applied egg-rr38.4%
*-commutative38.4%
Simplified38.4%
Final simplification36.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 (+ C (hypot B_m C)))
(t_1 (* C (* 4.0 A)))
(t_2 (- t_1 (pow B_m 2.0)))
(t_3 (- (pow B_m 2.0) t_1)))
(if (<= (pow B_m 2.0) 1e-321)
(/ (sqrt (* (* 2.0 t_3) (* 2.0 (* C F)))) t_2)
(if (<= (pow B_m 2.0) 4e-233)
(* (sqrt (* F (/ -0.5 A))) (- (sqrt 2.0)))
(if (<= (pow B_m 2.0) 2e+72)
(/ (sqrt (* (* 2.0 (* t_3 F)) t_0)) t_2)
(if (<= (pow B_m 2.0) 2e+265)
(/ (* (* (sqrt F) (sqrt t_0)) (* B_m (sqrt 2.0))) t_2)
(/ (sqrt (* 2.0 F)) (- (sqrt B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = C + hypot(B_m, C);
double t_1 = C * (4.0 * A);
double t_2 = t_1 - pow(B_m, 2.0);
double t_3 = pow(B_m, 2.0) - t_1;
double tmp;
if (pow(B_m, 2.0) <= 1e-321) {
tmp = sqrt(((2.0 * t_3) * (2.0 * (C * F)))) / t_2;
} else if (pow(B_m, 2.0) <= 4e-233) {
tmp = sqrt((F * (-0.5 / A))) * -sqrt(2.0);
} else if (pow(B_m, 2.0) <= 2e+72) {
tmp = sqrt(((2.0 * (t_3 * F)) * t_0)) / t_2;
} else if (pow(B_m, 2.0) <= 2e+265) {
tmp = ((sqrt(F) * sqrt(t_0)) * (B_m * sqrt(2.0))) / t_2;
} else {
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = C + Math.hypot(B_m, C);
double t_1 = C * (4.0 * A);
double t_2 = t_1 - Math.pow(B_m, 2.0);
double t_3 = Math.pow(B_m, 2.0) - t_1;
double tmp;
if (Math.pow(B_m, 2.0) <= 1e-321) {
tmp = Math.sqrt(((2.0 * t_3) * (2.0 * (C * F)))) / t_2;
} else if (Math.pow(B_m, 2.0) <= 4e-233) {
tmp = Math.sqrt((F * (-0.5 / A))) * -Math.sqrt(2.0);
} else if (Math.pow(B_m, 2.0) <= 2e+72) {
tmp = Math.sqrt(((2.0 * (t_3 * F)) * t_0)) / t_2;
} else if (Math.pow(B_m, 2.0) <= 2e+265) {
tmp = ((Math.sqrt(F) * Math.sqrt(t_0)) * (B_m * Math.sqrt(2.0))) / t_2;
} else {
tmp = Math.sqrt((2.0 * F)) / -Math.sqrt(B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = C + math.hypot(B_m, C) t_1 = C * (4.0 * A) t_2 = t_1 - math.pow(B_m, 2.0) t_3 = math.pow(B_m, 2.0) - t_1 tmp = 0 if math.pow(B_m, 2.0) <= 1e-321: tmp = math.sqrt(((2.0 * t_3) * (2.0 * (C * F)))) / t_2 elif math.pow(B_m, 2.0) <= 4e-233: tmp = math.sqrt((F * (-0.5 / A))) * -math.sqrt(2.0) elif math.pow(B_m, 2.0) <= 2e+72: tmp = math.sqrt(((2.0 * (t_3 * F)) * t_0)) / t_2 elif math.pow(B_m, 2.0) <= 2e+265: tmp = ((math.sqrt(F) * math.sqrt(t_0)) * (B_m * math.sqrt(2.0))) / t_2 else: tmp = math.sqrt((2.0 * F)) / -math.sqrt(B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(C + hypot(B_m, C)) t_1 = Float64(C * Float64(4.0 * A)) t_2 = Float64(t_1 - (B_m ^ 2.0)) t_3 = Float64((B_m ^ 2.0) - t_1) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-321) tmp = Float64(sqrt(Float64(Float64(2.0 * t_3) * Float64(2.0 * Float64(C * F)))) / t_2); elseif ((B_m ^ 2.0) <= 4e-233) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / A))) * Float64(-sqrt(2.0))); elseif ((B_m ^ 2.0) <= 2e+72) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(t_3 * F)) * t_0)) / t_2); elseif ((B_m ^ 2.0) <= 2e+265) tmp = Float64(Float64(Float64(sqrt(F) * sqrt(t_0)) * Float64(B_m * sqrt(2.0))) / t_2); else tmp = Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = C + hypot(B_m, C);
t_1 = C * (4.0 * A);
t_2 = t_1 - (B_m ^ 2.0);
t_3 = (B_m ^ 2.0) - t_1;
tmp = 0.0;
if ((B_m ^ 2.0) <= 1e-321)
tmp = sqrt(((2.0 * t_3) * (2.0 * (C * F)))) / t_2;
elseif ((B_m ^ 2.0) <= 4e-233)
tmp = sqrt((F * (-0.5 / A))) * -sqrt(2.0);
elseif ((B_m ^ 2.0) <= 2e+72)
tmp = sqrt(((2.0 * (t_3 * F)) * t_0)) / t_2;
elseif ((B_m ^ 2.0) <= 2e+265)
tmp = ((sqrt(F) * sqrt(t_0)) * (B_m * sqrt(2.0))) / t_2;
else
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C * N[(4.0 * A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-321], N[(N[Sqrt[N[(N[(2.0 * t$95$3), $MachinePrecision] * N[(2.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-233], N[(N[Sqrt[N[(F * N[(-0.5 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+72], N[(N[Sqrt[N[(N[(2.0 * N[(t$95$3 * F), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+265], N[(N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] * N[(B$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := C + \mathsf{hypot}\left(B\_m, C\right)\\
t_1 := C \cdot \left(4 \cdot A\right)\\
t_2 := t\_1 - {B\_m}^{2}\\
t_3 := {B\_m}^{2} - t\_1\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-321}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot t\_3\right) \cdot \left(2 \cdot \left(C \cdot F\right)\right)}}{t\_2}\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{-233}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{A}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+72}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(t\_3 \cdot F\right)\right) \cdot t\_0}}{t\_2}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+265}:\\
\;\;\;\;\frac{\left(\sqrt{F} \cdot \sqrt{t\_0}\right) \cdot \left(B\_m \cdot \sqrt{2}\right)}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.98013e-322Initial program 24.5%
Taylor expanded in A around -inf 30.4%
*-un-lft-identity30.4%
distribute-frac-neg30.4%
Applied egg-rr30.4%
*-lft-identity30.4%
distribute-neg-frac230.4%
associate-*l*30.5%
associate-*r/30.5%
Simplified30.5%
Taylor expanded in C around inf 30.5%
*-commutative30.5%
Simplified30.5%
if 9.98013e-322 < (pow.f64 B #s(literal 2 binary64)) < 3.99999999999999983e-233Initial program 8.9%
Taylor expanded in F around 0 9.6%
mul-1-neg9.6%
*-commutative9.6%
distribute-rgt-neg-in9.6%
associate-/l*9.6%
cancel-sign-sub-inv9.6%
metadata-eval9.6%
+-commutative9.6%
Simplified18.4%
Taylor expanded in A around -inf 18.4%
if 3.99999999999999983e-233 < (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999989e72Initial program 35.3%
Taylor expanded in A around 0 29.5%
unpow229.5%
unpow229.5%
hypot-define36.4%
Simplified36.4%
if 1.99999999999999989e72 < (pow.f64 B #s(literal 2 binary64)) < 2.00000000000000013e265Initial program 31.6%
Taylor expanded in A around 0 18.0%
*-commutative18.0%
unpow218.0%
unpow218.0%
hypot-define21.0%
Simplified21.0%
*-commutative21.0%
sqrt-prod31.3%
Applied egg-rr31.3%
if 2.00000000000000013e265 < (pow.f64 B #s(literal 2 binary64)) Initial program 1.7%
Taylor expanded in B around inf 26.4%
mul-1-neg26.4%
*-commutative26.4%
distribute-rgt-neg-in26.4%
Simplified26.4%
sqrt-div40.0%
Applied egg-rr40.0%
distribute-rgt-neg-out40.0%
sqrt-undiv26.4%
sqrt-prod26.6%
pow1/226.6%
neg-sub026.6%
pow1/226.6%
Applied egg-rr26.6%
neg-sub026.6%
associate-*r/26.6%
*-commutative26.6%
Simplified26.6%
sqrt-div40.1%
*-commutative40.1%
Applied egg-rr40.1%
*-commutative40.1%
Simplified40.1%
Final simplification33.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 (fma B_m B_m (* C (* A -4.0))))
(t_1 (* C (* 4.0 A)))
(t_2 (- t_1 (pow B_m 2.0))))
(if (<= (pow B_m 2.0) 1e-321)
(/ (sqrt (* (* 2.0 (- (pow B_m 2.0) t_1)) (* 2.0 (* C F)))) t_2)
(if (<= (pow B_m 2.0) 2e-222)
(* (sqrt (* F (/ -0.5 A))) (- (sqrt 2.0)))
(if (<= (pow B_m 2.0) 2e+98)
(*
(sqrt (* F (* 2.0 t_0)))
(/ (sqrt (+ (+ A C) (hypot (- A C) B_m))) (- t_0)))
(if (<= (pow B_m 2.0) 2e+265)
(/
(* (* (sqrt F) (sqrt (+ C (hypot B_m C)))) (* B_m (sqrt 2.0)))
t_2)
(/ (sqrt (* 2.0 F)) (- (sqrt B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (C * (A * -4.0)));
double t_1 = C * (4.0 * A);
double t_2 = t_1 - pow(B_m, 2.0);
double tmp;
if (pow(B_m, 2.0) <= 1e-321) {
tmp = sqrt(((2.0 * (pow(B_m, 2.0) - t_1)) * (2.0 * (C * F)))) / t_2;
} else if (pow(B_m, 2.0) <= 2e-222) {
tmp = sqrt((F * (-0.5 / A))) * -sqrt(2.0);
} else if (pow(B_m, 2.0) <= 2e+98) {
tmp = sqrt((F * (2.0 * t_0))) * (sqrt(((A + C) + hypot((A - C), B_m))) / -t_0);
} else if (pow(B_m, 2.0) <= 2e+265) {
tmp = ((sqrt(F) * sqrt((C + hypot(B_m, C)))) * (B_m * sqrt(2.0))) / t_2;
} else {
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(C * Float64(A * -4.0))) t_1 = Float64(C * Float64(4.0 * A)) t_2 = Float64(t_1 - (B_m ^ 2.0)) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-321) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64((B_m ^ 2.0) - t_1)) * Float64(2.0 * Float64(C * F)))) / t_2); elseif ((B_m ^ 2.0) <= 2e-222) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / A))) * Float64(-sqrt(2.0))); elseif ((B_m ^ 2.0) <= 2e+98) tmp = Float64(sqrt(Float64(F * Float64(2.0 * t_0))) * Float64(sqrt(Float64(Float64(A + C) + hypot(Float64(A - C), B_m))) / Float64(-t_0))); elseif ((B_m ^ 2.0) <= 2e+265) tmp = Float64(Float64(Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C)))) * Float64(B_m * sqrt(2.0))) / t_2); else tmp = Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(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[(B$95$m * B$95$m + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C * N[(4.0 * A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-321], N[(N[Sqrt[N[(N[(2.0 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-222], N[(N[Sqrt[N[(F * N[(-0.5 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+98], N[(N[Sqrt[N[(F * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+265], N[(N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(B$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, C \cdot \left(A \cdot -4\right)\right)\\
t_1 := C \cdot \left(4 \cdot A\right)\\
t_2 := t\_1 - {B\_m}^{2}\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-321}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left({B\_m}^{2} - t\_1\right)\right) \cdot \left(2 \cdot \left(C \cdot F\right)\right)}}{t\_2}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-222}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{A}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+98}:\\
\;\;\;\;\sqrt{F \cdot \left(2 \cdot t\_0\right)} \cdot \frac{\sqrt{\left(A + C\right) + \mathsf{hypot}\left(A - C, B\_m\right)}}{-t\_0}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+265}:\\
\;\;\;\;\frac{\left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B\_m, C\right)}\right) \cdot \left(B\_m \cdot \sqrt{2}\right)}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.98013e-322Initial program 24.5%
Taylor expanded in A around -inf 30.4%
*-un-lft-identity30.4%
distribute-frac-neg30.4%
Applied egg-rr30.4%
*-lft-identity30.4%
distribute-neg-frac230.4%
associate-*l*30.5%
associate-*r/30.5%
Simplified30.5%
Taylor expanded in C around inf 30.5%
*-commutative30.5%
Simplified30.5%
if 9.98013e-322 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e-222Initial program 11.6%
Taylor expanded in F around 0 12.2%
mul-1-neg12.2%
*-commutative12.2%
distribute-rgt-neg-in12.2%
associate-/l*12.2%
cancel-sign-sub-inv12.2%
metadata-eval12.2%
+-commutative12.2%
Simplified20.6%
Taylor expanded in A around -inf 20.6%
if 2.0000000000000001e-222 < (pow.f64 B #s(literal 2 binary64)) < 2e98Initial program 35.3%
Simplified46.4%
associate-*r*46.4%
associate-+r+45.6%
hypot-undefine35.3%
unpow235.3%
unpow235.3%
+-commutative35.3%
sqrt-prod35.2%
*-commutative35.2%
associate-*r*35.2%
associate-+l+35.2%
Applied egg-rr57.0%
associate-/l*57.0%
associate-*l*57.0%
*-commutative57.0%
associate-*l*57.0%
*-commutative57.0%
*-commutative57.0%
associate-+r+56.4%
associate-*r*56.4%
*-commutative56.4%
associate-*l*56.4%
*-commutative56.4%
*-commutative56.4%
Applied egg-rr56.4%
if 2e98 < (pow.f64 B #s(literal 2 binary64)) < 2.00000000000000013e265Initial program 30.5%
Taylor expanded in A around 0 16.1%
*-commutative16.1%
unpow216.1%
unpow216.1%
hypot-define19.2%
Simplified19.2%
*-commutative19.2%
sqrt-prod30.1%
Applied egg-rr30.1%
if 2.00000000000000013e265 < (pow.f64 B #s(literal 2 binary64)) Initial program 1.7%
Taylor expanded in B around inf 26.4%
mul-1-neg26.4%
*-commutative26.4%
distribute-rgt-neg-in26.4%
Simplified26.4%
sqrt-div40.0%
Applied egg-rr40.0%
distribute-rgt-neg-out40.0%
sqrt-undiv26.4%
sqrt-prod26.6%
pow1/226.6%
neg-sub026.6%
pow1/226.6%
Applied egg-rr26.6%
neg-sub026.6%
associate-*r/26.6%
*-commutative26.6%
Simplified26.6%
sqrt-div40.1%
*-commutative40.1%
Applied egg-rr40.1%
*-commutative40.1%
Simplified40.1%
Final simplification37.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
(let* ((t_0 (- (sqrt 2.0)))
(t_1 (* C (* 4.0 A)))
(t_2
(/
(sqrt (* (* 2.0 (- (pow B_m 2.0) t_1)) (* 2.0 (* C F))))
(- t_1 (pow B_m 2.0)))))
(if (<= (pow B_m 2.0) 1e-321)
t_2
(if (<= (pow B_m 2.0) 1e-257)
(* (sqrt (* F (/ -0.5 A))) t_0)
(if (<= (pow B_m 2.0) 4e+18)
t_2
(if (<= (pow B_m 2.0) 2e+240)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(+ (pow B_m 2.0) (* -4.0 (* A C))))))
t_0)
(/ (sqrt (* 2.0 F)) (- (sqrt B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double t_1 = C * (4.0 * A);
double t_2 = sqrt(((2.0 * (pow(B_m, 2.0) - t_1)) * (2.0 * (C * F)))) / (t_1 - pow(B_m, 2.0));
double tmp;
if (pow(B_m, 2.0) <= 1e-321) {
tmp = t_2;
} else if (pow(B_m, 2.0) <= 1e-257) {
tmp = sqrt((F * (-0.5 / A))) * t_0;
} else if (pow(B_m, 2.0) <= 4e+18) {
tmp = t_2;
} else if (pow(B_m, 2.0) <= 2e+240) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + (-4.0 * (A * C)))))) * t_0;
} else {
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double t_1 = C * (4.0 * A);
double t_2 = Math.sqrt(((2.0 * (Math.pow(B_m, 2.0) - t_1)) * (2.0 * (C * F)))) / (t_1 - Math.pow(B_m, 2.0));
double tmp;
if (Math.pow(B_m, 2.0) <= 1e-321) {
tmp = t_2;
} else if (Math.pow(B_m, 2.0) <= 1e-257) {
tmp = Math.sqrt((F * (-0.5 / A))) * t_0;
} else if (Math.pow(B_m, 2.0) <= 4e+18) {
tmp = t_2;
} else if (Math.pow(B_m, 2.0) <= 2e+240) {
tmp = Math.sqrt((F * ((A + (C + Math.hypot(B_m, (A - C)))) / (Math.pow(B_m, 2.0) + (-4.0 * (A * C)))))) * t_0;
} else {
tmp = Math.sqrt((2.0 * F)) / -Math.sqrt(B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) t_1 = C * (4.0 * A) t_2 = math.sqrt(((2.0 * (math.pow(B_m, 2.0) - t_1)) * (2.0 * (C * F)))) / (t_1 - math.pow(B_m, 2.0)) tmp = 0 if math.pow(B_m, 2.0) <= 1e-321: tmp = t_2 elif math.pow(B_m, 2.0) <= 1e-257: tmp = math.sqrt((F * (-0.5 / A))) * t_0 elif math.pow(B_m, 2.0) <= 4e+18: tmp = t_2 elif math.pow(B_m, 2.0) <= 2e+240: tmp = math.sqrt((F * ((A + (C + math.hypot(B_m, (A - C)))) / (math.pow(B_m, 2.0) + (-4.0 * (A * C)))))) * t_0 else: tmp = math.sqrt((2.0 * F)) / -math.sqrt(B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) t_1 = Float64(C * Float64(4.0 * A)) t_2 = Float64(sqrt(Float64(Float64(2.0 * Float64((B_m ^ 2.0) - t_1)) * Float64(2.0 * Float64(C * F)))) / Float64(t_1 - (B_m ^ 2.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-321) tmp = t_2; elseif ((B_m ^ 2.0) <= 1e-257) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / A))) * t_0); elseif ((B_m ^ 2.0) <= 4e+18) tmp = t_2; elseif ((B_m ^ 2.0) <= 2e+240) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))) * t_0); else tmp = Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = -sqrt(2.0);
t_1 = C * (4.0 * A);
t_2 = sqrt(((2.0 * ((B_m ^ 2.0) - t_1)) * (2.0 * (C * F)))) / (t_1 - (B_m ^ 2.0));
tmp = 0.0;
if ((B_m ^ 2.0) <= 1e-321)
tmp = t_2;
elseif ((B_m ^ 2.0) <= 1e-257)
tmp = sqrt((F * (-0.5 / A))) * t_0;
elseif ((B_m ^ 2.0) <= 4e+18)
tmp = t_2;
elseif ((B_m ^ 2.0) <= 2e+240)
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / ((B_m ^ 2.0) + (-4.0 * (A * C)))))) * t_0;
else
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(C * N[(4.0 * A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[(2.0 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$1 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-321], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-257], N[(N[Sqrt[N[(F * N[(-0.5 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+18], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+240], N[(N[Sqrt[N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
t_1 := C \cdot \left(4 \cdot A\right)\\
t_2 := \frac{\sqrt{\left(2 \cdot \left({B\_m}^{2} - t\_1\right)\right) \cdot \left(2 \cdot \left(C \cdot F\right)\right)}}{t\_1 - {B\_m}^{2}}\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-321}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{-257}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{A}} \cdot t\_0\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+18}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + -4 \cdot \left(A \cdot C\right)}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.98013e-322 or 9.9999999999999998e-258 < (pow.f64 B #s(literal 2 binary64)) < 4e18Initial program 27.8%
Taylor expanded in A around -inf 28.5%
*-un-lft-identity28.5%
distribute-frac-neg28.5%
Applied egg-rr28.5%
*-lft-identity28.5%
distribute-neg-frac228.5%
associate-*l*29.4%
associate-*r/29.4%
Simplified29.4%
Taylor expanded in C around inf 27.5%
*-commutative27.5%
Simplified27.5%
if 9.98013e-322 < (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999998e-258Initial program 11.1%
Taylor expanded in F around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
associate-/l*5.8%
cancel-sign-sub-inv5.8%
metadata-eval5.8%
+-commutative5.8%
Simplified13.3%
Taylor expanded in A around -inf 20.6%
if 4e18 < (pow.f64 B #s(literal 2 binary64)) < 2.00000000000000003e240Initial program 33.5%
Taylor expanded in F around 0 38.0%
mul-1-neg38.0%
*-commutative38.0%
distribute-rgt-neg-in38.0%
associate-/l*47.3%
cancel-sign-sub-inv47.3%
metadata-eval47.3%
+-commutative47.3%
Simplified61.9%
fma-undefine61.9%
Applied egg-rr61.9%
if 2.00000000000000003e240 < (pow.f64 B #s(literal 2 binary64)) Initial program 3.1%
Taylor expanded in B around inf 25.8%
mul-1-neg25.8%
*-commutative25.8%
distribute-rgt-neg-in25.8%
Simplified25.8%
sqrt-div38.2%
Applied egg-rr38.2%
distribute-rgt-neg-out38.2%
sqrt-undiv25.8%
sqrt-prod26.0%
pow1/226.0%
neg-sub026.0%
pow1/226.0%
Applied egg-rr26.0%
neg-sub026.0%
associate-*r/26.0%
*-commutative26.0%
Simplified26.0%
sqrt-div38.4%
*-commutative38.4%
Applied egg-rr38.4%
*-commutative38.4%
Simplified38.4%
Final simplification35.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 (- (sqrt 2.0)))
(t_1 (* C (* 4.0 A)))
(t_2 (- t_1 (pow B_m 2.0)))
(t_3 (- (pow B_m 2.0) t_1)))
(if (<= (pow B_m 2.0) 1e-321)
(/ (sqrt (* (* 2.0 t_3) (* 2.0 (* C F)))) t_2)
(if (<= (pow B_m 2.0) 4e-233)
(* (sqrt (* F (/ -0.5 A))) t_0)
(if (<= (pow B_m 2.0) 2e-95)
(/ (sqrt (* (* 2.0 (* t_3 F)) (+ C (hypot B_m C)))) t_2)
(if (<= (pow B_m 2.0) 2e+240)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(+ (pow B_m 2.0) (* -4.0 (* A C))))))
t_0)
(/ (sqrt (* 2.0 F)) (- (sqrt B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double t_1 = C * (4.0 * A);
double t_2 = t_1 - pow(B_m, 2.0);
double t_3 = pow(B_m, 2.0) - t_1;
double tmp;
if (pow(B_m, 2.0) <= 1e-321) {
tmp = sqrt(((2.0 * t_3) * (2.0 * (C * F)))) / t_2;
} else if (pow(B_m, 2.0) <= 4e-233) {
tmp = sqrt((F * (-0.5 / A))) * t_0;
} else if (pow(B_m, 2.0) <= 2e-95) {
tmp = sqrt(((2.0 * (t_3 * F)) * (C + hypot(B_m, C)))) / t_2;
} else if (pow(B_m, 2.0) <= 2e+240) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + (-4.0 * (A * C)))))) * t_0;
} else {
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double t_1 = C * (4.0 * A);
double t_2 = t_1 - Math.pow(B_m, 2.0);
double t_3 = Math.pow(B_m, 2.0) - t_1;
double tmp;
if (Math.pow(B_m, 2.0) <= 1e-321) {
tmp = Math.sqrt(((2.0 * t_3) * (2.0 * (C * F)))) / t_2;
} else if (Math.pow(B_m, 2.0) <= 4e-233) {
tmp = Math.sqrt((F * (-0.5 / A))) * t_0;
} else if (Math.pow(B_m, 2.0) <= 2e-95) {
tmp = Math.sqrt(((2.0 * (t_3 * F)) * (C + Math.hypot(B_m, C)))) / t_2;
} else if (Math.pow(B_m, 2.0) <= 2e+240) {
tmp = Math.sqrt((F * ((A + (C + Math.hypot(B_m, (A - C)))) / (Math.pow(B_m, 2.0) + (-4.0 * (A * C)))))) * t_0;
} else {
tmp = Math.sqrt((2.0 * F)) / -Math.sqrt(B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) t_1 = C * (4.0 * A) t_2 = t_1 - math.pow(B_m, 2.0) t_3 = math.pow(B_m, 2.0) - t_1 tmp = 0 if math.pow(B_m, 2.0) <= 1e-321: tmp = math.sqrt(((2.0 * t_3) * (2.0 * (C * F)))) / t_2 elif math.pow(B_m, 2.0) <= 4e-233: tmp = math.sqrt((F * (-0.5 / A))) * t_0 elif math.pow(B_m, 2.0) <= 2e-95: tmp = math.sqrt(((2.0 * (t_3 * F)) * (C + math.hypot(B_m, C)))) / t_2 elif math.pow(B_m, 2.0) <= 2e+240: tmp = math.sqrt((F * ((A + (C + math.hypot(B_m, (A - C)))) / (math.pow(B_m, 2.0) + (-4.0 * (A * C)))))) * t_0 else: tmp = math.sqrt((2.0 * F)) / -math.sqrt(B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) t_1 = Float64(C * Float64(4.0 * A)) t_2 = Float64(t_1 - (B_m ^ 2.0)) t_3 = Float64((B_m ^ 2.0) - t_1) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-321) tmp = Float64(sqrt(Float64(Float64(2.0 * t_3) * Float64(2.0 * Float64(C * F)))) / t_2); elseif ((B_m ^ 2.0) <= 4e-233) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / A))) * t_0); elseif ((B_m ^ 2.0) <= 2e-95) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(t_3 * F)) * Float64(C + hypot(B_m, C)))) / t_2); elseif ((B_m ^ 2.0) <= 2e+240) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))) * t_0); else tmp = Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = -sqrt(2.0);
t_1 = C * (4.0 * A);
t_2 = t_1 - (B_m ^ 2.0);
t_3 = (B_m ^ 2.0) - t_1;
tmp = 0.0;
if ((B_m ^ 2.0) <= 1e-321)
tmp = sqrt(((2.0 * t_3) * (2.0 * (C * F)))) / t_2;
elseif ((B_m ^ 2.0) <= 4e-233)
tmp = sqrt((F * (-0.5 / A))) * t_0;
elseif ((B_m ^ 2.0) <= 2e-95)
tmp = sqrt(((2.0 * (t_3 * F)) * (C + hypot(B_m, C)))) / t_2;
elseif ((B_m ^ 2.0) <= 2e+240)
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / ((B_m ^ 2.0) + (-4.0 * (A * C)))))) * t_0;
else
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(C * N[(4.0 * A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-321], N[(N[Sqrt[N[(N[(2.0 * t$95$3), $MachinePrecision] * N[(2.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-233], N[(N[Sqrt[N[(F * N[(-0.5 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-95], N[(N[Sqrt[N[(N[(2.0 * N[(t$95$3 * F), $MachinePrecision]), $MachinePrecision] * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+240], N[(N[Sqrt[N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
t_1 := C \cdot \left(4 \cdot A\right)\\
t_2 := t\_1 - {B\_m}^{2}\\
t_3 := {B\_m}^{2} - t\_1\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-321}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot t\_3\right) \cdot \left(2 \cdot \left(C \cdot F\right)\right)}}{t\_2}\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{-233}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{A}} \cdot t\_0\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-95}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(t\_3 \cdot F\right)\right) \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}}{t\_2}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + -4 \cdot \left(A \cdot C\right)}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.98013e-322Initial program 24.5%
Taylor expanded in A around -inf 30.4%
*-un-lft-identity30.4%
distribute-frac-neg30.4%
Applied egg-rr30.4%
*-lft-identity30.4%
distribute-neg-frac230.4%
associate-*l*30.5%
associate-*r/30.5%
Simplified30.5%
Taylor expanded in C around inf 30.5%
*-commutative30.5%
Simplified30.5%
if 9.98013e-322 < (pow.f64 B #s(literal 2 binary64)) < 3.99999999999999983e-233Initial program 8.9%
Taylor expanded in F around 0 9.6%
mul-1-neg9.6%
*-commutative9.6%
distribute-rgt-neg-in9.6%
associate-/l*9.6%
cancel-sign-sub-inv9.6%
metadata-eval9.6%
+-commutative9.6%
Simplified18.4%
Taylor expanded in A around -inf 18.4%
if 3.99999999999999983e-233 < (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999998e-95Initial program 52.8%
Taylor expanded in A around 0 45.1%
unpow245.1%
unpow245.1%
hypot-define49.7%
Simplified49.7%
if 1.99999999999999998e-95 < (pow.f64 B #s(literal 2 binary64)) < 2.00000000000000003e240Initial program 28.7%
Taylor expanded in F around 0 31.3%
mul-1-neg31.3%
*-commutative31.3%
distribute-rgt-neg-in31.3%
associate-/l*38.4%
cancel-sign-sub-inv38.4%
metadata-eval38.4%
+-commutative38.4%
Simplified52.5%
fma-undefine52.5%
Applied egg-rr52.5%
if 2.00000000000000003e240 < (pow.f64 B #s(literal 2 binary64)) Initial program 3.1%
Taylor expanded in B around inf 25.8%
mul-1-neg25.8%
*-commutative25.8%
distribute-rgt-neg-in25.8%
Simplified25.8%
sqrt-div38.2%
Applied egg-rr38.2%
distribute-rgt-neg-out38.2%
sqrt-undiv25.8%
sqrt-prod26.0%
pow1/226.0%
neg-sub026.0%
pow1/226.0%
Applied egg-rr26.0%
neg-sub026.0%
associate-*r/26.0%
*-commutative26.0%
Simplified26.0%
sqrt-div38.4%
*-commutative38.4%
Applied egg-rr38.4%
*-commutative38.4%
Simplified38.4%
Final simplification39.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0)))
(t_1 (* C (* 4.0 A)))
(t_2
(/
(sqrt (* (* 2.0 (- (pow B_m 2.0) t_1)) (* 2.0 (* C F))))
(- t_1 (pow B_m 2.0)))))
(if (<= (pow B_m 2.0) 1e-321)
t_2
(if (<= (pow B_m 2.0) 1e-257)
(* (sqrt (* F (/ -0.5 A))) t_0)
(if (<= (pow B_m 2.0) 4e+18)
t_2
(if (<= (pow B_m 2.0) 2e+240)
(* (sqrt (* F (/ (+ C (hypot B_m C)) (pow B_m 2.0)))) t_0)
(/ (sqrt (* 2.0 F)) (- (sqrt B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double t_1 = C * (4.0 * A);
double t_2 = sqrt(((2.0 * (pow(B_m, 2.0) - t_1)) * (2.0 * (C * F)))) / (t_1 - pow(B_m, 2.0));
double tmp;
if (pow(B_m, 2.0) <= 1e-321) {
tmp = t_2;
} else if (pow(B_m, 2.0) <= 1e-257) {
tmp = sqrt((F * (-0.5 / A))) * t_0;
} else if (pow(B_m, 2.0) <= 4e+18) {
tmp = t_2;
} else if (pow(B_m, 2.0) <= 2e+240) {
tmp = sqrt((F * ((C + hypot(B_m, C)) / pow(B_m, 2.0)))) * t_0;
} else {
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double t_1 = C * (4.0 * A);
double t_2 = Math.sqrt(((2.0 * (Math.pow(B_m, 2.0) - t_1)) * (2.0 * (C * F)))) / (t_1 - Math.pow(B_m, 2.0));
double tmp;
if (Math.pow(B_m, 2.0) <= 1e-321) {
tmp = t_2;
} else if (Math.pow(B_m, 2.0) <= 1e-257) {
tmp = Math.sqrt((F * (-0.5 / A))) * t_0;
} else if (Math.pow(B_m, 2.0) <= 4e+18) {
tmp = t_2;
} else if (Math.pow(B_m, 2.0) <= 2e+240) {
tmp = Math.sqrt((F * ((C + Math.hypot(B_m, C)) / Math.pow(B_m, 2.0)))) * t_0;
} else {
tmp = Math.sqrt((2.0 * F)) / -Math.sqrt(B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) t_1 = C * (4.0 * A) t_2 = math.sqrt(((2.0 * (math.pow(B_m, 2.0) - t_1)) * (2.0 * (C * F)))) / (t_1 - math.pow(B_m, 2.0)) tmp = 0 if math.pow(B_m, 2.0) <= 1e-321: tmp = t_2 elif math.pow(B_m, 2.0) <= 1e-257: tmp = math.sqrt((F * (-0.5 / A))) * t_0 elif math.pow(B_m, 2.0) <= 4e+18: tmp = t_2 elif math.pow(B_m, 2.0) <= 2e+240: tmp = math.sqrt((F * ((C + math.hypot(B_m, C)) / math.pow(B_m, 2.0)))) * t_0 else: tmp = math.sqrt((2.0 * F)) / -math.sqrt(B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) t_1 = Float64(C * Float64(4.0 * A)) t_2 = Float64(sqrt(Float64(Float64(2.0 * Float64((B_m ^ 2.0) - t_1)) * Float64(2.0 * Float64(C * F)))) / Float64(t_1 - (B_m ^ 2.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-321) tmp = t_2; elseif ((B_m ^ 2.0) <= 1e-257) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / A))) * t_0); elseif ((B_m ^ 2.0) <= 4e+18) tmp = t_2; elseif ((B_m ^ 2.0) <= 2e+240) tmp = Float64(sqrt(Float64(F * Float64(Float64(C + hypot(B_m, C)) / (B_m ^ 2.0)))) * t_0); else tmp = Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = -sqrt(2.0);
t_1 = C * (4.0 * A);
t_2 = sqrt(((2.0 * ((B_m ^ 2.0) - t_1)) * (2.0 * (C * F)))) / (t_1 - (B_m ^ 2.0));
tmp = 0.0;
if ((B_m ^ 2.0) <= 1e-321)
tmp = t_2;
elseif ((B_m ^ 2.0) <= 1e-257)
tmp = sqrt((F * (-0.5 / A))) * t_0;
elseif ((B_m ^ 2.0) <= 4e+18)
tmp = t_2;
elseif ((B_m ^ 2.0) <= 2e+240)
tmp = sqrt((F * ((C + hypot(B_m, C)) / (B_m ^ 2.0)))) * t_0;
else
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(C * N[(4.0 * A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[(2.0 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$1 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-321], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-257], N[(N[Sqrt[N[(F * N[(-0.5 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+18], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+240], N[(N[Sqrt[N[(F * N[(N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision] / N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
t_1 := C \cdot \left(4 \cdot A\right)\\
t_2 := \frac{\sqrt{\left(2 \cdot \left({B\_m}^{2} - t\_1\right)\right) \cdot \left(2 \cdot \left(C \cdot F\right)\right)}}{t\_1 - {B\_m}^{2}}\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-321}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{-257}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{A}} \cdot t\_0\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+18}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\sqrt{F \cdot \frac{C + \mathsf{hypot}\left(B\_m, C\right)}{{B\_m}^{2}}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.98013e-322 or 9.9999999999999998e-258 < (pow.f64 B #s(literal 2 binary64)) < 4e18Initial program 27.8%
Taylor expanded in A around -inf 28.5%
*-un-lft-identity28.5%
distribute-frac-neg28.5%
Applied egg-rr28.5%
*-lft-identity28.5%
distribute-neg-frac228.5%
associate-*l*29.4%
associate-*r/29.4%
Simplified29.4%
Taylor expanded in C around inf 27.5%
*-commutative27.5%
Simplified27.5%
if 9.98013e-322 < (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999998e-258Initial program 11.1%
Taylor expanded in F around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
associate-/l*5.8%
cancel-sign-sub-inv5.8%
metadata-eval5.8%
+-commutative5.8%
Simplified13.3%
Taylor expanded in A around -inf 20.6%
if 4e18 < (pow.f64 B #s(literal 2 binary64)) < 2.00000000000000003e240Initial program 33.5%
Taylor expanded in F around 0 38.0%
mul-1-neg38.0%
*-commutative38.0%
distribute-rgt-neg-in38.0%
associate-/l*47.3%
cancel-sign-sub-inv47.3%
metadata-eval47.3%
+-commutative47.3%
Simplified61.9%
Taylor expanded in A around 0 45.7%
unpow245.7%
unpow245.7%
hypot-define52.1%
Simplified52.1%
if 2.00000000000000003e240 < (pow.f64 B #s(literal 2 binary64)) Initial program 3.1%
Taylor expanded in B around inf 25.8%
mul-1-neg25.8%
*-commutative25.8%
distribute-rgt-neg-in25.8%
Simplified25.8%
sqrt-div38.2%
Applied egg-rr38.2%
distribute-rgt-neg-out38.2%
sqrt-undiv25.8%
sqrt-prod26.0%
pow1/226.0%
neg-sub026.0%
pow1/226.0%
Applied egg-rr26.0%
neg-sub026.0%
associate-*r/26.0%
*-commutative26.0%
Simplified26.0%
sqrt-div38.4%
*-commutative38.4%
Applied egg-rr38.4%
*-commutative38.4%
Simplified38.4%
Final simplification34.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 (* C (* 4.0 A)))
(t_1
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 C)))
(- t_0 (pow B_m 2.0)))))
(if (<= (pow B_m 2.0) 1e-321)
t_1
(if (<= (pow B_m 2.0) 1e-257)
(* (sqrt (* F (/ -0.5 A))) (- (sqrt 2.0)))
(if (<= (pow B_m 2.0) 5e-46)
t_1
(/ (sqrt (* 2.0 F)) (- (sqrt B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = C * (4.0 * A);
double t_1 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - pow(B_m, 2.0));
double tmp;
if (pow(B_m, 2.0) <= 1e-321) {
tmp = t_1;
} else if (pow(B_m, 2.0) <= 1e-257) {
tmp = sqrt((F * (-0.5 / A))) * -sqrt(2.0);
} else if (pow(B_m, 2.0) <= 5e-46) {
tmp = t_1;
} else {
tmp = sqrt((2.0 * F)) / -sqrt(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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = c * (4.0d0 * a)
t_1 = sqrt(((2.0d0 * (((b_m ** 2.0d0) - t_0) * f)) * (2.0d0 * c))) / (t_0 - (b_m ** 2.0d0))
if ((b_m ** 2.0d0) <= 1d-321) then
tmp = t_1
else if ((b_m ** 2.0d0) <= 1d-257) then
tmp = sqrt((f * ((-0.5d0) / a))) * -sqrt(2.0d0)
else if ((b_m ** 2.0d0) <= 5d-46) then
tmp = t_1
else
tmp = sqrt((2.0d0 * f)) / -sqrt(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 t_0 = C * (4.0 * A);
double t_1 = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - Math.pow(B_m, 2.0));
double tmp;
if (Math.pow(B_m, 2.0) <= 1e-321) {
tmp = t_1;
} else if (Math.pow(B_m, 2.0) <= 1e-257) {
tmp = Math.sqrt((F * (-0.5 / A))) * -Math.sqrt(2.0);
} else if (Math.pow(B_m, 2.0) <= 5e-46) {
tmp = t_1;
} else {
tmp = Math.sqrt((2.0 * F)) / -Math.sqrt(B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = C * (4.0 * A) t_1 = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - math.pow(B_m, 2.0)) tmp = 0 if math.pow(B_m, 2.0) <= 1e-321: tmp = t_1 elif math.pow(B_m, 2.0) <= 1e-257: tmp = math.sqrt((F * (-0.5 / A))) * -math.sqrt(2.0) elif math.pow(B_m, 2.0) <= 5e-46: tmp = t_1 else: tmp = math.sqrt((2.0 * F)) / -math.sqrt(B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(C * Float64(4.0 * A)) t_1 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-321) tmp = t_1; elseif ((B_m ^ 2.0) <= 1e-257) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / A))) * Float64(-sqrt(2.0))); elseif ((B_m ^ 2.0) <= 5e-46) tmp = t_1; else tmp = Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = C * (4.0 * A);
t_1 = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - (B_m ^ 2.0));
tmp = 0.0;
if ((B_m ^ 2.0) <= 1e-321)
tmp = t_1;
elseif ((B_m ^ 2.0) <= 1e-257)
tmp = sqrt((F * (-0.5 / A))) * -sqrt(2.0);
elseif ((B_m ^ 2.0) <= 5e-46)
tmp = t_1;
else
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(C * N[(4.0 * A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-321], t$95$1, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-257], N[(N[Sqrt[N[(F * N[(-0.5 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-46], t$95$1, N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := C \cdot \left(4 \cdot A\right)\\
t_1 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-321}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{-257}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{A}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-46}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.98013e-322 or 9.9999999999999998e-258 < (pow.f64 B #s(literal 2 binary64)) < 4.99999999999999992e-46Initial program 28.5%
Taylor expanded in A around -inf 28.3%
if 9.98013e-322 < (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999998e-258Initial program 11.1%
Taylor expanded in F around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
associate-/l*5.8%
cancel-sign-sub-inv5.8%
metadata-eval5.8%
+-commutative5.8%
Simplified13.3%
Taylor expanded in A around -inf 20.6%
if 4.99999999999999992e-46 < (pow.f64 B #s(literal 2 binary64)) Initial program 14.7%
Taylor expanded in B around inf 22.8%
mul-1-neg22.8%
*-commutative22.8%
distribute-rgt-neg-in22.8%
Simplified22.8%
sqrt-div29.8%
Applied egg-rr29.8%
distribute-rgt-neg-out29.8%
sqrt-undiv22.8%
sqrt-prod22.9%
pow1/222.9%
neg-sub022.9%
pow1/222.9%
Applied egg-rr22.9%
neg-sub022.9%
associate-*r/22.9%
*-commutative22.9%
Simplified22.9%
sqrt-div29.9%
*-commutative29.9%
Applied egg-rr29.9%
*-commutative29.9%
Simplified29.9%
Final simplification28.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
(let* ((t_0 (* C (* 4.0 A)))
(t_1
(/
(sqrt (* (* 2.0 (- (pow B_m 2.0) t_0)) (* 2.0 (* C F))))
(- t_0 (pow B_m 2.0)))))
(if (<= (pow B_m 2.0) 1e-321)
t_1
(if (<= (pow B_m 2.0) 1e-257)
(* (sqrt (* F (/ -0.5 A))) (- (sqrt 2.0)))
(if (<= (pow B_m 2.0) 4e+18)
t_1
(/ (sqrt (* 2.0 F)) (- (sqrt B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = C * (4.0 * A);
double t_1 = sqrt(((2.0 * (pow(B_m, 2.0) - t_0)) * (2.0 * (C * F)))) / (t_0 - pow(B_m, 2.0));
double tmp;
if (pow(B_m, 2.0) <= 1e-321) {
tmp = t_1;
} else if (pow(B_m, 2.0) <= 1e-257) {
tmp = sqrt((F * (-0.5 / A))) * -sqrt(2.0);
} else if (pow(B_m, 2.0) <= 4e+18) {
tmp = t_1;
} else {
tmp = sqrt((2.0 * F)) / -sqrt(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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = c * (4.0d0 * a)
t_1 = sqrt(((2.0d0 * ((b_m ** 2.0d0) - t_0)) * (2.0d0 * (c * f)))) / (t_0 - (b_m ** 2.0d0))
if ((b_m ** 2.0d0) <= 1d-321) then
tmp = t_1
else if ((b_m ** 2.0d0) <= 1d-257) then
tmp = sqrt((f * ((-0.5d0) / a))) * -sqrt(2.0d0)
else if ((b_m ** 2.0d0) <= 4d+18) then
tmp = t_1
else
tmp = sqrt((2.0d0 * f)) / -sqrt(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 t_0 = C * (4.0 * A);
double t_1 = Math.sqrt(((2.0 * (Math.pow(B_m, 2.0) - t_0)) * (2.0 * (C * F)))) / (t_0 - Math.pow(B_m, 2.0));
double tmp;
if (Math.pow(B_m, 2.0) <= 1e-321) {
tmp = t_1;
} else if (Math.pow(B_m, 2.0) <= 1e-257) {
tmp = Math.sqrt((F * (-0.5 / A))) * -Math.sqrt(2.0);
} else if (Math.pow(B_m, 2.0) <= 4e+18) {
tmp = t_1;
} else {
tmp = Math.sqrt((2.0 * F)) / -Math.sqrt(B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = C * (4.0 * A) t_1 = math.sqrt(((2.0 * (math.pow(B_m, 2.0) - t_0)) * (2.0 * (C * F)))) / (t_0 - math.pow(B_m, 2.0)) tmp = 0 if math.pow(B_m, 2.0) <= 1e-321: tmp = t_1 elif math.pow(B_m, 2.0) <= 1e-257: tmp = math.sqrt((F * (-0.5 / A))) * -math.sqrt(2.0) elif math.pow(B_m, 2.0) <= 4e+18: tmp = t_1 else: tmp = math.sqrt((2.0 * F)) / -math.sqrt(B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(C * Float64(4.0 * A)) t_1 = Float64(sqrt(Float64(Float64(2.0 * Float64((B_m ^ 2.0) - t_0)) * Float64(2.0 * Float64(C * F)))) / Float64(t_0 - (B_m ^ 2.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-321) tmp = t_1; elseif ((B_m ^ 2.0) <= 1e-257) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / A))) * Float64(-sqrt(2.0))); elseif ((B_m ^ 2.0) <= 4e+18) tmp = t_1; else tmp = Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = C * (4.0 * A);
t_1 = sqrt(((2.0 * ((B_m ^ 2.0) - t_0)) * (2.0 * (C * F)))) / (t_0 - (B_m ^ 2.0));
tmp = 0.0;
if ((B_m ^ 2.0) <= 1e-321)
tmp = t_1;
elseif ((B_m ^ 2.0) <= 1e-257)
tmp = sqrt((F * (-0.5 / A))) * -sqrt(2.0);
elseif ((B_m ^ 2.0) <= 4e+18)
tmp = t_1;
else
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(C * N[(4.0 * A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(N[(2.0 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(C * F), $MachinePrecision]), $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], 1e-321], t$95$1, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-257], N[(N[Sqrt[N[(F * N[(-0.5 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+18], t$95$1, N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := C \cdot \left(4 \cdot A\right)\\
t_1 := \frac{\sqrt{\left(2 \cdot \left({B\_m}^{2} - t\_0\right)\right) \cdot \left(2 \cdot \left(C \cdot F\right)\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-321}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{-257}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{A}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.98013e-322 or 9.9999999999999998e-258 < (pow.f64 B #s(literal 2 binary64)) < 4e18Initial program 27.8%
Taylor expanded in A around -inf 28.5%
*-un-lft-identity28.5%
distribute-frac-neg28.5%
Applied egg-rr28.5%
*-lft-identity28.5%
distribute-neg-frac228.5%
associate-*l*29.4%
associate-*r/29.4%
Simplified29.4%
Taylor expanded in C around inf 27.5%
*-commutative27.5%
Simplified27.5%
if 9.98013e-322 < (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999998e-258Initial program 11.1%
Taylor expanded in F around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
associate-/l*5.8%
cancel-sign-sub-inv5.8%
metadata-eval5.8%
+-commutative5.8%
Simplified13.3%
Taylor expanded in A around -inf 20.6%
if 4e18 < (pow.f64 B #s(literal 2 binary64)) Initial program 13.7%
Taylor expanded in B around inf 24.4%
mul-1-neg24.4%
*-commutative24.4%
distribute-rgt-neg-in24.4%
Simplified24.4%
sqrt-div32.3%
Applied egg-rr32.3%
distribute-rgt-neg-out32.3%
sqrt-undiv24.4%
sqrt-prod24.6%
pow1/224.6%
neg-sub024.6%
pow1/224.6%
Applied egg-rr24.6%
neg-sub024.6%
associate-*r/24.6%
*-commutative24.6%
Simplified24.6%
sqrt-div32.4%
*-commutative32.4%
Applied egg-rr32.4%
*-commutative32.4%
Simplified32.4%
Final simplification29.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 1.16e+54) (* (sqrt (* F (/ -0.5 A))) (- (sqrt 2.0))) (/ (sqrt (* 2.0 F)) (- (sqrt B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.16e+54) {
tmp = sqrt((F * (-0.5 / A))) * -sqrt(2.0);
} else {
tmp = sqrt((2.0 * F)) / -sqrt(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.16d+54) then
tmp = sqrt((f * ((-0.5d0) / a))) * -sqrt(2.0d0)
else
tmp = sqrt((2.0d0 * f)) / -sqrt(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.16e+54) {
tmp = Math.sqrt((F * (-0.5 / A))) * -Math.sqrt(2.0);
} else {
tmp = Math.sqrt((2.0 * F)) / -Math.sqrt(B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.16e+54: tmp = math.sqrt((F * (-0.5 / A))) * -math.sqrt(2.0) else: tmp = math.sqrt((2.0 * F)) / -math.sqrt(B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.16e+54) tmp = Float64(sqrt(Float64(F * Float64(-0.5 / A))) * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 1.16e+54)
tmp = sqrt((F * (-0.5 / A))) * -sqrt(2.0);
else
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.16e+54], N[(N[Sqrt[N[(F * N[(-0.5 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.16 \cdot 10^{+54}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{A}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if B < 1.1600000000000001e54Initial program 22.7%
Taylor expanded in F around 0 17.5%
mul-1-neg17.5%
*-commutative17.5%
distribute-rgt-neg-in17.5%
associate-/l*19.8%
cancel-sign-sub-inv19.8%
metadata-eval19.8%
+-commutative19.8%
Simplified28.0%
Taylor expanded in A around -inf 16.5%
if 1.1600000000000001e54 < B Initial program 8.7%
Taylor expanded in B around inf 50.9%
mul-1-neg50.9%
*-commutative50.9%
distribute-rgt-neg-in50.9%
Simplified50.9%
sqrt-div71.0%
Applied egg-rr71.0%
distribute-rgt-neg-out71.0%
sqrt-undiv50.9%
sqrt-prod51.2%
pow1/251.2%
neg-sub051.2%
pow1/251.2%
Applied egg-rr51.2%
neg-sub051.2%
associate-*r/51.3%
*-commutative51.3%
Simplified51.3%
sqrt-div71.3%
*-commutative71.3%
Applied egg-rr71.3%
*-commutative71.3%
Simplified71.3%
Final simplification27.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 (* (sqrt (* 2.0 F)) (- (sqrt (/ 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 * F)) * -sqrt((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 * f)) * -sqrt((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 * F)) * -Math.sqrt((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 * F)) * -math.sqrt((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(Float64(2.0 * F)) * Float64(-sqrt(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 * F)) * -sqrt((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[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(1.0 / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{2 \cdot F} \cdot \left(-\sqrt{\frac{1}{B\_m}}\right)
\end{array}
Initial program 20.0%
Taylor expanded in B around inf 13.7%
mul-1-neg13.7%
*-commutative13.7%
distribute-rgt-neg-in13.7%
Simplified13.7%
sqrt-div17.6%
Applied egg-rr17.6%
distribute-rgt-neg-out17.6%
sqrt-undiv13.7%
sqrt-prod13.8%
pow1/213.9%
neg-sub013.9%
pow1/213.8%
Applied egg-rr13.8%
neg-sub013.8%
associate-*r/13.8%
*-commutative13.8%
Simplified13.8%
pow1/214.0%
div-inv14.0%
unpow-prod-down17.6%
pow1/217.6%
*-commutative17.6%
Applied egg-rr17.6%
*-commutative17.6%
unpow1/217.6%
Simplified17.6%
Final simplification17.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 (- (sqrt (fabs (/ (* 2.0 F) B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt(fabs(((2.0 * F) / B_m)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt(abs(((2.0d0 * f) / b_m)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt(Math.abs(((2.0 * F) / B_m)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt(math.fabs(((2.0 * F) / B_m)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(abs(Float64(Float64(2.0 * F) / B_m)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt(abs(((2.0 * F) / B_m)));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[Abs[N[(N[(2.0 * F), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{\left|\frac{2 \cdot F}{B\_m}\right|}
\end{array}
Initial program 20.0%
Taylor expanded in B around inf 13.7%
mul-1-neg13.7%
*-commutative13.7%
distribute-rgt-neg-in13.7%
Simplified13.7%
pow113.7%
distribute-rgt-neg-out13.7%
pow1/213.7%
pow1/213.9%
pow-prod-down13.9%
Applied egg-rr13.9%
unpow113.9%
unpow1/213.8%
Simplified13.8%
add-sqr-sqrt13.8%
pow1/213.8%
pow1/213.9%
pow-prod-down19.6%
pow219.6%
Applied egg-rr19.6%
unpow1/219.6%
unpow219.6%
rem-sqrt-square28.0%
associate-*r/28.0%
*-commutative28.0%
Simplified28.0%
Final simplification28.0%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (* (sqrt F) (- (sqrt (/ 2.0 B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt(F) * -sqrt((2.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(f) * -sqrt((2.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(F) * -Math.sqrt((2.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(F) * -math.sqrt((2.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(F) * Float64(-sqrt(Float64(2.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(F) * -sqrt((2.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[F], $MachinePrecision] * (-N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)
\end{array}
Initial program 20.0%
Taylor expanded in B around inf 13.7%
mul-1-neg13.7%
*-commutative13.7%
distribute-rgt-neg-in13.7%
Simplified13.7%
sqrt-div17.6%
Applied egg-rr17.6%
distribute-rgt-neg-out17.6%
sqrt-undiv13.7%
sqrt-prod13.8%
pow1/213.9%
neg-sub013.9%
pow1/213.8%
Applied egg-rr13.8%
neg-sub013.8%
associate-*r/13.8%
*-commutative13.8%
Simplified13.8%
pow1/214.0%
associate-/l*14.0%
unpow-prod-down17.6%
pow1/217.6%
Applied egg-rr17.6%
unpow1/217.6%
Simplified17.6%
Final simplification17.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 (/ (sqrt (* 2.0 F)) (- (sqrt B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt((2.0 * F)) / -sqrt(B_m);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((2.0d0 * f)) / -sqrt(b_m)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((2.0 * F)) / -Math.sqrt(B_m);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt((2.0 * F)) / -math.sqrt(B_m)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(B_m))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt((2.0 * F)) / -sqrt(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[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[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])\\
\\
\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}
\end{array}
Initial program 20.0%
Taylor expanded in B around inf 13.7%
mul-1-neg13.7%
*-commutative13.7%
distribute-rgt-neg-in13.7%
Simplified13.7%
sqrt-div17.6%
Applied egg-rr17.6%
distribute-rgt-neg-out17.6%
sqrt-undiv13.7%
sqrt-prod13.8%
pow1/213.9%
neg-sub013.9%
pow1/213.8%
Applied egg-rr13.8%
neg-sub013.8%
associate-*r/13.8%
*-commutative13.8%
Simplified13.8%
sqrt-div17.6%
*-commutative17.6%
Applied egg-rr17.6%
*-commutative17.6%
Simplified17.6%
Final simplification17.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 (- (sqrt (* 2.0 (/ F B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((2.0 * (F / B_m)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((2.0d0 * (f / b_m)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((2.0 * (F / B_m)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((2.0 * (F / B_m)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((2.0 * (F / B_m)));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{2 \cdot \frac{F}{B\_m}}
\end{array}
Initial program 20.0%
Taylor expanded in B around inf 13.7%
mul-1-neg13.7%
*-commutative13.7%
distribute-rgt-neg-in13.7%
Simplified13.7%
pow113.7%
distribute-rgt-neg-out13.7%
pow1/213.7%
pow1/213.9%
pow-prod-down13.9%
Applied egg-rr13.9%
unpow113.9%
unpow1/213.8%
Simplified13.8%
Final simplification13.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 (/ 2.0 B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((F * (2.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((f * (2.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((F * (2.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((F * (2.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(Float64(F * Float64(2.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((F * (2.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[Sqrt[N[(F * N[(2.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{F \cdot \frac{2}{B\_m}}
\end{array}
Initial program 20.0%
Taylor expanded in B around inf 13.7%
mul-1-neg13.7%
*-commutative13.7%
distribute-rgt-neg-in13.7%
Simplified13.7%
sqrt-div17.6%
Applied egg-rr17.6%
distribute-rgt-neg-out17.6%
sqrt-undiv13.7%
sqrt-prod13.8%
pow1/213.9%
neg-sub013.9%
pow1/213.8%
Applied egg-rr13.8%
neg-sub013.8%
associate-*r/13.8%
*-commutative13.8%
Simplified13.8%
*-un-lft-identity13.8%
associate-/l*13.8%
Applied egg-rr13.8%
*-lft-identity13.8%
Simplified13.8%
Final simplification13.8%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (sqrt (/ (* 2.0 F) B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt(((2.0 * F) / B_m));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt(((2.0d0 * f) / b_m))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt(((2.0 * F) / B_m));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt(((2.0 * F) / B_m))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(Float64(2.0 * F) / B_m))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt(((2.0 * F) / B_m));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{\frac{2 \cdot F}{B\_m}}
\end{array}
Initial program 20.0%
Taylor expanded in B around inf 13.7%
mul-1-neg13.7%
*-commutative13.7%
distribute-rgt-neg-in13.7%
Simplified13.7%
sqrt-div17.6%
Applied egg-rr17.6%
distribute-rgt-neg-out17.6%
sqrt-undiv13.7%
sqrt-prod13.8%
pow1/213.9%
neg-sub013.9%
pow1/213.8%
Applied egg-rr13.8%
neg-sub013.8%
associate-*r/13.8%
*-commutative13.8%
Simplified13.8%
Final simplification13.8%
herbie shell --seed 2024059
(FPCore (A B C F)
:name "ABCF->ab-angle a"
:precision binary64
(/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))