
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (+ A (- C (hypot B_m (- A C)))))
(t_1 (fma C (* A -4.0) (pow B_m 2.0)))
(t_2 (fma B_m B_m (* A (* C -4.0))))
(t_3
(/
(sqrt (* (* t_2 F) (* 2.0 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))))
(- t_2))))
(if (<= (pow B_m 2.0) 1e-134)
t_3
(if (<= (pow B_m 2.0) 4e-36)
(/ (* (sqrt (* F t_0)) (sqrt (* 2.0 t_1))) (- t_1))
(if (<= (pow B_m 2.0) 2e-11)
t_3
(if (<= (pow B_m 2.0) 1e+288)
(*
(sqrt 2.0)
(- (sqrt (* F (/ t_0 (fma -4.0 (* A C) (pow B_m 2.0)))))))
(* (sqrt (* F (- A (hypot B_m A)))) (/ (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 = A + (C - hypot(B_m, (A - C)));
double t_1 = fma(C, (A * -4.0), pow(B_m, 2.0));
double t_2 = fma(B_m, B_m, (A * (C * -4.0)));
double t_3 = sqrt(((t_2 * F) * (2.0 * (A + (A + (-0.5 * (pow(B_m, 2.0) / C))))))) / -t_2;
double tmp;
if (pow(B_m, 2.0) <= 1e-134) {
tmp = t_3;
} else if (pow(B_m, 2.0) <= 4e-36) {
tmp = (sqrt((F * t_0)) * sqrt((2.0 * t_1))) / -t_1;
} else if (pow(B_m, 2.0) <= 2e-11) {
tmp = t_3;
} else if (pow(B_m, 2.0) <= 1e+288) {
tmp = sqrt(2.0) * -sqrt((F * (t_0 / fma(-4.0, (A * C), pow(B_m, 2.0)))));
} else {
tmp = sqrt((F * (A - hypot(B_m, A)))) * (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(A + Float64(C - hypot(B_m, Float64(A - C)))) t_1 = fma(C, Float64(A * -4.0), (B_m ^ 2.0)) t_2 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_3 = Float64(sqrt(Float64(Float64(t_2 * F) * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))))) / Float64(-t_2)) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-134) tmp = t_3; elseif ((B_m ^ 2.0) <= 4e-36) tmp = Float64(Float64(sqrt(Float64(F * t_0)) * sqrt(Float64(2.0 * t_1))) / Float64(-t_1)); elseif ((B_m ^ 2.0) <= 2e-11) tmp = t_3; elseif ((B_m ^ 2.0) <= 1e+288) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(t_0 / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))))); else tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-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[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $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[(t$95$2 * F), $MachinePrecision] * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$2)), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-134], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-36], N[(N[(N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-11], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+288], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(t$95$0 / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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 := A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\\
t_1 := \mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)\\
t_2 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_3 := \frac{\sqrt{\left(t\_2 \cdot F\right) \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\right)\right)}}{-t\_2}\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-134}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{-36}:\\
\;\;\;\;\frac{\sqrt{F \cdot t\_0} \cdot \sqrt{2 \cdot t\_1}}{-t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+288}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{t\_0}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.00000000000000004e-134 or 3.9999999999999998e-36 < (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999988e-11Initial program 20.5%
Simplified30.9%
Taylor expanded in C around inf 31.9%
mul-1-neg31.9%
Simplified31.9%
if 1.00000000000000004e-134 < (pow.f64 B #s(literal 2 binary64)) < 3.9999999999999998e-36Initial program 49.0%
Simplified51.3%
pow1/251.3%
associate-*r*54.8%
unpow-prod-down60.9%
associate-+r-60.8%
hypot-undefine56.2%
unpow256.2%
unpow256.2%
+-commutative56.2%
unpow256.2%
unpow256.2%
hypot-define60.8%
pow1/260.8%
Applied egg-rr60.8%
unpow1/260.8%
associate-+r-60.9%
hypot-undefine56.2%
unpow256.2%
unpow256.2%
+-commutative56.2%
unpow256.2%
unpow256.2%
hypot-undefine60.9%
Simplified60.9%
if 1.99999999999999988e-11 < (pow.f64 B #s(literal 2 binary64)) < 1e288Initial program 34.4%
Taylor expanded in F around 0 50.1%
mul-1-neg50.1%
*-commutative50.1%
associate-/l*60.4%
associate--l+60.4%
unpow260.4%
unpow260.4%
hypot-undefine68.0%
cancel-sign-sub-inv68.0%
Simplified68.0%
if 1e288 < (pow.f64 B #s(literal 2 binary64)) Initial program 1.7%
Taylor expanded in C around 0 6.2%
mul-1-neg6.2%
+-commutative6.2%
unpow26.2%
unpow26.2%
hypot-define34.9%
Simplified34.9%
Final simplification45.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 (+ A (- C (hypot B_m (- A C)))))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2 (- t_1))
(t_3
(/
(sqrt (* (* t_1 F) (* 2.0 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))))
t_2)))
(if (<= (pow B_m 2.0) 1e-134)
t_3
(if (<= (pow B_m 2.0) 4e-36)
(/ (* (hypot B_m (sqrt (* -4.0 (* A C)))) (sqrt (* t_0 (* 2.0 F)))) t_2)
(if (<= (pow B_m 2.0) 2e-11)
t_3
(if (<= (pow B_m 2.0) 1e+288)
(*
(sqrt 2.0)
(- (sqrt (* F (/ t_0 (fma -4.0 (* A C) (pow B_m 2.0)))))))
(* (sqrt (* F (- A (hypot B_m A)))) (/ (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 = A + (C - hypot(B_m, (A - C)));
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = -t_1;
double t_3 = sqrt(((t_1 * F) * (2.0 * (A + (A + (-0.5 * (pow(B_m, 2.0) / C))))))) / t_2;
double tmp;
if (pow(B_m, 2.0) <= 1e-134) {
tmp = t_3;
} else if (pow(B_m, 2.0) <= 4e-36) {
tmp = (hypot(B_m, sqrt((-4.0 * (A * C)))) * sqrt((t_0 * (2.0 * F)))) / t_2;
} else if (pow(B_m, 2.0) <= 2e-11) {
tmp = t_3;
} else if (pow(B_m, 2.0) <= 1e+288) {
tmp = sqrt(2.0) * -sqrt((F * (t_0 / fma(-4.0, (A * C), pow(B_m, 2.0)))));
} else {
tmp = sqrt((F * (A - hypot(B_m, A)))) * (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(A + Float64(C - hypot(B_m, Float64(A - C)))) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(-t_1) t_3 = Float64(sqrt(Float64(Float64(t_1 * F) * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))))) / t_2) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-134) tmp = t_3; elseif ((B_m ^ 2.0) <= 4e-36) tmp = Float64(Float64(hypot(B_m, sqrt(Float64(-4.0 * Float64(A * C)))) * sqrt(Float64(t_0 * Float64(2.0 * F)))) / t_2); elseif ((B_m ^ 2.0) <= 2e-11) tmp = t_3; elseif ((B_m ^ 2.0) <= 1e+288) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(t_0 / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))))); else tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-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[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-t$95$1)}, Block[{t$95$3 = N[(N[Sqrt[N[(N[(t$95$1 * F), $MachinePrecision] * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-134], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-36], N[(N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] * N[Sqrt[N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-11], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+288], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(t$95$0 / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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 := A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := -t\_1\\
t_3 := \frac{\sqrt{\left(t\_1 \cdot F\right) \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\right)\right)}}{t\_2}\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-134}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{-36}:\\
\;\;\;\;\frac{\mathsf{hypot}\left(B\_m, \sqrt{-4 \cdot \left(A \cdot C\right)}\right) \cdot \sqrt{t\_0 \cdot \left(2 \cdot F\right)}}{t\_2}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+288}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{t\_0}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.00000000000000004e-134 or 3.9999999999999998e-36 < (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999988e-11Initial program 20.5%
Simplified30.9%
Taylor expanded in C around inf 31.9%
mul-1-neg31.9%
Simplified31.9%
if 1.00000000000000004e-134 < (pow.f64 B #s(literal 2 binary64)) < 3.9999999999999998e-36Initial program 49.0%
Simplified59.2%
pow1/259.2%
associate-*l*54.8%
unpow-prod-down60.8%
pow1/260.8%
fma-undefine60.8%
add-sqr-sqrt60.8%
hypot-define60.8%
Applied egg-rr60.7%
associate-*r*60.7%
*-commutative60.7%
unpow1/260.7%
associate-*r*60.7%
associate-+r-60.8%
hypot-undefine56.2%
unpow256.2%
unpow256.2%
+-commutative56.2%
unpow256.2%
unpow256.2%
hypot-undefine60.8%
Simplified60.8%
if 1.99999999999999988e-11 < (pow.f64 B #s(literal 2 binary64)) < 1e288Initial program 34.4%
Taylor expanded in F around 0 50.1%
mul-1-neg50.1%
*-commutative50.1%
associate-/l*60.4%
associate--l+60.4%
unpow260.4%
unpow260.4%
hypot-undefine68.0%
cancel-sign-sub-inv68.0%
Simplified68.0%
if 1e288 < (pow.f64 B #s(literal 2 binary64)) Initial program 1.7%
Taylor expanded in C around 0 6.2%
mul-1-neg6.2%
+-commutative6.2%
unpow26.2%
unpow26.2%
hypot-define34.9%
Simplified34.9%
Final simplification45.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 (+ A (- C (hypot B_m (- A C)))))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2 (- t_1))
(t_3 (* t_1 F))
(t_4
(/
(sqrt (* t_3 (* 2.0 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))))
t_2)))
(if (<= (pow B_m 2.0) 1e-188)
t_4
(if (<= (pow B_m 2.0) 4e-36)
(/ (sqrt (* t_3 (* 2.0 t_0))) t_2)
(if (<= (pow B_m 2.0) 2e-11)
t_4
(if (<= (pow B_m 2.0) 1e+288)
(*
(sqrt 2.0)
(- (sqrt (* F (/ t_0 (fma -4.0 (* A C) (pow B_m 2.0)))))))
(* (sqrt (* F (- A (hypot B_m A)))) (/ (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 = A + (C - hypot(B_m, (A - C)));
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = -t_1;
double t_3 = t_1 * F;
double t_4 = sqrt((t_3 * (2.0 * (A + (A + (-0.5 * (pow(B_m, 2.0) / C))))))) / t_2;
double tmp;
if (pow(B_m, 2.0) <= 1e-188) {
tmp = t_4;
} else if (pow(B_m, 2.0) <= 4e-36) {
tmp = sqrt((t_3 * (2.0 * t_0))) / t_2;
} else if (pow(B_m, 2.0) <= 2e-11) {
tmp = t_4;
} else if (pow(B_m, 2.0) <= 1e+288) {
tmp = sqrt(2.0) * -sqrt((F * (t_0 / fma(-4.0, (A * C), pow(B_m, 2.0)))));
} else {
tmp = sqrt((F * (A - hypot(B_m, A)))) * (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(A + Float64(C - hypot(B_m, Float64(A - C)))) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(-t_1) t_3 = Float64(t_1 * F) t_4 = Float64(sqrt(Float64(t_3 * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))))) / t_2) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-188) tmp = t_4; elseif ((B_m ^ 2.0) <= 4e-36) tmp = Float64(sqrt(Float64(t_3 * Float64(2.0 * t_0))) / t_2); elseif ((B_m ^ 2.0) <= 2e-11) tmp = t_4; elseif ((B_m ^ 2.0) <= 1e+288) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(t_0 / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))))); else tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-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[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-t$95$1)}, Block[{t$95$3 = N[(t$95$1 * F), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(t$95$3 * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-188], t$95$4, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-36], N[(N[Sqrt[N[(t$95$3 * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-11], t$95$4, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+288], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(t$95$0 / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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 := A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := -t\_1\\
t_3 := t\_1 \cdot F\\
t_4 := \frac{\sqrt{t\_3 \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\right)\right)}}{t\_2}\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-188}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{-36}:\\
\;\;\;\;\frac{\sqrt{t\_3 \cdot \left(2 \cdot t\_0\right)}}{t\_2}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+288}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{t\_0}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999995e-189 or 3.9999999999999998e-36 < (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999988e-11Initial program 18.3%
Simplified29.4%
Taylor expanded in C around inf 30.8%
mul-1-neg30.8%
Simplified30.8%
if 9.9999999999999995e-189 < (pow.f64 B #s(literal 2 binary64)) < 3.9999999999999998e-36Initial program 49.1%
Simplified56.8%
if 1.99999999999999988e-11 < (pow.f64 B #s(literal 2 binary64)) < 1e288Initial program 34.4%
Taylor expanded in F around 0 50.1%
mul-1-neg50.1%
*-commutative50.1%
associate-/l*60.4%
associate--l+60.4%
unpow260.4%
unpow260.4%
hypot-undefine68.0%
cancel-sign-sub-inv68.0%
Simplified68.0%
if 1e288 < (pow.f64 B #s(literal 2 binary64)) Initial program 1.7%
Taylor expanded in C around 0 6.2%
mul-1-neg6.2%
+-commutative6.2%
unpow26.2%
unpow26.2%
hypot-define34.9%
Simplified34.9%
Final simplification45.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 (hypot B_m (- A C)))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2 (- t_1))
(t_3 (* t_1 F))
(t_4
(/
(sqrt (* t_3 (* 2.0 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))))
t_2)))
(if (<= (pow B_m 2.0) 1e-188)
t_4
(if (<= (pow B_m 2.0) 4e-36)
(/ (sqrt (* t_3 (* 2.0 (+ A (- C t_0))))) t_2)
(if (<= (pow B_m 2.0) 2e-11)
t_4
(if (<= (pow B_m 2.0) 1e+288)
(-
(sqrt
(*
2.0
(* F (/ (- (+ A C) t_0) (fma -4.0 (* A C) (pow B_m 2.0)))))))
(* (sqrt (* F (- A (hypot B_m A)))) (/ (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 = hypot(B_m, (A - C));
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = -t_1;
double t_3 = t_1 * F;
double t_4 = sqrt((t_3 * (2.0 * (A + (A + (-0.5 * (pow(B_m, 2.0) / C))))))) / t_2;
double tmp;
if (pow(B_m, 2.0) <= 1e-188) {
tmp = t_4;
} else if (pow(B_m, 2.0) <= 4e-36) {
tmp = sqrt((t_3 * (2.0 * (A + (C - t_0))))) / t_2;
} else if (pow(B_m, 2.0) <= 2e-11) {
tmp = t_4;
} else if (pow(B_m, 2.0) <= 1e+288) {
tmp = -sqrt((2.0 * (F * (((A + C) - t_0) / fma(-4.0, (A * C), pow(B_m, 2.0))))));
} else {
tmp = sqrt((F * (A - hypot(B_m, A)))) * (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 = hypot(B_m, Float64(A - C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(-t_1) t_3 = Float64(t_1 * F) t_4 = Float64(sqrt(Float64(t_3 * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))))) / t_2) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-188) tmp = t_4; elseif ((B_m ^ 2.0) <= 4e-36) tmp = Float64(sqrt(Float64(t_3 * Float64(2.0 * Float64(A + Float64(C - t_0))))) / t_2); elseif ((B_m ^ 2.0) <= 2e-11) tmp = t_4; elseif ((B_m ^ 2.0) <= 1e+288) tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(Float64(Float64(A + C) - t_0) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))))); else tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-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[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-t$95$1)}, Block[{t$95$3 = N[(t$95$1 * F), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(t$95$3 * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-188], t$95$4, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-36], N[(N[Sqrt[N[(t$95$3 * N[(2.0 * N[(A + N[(C - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-11], t$95$4, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+288], (-N[Sqrt[N[(2.0 * N[(F * N[(N[(N[(A + C), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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{hypot}\left(B\_m, A - C\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := -t\_1\\
t_3 := t\_1 \cdot F\\
t_4 := \frac{\sqrt{t\_3 \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\right)\right)}}{t\_2}\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-188}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{-36}:\\
\;\;\;\;\frac{\sqrt{t\_3 \cdot \left(2 \cdot \left(A + \left(C - t\_0\right)\right)\right)}}{t\_2}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+288}:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{\left(A + C\right) - t\_0}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999995e-189 or 3.9999999999999998e-36 < (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999988e-11Initial program 18.3%
Simplified29.4%
Taylor expanded in C around inf 30.8%
mul-1-neg30.8%
Simplified30.8%
if 9.9999999999999995e-189 < (pow.f64 B #s(literal 2 binary64)) < 3.9999999999999998e-36Initial program 49.1%
Simplified56.8%
if 1.99999999999999988e-11 < (pow.f64 B #s(literal 2 binary64)) < 1e288Initial program 34.4%
Taylor expanded in F around 0 50.1%
mul-1-neg50.1%
*-commutative50.1%
associate-/l*60.4%
associate--l+60.4%
unpow260.4%
unpow260.4%
hypot-undefine68.0%
cancel-sign-sub-inv68.0%
Simplified68.0%
*-commutative68.0%
pow1/268.0%
pow1/268.0%
pow-prod-down68.4%
*-commutative68.4%
associate-+r-67.9%
*-commutative67.9%
Applied egg-rr67.9%
unpow1/267.9%
Simplified67.9%
if 1e288 < (pow.f64 B #s(literal 2 binary64)) Initial program 1.7%
Taylor expanded in C around 0 6.2%
mul-1-neg6.2%
+-commutative6.2%
unpow26.2%
unpow26.2%
hypot-define34.9%
Simplified34.9%
Final simplification45.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 (* A 4.0))))
(if (<= (pow B_m 2.0) 4e-86)
(/
(sqrt (* (* 2.0 (* F (- (pow B_m 2.0) t_0))) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 1e+288)
(-
(sqrt
(*
2.0
(*
F
(/
(- (+ A C) (hypot B_m (- A C)))
(fma -4.0 (* A C) (pow B_m 2.0)))))))
(* (sqrt (* F (- A (hypot B_m A)))) (/ (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 = C * (A * 4.0);
double tmp;
if (pow(B_m, 2.0) <= 4e-86) {
tmp = sqrt(((2.0 * (F * (pow(B_m, 2.0) - t_0))) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 1e+288) {
tmp = -sqrt((2.0 * (F * (((A + C) - hypot(B_m, (A - C))) / fma(-4.0, (A * C), pow(B_m, 2.0))))));
} else {
tmp = sqrt((F * (A - hypot(B_m, A)))) * (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(C * Float64(A * 4.0)) tmp = 0.0 if ((B_m ^ 2.0) <= 4e-86) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(F * Float64((B_m ^ 2.0) - t_0))) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 1e+288) tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(Float64(Float64(A + C) - hypot(B_m, Float64(A - C))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))))); else tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-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[(A * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-86], N[(N[Sqrt[N[(N[(2.0 * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+288], (-N[Sqrt[N[(2.0 * N[(F * 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]), $MachinePrecision]], $MachinePrecision]), N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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 := C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 4 \cdot 10^{-86}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(F \cdot \left({B\_m}^{2} - t\_0\right)\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+288}:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{\left(A + C\right) - \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.00000000000000034e-86Initial program 22.8%
Taylor expanded in A around -inf 30.4%
if 4.00000000000000034e-86 < (pow.f64 B #s(literal 2 binary64)) < 1e288Initial program 35.5%
Taylor expanded in F around 0 48.9%
mul-1-neg48.9%
*-commutative48.9%
associate-/l*56.9%
associate--l+57.1%
unpow257.1%
unpow257.1%
hypot-undefine63.5%
cancel-sign-sub-inv63.5%
Simplified63.5%
*-commutative63.5%
pow1/263.5%
pow1/263.5%
pow-prod-down63.8%
*-commutative63.8%
associate-+r-63.1%
*-commutative63.1%
Applied egg-rr63.1%
unpow1/263.1%
Simplified63.1%
if 1e288 < (pow.f64 B #s(literal 2 binary64)) Initial program 1.7%
Taylor expanded in C around 0 6.2%
mul-1-neg6.2%
+-commutative6.2%
unpow26.2%
unpow26.2%
hypot-define34.9%
Simplified34.9%
Final simplification43.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 (* C (* A 4.0))))
(if (<= (pow B_m 2.0) 4e-86)
(/
(sqrt (* (* 2.0 (* F (- (pow B_m 2.0) t_0))) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(* (sqrt (* F (- A (hypot B_m A)))) (/ (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 = C * (A * 4.0);
double tmp;
if (pow(B_m, 2.0) <= 4e-86) {
tmp = sqrt(((2.0 * (F * (pow(B_m, 2.0) - t_0))) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else {
tmp = sqrt((F * (A - hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = C * (A * 4.0);
double tmp;
if (Math.pow(B_m, 2.0) <= 4e-86) {
tmp = Math.sqrt(((2.0 * (F * (Math.pow(B_m, 2.0) - t_0))) * (2.0 * A))) / (t_0 - Math.pow(B_m, 2.0));
} else {
tmp = Math.sqrt((F * (A - Math.hypot(B_m, A)))) * (Math.sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = C * (A * 4.0) tmp = 0 if math.pow(B_m, 2.0) <= 4e-86: tmp = math.sqrt(((2.0 * (F * (math.pow(B_m, 2.0) - t_0))) * (2.0 * A))) / (t_0 - math.pow(B_m, 2.0)) else: tmp = math.sqrt((F * (A - math.hypot(B_m, A)))) * (math.sqrt(2.0) / -B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(C * Float64(A * 4.0)) tmp = 0.0 if ((B_m ^ 2.0) <= 4e-86) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(F * Float64((B_m ^ 2.0) - t_0))) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); else tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = C * (A * 4.0);
tmp = 0.0;
if ((B_m ^ 2.0) <= 4e-86)
tmp = sqrt(((2.0 * (F * ((B_m ^ 2.0) - t_0))) * (2.0 * A))) / (t_0 - (B_m ^ 2.0));
else
tmp = sqrt((F * (A - hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-86], N[(N[Sqrt[N[(N[(2.0 * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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 := C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 4 \cdot 10^{-86}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(F \cdot \left({B\_m}^{2} - t\_0\right)\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.00000000000000034e-86Initial program 22.8%
Taylor expanded in A around -inf 30.4%
if 4.00000000000000034e-86 < (pow.f64 B #s(literal 2 binary64)) Initial program 21.7%
Taylor expanded in C around 0 16.1%
mul-1-neg16.1%
+-commutative16.1%
unpow216.1%
unpow216.1%
hypot-define28.6%
Simplified28.6%
Final simplification29.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
(if (<= (pow B_m 2.0) 2e-110)
(/
(sqrt (* -8.0 (* (* A C) (* F (+ A A)))))
(- (fma C (* A -4.0) (pow B_m 2.0))))
(* (sqrt (* F (- A (hypot B_m A)))) (/ (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 tmp;
if (pow(B_m, 2.0) <= 2e-110) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / -fma(C, (A * -4.0), pow(B_m, 2.0));
} else {
tmp = sqrt((F * (A - hypot(B_m, A)))) * (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) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-110) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(-fma(C, Float64(A * -4.0), (B_m ^ 2.0)))); else tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-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[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-110], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-110}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e-110Initial program 22.3%
Simplified27.3%
Taylor expanded in C around inf 30.3%
associate-*r*30.5%
*-commutative30.5%
mul-1-neg30.5%
Simplified30.5%
if 2.0000000000000001e-110 < (pow.f64 B #s(literal 2 binary64)) Initial program 21.9%
Taylor expanded in C around 0 15.9%
mul-1-neg15.9%
+-commutative15.9%
unpow215.9%
unpow215.9%
hypot-define28.2%
Simplified28.2%
Final simplification29.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 (<= C 1.2e+45) (* (sqrt (* F (- A (hypot B_m A)))) (/ (sqrt 2.0) (- B_m))) (- (sqrt (* 2.0 (* F (/ -0.5 C)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 1.2e+45) {
tmp = sqrt((F * (A - hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
} else {
tmp = -sqrt((2.0 * (F * (-0.5 / C))));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 1.2e+45) {
tmp = Math.sqrt((F * (A - Math.hypot(B_m, A)))) * (Math.sqrt(2.0) / -B_m);
} else {
tmp = -Math.sqrt((2.0 * (F * (-0.5 / C))));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= 1.2e+45: tmp = math.sqrt((F * (A - math.hypot(B_m, A)))) * (math.sqrt(2.0) / -B_m) else: tmp = -math.sqrt((2.0 * (F * (-0.5 / C)))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= 1.2e+45) tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(-0.5 / C))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= 1.2e+45)
tmp = sqrt((F * (A - hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
else
tmp = -sqrt((2.0 * (F * (-0.5 / C))));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 1.2e+45], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 1.2 \cdot 10^{+45}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{-0.5}{C}\right)}\\
\end{array}
\end{array}
if C < 1.19999999999999995e45Initial program 27.6%
Taylor expanded in C around 0 12.7%
mul-1-neg12.7%
+-commutative12.7%
unpow212.7%
unpow212.7%
hypot-define21.0%
Simplified21.0%
if 1.19999999999999995e45 < C Initial program 2.7%
Taylor expanded in F around 0 5.6%
mul-1-neg5.6%
*-commutative5.6%
associate-/l*8.9%
associate--l+9.5%
unpow29.5%
unpow29.5%
hypot-undefine13.3%
cancel-sign-sub-inv13.3%
Simplified13.3%
Taylor expanded in A around -inf 32.8%
pow132.8%
sqrt-unprod33.0%
Applied egg-rr33.0%
unpow133.0%
Simplified33.0%
Final simplification23.7%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= C 6e+42) (* (sqrt (* F (/ (+ (+ (/ A B_m) (/ C B_m)) -1.0) B_m))) (- (sqrt 2.0))) (- (sqrt (* 2.0 (* F (/ -0.5 C)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 6e+42) {
tmp = sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * -sqrt(2.0);
} else {
tmp = -sqrt((2.0 * (F * (-0.5 / C))));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 6d+42) then
tmp = sqrt((f * ((((a / b_m) + (c / b_m)) + (-1.0d0)) / b_m))) * -sqrt(2.0d0)
else
tmp = -sqrt((2.0d0 * (f * ((-0.5d0) / c))))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 6e+42) {
tmp = Math.sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * -Math.sqrt(2.0);
} else {
tmp = -Math.sqrt((2.0 * (F * (-0.5 / C))));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= 6e+42: tmp = math.sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * -math.sqrt(2.0) else: tmp = -math.sqrt((2.0 * (F * (-0.5 / C)))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= 6e+42) tmp = Float64(sqrt(Float64(F * Float64(Float64(Float64(Float64(A / B_m) + Float64(C / B_m)) + -1.0) / B_m))) * Float64(-sqrt(2.0))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(-0.5 / C))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= 6e+42)
tmp = sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * -sqrt(2.0);
else
tmp = -sqrt((2.0 * (F * (-0.5 / C))));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 6e+42], N[(N[Sqrt[N[(F * N[(N[(N[(N[(A / B$95$m), $MachinePrecision] + N[(C / B$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 6 \cdot 10^{+42}:\\
\;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B\_m} + \frac{C}{B\_m}\right) + -1}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{-0.5}{C}\right)}\\
\end{array}
\end{array}
if C < 6.00000000000000058e42Initial program 27.6%
Taylor expanded in F around 0 28.4%
mul-1-neg28.4%
*-commutative28.4%
associate-/l*31.2%
associate--l+31.4%
unpow231.4%
unpow231.4%
hypot-undefine37.9%
cancel-sign-sub-inv37.9%
Simplified37.9%
Taylor expanded in B around inf 20.8%
if 6.00000000000000058e42 < C Initial program 2.7%
Taylor expanded in F around 0 5.6%
mul-1-neg5.6%
*-commutative5.6%
associate-/l*8.9%
associate--l+9.5%
unpow29.5%
unpow29.5%
hypot-undefine13.3%
cancel-sign-sub-inv13.3%
Simplified13.3%
Taylor expanded in A around -inf 32.8%
pow132.8%
sqrt-unprod33.0%
Applied egg-rr33.0%
unpow133.0%
Simplified33.0%
Final simplification23.5%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= C 2.7e+44) (* (sqrt (* B_m (- F))) (/ (sqrt 2.0) (- B_m))) (- (sqrt (* 2.0 (* F (/ -0.5 C)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 2.7e+44) {
tmp = sqrt((B_m * -F)) * (sqrt(2.0) / -B_m);
} else {
tmp = -sqrt((2.0 * (F * (-0.5 / C))));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 2.7d+44) then
tmp = sqrt((b_m * -f)) * (sqrt(2.0d0) / -b_m)
else
tmp = -sqrt((2.0d0 * (f * ((-0.5d0) / c))))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 2.7e+44) {
tmp = Math.sqrt((B_m * -F)) * (Math.sqrt(2.0) / -B_m);
} else {
tmp = -Math.sqrt((2.0 * (F * (-0.5 / C))));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= 2.7e+44: tmp = math.sqrt((B_m * -F)) * (math.sqrt(2.0) / -B_m) else: tmp = -math.sqrt((2.0 * (F * (-0.5 / C)))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= 2.7e+44) tmp = Float64(sqrt(Float64(B_m * Float64(-F))) * Float64(sqrt(2.0) / Float64(-B_m))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(-0.5 / C))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= 2.7e+44)
tmp = sqrt((B_m * -F)) * (sqrt(2.0) / -B_m);
else
tmp = -sqrt((2.0 * (F * (-0.5 / C))));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 2.7e+44], 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 * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 2.7 \cdot 10^{+44}:\\
\;\;\;\;\sqrt{B\_m \cdot \left(-F\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{-0.5}{C}\right)}\\
\end{array}
\end{array}
if C < 2.7e44Initial program 27.6%
Taylor expanded in A around 0 12.8%
mul-1-neg12.8%
unpow212.8%
unpow212.8%
hypot-define20.4%
Simplified20.4%
Taylor expanded in C around 0 18.6%
mul-1-neg18.6%
Simplified18.6%
if 2.7e44 < C Initial program 2.7%
Taylor expanded in F around 0 5.6%
mul-1-neg5.6%
*-commutative5.6%
associate-/l*8.9%
associate--l+9.5%
unpow29.5%
unpow29.5%
hypot-undefine13.3%
cancel-sign-sub-inv13.3%
Simplified13.3%
Taylor expanded in A around -inf 32.8%
pow132.8%
sqrt-unprod33.0%
Applied egg-rr33.0%
unpow133.0%
Simplified33.0%
Final simplification21.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 (<= C 1.3e+57) (- (sqrt (/ (* 2.0 F) (- B_m)))) (- (sqrt (* 2.0 (* F (/ -0.5 C)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 1.3e+57) {
tmp = -sqrt(((2.0 * F) / -B_m));
} else {
tmp = -sqrt((2.0 * (F * (-0.5 / C))));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 1.3d+57) then
tmp = -sqrt(((2.0d0 * f) / -b_m))
else
tmp = -sqrt((2.0d0 * (f * ((-0.5d0) / c))))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 1.3e+57) {
tmp = -Math.sqrt(((2.0 * F) / -B_m));
} else {
tmp = -Math.sqrt((2.0 * (F * (-0.5 / C))));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= 1.3e+57: tmp = -math.sqrt(((2.0 * F) / -B_m)) else: tmp = -math.sqrt((2.0 * (F * (-0.5 / C)))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= 1.3e+57) tmp = Float64(-sqrt(Float64(Float64(2.0 * F) / Float64(-B_m)))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(-0.5 / C))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= 1.3e+57)
tmp = -sqrt(((2.0 * F) / -B_m));
else
tmp = -sqrt((2.0 * (F * (-0.5 / C))));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 1.3e+57], (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / (-B$95$m)), $MachinePrecision]], $MachinePrecision]), (-N[Sqrt[N[(2.0 * N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 1.3 \cdot 10^{+57}:\\
\;\;\;\;-\sqrt{\frac{2 \cdot F}{-B\_m}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{-0.5}{C}\right)}\\
\end{array}
\end{array}
if C < 1.3e57Initial program 27.2%
Taylor expanded in F around 0 28.0%
mul-1-neg28.0%
*-commutative28.0%
associate-/l*30.8%
associate--l+30.9%
unpow230.9%
unpow230.9%
hypot-undefine37.5%
cancel-sign-sub-inv37.5%
Simplified37.5%
Taylor expanded in B around inf 19.8%
pow119.8%
sqrt-unprod19.9%
associate-*r/19.9%
Applied egg-rr19.9%
unpow119.9%
associate-*r/19.9%
Simplified19.9%
if 1.3e57 < C Initial program 2.8%
Taylor expanded in F around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
associate-/l*9.4%
associate--l+9.9%
unpow29.9%
unpow29.9%
hypot-undefine13.8%
cancel-sign-sub-inv13.8%
Simplified13.8%
Taylor expanded in A around -inf 34.3%
pow134.3%
sqrt-unprod34.5%
Applied egg-rr34.5%
unpow134.5%
Simplified34.5%
Final simplification23.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 (<= C 2.4e+57) (- (sqrt (* 2.0 (* F (/ -1.0 B_m))))) (- (sqrt (* 2.0 (* F (/ -0.5 C)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 2.4e+57) {
tmp = -sqrt((2.0 * (F * (-1.0 / B_m))));
} else {
tmp = -sqrt((2.0 * (F * (-0.5 / C))));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 2.4d+57) then
tmp = -sqrt((2.0d0 * (f * ((-1.0d0) / b_m))))
else
tmp = -sqrt((2.0d0 * (f * ((-0.5d0) / c))))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 2.4e+57) {
tmp = -Math.sqrt((2.0 * (F * (-1.0 / B_m))));
} else {
tmp = -Math.sqrt((2.0 * (F * (-0.5 / C))));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= 2.4e+57: tmp = -math.sqrt((2.0 * (F * (-1.0 / B_m)))) else: tmp = -math.sqrt((2.0 * (F * (-0.5 / C)))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= 2.4e+57) tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(-1.0 / B_m))))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(-0.5 / C))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= 2.4e+57)
tmp = -sqrt((2.0 * (F * (-1.0 / B_m))));
else
tmp = -sqrt((2.0 * (F * (-0.5 / C))));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 2.4e+57], (-N[Sqrt[N[(2.0 * N[(F * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), (-N[Sqrt[N[(2.0 * N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 2.4 \cdot 10^{+57}:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{-1}{B\_m}\right)}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{-0.5}{C}\right)}\\
\end{array}
\end{array}
if C < 2.40000000000000005e57Initial program 27.2%
Taylor expanded in F around 0 28.0%
mul-1-neg28.0%
*-commutative28.0%
associate-/l*30.8%
associate--l+30.9%
unpow230.9%
unpow230.9%
hypot-undefine37.5%
cancel-sign-sub-inv37.5%
Simplified37.5%
Taylor expanded in B around inf 19.8%
*-commutative19.8%
pow1/220.1%
pow1/220.1%
pow-prod-down20.2%
associate-*r/20.2%
Applied egg-rr20.2%
unpow1/219.9%
associate-/l*19.9%
Simplified19.9%
if 2.40000000000000005e57 < C Initial program 2.8%
Taylor expanded in F around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
associate-/l*9.4%
associate--l+9.9%
unpow29.9%
unpow29.9%
hypot-undefine13.8%
cancel-sign-sub-inv13.8%
Simplified13.8%
Taylor expanded in A around -inf 34.3%
pow134.3%
sqrt-unprod34.5%
Applied egg-rr34.5%
unpow134.5%
Simplified34.5%
Final simplification23.0%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (sqrt (* 2.0 (* F (/ -0.5 C))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((2.0 * (F * (-0.5 / C))));
}
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 * ((-0.5d0) / c))))
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 * (-0.5 / C))));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((2.0 * (F * (-0.5 / C))))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(2.0 * Float64(F * Float64(-0.5 / C))))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((2.0 * (F * (-0.5 / C))));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(2.0 * N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{2 \cdot \left(F \cdot \frac{-0.5}{C}\right)}
\end{array}
Initial program 22.1%
Taylor expanded in F around 0 23.3%
mul-1-neg23.3%
*-commutative23.3%
associate-/l*26.3%
associate--l+26.5%
unpow226.5%
unpow226.5%
hypot-undefine32.5%
cancel-sign-sub-inv32.5%
Simplified32.5%
Taylor expanded in A around -inf 11.9%
pow111.9%
sqrt-unprod12.0%
Applied egg-rr12.0%
unpow112.0%
Simplified12.0%
herbie shell --seed 2024091
(FPCore (A B C F)
:name "ABCF->ab-angle b"
:precision binary64
(/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))