
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
(t_1
(*
(sqrt 2.0)
(-
(sqrt
(*
F
(/
(+ (+ C A) (hypot B_m (- A C)))
(fma -4.0 (* C A) (pow B_m 2.0)))))))))
(if (<= B_m 1.9e-250)
t_1
(if (<= B_m 1.95e-140)
(/ (sqrt (* (* F t_0) (* C 4.0))) (- t_0))
(if (<= B_m 9.2e+127)
t_1
(*
(* (sqrt (+ A (hypot B_m A))) (sqrt F))
(/ (- (sqrt 2.0)) B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = sqrt(2.0) * -sqrt((F * (((C + A) + hypot(B_m, (A - C))) / fma(-4.0, (C * A), pow(B_m, 2.0)))));
double tmp;
if (B_m <= 1.9e-250) {
tmp = t_1;
} else if (B_m <= 1.95e-140) {
tmp = sqrt(((F * t_0) * (C * 4.0))) / -t_0;
} else if (B_m <= 9.2e+127) {
tmp = t_1;
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(Float64(Float64(C + A) + hypot(B_m, Float64(A - C))) / fma(-4.0, Float64(C * A), (B_m ^ 2.0))))))) tmp = 0.0 if (B_m <= 1.9e-250) tmp = t_1; elseif (B_m <= 1.95e-140) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(C * 4.0))) / Float64(-t_0)); elseif (B_m <= 9.2e+127) tmp = t_1; else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(N[(C + A), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(C * A), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[B$95$m, 1.9e-250], t$95$1, If[LessEqual[B$95$m, 1.95e-140], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[B$95$m, 9.2e+127], t$95$1, N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B\_m}^{2}\right)}}\right)\\
\mathbf{if}\;B\_m \leq 1.9 \cdot 10^{-250}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;B\_m \leq 1.95 \cdot 10^{-140}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(C \cdot 4\right)}}{-t\_0}\\
\mathbf{elif}\;B\_m \leq 9.2 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B\_m}\\
\end{array}
\end{array}
if B < 1.89999999999999985e-250 or 1.9500000000000001e-140 < B < 9.2000000000000007e127Initial program 18.3%
Taylor expanded in F around 0 17.7%
Simplified37.5%
if 1.89999999999999985e-250 < B < 1.9500000000000001e-140Initial program 25.5%
Simplified40.0%
Taylor expanded in A around -inf 28.9%
*-commutative28.9%
Simplified28.9%
if 9.2000000000000007e127 < B Initial program 0.0%
Taylor expanded in C around 0 2.2%
mul-1-neg2.2%
*-commutative2.2%
*-commutative2.2%
+-commutative2.2%
unpow22.2%
unpow22.2%
hypot-define43.5%
Simplified43.5%
sqrt-prod70.6%
Applied egg-rr70.6%
Final simplification41.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 (* (/ (pow B_m 2.0) A) -0.5))
(t_1 (/ (sqrt 2.0) B_m))
(t_2 (fma B_m B_m (* A (* C -4.0))))
(t_3 (- t_2))
(t_4 (* F t_2)))
(if (<= (pow B_m 2.0) 1e-286)
(/ (sqrt (* t_4 (* C 4.0))) t_3)
(if (<= (pow B_m 2.0) 5e-115)
(* t_1 (- (sqrt (* F t_0))))
(if (<= (pow B_m 2.0) 1e+77)
(/ (sqrt (* t_4 (* 2.0 (+ A (+ C (hypot B_m (- A C))))))) t_3)
(if (<= (pow B_m 2.0) 2e+152)
(* t_1 (* (sqrt F) (- (sqrt t_0))))
(*
(* (sqrt (+ A (hypot B_m A))) (sqrt F))
(/ (- (sqrt 2.0)) B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (pow(B_m, 2.0) / A) * -0.5;
double t_1 = sqrt(2.0) / B_m;
double t_2 = fma(B_m, B_m, (A * (C * -4.0)));
double t_3 = -t_2;
double t_4 = F * t_2;
double tmp;
if (pow(B_m, 2.0) <= 1e-286) {
tmp = sqrt((t_4 * (C * 4.0))) / t_3;
} else if (pow(B_m, 2.0) <= 5e-115) {
tmp = t_1 * -sqrt((F * t_0));
} else if (pow(B_m, 2.0) <= 1e+77) {
tmp = sqrt((t_4 * (2.0 * (A + (C + hypot(B_m, (A - C))))))) / t_3;
} else if (pow(B_m, 2.0) <= 2e+152) {
tmp = t_1 * (sqrt(F) * -sqrt(t_0));
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64((B_m ^ 2.0) / A) * -0.5) t_1 = Float64(sqrt(2.0) / B_m) t_2 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_3 = Float64(-t_2) t_4 = Float64(F * t_2) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-286) tmp = Float64(sqrt(Float64(t_4 * Float64(C * 4.0))) / t_3); elseif ((B_m ^ 2.0) <= 5e-115) tmp = Float64(t_1 * Float64(-sqrt(Float64(F * t_0)))); elseif ((B_m ^ 2.0) <= 1e+77) tmp = Float64(sqrt(Float64(t_4 * Float64(2.0 * Float64(A + Float64(C + hypot(B_m, Float64(A - C))))))) / t_3); elseif ((B_m ^ 2.0) <= 2e+152) tmp = Float64(t_1 * Float64(sqrt(F) * Float64(-sqrt(t_0)))); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, Block[{t$95$2 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = (-t$95$2)}, Block[{t$95$4 = N[(F * t$95$2), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-286], N[(N[Sqrt[N[(t$95$4 * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-115], N[(t$95$1 * (-N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+77], N[(N[Sqrt[N[(t$95$4 * N[(2.0 * N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+152], N[(t$95$1 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[t$95$0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{{B\_m}^{2}}{A} \cdot -0.5\\
t_1 := \frac{\sqrt{2}}{B\_m}\\
t_2 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_3 := -t\_2\\
t_4 := F \cdot t\_2\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-286}:\\
\;\;\;\;\frac{\sqrt{t\_4 \cdot \left(C \cdot 4\right)}}{t\_3}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-115}:\\
\;\;\;\;t\_1 \cdot \left(-\sqrt{F \cdot t\_0}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+77}:\\
\;\;\;\;\frac{\sqrt{t\_4 \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_3}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+152}:\\
\;\;\;\;t\_1 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{t\_0}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.00000000000000005e-286Initial program 20.0%
Simplified29.8%
Taylor expanded in A around -inf 21.3%
*-commutative21.3%
Simplified21.3%
if 1.00000000000000005e-286 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000003e-115Initial program 16.7%
Taylor expanded in C around 0 2.0%
mul-1-neg2.0%
*-commutative2.0%
*-commutative2.0%
+-commutative2.0%
unpow22.0%
unpow22.0%
hypot-define11.5%
Simplified11.5%
Taylor expanded in A around -inf 16.2%
if 5.0000000000000003e-115 < (pow.f64 B #s(literal 2 binary64)) < 9.99999999999999983e76Initial program 35.5%
Simplified54.3%
if 9.99999999999999983e76 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e152Initial program 7.0%
Taylor expanded in C around 0 12.0%
mul-1-neg12.0%
*-commutative12.0%
*-commutative12.0%
+-commutative12.0%
unpow212.0%
unpow212.0%
hypot-define12.6%
Simplified12.6%
sqrt-prod16.5%
Applied egg-rr16.5%
Taylor expanded in A around -inf 26.5%
if 2.0000000000000001e152 < (pow.f64 B #s(literal 2 binary64)) Initial program 10.1%
Taylor expanded in C around 0 9.1%
mul-1-neg9.1%
*-commutative9.1%
*-commutative9.1%
+-commutative9.1%
unpow29.1%
unpow29.1%
hypot-define29.1%
Simplified29.1%
sqrt-prod37.6%
Applied egg-rr37.6%
Final simplification30.6%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (/ (pow B_m 2.0) A) -0.5))
(t_1 (/ (sqrt 2.0) B_m))
(t_2 (fma B_m B_m (* A (* C -4.0))))
(t_3 (/ (sqrt (* (* F t_2) (* C 4.0))) (- t_2))))
(if (<= (pow B_m 2.0) 1e-286)
t_3
(if (<= (pow B_m 2.0) 5e-127)
(* t_1 (- (sqrt (* F t_0))))
(if (<= (pow B_m 2.0) 1e+77)
t_3
(if (<= (pow B_m 2.0) 2e+152)
(* t_1 (* (sqrt F) (- (sqrt t_0))))
(*
(* (sqrt (+ A (hypot B_m A))) (sqrt F))
(/ (- (sqrt 2.0)) B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (pow(B_m, 2.0) / A) * -0.5;
double t_1 = sqrt(2.0) / B_m;
double t_2 = fma(B_m, B_m, (A * (C * -4.0)));
double t_3 = sqrt(((F * t_2) * (C * 4.0))) / -t_2;
double tmp;
if (pow(B_m, 2.0) <= 1e-286) {
tmp = t_3;
} else if (pow(B_m, 2.0) <= 5e-127) {
tmp = t_1 * -sqrt((F * t_0));
} else if (pow(B_m, 2.0) <= 1e+77) {
tmp = t_3;
} else if (pow(B_m, 2.0) <= 2e+152) {
tmp = t_1 * (sqrt(F) * -sqrt(t_0));
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64((B_m ^ 2.0) / A) * -0.5) t_1 = Float64(sqrt(2.0) / B_m) t_2 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_3 = Float64(sqrt(Float64(Float64(F * t_2) * Float64(C * 4.0))) / Float64(-t_2)) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-286) tmp = t_3; elseif ((B_m ^ 2.0) <= 5e-127) tmp = Float64(t_1 * Float64(-sqrt(Float64(F * t_0)))); elseif ((B_m ^ 2.0) <= 1e+77) tmp = t_3; elseif ((B_m ^ 2.0) <= 2e+152) tmp = Float64(t_1 * Float64(sqrt(F) * Float64(-sqrt(t_0)))); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, Block[{t$95$2 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(N[(F * t$95$2), $MachinePrecision] * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$2)), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-286], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-127], N[(t$95$1 * (-N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+77], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+152], N[(t$95$1 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[t$95$0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{{B\_m}^{2}}{A} \cdot -0.5\\
t_1 := \frac{\sqrt{2}}{B\_m}\\
t_2 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_3 := \frac{\sqrt{\left(F \cdot t\_2\right) \cdot \left(C \cdot 4\right)}}{-t\_2}\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-286}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-127}:\\
\;\;\;\;t\_1 \cdot \left(-\sqrt{F \cdot t\_0}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+77}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+152}:\\
\;\;\;\;t\_1 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{t\_0}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.00000000000000005e-286 or 4.9999999999999997e-127 < (pow.f64 B #s(literal 2 binary64)) < 9.99999999999999983e76Initial program 24.7%
Simplified37.4%
Taylor expanded in A around -inf 24.2%
*-commutative24.2%
Simplified24.2%
if 1.00000000000000005e-286 < (pow.f64 B #s(literal 2 binary64)) < 4.9999999999999997e-127Initial program 17.0%
Taylor expanded in C around 0 2.0%
mul-1-neg2.0%
*-commutative2.0%
*-commutative2.0%
+-commutative2.0%
unpow22.0%
unpow22.0%
hypot-define11.8%
Simplified11.8%
Taylor expanded in A around -inf 16.6%
if 9.99999999999999983e76 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e152Initial program 7.0%
Taylor expanded in C around 0 12.0%
mul-1-neg12.0%
*-commutative12.0%
*-commutative12.0%
+-commutative12.0%
unpow212.0%
unpow212.0%
hypot-define12.6%
Simplified12.6%
sqrt-prod16.5%
Applied egg-rr16.5%
Taylor expanded in A around -inf 26.5%
if 2.0000000000000001e152 < (pow.f64 B #s(literal 2 binary64)) Initial program 10.1%
Taylor expanded in C around 0 9.1%
mul-1-neg9.1%
*-commutative9.1%
*-commutative9.1%
+-commutative9.1%
unpow29.1%
unpow29.1%
hypot-define29.1%
Simplified29.1%
sqrt-prod37.6%
Applied egg-rr37.6%
Final simplification27.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 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 1e-286)
(/ (sqrt (* (* F t_0) (* C 4.0))) (- t_0))
(if (<= (pow B_m 2.0) 2e+161)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (* (/ (pow B_m 2.0) A) -0.5)))))
(* (sqrt 2.0) (* (sqrt 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) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 1e-286) {
tmp = sqrt(((F * t_0) * (C * 4.0))) / -t_0;
} else if (pow(B_m, 2.0) <= 2e+161) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * ((pow(B_m, 2.0) / A) * -0.5)));
} else {
tmp = sqrt(2.0) * (sqrt(F) * -sqrt((1.0 / B_m)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-286) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(C * 4.0))) / Float64(-t_0)); elseif ((B_m ^ 2.0) <= 2e+161) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(Float64((B_m ^ 2.0) / A) * -0.5))))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) * Float64(-sqrt(Float64(1.0 / B_m))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-286], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+161], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(1.0 / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-286}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(C \cdot 4\right)}}{-t\_0}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+161}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(\frac{{B\_m}^{2}}{A} \cdot -0.5\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{\frac{1}{B\_m}}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.00000000000000005e-286Initial program 20.0%
Simplified29.8%
Taylor expanded in A around -inf 21.3%
*-commutative21.3%
Simplified21.3%
if 1.00000000000000005e-286 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e161Initial program 19.9%
Taylor expanded in C around 0 9.6%
mul-1-neg9.6%
*-commutative9.6%
*-commutative9.6%
+-commutative9.6%
unpow29.6%
unpow29.6%
hypot-define14.3%
Simplified14.3%
Taylor expanded in A around -inf 15.5%
if 2.0000000000000001e161 < (pow.f64 B #s(literal 2 binary64)) Initial program 10.2%
Taylor expanded in B around inf 24.2%
mul-1-neg24.2%
*-commutative24.2%
Simplified24.2%
pow1/224.2%
div-inv24.2%
unpow-prod-down34.8%
pow1/234.8%
Applied egg-rr34.8%
unpow1/234.8%
Simplified34.8%
Final simplification23.8%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (/ (pow B_m 2.0) A))
(t_1 (* t_0 -0.5))
(t_2 (fma B_m B_m (* A (* C -4.0))))
(t_3 (- t_2))
(t_4 (* F t_2))
(t_5 (/ (sqrt 2.0) B_m)))
(if (<= B_m 3.9e-127)
(/ (sqrt (* t_4 (- (* C 4.0) t_0))) t_3)
(if (<= B_m 3e-56)
(* t_5 (- (sqrt (* F t_1))))
(if (<= B_m 3.1e+38)
(/ (sqrt (* t_4 (* 2.0 (+ A (+ C (hypot B_m (- A C))))))) t_3)
(if (<= B_m 1.02e+77)
(* t_5 (* (sqrt F) (- (sqrt t_1))))
(*
(* (sqrt (+ A (hypot B_m A))) (sqrt F))
(/ (- (sqrt 2.0)) B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) / A;
double t_1 = t_0 * -0.5;
double t_2 = fma(B_m, B_m, (A * (C * -4.0)));
double t_3 = -t_2;
double t_4 = F * t_2;
double t_5 = sqrt(2.0) / B_m;
double tmp;
if (B_m <= 3.9e-127) {
tmp = sqrt((t_4 * ((C * 4.0) - t_0))) / t_3;
} else if (B_m <= 3e-56) {
tmp = t_5 * -sqrt((F * t_1));
} else if (B_m <= 3.1e+38) {
tmp = sqrt((t_4 * (2.0 * (A + (C + hypot(B_m, (A - C))))))) / t_3;
} else if (B_m <= 1.02e+77) {
tmp = t_5 * (sqrt(F) * -sqrt(t_1));
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) / A) t_1 = Float64(t_0 * -0.5) t_2 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_3 = Float64(-t_2) t_4 = Float64(F * t_2) t_5 = Float64(sqrt(2.0) / B_m) tmp = 0.0 if (B_m <= 3.9e-127) tmp = Float64(sqrt(Float64(t_4 * Float64(Float64(C * 4.0) - t_0))) / t_3); elseif (B_m <= 3e-56) tmp = Float64(t_5 * Float64(-sqrt(Float64(F * t_1)))); elseif (B_m <= 3.1e+38) tmp = Float64(sqrt(Float64(t_4 * Float64(2.0 * Float64(A + Float64(C + hypot(B_m, Float64(A - C))))))) / t_3); elseif (B_m <= 1.02e+77) tmp = Float64(t_5 * Float64(sqrt(F) * Float64(-sqrt(t_1)))); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * -0.5), $MachinePrecision]}, Block[{t$95$2 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = (-t$95$2)}, Block[{t$95$4 = N[(F * t$95$2), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, If[LessEqual[B$95$m, 3.9e-127], N[(N[Sqrt[N[(t$95$4 * N[(N[(C * 4.0), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[B$95$m, 3e-56], N[(t$95$5 * (-N[Sqrt[N[(F * t$95$1), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B$95$m, 3.1e+38], N[(N[Sqrt[N[(t$95$4 * N[(2.0 * N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[B$95$m, 1.02e+77], N[(t$95$5 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[t$95$1], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{{B\_m}^{2}}{A}\\
t_1 := t\_0 \cdot -0.5\\
t_2 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_3 := -t\_2\\
t_4 := F \cdot t\_2\\
t_5 := \frac{\sqrt{2}}{B\_m}\\
\mathbf{if}\;B\_m \leq 3.9 \cdot 10^{-127}:\\
\;\;\;\;\frac{\sqrt{t\_4 \cdot \left(C \cdot 4 - t\_0\right)}}{t\_3}\\
\mathbf{elif}\;B\_m \leq 3 \cdot 10^{-56}:\\
\;\;\;\;t\_5 \cdot \left(-\sqrt{F \cdot t\_1}\right)\\
\mathbf{elif}\;B\_m \leq 3.1 \cdot 10^{+38}:\\
\;\;\;\;\frac{\sqrt{t\_4 \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)\right)}}{t\_3}\\
\mathbf{elif}\;B\_m \leq 1.02 \cdot 10^{+77}:\\
\;\;\;\;t\_5 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{t\_1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B\_m}\\
\end{array}
\end{array}
if B < 3.89999999999999966e-127Initial program 17.4%
Simplified23.2%
Taylor expanded in A around -inf 13.6%
if 3.89999999999999966e-127 < B < 2.99999999999999989e-56Initial program 1.6%
Taylor expanded in C around 0 2.7%
mul-1-neg2.7%
*-commutative2.7%
*-commutative2.7%
+-commutative2.7%
unpow22.7%
unpow22.7%
hypot-define16.3%
Simplified16.3%
Taylor expanded in A around -inf 28.2%
if 2.99999999999999989e-56 < B < 3.10000000000000018e38Initial program 38.1%
Simplified64.3%
if 3.10000000000000018e38 < B < 1.02e77Initial program 9.4%
Taylor expanded in C around 0 17.2%
mul-1-neg17.2%
*-commutative17.2%
*-commutative17.2%
+-commutative17.2%
unpow217.2%
unpow217.2%
hypot-define17.7%
Simplified17.7%
sqrt-prod23.6%
Applied egg-rr23.6%
Taylor expanded in A around -inf 32.9%
if 1.02e77 < B Initial program 12.9%
Taylor expanded in C around 0 16.6%
mul-1-neg16.6%
*-commutative16.6%
*-commutative16.6%
+-commutative16.6%
unpow216.6%
unpow216.6%
hypot-define52.4%
Simplified52.4%
sqrt-prod70.9%
Applied egg-rr70.9%
Final simplification29.6%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 1.25e-141)
(/ (sqrt (* (* F t_0) (* C 4.0))) (- t_0))
(if (<= B_m 4.55e+80)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (* (/ (pow B_m 2.0) A) -0.5)))))
(* (* (sqrt (+ A (hypot B_m A))) (sqrt F)) (/ (- (sqrt 2.0)) B_m))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 1.25e-141) {
tmp = sqrt(((F * t_0) * (C * 4.0))) / -t_0;
} else if (B_m <= 4.55e+80) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * ((pow(B_m, 2.0) / A) * -0.5)));
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 1.25e-141) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(C * 4.0))) / Float64(-t_0)); elseif (B_m <= 4.55e+80) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(Float64((B_m ^ 2.0) / A) * -0.5))))); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 1.25e-141], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[B$95$m, 4.55e+80], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 1.25 \cdot 10^{-141}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(C \cdot 4\right)}}{-t\_0}\\
\mathbf{elif}\;B\_m \leq 4.55 \cdot 10^{+80}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(\frac{{B\_m}^{2}}{A} \cdot -0.5\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B\_m}\\
\end{array}
\end{array}
if B < 1.25e-141Initial program 16.4%
Simplified22.9%
Taylor expanded in A around -inf 13.2%
*-commutative13.2%
Simplified13.2%
if 1.25e-141 < B < 4.55000000000000007e80Initial program 19.7%
Taylor expanded in C around 0 16.9%
mul-1-neg16.9%
*-commutative16.9%
*-commutative16.9%
+-commutative16.9%
unpow216.9%
unpow216.9%
hypot-define21.3%
Simplified21.3%
Taylor expanded in A around -inf 21.5%
if 4.55000000000000007e80 < B Initial program 13.1%
Taylor expanded in C around 0 17.0%
mul-1-neg17.0%
*-commutative17.0%
*-commutative17.0%
+-commutative17.0%
unpow217.0%
unpow217.0%
hypot-define53.5%
Simplified53.5%
sqrt-prod72.4%
Applied egg-rr72.4%
Final simplification25.5%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= F -1.36e+89)
(/ (sqrt (* 2.0 (* F (+ A (hypot B_m A))))) (- B_m))
(if (<= F 6.3e-304)
(sqrt (fabs (/ F A)))
(if (<= F 2.9e-26)
(* (sqrt (* F (+ C (hypot C B_m)))) (/ (- (sqrt 2.0)) B_m))
(* (sqrt 2.0) (* (sqrt 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) {
double tmp;
if (F <= -1.36e+89) {
tmp = sqrt((2.0 * (F * (A + hypot(B_m, A))))) / -B_m;
} else if (F <= 6.3e-304) {
tmp = sqrt(fabs((F / A)));
} else if (F <= 2.9e-26) {
tmp = sqrt((F * (C + hypot(C, B_m)))) * (-sqrt(2.0) / B_m);
} else {
tmp = sqrt(2.0) * (sqrt(F) * -sqrt((1.0 / B_m)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -1.36e+89) {
tmp = Math.sqrt((2.0 * (F * (A + Math.hypot(B_m, A))))) / -B_m;
} else if (F <= 6.3e-304) {
tmp = Math.sqrt(Math.abs((F / A)));
} else if (F <= 2.9e-26) {
tmp = Math.sqrt((F * (C + Math.hypot(C, B_m)))) * (-Math.sqrt(2.0) / B_m);
} else {
tmp = Math.sqrt(2.0) * (Math.sqrt(F) * -Math.sqrt((1.0 / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= -1.36e+89: tmp = math.sqrt((2.0 * (F * (A + math.hypot(B_m, A))))) / -B_m elif F <= 6.3e-304: tmp = math.sqrt(math.fabs((F / A))) elif F <= 2.9e-26: tmp = math.sqrt((F * (C + math.hypot(C, B_m)))) * (-math.sqrt(2.0) / B_m) else: tmp = math.sqrt(2.0) * (math.sqrt(F) * -math.sqrt((1.0 / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= -1.36e+89) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A + hypot(B_m, A))))) / Float64(-B_m)); elseif (F <= 6.3e-304) tmp = sqrt(abs(Float64(F / A))); elseif (F <= 2.9e-26) tmp = Float64(sqrt(Float64(F * Float64(C + hypot(C, B_m)))) * Float64(Float64(-sqrt(2.0)) / B_m)); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) * Float64(-sqrt(Float64(1.0 / B_m))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= -1.36e+89)
tmp = sqrt((2.0 * (F * (A + hypot(B_m, A))))) / -B_m;
elseif (F <= 6.3e-304)
tmp = sqrt(abs((F / A)));
elseif (F <= 2.9e-26)
tmp = sqrt((F * (C + hypot(C, B_m)))) * (-sqrt(2.0) / B_m);
else
tmp = sqrt(2.0) * (sqrt(F) * -sqrt((1.0 / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -1.36e+89], N[(N[Sqrt[N[(2.0 * N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], If[LessEqual[F, 6.3e-304], N[Sqrt[N[Abs[N[(F / A), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], If[LessEqual[F, 2.9e-26], N[(N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(1.0 / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.36 \cdot 10^{+89}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-B\_m}\\
\mathbf{elif}\;F \leq 6.3 \cdot 10^{-304}:\\
\;\;\;\;\sqrt{\left|\frac{F}{A}\right|}\\
\mathbf{elif}\;F \leq 2.9 \cdot 10^{-26}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)} \cdot \frac{-\sqrt{2}}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{\frac{1}{B\_m}}\right)\right)\\
\end{array}
\end{array}
if F < -1.36000000000000002e89Initial program 46.6%
Taylor expanded in C around 0 6.7%
mul-1-neg6.7%
*-commutative6.7%
*-commutative6.7%
+-commutative6.7%
unpow26.7%
unpow26.7%
hypot-define40.0%
Simplified40.0%
neg-sub040.0%
associate-*r/40.0%
pow1/240.3%
pow1/240.3%
pow-prod-down40.3%
Applied egg-rr40.3%
neg-sub040.3%
distribute-neg-frac240.3%
unpow1/240.0%
Simplified40.0%
if -1.36000000000000002e89 < F < 6.29999999999999984e-304Initial program 27.4%
Simplified56.9%
add-sqr-sqrt56.9%
sqrt-unprod52.7%
frac-times40.5%
Applied egg-rr43.9%
Taylor expanded in A around -inf 41.7%
mul-1-neg41.7%
Simplified41.7%
add-sqr-sqrt41.7%
pow1/241.7%
pow1/241.7%
pow-prod-down36.6%
pow236.6%
distribute-neg-frac236.6%
Applied egg-rr36.6%
unpow1/236.6%
unpow236.6%
rem-sqrt-square42.0%
distribute-frac-neg242.0%
Simplified42.0%
if 6.29999999999999984e-304 < F < 2.8999999999999998e-26Initial program 13.4%
Taylor expanded in A around 0 6.9%
mul-1-neg6.9%
*-commutative6.9%
*-commutative6.9%
+-commutative6.9%
unpow26.9%
unpow26.9%
hypot-define19.8%
Simplified19.8%
if 2.8999999999999998e-26 < F Initial program 12.2%
Taylor expanded in B around inf 22.1%
mul-1-neg22.1%
*-commutative22.1%
Simplified22.1%
pow1/222.5%
div-inv22.4%
unpow-prod-down22.5%
pow1/222.5%
Applied egg-rr22.5%
unpow1/222.5%
Simplified22.5%
Final simplification24.8%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 8.6e-143)
(/
(sqrt (* (* (* A -4.0) (* F C)) (* 2.0 (* 2.0 C))))
(- (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 4.5e+80)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (* (/ (pow B_m 2.0) A) -0.5)))))
(* (sqrt 2.0) (* (sqrt 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) {
double tmp;
if (B_m <= 8.6e-143) {
tmp = sqrt((((A * -4.0) * (F * C)) * (2.0 * (2.0 * C)))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else if (B_m <= 4.5e+80) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * ((pow(B_m, 2.0) / A) * -0.5)));
} else {
tmp = sqrt(2.0) * (sqrt(F) * -sqrt((1.0 / B_m)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 8.6e-143) tmp = Float64(sqrt(Float64(Float64(Float64(A * -4.0) * Float64(F * C)) * Float64(2.0 * Float64(2.0 * C)))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif (B_m <= 4.5e+80) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(Float64((B_m ^ 2.0) / A) * -0.5))))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) * Float64(-sqrt(Float64(1.0 / B_m))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 8.6e-143], N[(N[Sqrt[N[(N[(N[(A * -4.0), $MachinePrecision] * N[(F * C), $MachinePrecision]), $MachinePrecision] * N[(2.0 * 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[B$95$m, 4.5e+80], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(1.0 / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 8.6 \cdot 10^{-143}:\\
\;\;\;\;\frac{\sqrt{\left(\left(A \cdot -4\right) \cdot \left(F \cdot C\right)\right) \cdot \left(2 \cdot \left(2 \cdot C\right)\right)}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;B\_m \leq 4.5 \cdot 10^{+80}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(\frac{{B\_m}^{2}}{A} \cdot -0.5\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{\frac{1}{B\_m}}\right)\right)\\
\end{array}
\end{array}
if B < 8.59999999999999912e-143Initial program 16.4%
Simplified22.9%
Taylor expanded in B around 0 18.5%
associate-*r*18.5%
Simplified18.5%
Taylor expanded in A around -inf 13.3%
if 8.59999999999999912e-143 < B < 4.50000000000000007e80Initial program 19.7%
Taylor expanded in C around 0 16.9%
mul-1-neg16.9%
*-commutative16.9%
*-commutative16.9%
+-commutative16.9%
unpow216.9%
unpow216.9%
hypot-define21.3%
Simplified21.3%
Taylor expanded in A around -inf 21.5%
if 4.50000000000000007e80 < B Initial program 13.1%
Taylor expanded in B around inf 46.0%
mul-1-neg46.0%
*-commutative46.0%
Simplified46.0%
pow1/246.0%
div-inv45.8%
unpow-prod-down68.9%
pow1/268.9%
Applied egg-rr68.9%
unpow1/268.9%
Simplified68.9%
Final simplification25.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
(if (<= B_m 3.3e-140)
(/
(sqrt (* (* (* A -4.0) (* F C)) (* 2.0 (* 2.0 C))))
(- (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 8.2e-99)
(/ (sqrt (* 2.0 (* F (+ A (hypot B_m A))))) (- B_m))
(if (<= B_m 7.5e-30)
(sqrt (fabs (/ F A)))
(* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 3.3e-140) {
tmp = sqrt((((A * -4.0) * (F * C)) * (2.0 * (2.0 * C)))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else if (B_m <= 8.2e-99) {
tmp = sqrt((2.0 * (F * (A + hypot(B_m, A))))) / -B_m;
} else if (B_m <= 7.5e-30) {
tmp = sqrt(fabs((F / A)));
} else {
tmp = sqrt(2.0) * (sqrt(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) tmp = 0.0 if (B_m <= 3.3e-140) tmp = Float64(sqrt(Float64(Float64(Float64(A * -4.0) * Float64(F * C)) * Float64(2.0 * Float64(2.0 * C)))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif (B_m <= 8.2e-99) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A + hypot(B_m, A))))) / Float64(-B_m)); elseif (B_m <= 7.5e-30) tmp = sqrt(abs(Float64(F / A))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(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_] := If[LessEqual[B$95$m, 3.3e-140], N[(N[Sqrt[N[(N[(N[(A * -4.0), $MachinePrecision] * N[(F * C), $MachinePrecision]), $MachinePrecision] * N[(2.0 * 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[B$95$m, 8.2e-99], N[(N[Sqrt[N[(2.0 * N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], If[LessEqual[B$95$m, 7.5e-30], N[Sqrt[N[Abs[N[(F / A), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 3.3 \cdot 10^{-140}:\\
\;\;\;\;\frac{\sqrt{\left(\left(A \cdot -4\right) \cdot \left(F \cdot C\right)\right) \cdot \left(2 \cdot \left(2 \cdot C\right)\right)}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;B\_m \leq 8.2 \cdot 10^{-99}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-B\_m}\\
\mathbf{elif}\;B\_m \leq 7.5 \cdot 10^{-30}:\\
\;\;\;\;\sqrt{\left|\frac{F}{A}\right|}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if B < 3.29999999999999987e-140Initial program 16.4%
Simplified22.9%
Taylor expanded in B around 0 18.5%
associate-*r*18.5%
Simplified18.5%
Taylor expanded in A around -inf 13.3%
if 3.29999999999999987e-140 < B < 8.20000000000000057e-99Initial program 23.6%
Taylor expanded in C around 0 2.4%
mul-1-neg2.4%
*-commutative2.4%
*-commutative2.4%
+-commutative2.4%
unpow22.4%
unpow22.4%
hypot-define14.1%
Simplified14.1%
neg-sub014.1%
associate-*r/14.1%
pow1/214.1%
pow1/214.1%
pow-prod-down14.1%
Applied egg-rr14.1%
neg-sub014.1%
distribute-neg-frac214.1%
unpow1/214.1%
Simplified14.1%
if 8.20000000000000057e-99 < B < 7.5000000000000006e-30Initial program 3.8%
Simplified13.0%
add-sqr-sqrt13.0%
sqrt-unprod13.0%
frac-times9.9%
Applied egg-rr9.9%
Taylor expanded in A around -inf 26.8%
mul-1-neg26.8%
Simplified26.8%
add-sqr-sqrt26.8%
pow1/226.8%
pow1/226.8%
pow-prod-down19.6%
pow219.6%
distribute-neg-frac219.6%
Applied egg-rr19.6%
unpow1/219.6%
unpow219.6%
rem-sqrt-square27.1%
distribute-frac-neg227.1%
Simplified27.1%
if 7.5000000000000006e-30 < B Initial program 18.0%
Taylor expanded in B around inf 39.5%
mul-1-neg39.5%
*-commutative39.5%
Simplified39.5%
sqrt-div53.4%
Applied egg-rr53.4%
Final simplification25.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 (* F (+ A (hypot B_m A))))) (- B_m))))
(if (<= F -8.8e+93)
t_0
(if (<= F -4e-310)
(sqrt (fabs (/ F A)))
(if (<= F 7.5e-21) t_0 (- (sqrt (* 2.0 (/ F B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt((2.0 * (F * (A + hypot(B_m, A))))) / -B_m;
double tmp;
if (F <= -8.8e+93) {
tmp = t_0;
} else if (F <= -4e-310) {
tmp = sqrt(fabs((F / A)));
} else if (F <= 7.5e-21) {
tmp = t_0;
} else {
tmp = -sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = Math.sqrt((2.0 * (F * (A + Math.hypot(B_m, A))))) / -B_m;
double tmp;
if (F <= -8.8e+93) {
tmp = t_0;
} else if (F <= -4e-310) {
tmp = Math.sqrt(Math.abs((F / A)));
} else if (F <= 7.5e-21) {
tmp = t_0;
} else {
tmp = -Math.sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = math.sqrt((2.0 * (F * (A + math.hypot(B_m, A))))) / -B_m tmp = 0 if F <= -8.8e+93: tmp = t_0 elif F <= -4e-310: tmp = math.sqrt(math.fabs((F / A))) elif F <= 7.5e-21: tmp = t_0 else: tmp = -math.sqrt((2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A + hypot(B_m, A))))) / Float64(-B_m)) tmp = 0.0 if (F <= -8.8e+93) tmp = t_0; elseif (F <= -4e-310) tmp = sqrt(abs(Float64(F / A))); elseif (F <= 7.5e-21) tmp = t_0; else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = sqrt((2.0 * (F * (A + hypot(B_m, A))))) / -B_m;
tmp = 0.0;
if (F <= -8.8e+93)
tmp = t_0;
elseif (F <= -4e-310)
tmp = sqrt(abs((F / A)));
elseif (F <= 7.5e-21)
tmp = t_0;
else
tmp = -sqrt((2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[N[(2.0 * N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]}, If[LessEqual[F, -8.8e+93], t$95$0, If[LessEqual[F, -4e-310], N[Sqrt[N[Abs[N[(F / A), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], If[LessEqual[F, 7.5e-21], t$95$0, (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2 \cdot \left(F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-B\_m}\\
\mathbf{if}\;F \leq -8.8 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\left|\frac{F}{A}\right|}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-21}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if F < -8.80000000000000084e93 or -3.999999999999988e-310 < F < 7.50000000000000072e-21Initial program 17.1%
Taylor expanded in C around 0 8.2%
mul-1-neg8.2%
*-commutative8.2%
*-commutative8.2%
+-commutative8.2%
unpow28.2%
unpow28.2%
hypot-define24.2%
Simplified24.2%
neg-sub024.2%
associate-*r/24.2%
pow1/224.2%
pow1/224.2%
pow-prod-down24.3%
Applied egg-rr24.3%
neg-sub024.3%
distribute-neg-frac224.3%
unpow1/224.3%
Simplified24.3%
if -8.80000000000000084e93 < F < -3.999999999999988e-310Initial program 29.3%
Simplified60.9%
add-sqr-sqrt60.9%
sqrt-unprod56.4%
frac-times43.4%
Applied egg-rr47.0%
Taylor expanded in A around -inf 44.2%
mul-1-neg44.2%
Simplified44.2%
add-sqr-sqrt44.2%
pow1/244.2%
pow1/244.2%
pow-prod-down38.7%
pow238.7%
distribute-neg-frac238.7%
Applied egg-rr38.7%
unpow1/238.7%
unpow238.7%
rem-sqrt-square44.5%
distribute-frac-neg244.5%
Simplified44.5%
if 7.50000000000000072e-21 < F Initial program 12.4%
Taylor expanded in B around inf 21.9%
mul-1-neg21.9%
*-commutative21.9%
Simplified21.9%
*-commutative21.9%
pow1/222.2%
pow1/222.2%
pow-prod-down22.3%
Applied egg-rr22.3%
unpow1/221.9%
Simplified21.9%
Final simplification25.5%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= F 6.3e-304)
(sqrt (+ -1.0 (- 1.0 (/ F A))))
(if (<= F 3.9e-19)
(* (sqrt (* B_m F)) (/ (- (sqrt 2.0)) B_m))
(- (sqrt (* 2.0 (/ F B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 6.3e-304) {
tmp = sqrt((-1.0 + (1.0 - (F / A))));
} else if (F <= 3.9e-19) {
tmp = sqrt((B_m * F)) * (-sqrt(2.0) / B_m);
} else {
tmp = -sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 6.3d-304) then
tmp = sqrt(((-1.0d0) + (1.0d0 - (f / a))))
else if (f <= 3.9d-19) then
tmp = sqrt((b_m * f)) * (-sqrt(2.0d0) / b_m)
else
tmp = -sqrt((2.0d0 * (f / b_m)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 6.3e-304) {
tmp = Math.sqrt((-1.0 + (1.0 - (F / A))));
} else if (F <= 3.9e-19) {
tmp = Math.sqrt((B_m * F)) * (-Math.sqrt(2.0) / B_m);
} else {
tmp = -Math.sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 6.3e-304: tmp = math.sqrt((-1.0 + (1.0 - (F / A)))) elif F <= 3.9e-19: tmp = math.sqrt((B_m * F)) * (-math.sqrt(2.0) / B_m) else: tmp = -math.sqrt((2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 6.3e-304) tmp = sqrt(Float64(-1.0 + Float64(1.0 - Float64(F / A)))); elseif (F <= 3.9e-19) tmp = Float64(sqrt(Float64(B_m * F)) * Float64(Float64(-sqrt(2.0)) / B_m)); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 6.3e-304)
tmp = sqrt((-1.0 + (1.0 - (F / A))));
elseif (F <= 3.9e-19)
tmp = sqrt((B_m * F)) * (-sqrt(2.0) / B_m);
else
tmp = -sqrt((2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 6.3e-304], N[Sqrt[N[(-1.0 + N[(1.0 - N[(F / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[F, 3.9e-19], N[(N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 6.3 \cdot 10^{-304}:\\
\;\;\;\;\sqrt{-1 + \left(1 - \frac{F}{A}\right)}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-19}:\\
\;\;\;\;\sqrt{B\_m \cdot F} \cdot \frac{-\sqrt{2}}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if F < 6.29999999999999984e-304Initial program 33.8%
Simplified51.2%
add-sqr-sqrt51.2%
sqrt-unprod42.1%
frac-times34.0%
Applied egg-rr36.3%
Taylor expanded in A around -inf 30.6%
mul-1-neg30.6%
Simplified30.6%
expm1-log1p-u30.1%
expm1-undefine31.0%
distribute-neg-frac231.0%
Applied egg-rr31.0%
sub-neg31.0%
log1p-undefine31.0%
rem-exp-log31.5%
distribute-frac-neg231.5%
unsub-neg31.5%
metadata-eval31.5%
Simplified31.5%
if 6.29999999999999984e-304 < F < 3.89999999999999995e-19Initial program 13.1%
Taylor expanded in C around 0 8.5%
mul-1-neg8.5%
*-commutative8.5%
*-commutative8.5%
+-commutative8.5%
unpow28.5%
unpow28.5%
hypot-define22.2%
Simplified22.2%
Taylor expanded in A around 0 18.5%
if 3.89999999999999995e-19 < F Initial program 12.4%
Taylor expanded in B around inf 21.9%
mul-1-neg21.9%
*-commutative21.9%
Simplified21.9%
*-commutative21.9%
pow1/222.2%
pow1/222.2%
pow-prod-down22.3%
Applied egg-rr22.3%
unpow1/221.9%
Simplified21.9%
Final simplification22.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 2.3e-30) (sqrt (fabs (/ F A))) (- (sqrt (* 2.0 (/ F B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 2.3e-30) {
tmp = sqrt(fabs((F / A)));
} else {
tmp = -sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 2.3d-30) then
tmp = sqrt(abs((f / a)))
else
tmp = -sqrt((2.0d0 * (f / b_m)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 2.3e-30) {
tmp = Math.sqrt(Math.abs((F / A)));
} else {
tmp = -Math.sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 2.3e-30: tmp = math.sqrt(math.fabs((F / A))) else: tmp = -math.sqrt((2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 2.3e-30) tmp = sqrt(abs(Float64(F / A))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 2.3e-30)
tmp = sqrt(abs((F / A)));
else
tmp = -sqrt((2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 2.3e-30], N[Sqrt[N[Abs[N[(F / A), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 2.3 \cdot 10^{-30}:\\
\;\;\;\;\sqrt{\left|\frac{F}{A}\right|}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if B < 2.29999999999999984e-30Initial program 15.8%
Simplified22.3%
add-sqr-sqrt12.7%
sqrt-unprod11.2%
frac-times9.1%
Applied egg-rr9.6%
Taylor expanded in A around -inf 14.4%
mul-1-neg14.4%
Simplified14.4%
add-sqr-sqrt14.4%
pow1/214.4%
pow1/214.4%
pow-prod-down13.3%
pow213.3%
distribute-neg-frac213.3%
Applied egg-rr13.3%
unpow1/213.3%
unpow213.3%
rem-sqrt-square14.9%
distribute-frac-neg214.9%
Simplified14.9%
if 2.29999999999999984e-30 < B Initial program 18.0%
Taylor expanded in B around inf 39.5%
mul-1-neg39.5%
*-commutative39.5%
Simplified39.5%
*-commutative39.5%
pow1/239.5%
pow1/239.5%
pow-prod-down39.6%
Applied egg-rr39.6%
unpow1/239.6%
Simplified39.6%
Final simplification22.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.9e-30) (sqrt (/ F (- A))) (- (sqrt (* 2.0 (/ F B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.9e-30) {
tmp = sqrt((F / -A));
} else {
tmp = -sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 1.9d-30) then
tmp = sqrt((f / -a))
else
tmp = -sqrt((2.0d0 * (f / b_m)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.9e-30) {
tmp = Math.sqrt((F / -A));
} else {
tmp = -Math.sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.9e-30: tmp = math.sqrt((F / -A)) else: tmp = -math.sqrt((2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.9e-30) tmp = sqrt(Float64(F / Float64(-A))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 1.9e-30)
tmp = sqrt((F / -A));
else
tmp = -sqrt((2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.9e-30], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.9 \cdot 10^{-30}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if B < 1.9000000000000002e-30Initial program 15.8%
Simplified22.3%
add-sqr-sqrt12.7%
sqrt-unprod11.2%
frac-times9.1%
Applied egg-rr9.6%
Taylor expanded in A around -inf 14.4%
mul-1-neg14.4%
Simplified14.4%
if 1.9000000000000002e-30 < B Initial program 18.0%
Taylor expanded in B around inf 39.5%
mul-1-neg39.5%
*-commutative39.5%
Simplified39.5%
*-commutative39.5%
pow1/239.5%
pow1/239.5%
pow-prod-down39.6%
Applied egg-rr39.6%
unpow1/239.6%
Simplified39.6%
Final simplification21.9%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (sqrt (/ F (- A))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt((F / -A));
}
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 / -a))
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 / -A));
}
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 / -A))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return sqrt(Float64(F / Float64(-A))) 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 / -A));
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 / (-A)), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{\frac{F}{-A}}
\end{array}
Initial program 16.5%
Simplified23.1%
add-sqr-sqrt10.3%
sqrt-unprod8.9%
frac-times7.2%
Applied egg-rr7.6%
Taylor expanded in A around -inf 11.6%
mul-1-neg11.6%
Simplified11.6%
Final simplification11.6%
herbie shell --seed 2024177
(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))))