
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C))
(t_1 (- t_0 (pow B_m 2.0)))
(t_2
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_0) F))
(+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
t_1))
(t_3 (+ A (+ C (hypot B_m (- A C)))))
(t_4 (fma B_m B_m (* A (* C -4.0)))))
(if (<= t_2 (- INFINITY))
(* (sqrt (* F (/ t_3 (fma -4.0 (* A C) (pow B_m 2.0))))) (- (sqrt 2.0)))
(if (<= t_2 -1e-173)
(/ (* (sqrt (* F (* 2.0 t_4))) (sqrt t_3)) (- t_4))
(if (<= t_2 INFINITY)
(/
(*
(sqrt (fma 2.0 C (* -0.5 (/ (pow B_m 2.0) A))))
(sqrt (* 2.0 (* F (- (pow B_m 2.0) (* 4.0 (* A C)))))))
t_1)
(/
-1.0
(*
(* B_m (* (sqrt (/ 1.0 F)) (sqrt (/ 1.0 (+ C (hypot B_m C))))))
(/ 1.0 (sqrt 2.0)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = t_0 - pow(B_m, 2.0);
double t_2 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_1;
double t_3 = A + (C + hypot(B_m, (A - C)));
double t_4 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = sqrt((F * (t_3 / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -sqrt(2.0);
} else if (t_2 <= -1e-173) {
tmp = (sqrt((F * (2.0 * t_4))) * sqrt(t_3)) / -t_4;
} else if (t_2 <= ((double) INFINITY)) {
tmp = (sqrt(fma(2.0, C, (-0.5 * (pow(B_m, 2.0) / A)))) * sqrt((2.0 * (F * (pow(B_m, 2.0) - (4.0 * (A * C))))))) / t_1;
} else {
tmp = -1.0 / ((B_m * (sqrt((1.0 / F)) * sqrt((1.0 / (C + hypot(B_m, C)))))) * (1.0 / sqrt(2.0)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(t_0 - (B_m ^ 2.0)) t_2 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / t_1) t_3 = Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) t_4 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(sqrt(Float64(F * Float64(t_3 / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-sqrt(2.0))); elseif (t_2 <= -1e-173) tmp = Float64(Float64(sqrt(Float64(F * Float64(2.0 * t_4))) * sqrt(t_3)) / Float64(-t_4)); elseif (t_2 <= Inf) tmp = Float64(Float64(sqrt(fma(2.0, C, Float64(-0.5 * Float64((B_m ^ 2.0) / A)))) * sqrt(Float64(2.0 * Float64(F * Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C))))))) / t_1); else tmp = Float64(-1.0 / Float64(Float64(B_m * Float64(sqrt(Float64(1.0 / F)) * sqrt(Float64(1.0 / Float64(C + hypot(B_m, C)))))) * Float64(1.0 / sqrt(2.0)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[Sqrt[N[(F * N[(t$95$3 / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$2, -1e-173], N[(N[(N[Sqrt[N[(F * N[(2.0 * t$95$4), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision] / (-t$95$4)), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(N[Sqrt[N[(2.0 * C + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(-1.0 / N[(N[(B$95$m * N[(N[Sqrt[N[(1.0 / F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := t\_0 - {B\_m}^{2}\\
t_2 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_1}\\
t_3 := A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\\
t_4 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\sqrt{F \cdot \frac{t\_3}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-173}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(2 \cdot t\_4\right)} \cdot \sqrt{t\_3}}{-t\_4}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(2, C, -0.5 \cdot \frac{{B\_m}^{2}}{A}\right)} \cdot \sqrt{2 \cdot \left(F \cdot \left({B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\left(B\_m \cdot \left(\sqrt{\frac{1}{F}} \cdot \sqrt{\frac{1}{C + \mathsf{hypot}\left(B\_m, C\right)}}\right)\right) \cdot \frac{1}{\sqrt{2}}}\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -inf.0Initial program 3.1%
Taylor expanded in F around 0 26.1%
mul-1-neg26.1%
Simplified59.9%
if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -1e-173Initial program 95.0%
Simplified95.0%
pow1/295.0%
associate-*r*95.0%
associate-+r+95.0%
hypot-undefine95.0%
unpow295.0%
unpow295.0%
+-commutative95.0%
unpow-prod-down95.0%
*-commutative95.0%
pow1/295.0%
Applied egg-rr95.0%
unpow1/295.0%
associate-*l*95.1%
hypot-undefine95.1%
unpow295.1%
unpow295.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-undefine95.1%
Simplified95.1%
if -1e-173 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0Initial program 12.7%
Taylor expanded in A around -inf 33.9%
pow1/233.9%
*-commutative33.9%
unpow-prod-down28.7%
pow1/228.6%
+-commutative28.6%
fma-define28.6%
pow1/228.6%
associate-*l*28.6%
Applied egg-rr28.6%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 0.0%
Simplified0.9%
clear-num0.9%
inv-pow0.9%
Applied egg-rr1.2%
unpow-11.2%
associate-*r*1.2%
hypot-undefine0.0%
unpow20.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
unpow20.0%
hypot-undefine1.2%
Simplified1.2%
Taylor expanded in F around 0 0.5%
mul-1-neg0.5%
fma-define0.5%
unpow20.5%
unpow20.5%
hypot-undefine2.3%
Simplified2.3%
Taylor expanded in A around 0 2.2%
associate-/r*2.2%
unpow22.2%
unpow22.2%
hypot-define13.7%
Simplified13.7%
pow1/213.7%
div-inv13.7%
unpow-prod-down26.3%
pow1/226.3%
Applied egg-rr26.3%
unpow1/226.3%
Simplified26.3%
Final simplification42.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 (/ 1.0 (* (sqrt (* -2.0 (/ A F))) (/ -1.0 (sqrt 2.0))))))
(if (<= (pow B_m 2.0) 5e-295)
t_0
(if (<= (pow B_m 2.0) 4e-110)
(/
(sqrt (* (* 2.0 C) (* 2.0 (* -4.0 (* A (* C F))))))
(- (* (* 4.0 A) C) (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 4e+46)
t_0
(* (sqrt (* 2.0 F)) (- (pow B_m -0.5))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
double tmp;
if (pow(B_m, 2.0) <= 5e-295) {
tmp = t_0;
} else if (pow(B_m, 2.0) <= 4e-110) {
tmp = sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (((4.0 * A) * C) - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 4e+46) {
tmp = t_0;
} else {
tmp = sqrt((2.0 * F)) * -pow(B_m, -0.5);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 / (sqrt(((-2.0d0) * (a / f))) * ((-1.0d0) / sqrt(2.0d0)))
if ((b_m ** 2.0d0) <= 5d-295) then
tmp = t_0
else if ((b_m ** 2.0d0) <= 4d-110) then
tmp = sqrt(((2.0d0 * c) * (2.0d0 * ((-4.0d0) * (a * (c * f)))))) / (((4.0d0 * a) * c) - (b_m ** 2.0d0))
else if ((b_m ** 2.0d0) <= 4d+46) then
tmp = t_0
else
tmp = sqrt((2.0d0 * f)) * -(b_m ** (-0.5d0))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = 1.0 / (Math.sqrt((-2.0 * (A / F))) * (-1.0 / Math.sqrt(2.0)));
double tmp;
if (Math.pow(B_m, 2.0) <= 5e-295) {
tmp = t_0;
} else if (Math.pow(B_m, 2.0) <= 4e-110) {
tmp = Math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (((4.0 * A) * C) - Math.pow(B_m, 2.0));
} else if (Math.pow(B_m, 2.0) <= 4e+46) {
tmp = t_0;
} else {
tmp = Math.sqrt((2.0 * F)) * -Math.pow(B_m, -0.5);
}
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 = 1.0 / (math.sqrt((-2.0 * (A / F))) * (-1.0 / math.sqrt(2.0))) tmp = 0 if math.pow(B_m, 2.0) <= 5e-295: tmp = t_0 elif math.pow(B_m, 2.0) <= 4e-110: tmp = math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (((4.0 * A) * C) - math.pow(B_m, 2.0)) elif math.pow(B_m, 2.0) <= 4e+46: tmp = t_0 else: tmp = math.sqrt((2.0 * F)) * -math.pow(B_m, -0.5) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(1.0 / Float64(sqrt(Float64(-2.0 * Float64(A / F))) * Float64(-1.0 / sqrt(2.0)))) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-295) tmp = t_0; elseif ((B_m ^ 2.0) <= 4e-110) tmp = Float64(sqrt(Float64(Float64(2.0 * C) * Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F)))))) / Float64(Float64(Float64(4.0 * A) * C) - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 4e+46) tmp = t_0; else tmp = Float64(sqrt(Float64(2.0 * F)) * Float64(-(B_m ^ -0.5))); 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 = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
tmp = 0.0;
if ((B_m ^ 2.0) <= 5e-295)
tmp = t_0;
elseif ((B_m ^ 2.0) <= 4e-110)
tmp = sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (((4.0 * A) * C) - (B_m ^ 2.0));
elseif ((B_m ^ 2.0) <= 4e+46)
tmp = t_0;
else
tmp = sqrt((2.0 * F)) * -(B_m ^ -0.5);
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[(1.0 / N[(N[Sqrt[N[(-2.0 * N[(A / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-295], t$95$0, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-110], N[(N[Sqrt[N[(N[(2.0 * C), $MachinePrecision] * N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+46], t$95$0, N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] * (-N[Power[B$95$m, -0.5], $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{1}{\sqrt{-2 \cdot \frac{A}{F}} \cdot \frac{-1}{\sqrt{2}}}\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-295}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{-110}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot C\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{\left(4 \cdot A\right) \cdot C - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+46}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot F} \cdot \left(-{B\_m}^{-0.5}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.00000000000000008e-295 or 4.0000000000000002e-110 < (pow.f64 B 2) < 4e46Initial program 20.9%
Simplified28.0%
clear-num28.0%
inv-pow28.0%
Applied egg-rr29.0%
unpow-129.0%
associate-*r*29.0%
hypot-undefine22.5%
unpow222.5%
unpow222.5%
+-commutative22.5%
unpow222.5%
unpow222.5%
hypot-undefine29.0%
Simplified29.0%
Taylor expanded in F around 0 19.9%
mul-1-neg19.9%
fma-define19.9%
unpow219.9%
unpow219.9%
hypot-undefine25.1%
Simplified25.1%
Taylor expanded in A around -inf 23.5%
if 5.00000000000000008e-295 < (pow.f64 B 2) < 4.0000000000000002e-110Initial program 28.6%
Taylor expanded in A around -inf 34.6%
Taylor expanded in B around 0 31.4%
if 4e46 < (pow.f64 B 2) Initial program 11.0%
Taylor expanded in B around inf 21.8%
mul-1-neg21.8%
Simplified21.8%
sqrt-div25.9%
Applied egg-rr25.9%
associate-*l/25.9%
sqrt-unprod26.0%
Applied egg-rr26.0%
div-inv26.0%
pow1/226.0%
pow-flip26.0%
metadata-eval26.0%
Applied egg-rr26.0%
Final simplification25.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 (* (* 4.0 A) C)) (t_1 (- t_0 (pow B_m 2.0))))
(if (<= B_m 3.6e-227)
(/ (* 2.0 (sqrt (* C (* F (- (pow B_m 2.0) (* 4.0 (* A C))))))) t_1)
(if (<= B_m 4.2e-142)
(/ 1.0 (* (sqrt (* -2.0 (/ A F))) (/ -1.0 (sqrt 2.0))))
(if (<= B_m 1.6e+23)
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_0) F))
(+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C))))
t_1)
(/
-1.0
(*
(* B_m (* (sqrt (/ 1.0 F)) (sqrt (/ 1.0 (+ C (hypot B_m C))))))
(/ 1.0 (sqrt 2.0)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = t_0 - pow(B_m, 2.0);
double tmp;
if (B_m <= 3.6e-227) {
tmp = (2.0 * sqrt((C * (F * (pow(B_m, 2.0) - (4.0 * (A * C))))))) / t_1;
} else if (B_m <= 4.2e-142) {
tmp = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
} else if (B_m <= 1.6e+23) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * ((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C)))) / t_1;
} else {
tmp = -1.0 / ((B_m * (sqrt((1.0 / F)) * sqrt((1.0 / (C + hypot(B_m, C)))))) * (1.0 / sqrt(2.0)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = t_0 - Math.pow(B_m, 2.0);
double tmp;
if (B_m <= 3.6e-227) {
tmp = (2.0 * Math.sqrt((C * (F * (Math.pow(B_m, 2.0) - (4.0 * (A * C))))))) / t_1;
} else if (B_m <= 4.2e-142) {
tmp = 1.0 / (Math.sqrt((-2.0 * (A / F))) * (-1.0 / Math.sqrt(2.0)));
} else if (B_m <= 1.6e+23) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * ((-0.5 * (Math.pow(B_m, 2.0) / A)) + (2.0 * C)))) / t_1;
} else {
tmp = -1.0 / ((B_m * (Math.sqrt((1.0 / F)) * Math.sqrt((1.0 / (C + Math.hypot(B_m, C)))))) * (1.0 / Math.sqrt(2.0)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = (4.0 * A) * C t_1 = t_0 - math.pow(B_m, 2.0) tmp = 0 if B_m <= 3.6e-227: tmp = (2.0 * math.sqrt((C * (F * (math.pow(B_m, 2.0) - (4.0 * (A * C))))))) / t_1 elif B_m <= 4.2e-142: tmp = 1.0 / (math.sqrt((-2.0 * (A / F))) * (-1.0 / math.sqrt(2.0))) elif B_m <= 1.6e+23: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * ((-0.5 * (math.pow(B_m, 2.0) / A)) + (2.0 * C)))) / t_1 else: tmp = -1.0 / ((B_m * (math.sqrt((1.0 / F)) * math.sqrt((1.0 / (C + math.hypot(B_m, C)))))) * (1.0 / math.sqrt(2.0))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(t_0 - (B_m ^ 2.0)) tmp = 0.0 if (B_m <= 3.6e-227) tmp = Float64(Float64(2.0 * sqrt(Float64(C * Float64(F * Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C))))))) / t_1); elseif (B_m <= 4.2e-142) tmp = Float64(1.0 / Float64(sqrt(Float64(-2.0 * Float64(A / F))) * Float64(-1.0 / sqrt(2.0)))); elseif (B_m <= 1.6e+23) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C)))) / t_1); else tmp = Float64(-1.0 / Float64(Float64(B_m * Float64(sqrt(Float64(1.0 / F)) * sqrt(Float64(1.0 / Float64(C + hypot(B_m, C)))))) * Float64(1.0 / sqrt(2.0)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = (4.0 * A) * C;
t_1 = t_0 - (B_m ^ 2.0);
tmp = 0.0;
if (B_m <= 3.6e-227)
tmp = (2.0 * sqrt((C * (F * ((B_m ^ 2.0) - (4.0 * (A * C))))))) / t_1;
elseif (B_m <= 4.2e-142)
tmp = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
elseif (B_m <= 1.6e+23)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * ((-0.5 * ((B_m ^ 2.0) / A)) + (2.0 * C)))) / t_1;
else
tmp = -1.0 / ((B_m * (sqrt((1.0 / F)) * sqrt((1.0 / (C + hypot(B_m, C)))))) * (1.0 / sqrt(2.0)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 3.6e-227], N[(N[(2.0 * N[Sqrt[N[(C * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 4.2e-142], N[(1.0 / N[(N[Sqrt[N[(-2.0 * N[(A / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.6e+23], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], N[(-1.0 / N[(N[(B$95$m * N[(N[Sqrt[N[(1.0 / F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := t\_0 - {B\_m}^{2}\\
\mathbf{if}\;B\_m \leq 3.6 \cdot 10^{-227}:\\
\;\;\;\;\frac{2 \cdot \sqrt{C \cdot \left(F \cdot \left({B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)}}{t\_1}\\
\mathbf{elif}\;B\_m \leq 4.2 \cdot 10^{-142}:\\
\;\;\;\;\frac{1}{\sqrt{-2 \cdot \frac{A}{F}} \cdot \frac{-1}{\sqrt{2}}}\\
\mathbf{elif}\;B\_m \leq 1.6 \cdot 10^{+23}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{A} + 2 \cdot C\right)}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\left(B\_m \cdot \left(\sqrt{\frac{1}{F}} \cdot \sqrt{\frac{1}{C + \mathsf{hypot}\left(B\_m, C\right)}}\right)\right) \cdot \frac{1}{\sqrt{2}}}\\
\end{array}
\end{array}
if B < 3.5999999999999999e-227Initial program 17.7%
Taylor expanded in A around -inf 16.9%
Taylor expanded in F around 0 16.9%
if 3.5999999999999999e-227 < B < 4.1999999999999999e-142Initial program 12.1%
Simplified12.9%
clear-num12.9%
inv-pow12.9%
Applied egg-rr13.0%
unpow-113.0%
associate-*r*13.0%
hypot-undefine12.1%
unpow212.1%
unpow212.1%
+-commutative12.1%
unpow212.1%
unpow212.1%
hypot-undefine13.0%
Simplified13.0%
Taylor expanded in F around 0 18.3%
mul-1-neg18.3%
fma-define18.3%
unpow218.3%
unpow218.3%
hypot-undefine19.5%
Simplified19.5%
Taylor expanded in A around -inf 20.9%
if 4.1999999999999999e-142 < B < 1.6e23Initial program 32.1%
Taylor expanded in A around -inf 31.1%
if 1.6e23 < B Initial program 10.0%
Simplified11.8%
clear-num11.9%
inv-pow11.9%
Applied egg-rr11.9%
unpow-111.9%
associate-*r*11.9%
hypot-undefine10.0%
unpow210.0%
unpow210.0%
+-commutative10.0%
unpow210.0%
unpow210.0%
hypot-undefine11.9%
Simplified11.9%
Taylor expanded in F around 0 10.1%
mul-1-neg10.1%
fma-define10.1%
unpow210.1%
unpow210.1%
hypot-undefine17.3%
Simplified17.3%
Taylor expanded in A around 0 15.6%
associate-/r*15.6%
unpow215.6%
unpow215.6%
hypot-define33.2%
Simplified33.2%
pow1/233.2%
div-inv33.2%
unpow-prod-down58.0%
pow1/258.0%
Applied egg-rr58.0%
unpow1/258.0%
Simplified58.0%
Final simplification27.2%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C))
(t_1 (- t_0 (pow B_m 2.0)))
(t_2 (+ C (hypot B_m C))))
(if (<= B_m 3.6e-227)
(/ (* 2.0 (sqrt (* C (* F (- (pow B_m 2.0) (* 4.0 (* A C))))))) t_1)
(if (<= B_m 6e-140)
(/ 1.0 (* (sqrt (* -2.0 (/ A F))) (/ -1.0 (sqrt 2.0))))
(if (<= B_m 8.2e+34)
(/ (sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) t_2)) t_1)
(/
-1.0
(*
(* B_m (* (sqrt (/ 1.0 F)) (sqrt (/ 1.0 t_2))))
(/ 1.0 (sqrt 2.0)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = t_0 - pow(B_m, 2.0);
double t_2 = C + hypot(B_m, C);
double tmp;
if (B_m <= 3.6e-227) {
tmp = (2.0 * sqrt((C * (F * (pow(B_m, 2.0) - (4.0 * (A * C))))))) / t_1;
} else if (B_m <= 6e-140) {
tmp = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
} else if (B_m <= 8.2e+34) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * t_2)) / t_1;
} else {
tmp = -1.0 / ((B_m * (sqrt((1.0 / F)) * sqrt((1.0 / t_2)))) * (1.0 / sqrt(2.0)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = t_0 - Math.pow(B_m, 2.0);
double t_2 = C + Math.hypot(B_m, C);
double tmp;
if (B_m <= 3.6e-227) {
tmp = (2.0 * Math.sqrt((C * (F * (Math.pow(B_m, 2.0) - (4.0 * (A * C))))))) / t_1;
} else if (B_m <= 6e-140) {
tmp = 1.0 / (Math.sqrt((-2.0 * (A / F))) * (-1.0 / Math.sqrt(2.0)));
} else if (B_m <= 8.2e+34) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * t_2)) / t_1;
} else {
tmp = -1.0 / ((B_m * (Math.sqrt((1.0 / F)) * Math.sqrt((1.0 / t_2)))) * (1.0 / Math.sqrt(2.0)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = (4.0 * A) * C t_1 = t_0 - math.pow(B_m, 2.0) t_2 = C + math.hypot(B_m, C) tmp = 0 if B_m <= 3.6e-227: tmp = (2.0 * math.sqrt((C * (F * (math.pow(B_m, 2.0) - (4.0 * (A * C))))))) / t_1 elif B_m <= 6e-140: tmp = 1.0 / (math.sqrt((-2.0 * (A / F))) * (-1.0 / math.sqrt(2.0))) elif B_m <= 8.2e+34: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * t_2)) / t_1 else: tmp = -1.0 / ((B_m * (math.sqrt((1.0 / F)) * math.sqrt((1.0 / t_2)))) * (1.0 / math.sqrt(2.0))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(t_0 - (B_m ^ 2.0)) t_2 = Float64(C + hypot(B_m, C)) tmp = 0.0 if (B_m <= 3.6e-227) tmp = Float64(Float64(2.0 * sqrt(Float64(C * Float64(F * Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C))))))) / t_1); elseif (B_m <= 6e-140) tmp = Float64(1.0 / Float64(sqrt(Float64(-2.0 * Float64(A / F))) * Float64(-1.0 / sqrt(2.0)))); elseif (B_m <= 8.2e+34) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * t_2)) / t_1); else tmp = Float64(-1.0 / Float64(Float64(B_m * Float64(sqrt(Float64(1.0 / F)) * sqrt(Float64(1.0 / t_2)))) * Float64(1.0 / sqrt(2.0)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = (4.0 * A) * C;
t_1 = t_0 - (B_m ^ 2.0);
t_2 = C + hypot(B_m, C);
tmp = 0.0;
if (B_m <= 3.6e-227)
tmp = (2.0 * sqrt((C * (F * ((B_m ^ 2.0) - (4.0 * (A * C))))))) / t_1;
elseif (B_m <= 6e-140)
tmp = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
elseif (B_m <= 8.2e+34)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * t_2)) / t_1;
else
tmp = -1.0 / ((B_m * (sqrt((1.0 / F)) * sqrt((1.0 / t_2)))) * (1.0 / sqrt(2.0)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 3.6e-227], N[(N[(2.0 * N[Sqrt[N[(C * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 6e-140], N[(1.0 / N[(N[Sqrt[N[(-2.0 * N[(A / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 8.2e+34], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], N[(-1.0 / N[(N[(B$95$m * N[(N[Sqrt[N[(1.0 / F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := t\_0 - {B\_m}^{2}\\
t_2 := C + \mathsf{hypot}\left(B\_m, C\right)\\
\mathbf{if}\;B\_m \leq 3.6 \cdot 10^{-227}:\\
\;\;\;\;\frac{2 \cdot \sqrt{C \cdot \left(F \cdot \left({B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)}}{t\_1}\\
\mathbf{elif}\;B\_m \leq 6 \cdot 10^{-140}:\\
\;\;\;\;\frac{1}{\sqrt{-2 \cdot \frac{A}{F}} \cdot \frac{-1}{\sqrt{2}}}\\
\mathbf{elif}\;B\_m \leq 8.2 \cdot 10^{+34}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot t\_2}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\left(B\_m \cdot \left(\sqrt{\frac{1}{F}} \cdot \sqrt{\frac{1}{t\_2}}\right)\right) \cdot \frac{1}{\sqrt{2}}}\\
\end{array}
\end{array}
if B < 3.5999999999999999e-227Initial program 17.7%
Taylor expanded in A around -inf 16.9%
Taylor expanded in F around 0 16.9%
if 3.5999999999999999e-227 < B < 6.00000000000000037e-140Initial program 12.1%
Simplified12.9%
clear-num12.9%
inv-pow12.9%
Applied egg-rr13.0%
unpow-113.0%
associate-*r*13.0%
hypot-undefine12.1%
unpow212.1%
unpow212.1%
+-commutative12.1%
unpow212.1%
unpow212.1%
hypot-undefine13.0%
Simplified13.0%
Taylor expanded in F around 0 18.3%
mul-1-neg18.3%
fma-define18.3%
unpow218.3%
unpow218.3%
hypot-undefine19.5%
Simplified19.5%
Taylor expanded in A around -inf 20.9%
if 6.00000000000000037e-140 < B < 8.1999999999999997e34Initial program 34.3%
Taylor expanded in A around 0 36.5%
unpow236.5%
unpow236.5%
hypot-define39.8%
Simplified39.8%
if 8.1999999999999997e34 < B Initial program 8.2%
Simplified10.1%
clear-num10.1%
inv-pow10.1%
Applied egg-rr10.2%
unpow-110.2%
associate-*r*10.2%
hypot-undefine8.3%
unpow28.3%
unpow28.3%
+-commutative8.3%
unpow28.3%
unpow28.3%
hypot-undefine10.2%
Simplified10.2%
Taylor expanded in F around 0 8.4%
mul-1-neg8.4%
fma-define8.4%
unpow28.4%
unpow28.4%
hypot-undefine15.6%
Simplified15.6%
Taylor expanded in A around 0 13.9%
associate-/r*14.0%
unpow214.0%
unpow214.0%
hypot-define32.0%
Simplified32.0%
pow1/232.0%
div-inv32.0%
unpow-prod-down57.2%
pow1/257.2%
Applied egg-rr57.2%
unpow1/257.2%
Simplified57.2%
Final simplification28.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 1.95e-226)
(/
(* 2.0 (sqrt (* C (* F (- (pow B_m 2.0) (* 4.0 (* A C)))))))
(- (* (* 4.0 A) C) (pow B_m 2.0)))
(if (<= B_m 6.4e-142)
(/ 1.0 (* (sqrt (* -2.0 (/ A F))) (/ -1.0 (sqrt 2.0))))
(if (<= B_m 2.6e-51)
(/ -1.0 (/ t_0 (sqrt (* t_0 (* 4.0 (* C F))))))
(/
-1.0
(*
(* B_m (* (sqrt (/ 1.0 F)) (sqrt (/ 1.0 (+ C (hypot B_m C))))))
(/ 1.0 (sqrt 2.0)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 1.95e-226) {
tmp = (2.0 * sqrt((C * (F * (pow(B_m, 2.0) - (4.0 * (A * C))))))) / (((4.0 * A) * C) - pow(B_m, 2.0));
} else if (B_m <= 6.4e-142) {
tmp = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
} else if (B_m <= 2.6e-51) {
tmp = -1.0 / (t_0 / sqrt((t_0 * (4.0 * (C * F)))));
} else {
tmp = -1.0 / ((B_m * (sqrt((1.0 / F)) * sqrt((1.0 / (C + hypot(B_m, C)))))) * (1.0 / sqrt(2.0)));
}
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.95e-226) tmp = Float64(Float64(2.0 * sqrt(Float64(C * Float64(F * Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C))))))) / Float64(Float64(Float64(4.0 * A) * C) - (B_m ^ 2.0))); elseif (B_m <= 6.4e-142) tmp = Float64(1.0 / Float64(sqrt(Float64(-2.0 * Float64(A / F))) * Float64(-1.0 / sqrt(2.0)))); elseif (B_m <= 2.6e-51) tmp = Float64(-1.0 / Float64(t_0 / sqrt(Float64(t_0 * Float64(4.0 * Float64(C * F)))))); else tmp = Float64(-1.0 / Float64(Float64(B_m * Float64(sqrt(Float64(1.0 / F)) * sqrt(Float64(1.0 / Float64(C + hypot(B_m, C)))))) * Float64(1.0 / sqrt(2.0)))); 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.95e-226], N[(N[(2.0 * N[Sqrt[N[(C * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 6.4e-142], N[(1.0 / N[(N[Sqrt[N[(-2.0 * N[(A / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2.6e-51], N[(-1.0 / N[(t$95$0 / N[Sqrt[N[(t$95$0 * N[(4.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(N[(B$95$m * N[(N[Sqrt[N[(1.0 / F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[2.0], $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 \leq 1.95 \cdot 10^{-226}:\\
\;\;\;\;\frac{2 \cdot \sqrt{C \cdot \left(F \cdot \left({B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)}}{\left(4 \cdot A\right) \cdot C - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 6.4 \cdot 10^{-142}:\\
\;\;\;\;\frac{1}{\sqrt{-2 \cdot \frac{A}{F}} \cdot \frac{-1}{\sqrt{2}}}\\
\mathbf{elif}\;B\_m \leq 2.6 \cdot 10^{-51}:\\
\;\;\;\;\frac{-1}{\frac{t\_0}{\sqrt{t\_0 \cdot \left(4 \cdot \left(C \cdot F\right)\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\left(B\_m \cdot \left(\sqrt{\frac{1}{F}} \cdot \sqrt{\frac{1}{C + \mathsf{hypot}\left(B\_m, C\right)}}\right)\right) \cdot \frac{1}{\sqrt{2}}}\\
\end{array}
\end{array}
if B < 1.9499999999999999e-226Initial program 17.7%
Taylor expanded in A around -inf 16.9%
Taylor expanded in F around 0 16.9%
if 1.9499999999999999e-226 < B < 6.3999999999999997e-142Initial program 12.1%
Simplified12.9%
clear-num12.9%
inv-pow12.9%
Applied egg-rr13.0%
unpow-113.0%
associate-*r*13.0%
hypot-undefine12.1%
unpow212.1%
unpow212.1%
+-commutative12.1%
unpow212.1%
unpow212.1%
hypot-undefine13.0%
Simplified13.0%
Taylor expanded in F around 0 18.3%
mul-1-neg18.3%
fma-define18.3%
unpow218.3%
unpow218.3%
hypot-undefine19.5%
Simplified19.5%
Taylor expanded in A around -inf 20.9%
if 6.3999999999999997e-142 < B < 2.6e-51Initial program 26.9%
Simplified40.4%
clear-num40.3%
inv-pow40.3%
Applied egg-rr41.5%
unpow-141.5%
associate-*r*41.5%
hypot-undefine26.9%
unpow226.9%
unpow226.9%
+-commutative26.9%
unpow226.9%
unpow226.9%
hypot-undefine41.5%
Simplified41.5%
Taylor expanded in A around -inf 32.8%
if 2.6e-51 < B Initial program 15.6%
Simplified17.4%
clear-num17.4%
inv-pow17.4%
Applied egg-rr17.5%
unpow-117.5%
associate-*r*17.5%
hypot-undefine15.8%
unpow215.8%
unpow215.8%
+-commutative15.8%
unpow215.8%
unpow215.8%
hypot-undefine17.5%
Simplified17.5%
Taylor expanded in F around 0 14.3%
mul-1-neg14.3%
fma-define14.3%
unpow214.3%
unpow214.3%
hypot-undefine20.2%
Simplified20.2%
Taylor expanded in A around 0 19.5%
associate-/r*19.5%
unpow219.5%
unpow219.5%
hypot-define33.8%
Simplified33.8%
pow1/233.8%
div-inv33.8%
unpow-prod-down54.0%
pow1/254.0%
Applied egg-rr54.0%
unpow1/254.0%
Simplified54.0%
Final simplification27.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 (/ -1.0 (sqrt 2.0))) (t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 4.5e-227)
(/
(* 2.0 (sqrt (* C (* F (- (pow B_m 2.0) (* 4.0 (* A C)))))))
(- (* (* 4.0 A) C) (pow B_m 2.0)))
(if (<= B_m 1.3e-143)
(/ 1.0 (* (sqrt (* -2.0 (/ A F))) t_0))
(if (<= B_m 2.1e-54)
(/ -1.0 (/ t_1 (sqrt (* t_1 (* 4.0 (* C F))))))
(/
1.0
(* (* B_m (/ (sqrt (/ 1.0 F)) (sqrt (+ C (hypot B_m C))))) t_0)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -1.0 / sqrt(2.0);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 4.5e-227) {
tmp = (2.0 * sqrt((C * (F * (pow(B_m, 2.0) - (4.0 * (A * C))))))) / (((4.0 * A) * C) - pow(B_m, 2.0));
} else if (B_m <= 1.3e-143) {
tmp = 1.0 / (sqrt((-2.0 * (A / F))) * t_0);
} else if (B_m <= 2.1e-54) {
tmp = -1.0 / (t_1 / sqrt((t_1 * (4.0 * (C * F)))));
} else {
tmp = 1.0 / ((B_m * (sqrt((1.0 / F)) / sqrt((C + hypot(B_m, C))))) * t_0);
}
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(-1.0 / sqrt(2.0)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 4.5e-227) tmp = Float64(Float64(2.0 * sqrt(Float64(C * Float64(F * Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C))))))) / Float64(Float64(Float64(4.0 * A) * C) - (B_m ^ 2.0))); elseif (B_m <= 1.3e-143) tmp = Float64(1.0 / Float64(sqrt(Float64(-2.0 * Float64(A / F))) * t_0)); elseif (B_m <= 2.1e-54) tmp = Float64(-1.0 / Float64(t_1 / sqrt(Float64(t_1 * Float64(4.0 * Float64(C * F)))))); else tmp = Float64(1.0 / Float64(Float64(B_m * Float64(sqrt(Float64(1.0 / F)) / sqrt(Float64(C + hypot(B_m, C))))) * t_0)); 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[(-1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 4.5e-227], N[(N[(2.0 * N[Sqrt[N[(C * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.3e-143], N[(1.0 / N[(N[Sqrt[N[(-2.0 * N[(A / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2.1e-54], N[(-1.0 / N[(t$95$1 / N[Sqrt[N[(t$95$1 * N[(4.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(B$95$m * N[(N[Sqrt[N[(1.0 / F), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $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{-1}{\sqrt{2}}\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 4.5 \cdot 10^{-227}:\\
\;\;\;\;\frac{2 \cdot \sqrt{C \cdot \left(F \cdot \left({B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)}}{\left(4 \cdot A\right) \cdot C - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 1.3 \cdot 10^{-143}:\\
\;\;\;\;\frac{1}{\sqrt{-2 \cdot \frac{A}{F}} \cdot t\_0}\\
\mathbf{elif}\;B\_m \leq 2.1 \cdot 10^{-54}:\\
\;\;\;\;\frac{-1}{\frac{t\_1}{\sqrt{t\_1 \cdot \left(4 \cdot \left(C \cdot F\right)\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(B\_m \cdot \frac{\sqrt{\frac{1}{F}}}{\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)}}\right) \cdot t\_0}\\
\end{array}
\end{array}
if B < 4.49999999999999993e-227Initial program 17.7%
Taylor expanded in A around -inf 16.9%
Taylor expanded in F around 0 16.9%
if 4.49999999999999993e-227 < B < 1.29999999999999994e-143Initial program 12.1%
Simplified12.9%
clear-num12.9%
inv-pow12.9%
Applied egg-rr13.0%
unpow-113.0%
associate-*r*13.0%
hypot-undefine12.1%
unpow212.1%
unpow212.1%
+-commutative12.1%
unpow212.1%
unpow212.1%
hypot-undefine13.0%
Simplified13.0%
Taylor expanded in F around 0 18.3%
mul-1-neg18.3%
fma-define18.3%
unpow218.3%
unpow218.3%
hypot-undefine19.5%
Simplified19.5%
Taylor expanded in A around -inf 20.9%
if 1.29999999999999994e-143 < B < 2.1e-54Initial program 26.9%
Simplified40.4%
clear-num40.3%
inv-pow40.3%
Applied egg-rr41.5%
unpow-141.5%
associate-*r*41.5%
hypot-undefine26.9%
unpow226.9%
unpow226.9%
+-commutative26.9%
unpow226.9%
unpow226.9%
hypot-undefine41.5%
Simplified41.5%
Taylor expanded in A around -inf 32.8%
if 2.1e-54 < B Initial program 15.6%
Simplified17.4%
clear-num17.4%
inv-pow17.4%
Applied egg-rr17.5%
unpow-117.5%
associate-*r*17.5%
hypot-undefine15.8%
unpow215.8%
unpow215.8%
+-commutative15.8%
unpow215.8%
unpow215.8%
hypot-undefine17.5%
Simplified17.5%
Taylor expanded in F around 0 14.3%
mul-1-neg14.3%
fma-define14.3%
unpow214.3%
unpow214.3%
hypot-undefine20.2%
Simplified20.2%
Taylor expanded in A around 0 19.5%
associate-/r*19.5%
unpow219.5%
unpow219.5%
hypot-define33.8%
Simplified33.8%
sqrt-div53.9%
Applied egg-rr53.9%
Final simplification27.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 (* (* 4.0 A) C)) (t_1 (- t_0 (pow B_m 2.0))))
(if (<= B_m 1.15e-226)
(/ (* 2.0 (sqrt (* C (* F (- (pow B_m 2.0) (* 4.0 (* A C))))))) t_1)
(if (<= B_m 8.5e-147)
(/ 1.0 (* (sqrt (* -2.0 (/ A F))) (/ -1.0 (sqrt 2.0))))
(if (<= B_m 3.5e-27)
(/ (sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 C))) t_1)
(* (sqrt (* 2.0 F)) (- (pow B_m -0.5))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = t_0 - pow(B_m, 2.0);
double tmp;
if (B_m <= 1.15e-226) {
tmp = (2.0 * sqrt((C * (F * (pow(B_m, 2.0) - (4.0 * (A * C))))))) / t_1;
} else if (B_m <= 8.5e-147) {
tmp = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
} else if (B_m <= 3.5e-27) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / t_1;
} else {
tmp = sqrt((2.0 * F)) * -pow(B_m, -0.5);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (4.0d0 * a) * c
t_1 = t_0 - (b_m ** 2.0d0)
if (b_m <= 1.15d-226) then
tmp = (2.0d0 * sqrt((c * (f * ((b_m ** 2.0d0) - (4.0d0 * (a * c))))))) / t_1
else if (b_m <= 8.5d-147) then
tmp = 1.0d0 / (sqrt(((-2.0d0) * (a / f))) * ((-1.0d0) / sqrt(2.0d0)))
else if (b_m <= 3.5d-27) then
tmp = sqrt(((2.0d0 * (((b_m ** 2.0d0) - t_0) * f)) * (2.0d0 * c))) / t_1
else
tmp = sqrt((2.0d0 * f)) * -(b_m ** (-0.5d0))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = t_0 - Math.pow(B_m, 2.0);
double tmp;
if (B_m <= 1.15e-226) {
tmp = (2.0 * Math.sqrt((C * (F * (Math.pow(B_m, 2.0) - (4.0 * (A * C))))))) / t_1;
} else if (B_m <= 8.5e-147) {
tmp = 1.0 / (Math.sqrt((-2.0 * (A / F))) * (-1.0 / Math.sqrt(2.0)));
} else if (B_m <= 3.5e-27) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / t_1;
} else {
tmp = Math.sqrt((2.0 * F)) * -Math.pow(B_m, -0.5);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = (4.0 * A) * C t_1 = t_0 - math.pow(B_m, 2.0) tmp = 0 if B_m <= 1.15e-226: tmp = (2.0 * math.sqrt((C * (F * (math.pow(B_m, 2.0) - (4.0 * (A * C))))))) / t_1 elif B_m <= 8.5e-147: tmp = 1.0 / (math.sqrt((-2.0 * (A / F))) * (-1.0 / math.sqrt(2.0))) elif B_m <= 3.5e-27: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / t_1 else: tmp = math.sqrt((2.0 * F)) * -math.pow(B_m, -0.5) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(t_0 - (B_m ^ 2.0)) tmp = 0.0 if (B_m <= 1.15e-226) tmp = Float64(Float64(2.0 * sqrt(Float64(C * Float64(F * Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C))))))) / t_1); elseif (B_m <= 8.5e-147) tmp = Float64(1.0 / Float64(sqrt(Float64(-2.0 * Float64(A / F))) * Float64(-1.0 / sqrt(2.0)))); elseif (B_m <= 3.5e-27) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * C))) / t_1); else tmp = Float64(sqrt(Float64(2.0 * F)) * Float64(-(B_m ^ -0.5))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = (4.0 * A) * C;
t_1 = t_0 - (B_m ^ 2.0);
tmp = 0.0;
if (B_m <= 1.15e-226)
tmp = (2.0 * sqrt((C * (F * ((B_m ^ 2.0) - (4.0 * (A * C))))))) / t_1;
elseif (B_m <= 8.5e-147)
tmp = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
elseif (B_m <= 3.5e-27)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * C))) / t_1;
else
tmp = sqrt((2.0 * F)) * -(B_m ^ -0.5);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 1.15e-226], N[(N[(2.0 * N[Sqrt[N[(C * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 8.5e-147], N[(1.0 / N[(N[Sqrt[N[(-2.0 * N[(A / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 3.5e-27], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] * (-N[Power[B$95$m, -0.5], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := t\_0 - {B\_m}^{2}\\
\mathbf{if}\;B\_m \leq 1.15 \cdot 10^{-226}:\\
\;\;\;\;\frac{2 \cdot \sqrt{C \cdot \left(F \cdot \left({B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)}}{t\_1}\\
\mathbf{elif}\;B\_m \leq 8.5 \cdot 10^{-147}:\\
\;\;\;\;\frac{1}{\sqrt{-2 \cdot \frac{A}{F}} \cdot \frac{-1}{\sqrt{2}}}\\
\mathbf{elif}\;B\_m \leq 3.5 \cdot 10^{-27}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot F} \cdot \left(-{B\_m}^{-0.5}\right)\\
\end{array}
\end{array}
if B < 1.15e-226Initial program 17.7%
Taylor expanded in A around -inf 16.9%
Taylor expanded in F around 0 16.9%
if 1.15e-226 < B < 8.5000000000000002e-147Initial program 12.1%
Simplified12.9%
clear-num12.9%
inv-pow12.9%
Applied egg-rr13.0%
unpow-113.0%
associate-*r*13.0%
hypot-undefine12.1%
unpow212.1%
unpow212.1%
+-commutative12.1%
unpow212.1%
unpow212.1%
hypot-undefine13.0%
Simplified13.0%
Taylor expanded in F around 0 18.3%
mul-1-neg18.3%
fma-define18.3%
unpow218.3%
unpow218.3%
hypot-undefine19.5%
Simplified19.5%
Taylor expanded in A around -inf 20.9%
if 8.5000000000000002e-147 < B < 3.5000000000000001e-27Initial program 28.0%
Taylor expanded in A around -inf 32.1%
if 3.5000000000000001e-27 < B Initial program 13.7%
Taylor expanded in B around inf 46.9%
mul-1-neg46.9%
Simplified46.9%
sqrt-div56.7%
Applied egg-rr56.7%
associate-*l/56.6%
sqrt-unprod56.8%
Applied egg-rr56.8%
div-inv56.8%
pow1/256.8%
pow-flip56.8%
metadata-eval56.8%
Applied egg-rr56.8%
Final simplification27.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 8e-227)
(/
(* 2.0 (sqrt (* C (* F (- (pow B_m 2.0) (* 4.0 (* A C)))))))
(- (* (* 4.0 A) C) (pow B_m 2.0)))
(if (<= B_m 4e-140)
(/ 1.0 (* (sqrt (* -2.0 (/ A F))) (/ -1.0 (sqrt 2.0))))
(if (<= B_m 5.2e-26)
(/ -1.0 (/ t_0 (sqrt (* t_0 (* 4.0 (* C F))))))
(* (sqrt (* 2.0 F)) (- (pow B_m -0.5))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 8e-227) {
tmp = (2.0 * sqrt((C * (F * (pow(B_m, 2.0) - (4.0 * (A * C))))))) / (((4.0 * A) * C) - pow(B_m, 2.0));
} else if (B_m <= 4e-140) {
tmp = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
} else if (B_m <= 5.2e-26) {
tmp = -1.0 / (t_0 / sqrt((t_0 * (4.0 * (C * F)))));
} else {
tmp = sqrt((2.0 * F)) * -pow(B_m, -0.5);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 8e-227) tmp = Float64(Float64(2.0 * sqrt(Float64(C * Float64(F * Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C))))))) / Float64(Float64(Float64(4.0 * A) * C) - (B_m ^ 2.0))); elseif (B_m <= 4e-140) tmp = Float64(1.0 / Float64(sqrt(Float64(-2.0 * Float64(A / F))) * Float64(-1.0 / sqrt(2.0)))); elseif (B_m <= 5.2e-26) tmp = Float64(-1.0 / Float64(t_0 / sqrt(Float64(t_0 * Float64(4.0 * Float64(C * F)))))); else tmp = Float64(sqrt(Float64(2.0 * F)) * Float64(-(B_m ^ -0.5))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 8e-227], N[(N[(2.0 * N[Sqrt[N[(C * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 4e-140], N[(1.0 / N[(N[Sqrt[N[(-2.0 * N[(A / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 5.2e-26], N[(-1.0 / N[(t$95$0 / N[Sqrt[N[(t$95$0 * N[(4.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] * (-N[Power[B$95$m, -0.5], $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 8 \cdot 10^{-227}:\\
\;\;\;\;\frac{2 \cdot \sqrt{C \cdot \left(F \cdot \left({B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right)}}{\left(4 \cdot A\right) \cdot C - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 4 \cdot 10^{-140}:\\
\;\;\;\;\frac{1}{\sqrt{-2 \cdot \frac{A}{F}} \cdot \frac{-1}{\sqrt{2}}}\\
\mathbf{elif}\;B\_m \leq 5.2 \cdot 10^{-26}:\\
\;\;\;\;\frac{-1}{\frac{t\_0}{\sqrt{t\_0 \cdot \left(4 \cdot \left(C \cdot F\right)\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot F} \cdot \left(-{B\_m}^{-0.5}\right)\\
\end{array}
\end{array}
if B < 7.99999999999999956e-227Initial program 17.7%
Taylor expanded in A around -inf 16.9%
Taylor expanded in F around 0 16.9%
if 7.99999999999999956e-227 < B < 3.9999999999999999e-140Initial program 12.1%
Simplified12.9%
clear-num12.9%
inv-pow12.9%
Applied egg-rr13.0%
unpow-113.0%
associate-*r*13.0%
hypot-undefine12.1%
unpow212.1%
unpow212.1%
+-commutative12.1%
unpow212.1%
unpow212.1%
hypot-undefine13.0%
Simplified13.0%
Taylor expanded in F around 0 18.3%
mul-1-neg18.3%
fma-define18.3%
unpow218.3%
unpow218.3%
hypot-undefine19.5%
Simplified19.5%
Taylor expanded in A around -inf 20.9%
if 3.9999999999999999e-140 < B < 5.2000000000000002e-26Initial program 28.0%
Simplified38.5%
clear-num38.5%
inv-pow38.5%
Applied egg-rr39.3%
unpow-139.3%
associate-*r*39.3%
hypot-undefine28.5%
unpow228.5%
unpow228.5%
+-commutative28.5%
unpow228.5%
unpow228.5%
hypot-undefine39.3%
Simplified39.3%
Taylor expanded in A around -inf 31.8%
if 5.2000000000000002e-26 < B Initial program 13.7%
Taylor expanded in B around inf 46.9%
mul-1-neg46.9%
Simplified46.9%
sqrt-div56.7%
Applied egg-rr56.7%
associate-*l/56.6%
sqrt-unprod56.8%
Applied egg-rr56.8%
div-inv56.8%
pow1/256.8%
pow-flip56.8%
metadata-eval56.8%
Applied egg-rr56.8%
Final simplification27.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 2.95e-27)
(/ -1.0 (/ t_0 (sqrt (* t_0 (* 4.0 (* C F))))))
(* (sqrt (* 2.0 F)) (- (pow B_m -0.5))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 2.95e-27) {
tmp = -1.0 / (t_0 / sqrt((t_0 * (4.0 * (C * F)))));
} else {
tmp = sqrt((2.0 * F)) * -pow(B_m, -0.5);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 2.95e-27) tmp = Float64(-1.0 / Float64(t_0 / sqrt(Float64(t_0 * Float64(4.0 * Float64(C * F)))))); else tmp = Float64(sqrt(Float64(2.0 * F)) * Float64(-(B_m ^ -0.5))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 2.95e-27], N[(-1.0 / N[(t$95$0 / N[Sqrt[N[(t$95$0 * N[(4.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] * (-N[Power[B$95$m, -0.5], $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 2.95 \cdot 10^{-27}:\\
\;\;\;\;\frac{-1}{\frac{t\_0}{\sqrt{t\_0 \cdot \left(4 \cdot \left(C \cdot F\right)\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot F} \cdot \left(-{B\_m}^{-0.5}\right)\\
\end{array}
\end{array}
if B < 2.9499999999999999e-27Initial program 18.4%
Simplified25.1%
clear-num25.1%
inv-pow25.1%
Applied egg-rr25.3%
unpow-125.3%
associate-*r*25.3%
hypot-undefine18.8%
unpow218.8%
unpow218.8%
+-commutative18.8%
unpow218.8%
unpow218.8%
hypot-undefine25.3%
Simplified25.3%
Taylor expanded in A around -inf 17.3%
if 2.9499999999999999e-27 < B Initial program 13.7%
Taylor expanded in B around inf 46.9%
mul-1-neg46.9%
Simplified46.9%
sqrt-div56.7%
Applied egg-rr56.7%
associate-*l/56.6%
sqrt-unprod56.8%
Applied egg-rr56.8%
div-inv56.8%
pow1/256.8%
pow-flip56.8%
metadata-eval56.8%
Applied egg-rr56.8%
Final simplification26.1%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= (pow B_m 2.0) 4e+46) (/ 1.0 (* (sqrt (* -2.0 (/ A F))) (/ -1.0 (sqrt 2.0)))) (* (sqrt (* 2.0 F)) (- (pow B_m -0.5)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 4e+46) {
tmp = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
} else {
tmp = sqrt((2.0 * F)) * -pow(B_m, -0.5);
}
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.0d0) <= 4d+46) then
tmp = 1.0d0 / (sqrt(((-2.0d0) * (a / f))) * ((-1.0d0) / sqrt(2.0d0)))
else
tmp = sqrt((2.0d0 * f)) * -(b_m ** (-0.5d0))
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 (Math.pow(B_m, 2.0) <= 4e+46) {
tmp = 1.0 / (Math.sqrt((-2.0 * (A / F))) * (-1.0 / Math.sqrt(2.0)));
} else {
tmp = Math.sqrt((2.0 * F)) * -Math.pow(B_m, -0.5);
}
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 math.pow(B_m, 2.0) <= 4e+46: tmp = 1.0 / (math.sqrt((-2.0 * (A / F))) * (-1.0 / math.sqrt(2.0))) else: tmp = math.sqrt((2.0 * F)) * -math.pow(B_m, -0.5) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 4e+46) tmp = Float64(1.0 / Float64(sqrt(Float64(-2.0 * Float64(A / F))) * Float64(-1.0 / sqrt(2.0)))); else tmp = Float64(sqrt(Float64(2.0 * F)) * Float64(-(B_m ^ -0.5))); 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.0) <= 4e+46)
tmp = 1.0 / (sqrt((-2.0 * (A / F))) * (-1.0 / sqrt(2.0)));
else
tmp = sqrt((2.0 * F)) * -(B_m ^ -0.5);
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[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+46], N[(1.0 / N[(N[Sqrt[N[(-2.0 * N[(A / F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] * (-N[Power[B$95$m, -0.5], $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 4 \cdot 10^{+46}:\\
\;\;\;\;\frac{1}{\sqrt{-2 \cdot \frac{A}{F}} \cdot \frac{-1}{\sqrt{2}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot F} \cdot \left(-{B\_m}^{-0.5}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4e46Initial program 22.6%
Simplified32.1%
clear-num32.0%
inv-pow32.0%
Applied egg-rr32.3%
unpow-132.3%
associate-*r*32.3%
hypot-undefine23.2%
unpow223.2%
unpow223.2%
+-commutative23.2%
unpow223.2%
unpow223.2%
hypot-undefine32.3%
Simplified32.3%
Taylor expanded in F around 0 20.6%
mul-1-neg20.6%
fma-define20.6%
unpow220.6%
unpow220.6%
hypot-undefine25.6%
Simplified25.6%
Taylor expanded in A around -inf 21.4%
if 4e46 < (pow.f64 B 2) Initial program 11.0%
Taylor expanded in B around inf 21.8%
mul-1-neg21.8%
Simplified21.8%
sqrt-div25.9%
Applied egg-rr25.9%
associate-*l/25.9%
sqrt-unprod26.0%
Applied egg-rr26.0%
div-inv26.0%
pow1/226.0%
pow-flip26.0%
metadata-eval26.0%
Applied egg-rr26.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 (* (sqrt (* 2.0 F)) (- (pow B_m -0.5))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt((2.0 * F)) * -pow(B_m, -0.5);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((2.0d0 * f)) * -(b_m ** (-0.5d0))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((2.0 * F)) * -Math.pow(B_m, -0.5);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt((2.0 * F)) * -math.pow(B_m, -0.5)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(sqrt(Float64(2.0 * F)) * Float64(-(B_m ^ -0.5))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt((2.0 * F)) * -(B_m ^ -0.5);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] * (-N[Power[B$95$m, -0.5], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{2 \cdot F} \cdot \left(-{B\_m}^{-0.5}\right)
\end{array}
Initial program 17.4%
Taylor expanded in B around inf 12.5%
mul-1-neg12.5%
Simplified12.5%
sqrt-div15.0%
Applied egg-rr15.0%
associate-*l/15.0%
sqrt-unprod15.1%
Applied egg-rr15.1%
div-inv15.1%
pow1/215.1%
pow-flip15.1%
metadata-eval15.1%
Applied egg-rr15.1%
Final simplification15.1%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (sqrt (fabs (* F (/ 2.0 B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt(fabs((F * (2.0 / B_m))));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt(abs((f * (2.0d0 / b_m))))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt(Math.abs((F * (2.0 / B_m))));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt(math.fabs((F * (2.0 / B_m))))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(abs(Float64(F * Float64(2.0 / B_m))))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt(abs((F * (2.0 / B_m))));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[Abs[N[(F * N[(2.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{\left|F \cdot \frac{2}{B\_m}\right|}
\end{array}
Initial program 17.4%
Taylor expanded in B around inf 12.5%
mul-1-neg12.5%
Simplified12.5%
pow112.5%
sqrt-unprod12.5%
Applied egg-rr12.5%
unpow112.5%
Simplified12.5%
add-sqr-sqrt12.5%
pow1/212.5%
pow1/212.7%
pow-prod-down16.3%
pow216.3%
*-commutative16.3%
Applied egg-rr16.3%
unpow1/216.3%
unpow216.3%
rem-sqrt-square29.4%
associate-*r/29.4%
*-commutative29.4%
associate-/l*29.4%
Simplified29.4%
Final simplification29.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 (* (sqrt (/ 2.0 B_m)) (- (sqrt F))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt((2.0 / B_m)) * -sqrt(F);
}
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 / b_m)) * -sqrt(f)
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 / B_m)) * -Math.sqrt(F);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt((2.0 / B_m)) * -math.sqrt(F)
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 / B_m)) * Float64(-sqrt(F))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt((2.0 / B_m)) * -sqrt(F);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{\frac{2}{B\_m}} \cdot \left(-\sqrt{F}\right)
\end{array}
Initial program 17.4%
Taylor expanded in B around inf 12.5%
mul-1-neg12.5%
Simplified12.5%
sqrt-div15.0%
Applied egg-rr15.0%
associate-*l/15.0%
sqrt-unprod15.1%
Applied egg-rr15.1%
sqrt-undiv12.6%
associate-*r/12.5%
pow1/212.7%
*-commutative12.7%
unpow-prod-down15.1%
pow1/215.1%
pow1/215.1%
Applied egg-rr15.1%
Final simplification15.1%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (/ (sqrt (* 2.0 F)) (- (sqrt B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt((2.0 * F)) / -sqrt(B_m);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((2.0d0 * f)) / -sqrt(b_m)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((2.0 * F)) / -Math.sqrt(B_m);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt((2.0 * F)) / -math.sqrt(B_m)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(sqrt(Float64(2.0 * F)) / Float64(-sqrt(B_m))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt((2.0 * F)) / -sqrt(B_m);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{\sqrt{2 \cdot F}}{-\sqrt{B\_m}}
\end{array}
Initial program 17.4%
Taylor expanded in B around inf 12.5%
mul-1-neg12.5%
Simplified12.5%
sqrt-div15.0%
Applied egg-rr15.0%
associate-*l/15.0%
sqrt-unprod15.1%
Applied egg-rr15.1%
Final simplification15.1%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (pow (* 2.0 (/ F B_m)) 0.5)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -pow((2.0 * (F / B_m)), 0.5);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -((2.0d0 * (f / b_m)) ** 0.5d0)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.pow((2.0 * (F / B_m)), 0.5);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.pow((2.0 * (F / B_m)), 0.5)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -((2.0 * (F / B_m)) ^ 0.5);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}
\end{array}
Initial program 17.4%
Taylor expanded in B around inf 12.5%
mul-1-neg12.5%
Simplified12.5%
sqrt-unprod12.5%
pow1/212.7%
Applied egg-rr12.7%
Final simplification12.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 (- (pow (/ (* 2.0 F) B_m) 0.5)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -pow(((2.0 * F) / B_m), 0.5);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -(((2.0d0 * f) / b_m) ** 0.5d0)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.pow(((2.0 * F) / B_m), 0.5);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.pow(((2.0 * F) / B_m), 0.5)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-(Float64(Float64(2.0 * F) / B_m) ^ 0.5)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -(((2.0 * F) / B_m) ^ 0.5);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Power[N[(N[(2.0 * F), $MachinePrecision] / B$95$m), $MachinePrecision], 0.5], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-{\left(\frac{2 \cdot F}{B\_m}\right)}^{0.5}
\end{array}
Initial program 17.4%
Taylor expanded in B around inf 12.5%
mul-1-neg12.5%
Simplified12.5%
sqrt-div15.0%
Applied egg-rr15.0%
associate-*l/15.0%
sqrt-unprod15.1%
Applied egg-rr15.1%
sqrt-undiv12.6%
associate-*r/12.5%
pow1/212.7%
associate-*r/12.8%
Applied egg-rr12.8%
Final simplification12.8%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (sqrt (* F (/ 2.0 B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((F * (2.0 / B_m)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((f * (2.0d0 / b_m)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((F * (2.0 / B_m)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((F * (2.0 / B_m)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(F * Float64(2.0 / B_m)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((F * (2.0 / B_m)));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(F * N[(2.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{F \cdot \frac{2}{B\_m}}
\end{array}
Initial program 17.4%
Taylor expanded in B around inf 12.5%
mul-1-neg12.5%
Simplified12.5%
pow112.5%
sqrt-unprod12.5%
Applied egg-rr12.5%
unpow112.5%
Simplified12.5%
Taylor expanded in F around 0 12.5%
associate-*r/12.6%
*-commutative12.6%
associate-/l*12.5%
Simplified12.5%
Final simplification12.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 (- (sqrt (* 2.0 (/ F B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((2.0 * (F / B_m)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((2.0d0 * (f / b_m)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((2.0 * (F / B_m)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((2.0 * (F / B_m)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((2.0 * (F / B_m)));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{2 \cdot \frac{F}{B\_m}}
\end{array}
Initial program 17.4%
Taylor expanded in B around inf 12.5%
mul-1-neg12.5%
Simplified12.5%
pow112.5%
sqrt-unprod12.5%
Applied egg-rr12.5%
unpow112.5%
Simplified12.5%
Final simplification12.5%
herbie shell --seed 2024055
(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))))