
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
(t_1 (hypot B_m (- A C)))
(t_2 (* (* 4.0 A) C))
(t_3 (- t_2 (pow B_m 2.0)))
(t_4
(/
(sqrt
(*
(* 2.0 (* F t_3))
(- (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))) (+ A C))))
t_3)))
(if (<= t_4 (- INFINITY))
(*
(sqrt 2.0)
(- (sqrt (* F (/ (+ C (- A t_1)) (fma -4.0 (* A C) (pow B_m 2.0)))))))
(if (<= t_4 -2e-213)
(/ (sqrt (* (* F t_0) (* 2.0 (- A (- t_1 C))))) (- t_0))
(if (<= t_4 INFINITY)
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_2) F))
(+ A (+ A (/ (* (pow B_m 2.0) -0.5) C)))))
t_3)
(*
(exp (* (+ (log (- F)) (log B_m)) 0.5))
(/ (sqrt 2.0) (- B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = hypot(B_m, (A - C));
double t_2 = (4.0 * A) * C;
double t_3 = t_2 - pow(B_m, 2.0);
double t_4 = sqrt(((2.0 * (F * t_3)) * (sqrt((pow(B_m, 2.0) + pow((A - C), 2.0))) - (A + C)))) / t_3;
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = sqrt(2.0) * -sqrt((F * ((C + (A - t_1)) / fma(-4.0, (A * C), pow(B_m, 2.0)))));
} else if (t_4 <= -2e-213) {
tmp = sqrt(((F * t_0) * (2.0 * (A - (t_1 - C))))) / -t_0;
} else if (t_4 <= ((double) INFINITY)) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_2) * F)) * (A + (A + ((pow(B_m, 2.0) * -0.5) / C))))) / t_3;
} else {
tmp = exp(((log(-F) + log(B_m)) * 0.5)) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = hypot(B_m, Float64(A - C)) t_2 = Float64(Float64(4.0 * A) * C) t_3 = Float64(t_2 - (B_m ^ 2.0)) t_4 = Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_3)) * Float64(sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))) - Float64(A + C)))) / t_3) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(Float64(C + Float64(A - t_1)) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))))); elseif (t_4 <= -2e-213) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A - Float64(t_1 - C))))) / Float64(-t_0)); elseif (t_4 <= Inf) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_2) * F)) * Float64(A + Float64(A + Float64(Float64((B_m ^ 2.0) * -0.5) / C))))) / t_3); else tmp = Float64(exp(Float64(Float64(log(Float64(-F)) + log(B_m)) * 0.5)) * 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[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(C + N[(A - t$95$1), $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$4, -2e-213], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A - N[(t$95$1 - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$2), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * -0.5), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision], N[(N[Exp[N[(N[(N[Log[(-F)], $MachinePrecision] + N[Log[B$95$m], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \mathsf{hypot}\left(B\_m, A - C\right)\\
t_2 := \left(4 \cdot A\right) \cdot C\\
t_3 := t\_2 - {B\_m}^{2}\\
t_4 := \frac{\sqrt{\left(2 \cdot \left(F \cdot t\_3\right)\right) \cdot \left(\sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}} - \left(A + C\right)\right)}}{t\_3}\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{C + \left(A - t\_1\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}}\right)\\
\mathbf{elif}\;t\_4 \leq -2 \cdot 10^{-213}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(2 \cdot \left(A - \left(t\_1 - C\right)\right)\right)}}{-t\_0}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_2\right) \cdot F\right)\right) \cdot \left(A + \left(A + \frac{{B\_m}^{2} \cdot -0.5}{C}\right)\right)}}{t\_3}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\log \left(-F\right) + \log B\_m\right) \cdot 0.5} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -inf.0Initial program 3.6%
Taylor expanded in F around 0 14.3%
Simplified68.6%
if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -1.9999999999999999e-213Initial program 98.0%
Simplified98.0%
if -1.9999999999999999e-213 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < +inf.0Initial program 27.0%
Taylor expanded in C around inf 32.8%
mul-1-neg32.8%
associate--l+32.8%
associate-*r/32.8%
Simplified32.8%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) Initial program 0.0%
Taylor expanded in A around 0 2.0%
mul-1-neg2.0%
unpow22.0%
unpow22.0%
hypot-define20.1%
Simplified20.1%
pow1/220.1%
pow-to-exp19.1%
Applied egg-rr19.1%
Taylor expanded in B around inf 22.7%
mul-1-neg22.7%
mul-1-neg22.7%
log-rec22.7%
remove-double-neg22.7%
Simplified22.7%
Final simplification44.1%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C))
(t_1
(*
(/ (sqrt 2.0) B_m)
(- (exp (* 0.5 (+ (log (/ (* F -0.5) C)) (* 2.0 (log B_m))))))))
(t_2 (+ (pow B_m 2.0) (* C (* A -4.0))))
(t_3 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 2e-184)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 5e-162)
t_1
(if (<= (pow B_m 2.0) 2e-106)
(/ -1.0 (/ t_2 (sqrt (* 2.0 (* t_2 (* 2.0 (* A F)))))))
(if (<= (pow B_m 2.0) 20000000.0)
(/
(sqrt (* (* F t_3) (* 2.0 (- A (- (hypot B_m (- A C)) C)))))
(- t_3))
(if (<= (pow B_m 2.0) 5e+90)
t_1
(*
(exp (* (+ (log (- F)) (log B_m)) 0.5))
(/ (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 = (4.0 * A) * C;
double t_1 = (sqrt(2.0) / B_m) * -exp((0.5 * (log(((F * -0.5) / C)) + (2.0 * log(B_m)))));
double t_2 = pow(B_m, 2.0) + (C * (A * -4.0));
double t_3 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 2e-184) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 5e-162) {
tmp = t_1;
} else if (pow(B_m, 2.0) <= 2e-106) {
tmp = -1.0 / (t_2 / sqrt((2.0 * (t_2 * (2.0 * (A * F))))));
} else if (pow(B_m, 2.0) <= 20000000.0) {
tmp = sqrt(((F * t_3) * (2.0 * (A - (hypot(B_m, (A - C)) - C))))) / -t_3;
} else if (pow(B_m, 2.0) <= 5e+90) {
tmp = t_1;
} else {
tmp = exp(((log(-F) + log(B_m)) * 0.5)) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(Float64(sqrt(2.0) / B_m) * Float64(-exp(Float64(0.5 * Float64(log(Float64(Float64(F * -0.5) / C)) + Float64(2.0 * log(B_m))))))) t_2 = Float64((B_m ^ 2.0) + Float64(C * Float64(A * -4.0))) t_3 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-184) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 5e-162) tmp = t_1; elseif ((B_m ^ 2.0) <= 2e-106) tmp = Float64(-1.0 / Float64(t_2 / sqrt(Float64(2.0 * Float64(t_2 * Float64(2.0 * Float64(A * F))))))); elseif ((B_m ^ 2.0) <= 20000000.0) tmp = Float64(sqrt(Float64(Float64(F * t_3) * Float64(2.0 * Float64(A - Float64(hypot(B_m, Float64(A - C)) - C))))) / Float64(-t_3)); elseif ((B_m ^ 2.0) <= 5e+90) tmp = t_1; else tmp = Float64(exp(Float64(Float64(log(Float64(-F)) + log(B_m)) * 0.5)) * 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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Exp[N[(0.5 * N[(N[Log[N[(N[(F * -0.5), $MachinePrecision] / C), $MachinePrecision]], $MachinePrecision] + N[(2.0 * N[Log[B$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-184], 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 * 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], 5e-162], t$95$1, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-106], N[(-1.0 / N[(t$95$2 / N[Sqrt[N[(2.0 * N[(t$95$2 * N[(2.0 * N[(A * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 20000000.0], N[(N[Sqrt[N[(N[(F * t$95$3), $MachinePrecision] * N[(2.0 * N[(A - N[(N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision] - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$3)), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+90], t$95$1, N[(N[Exp[N[(N[(N[Log[(-F)], $MachinePrecision] + N[Log[B$95$m], $MachinePrecision]), $MachinePrecision] * 0.5), $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 := \left(4 \cdot A\right) \cdot C\\
t_1 := \frac{\sqrt{2}}{B\_m} \cdot \left(-e^{0.5 \cdot \left(\log \left(\frac{F \cdot -0.5}{C}\right) + 2 \cdot \log B\_m\right)}\right)\\
t_2 := {B\_m}^{2} + C \cdot \left(A \cdot -4\right)\\
t_3 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-184}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-106}:\\
\;\;\;\;\frac{-1}{\frac{t\_2}{\sqrt{2 \cdot \left(t\_2 \cdot \left(2 \cdot \left(A \cdot F\right)\right)\right)}}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 20000000:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_3\right) \cdot \left(2 \cdot \left(A - \left(\mathsf{hypot}\left(B\_m, A - C\right) - C\right)\right)\right)}}{-t\_3}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+90}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\log \left(-F\right) + \log B\_m\right) \cdot 0.5} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e-184Initial program 29.0%
Taylor expanded in A around -inf 26.6%
if 2.0000000000000001e-184 < (pow.f64 B #s(literal 2 binary64)) < 5.00000000000000014e-162 or 2e7 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000004e90Initial program 20.4%
Taylor expanded in A around 0 12.6%
mul-1-neg12.6%
unpow212.6%
unpow212.6%
hypot-define12.7%
Simplified12.7%
pow1/212.8%
pow-to-exp12.1%
Applied egg-rr12.1%
Taylor expanded in B around 0 10.5%
associate-*r/10.5%
Simplified10.5%
if 5.00000000000000014e-162 < (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999988e-106Initial program 14.7%
Taylor expanded in C around inf 2.5%
mul-1-neg2.5%
associate--l+2.5%
associate-*r/2.5%
Simplified2.5%
clear-num2.5%
inv-pow2.5%
Applied egg-rr2.5%
unpow-12.5%
cancel-sign-sub-inv2.5%
metadata-eval2.5%
associate-*r*2.5%
associate-*l*14.6%
cancel-sign-sub-inv14.6%
metadata-eval14.6%
associate-*r*14.6%
Simplified14.6%
Taylor expanded in A around inf 14.6%
*-commutative14.6%
Simplified14.6%
if 1.99999999999999988e-106 < (pow.f64 B #s(literal 2 binary64)) < 2e7Initial program 47.1%
Simplified56.8%
if 5.0000000000000004e90 < (pow.f64 B #s(literal 2 binary64)) Initial program 11.7%
Taylor expanded in A around 0 10.7%
mul-1-neg10.7%
unpow210.7%
unpow210.7%
hypot-define29.5%
Simplified29.5%
pow1/229.5%
pow-to-exp28.0%
Applied egg-rr28.0%
Taylor expanded in B around inf 30.0%
mul-1-neg30.0%
mul-1-neg30.0%
log-rec30.0%
remove-double-neg30.0%
Simplified30.0%
Final simplification28.5%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))) (t_1 (- t_0)) (t_2 (* F t_0)))
(if (<= (pow B_m 2.0) 1e-179)
(/ (sqrt (* t_2 (* 2.0 (+ A (+ A (/ (* (pow B_m 2.0) -0.5) C)))))) t_1)
(if (<= (pow B_m 2.0) 20000000.0)
(/ (sqrt (* t_2 (* 2.0 (- A (- (hypot B_m (- A C)) C))))) t_1)
(if (<= (pow B_m 2.0) 5e+90)
(*
(/ (sqrt 2.0) B_m)
(- (exp (* 0.5 (+ (log (/ (* F -0.5) C)) (* 2.0 (log B_m)))))))
(*
(exp (* (+ (log (- F)) (log B_m)) 0.5))
(/ (sqrt 2.0) (- B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = -t_0;
double t_2 = F * t_0;
double tmp;
if (pow(B_m, 2.0) <= 1e-179) {
tmp = sqrt((t_2 * (2.0 * (A + (A + ((pow(B_m, 2.0) * -0.5) / C)))))) / t_1;
} else if (pow(B_m, 2.0) <= 20000000.0) {
tmp = sqrt((t_2 * (2.0 * (A - (hypot(B_m, (A - C)) - C))))) / t_1;
} else if (pow(B_m, 2.0) <= 5e+90) {
tmp = (sqrt(2.0) / B_m) * -exp((0.5 * (log(((F * -0.5) / C)) + (2.0 * log(B_m)))));
} else {
tmp = exp(((log(-F) + log(B_m)) * 0.5)) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = Float64(-t_0) t_2 = Float64(F * t_0) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-179) tmp = Float64(sqrt(Float64(t_2 * Float64(2.0 * Float64(A + Float64(A + Float64(Float64((B_m ^ 2.0) * -0.5) / C)))))) / t_1); elseif ((B_m ^ 2.0) <= 20000000.0) tmp = Float64(sqrt(Float64(t_2 * Float64(2.0 * Float64(A - Float64(hypot(B_m, Float64(A - C)) - C))))) / t_1); elseif ((B_m ^ 2.0) <= 5e+90) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-exp(Float64(0.5 * Float64(log(Float64(Float64(F * -0.5) / C)) + Float64(2.0 * log(B_m))))))); else tmp = Float64(exp(Float64(Float64(log(Float64(-F)) + log(B_m)) * 0.5)) * 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[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-t$95$0)}, Block[{t$95$2 = N[(F * t$95$0), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-179], N[(N[Sqrt[N[(t$95$2 * N[(2.0 * N[(A + N[(A + N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * -0.5), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 20000000.0], N[(N[Sqrt[N[(t$95$2 * N[(2.0 * N[(A - N[(N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision] - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+90], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Exp[N[(0.5 * N[(N[Log[N[(N[(F * -0.5), $MachinePrecision] / C), $MachinePrecision]], $MachinePrecision] + N[(2.0 * N[Log[B$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Exp[N[(N[(N[Log[(-F)], $MachinePrecision] + N[Log[B$95$m], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := -t\_0\\
t_2 := F \cdot t\_0\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-179}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(2 \cdot \left(A + \left(A + \frac{{B\_m}^{2} \cdot -0.5}{C}\right)\right)\right)}}{t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 20000000:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(2 \cdot \left(A - \left(\mathsf{hypot}\left(B\_m, A - C\right) - C\right)\right)\right)}}{t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+90}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-e^{0.5 \cdot \left(\log \left(\frac{F \cdot -0.5}{C}\right) + 2 \cdot \log B\_m\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\log \left(-F\right) + \log B\_m\right) \cdot 0.5} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1e-179Initial program 27.8%
Simplified36.4%
Taylor expanded in C around inf 26.0%
associate-*r/26.0%
mul-1-neg26.0%
Simplified26.0%
if 1e-179 < (pow.f64 B #s(literal 2 binary64)) < 2e7Initial program 38.0%
Simplified44.1%
if 2e7 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000004e90Initial program 19.3%
Taylor expanded in A around 0 13.6%
mul-1-neg13.6%
unpow213.6%
unpow213.6%
hypot-define13.7%
Simplified13.7%
pow1/213.7%
pow-to-exp12.8%
Applied egg-rr12.8%
Taylor expanded in B around 0 15.9%
associate-*r/15.9%
Simplified15.9%
if 5.0000000000000004e90 < (pow.f64 B #s(literal 2 binary64)) Initial program 11.7%
Taylor expanded in A around 0 10.7%
mul-1-neg10.7%
unpow210.7%
unpow210.7%
hypot-define29.5%
Simplified29.5%
pow1/229.5%
pow-to-exp28.0%
Applied egg-rr28.0%
Taylor expanded in B around inf 30.0%
mul-1-neg30.0%
mul-1-neg30.0%
log-rec30.0%
remove-double-neg30.0%
Simplified30.0%
Final simplification29.6%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 20000000.0)
(/
(sqrt (* -8.0 (* (* F (* A C)) (+ A A))))
(- (fma -4.0 (* A C) (pow B_m 2.0))))
(if (<= (pow B_m 2.0) 5e+90)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* -0.5 (/ (* (pow B_m 2.0) F) C)))))
(* (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) <= 20000000.0) {
tmp = sqrt((-8.0 * ((F * (A * C)) * (A + A)))) / -fma(-4.0, (A * C), pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 5e+90) {
tmp = (sqrt(2.0) / B_m) * -sqrt((-0.5 * ((pow(B_m, 2.0) * F) / C)));
} 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) <= 20000000.0) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(F * Float64(A * C)) * Float64(A + A)))) / Float64(-fma(-4.0, Float64(A * C), (B_m ^ 2.0)))); elseif ((B_m ^ 2.0) <= 5e+90) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(-0.5 * Float64(Float64((B_m ^ 2.0) * F) / C))))); 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], 20000000.0], N[(N[Sqrt[N[(-8.0 * N[(N[(F * N[(A * C), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+90], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(-0.5 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * F), $MachinePrecision] / C), $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}
\mathbf{if}\;{B\_m}^{2} \leq 20000000:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(F \cdot \left(A \cdot C\right)\right) \cdot \left(A + A\right)\right)}}{-\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+90}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{-0.5 \cdot \frac{{B\_m}^{2} \cdot F}{C}}\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)) < 2e7Initial program 30.7%
Simplified36.0%
Taylor expanded in C around inf 18.9%
associate-*r*19.6%
*-commutative19.6%
mul-1-neg19.6%
Simplified19.6%
*-un-lft-identity19.6%
associate-*r*19.5%
*-commutative19.5%
fma-undefine19.5%
*-commutative19.5%
*-commutative19.5%
associate-*l*19.5%
*-commutative19.5%
fma-define19.5%
*-commutative19.5%
Applied egg-rr19.5%
*-lft-identity19.5%
sub-neg19.5%
remove-double-neg19.5%
*-commutative19.5%
*-commutative19.5%
*-commutative19.5%
Simplified19.5%
if 2e7 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000004e90Initial program 19.3%
Taylor expanded in A around 0 13.6%
mul-1-neg13.6%
unpow213.6%
unpow213.6%
hypot-define13.7%
Simplified13.7%
Taylor expanded in C around inf 23.8%
if 5.0000000000000004e90 < (pow.f64 B #s(literal 2 binary64)) Initial program 11.7%
Taylor expanded in C around 0 11.8%
mul-1-neg11.8%
+-commutative11.8%
unpow211.8%
unpow211.8%
hypot-define29.7%
Simplified29.7%
Final simplification24.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 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 4.7e-88)
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_0) F))
(+ A (+ A (/ (* (pow B_m 2.0) -0.5) C)))))
(- t_0 (pow B_m 2.0)))
(if (<= B_m 55000.0)
(/ (sqrt (* (* F t_1) (* 2.0 (- A (- (hypot B_m (- A C)) C))))) (- t_1))
(if (<= B_m 1.05e+50)
(*
(/ (sqrt 2.0) B_m)
(- (exp (* 0.5 (+ (log (/ (* F -0.5) C)) (* 2.0 (log B_m)))))))
(*
(exp (* (+ (log (- F)) (log B_m)) 0.5))
(/ (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 = (4.0 * A) * C;
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 4.7e-88) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (A + (A + ((pow(B_m, 2.0) * -0.5) / C))))) / (t_0 - pow(B_m, 2.0));
} else if (B_m <= 55000.0) {
tmp = sqrt(((F * t_1) * (2.0 * (A - (hypot(B_m, (A - C)) - C))))) / -t_1;
} else if (B_m <= 1.05e+50) {
tmp = (sqrt(2.0) / B_m) * -exp((0.5 * (log(((F * -0.5) / C)) + (2.0 * log(B_m)))));
} else {
tmp = exp(((log(-F) + log(B_m)) * 0.5)) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 4.7e-88) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(A + Float64(A + Float64(Float64((B_m ^ 2.0) * -0.5) / C))))) / Float64(t_0 - (B_m ^ 2.0))); elseif (B_m <= 55000.0) tmp = Float64(sqrt(Float64(Float64(F * t_1) * Float64(2.0 * Float64(A - Float64(hypot(B_m, Float64(A - C)) - C))))) / Float64(-t_1)); elseif (B_m <= 1.05e+50) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-exp(Float64(0.5 * Float64(log(Float64(Float64(F * -0.5) / C)) + Float64(2.0 * log(B_m))))))); else tmp = Float64(exp(Float64(Float64(log(Float64(-F)) + log(B_m)) * 0.5)) * 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[(N[(4.0 * A), $MachinePrecision] * C), $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.7e-88], 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[(A + N[(A + N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * -0.5), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 55000.0], N[(N[Sqrt[N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * N[(A - N[(N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision] - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[B$95$m, 1.05e+50], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Exp[N[(0.5 * N[(N[Log[N[(N[(F * -0.5), $MachinePrecision] / C), $MachinePrecision]], $MachinePrecision] + N[(2.0 * N[Log[B$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Exp[N[(N[(N[Log[(-F)], $MachinePrecision] + N[Log[B$95$m], $MachinePrecision]), $MachinePrecision] * 0.5), $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 := \left(4 \cdot A\right) \cdot C\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 4.7 \cdot 10^{-88}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(A + \left(A + \frac{{B\_m}^{2} \cdot -0.5}{C}\right)\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 55000:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_1\right) \cdot \left(2 \cdot \left(A - \left(\mathsf{hypot}\left(B\_m, A - C\right) - C\right)\right)\right)}}{-t\_1}\\
\mathbf{elif}\;B\_m \leq 1.05 \cdot 10^{+50}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-e^{0.5 \cdot \left(\log \left(\frac{F \cdot -0.5}{C}\right) + 2 \cdot \log B\_m\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\log \left(-F\right) + \log B\_m\right) \cdot 0.5} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 4.7e-88Initial program 22.3%
Taylor expanded in C around inf 14.9%
mul-1-neg14.9%
associate--l+14.9%
associate-*r/14.9%
Simplified14.9%
if 4.7e-88 < B < 55000Initial program 40.1%
Simplified45.7%
if 55000 < B < 1.05e50Initial program 27.9%
Taylor expanded in A around 0 28.7%
mul-1-neg28.7%
unpow228.7%
unpow228.7%
hypot-define28.7%
Simplified28.7%
pow1/228.7%
pow-to-exp26.5%
Applied egg-rr26.5%
Taylor expanded in B around 0 35.8%
associate-*r/35.8%
Simplified35.8%
if 1.05e50 < B Initial program 12.6%
Taylor expanded in A around 0 18.7%
mul-1-neg18.7%
unpow218.7%
unpow218.7%
hypot-define52.7%
Simplified52.7%
pow1/252.7%
pow-to-exp49.8%
Applied egg-rr49.8%
Taylor expanded in B around inf 56.0%
mul-1-neg56.0%
mul-1-neg56.0%
log-rec56.0%
remove-double-neg56.0%
Simplified56.0%
Final simplification27.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 (* (* 4.0 A) C))
(t_1
(*
(/ (sqrt 2.0) B_m)
(- (exp (* 0.5 (+ (log (/ (* F -0.5) C)) (* 2.0 (log B_m))))))))
(t_2 (+ (pow B_m 2.0) (* C (* A -4.0)))))
(if (<= B_m 2.7e-92)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(if (<= B_m 1.1e-77)
t_1
(if (<= B_m 680000.0)
(/ -1.0 (/ t_2 (sqrt (* 2.0 (* t_2 (* 2.0 (* A F)))))))
(if (<= B_m 4.1e+46)
t_1
(*
(exp (* (+ (log (- F)) (log B_m)) 0.5))
(/ (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 = (4.0 * A) * C;
double t_1 = (sqrt(2.0) / B_m) * -exp((0.5 * (log(((F * -0.5) / C)) + (2.0 * log(B_m)))));
double t_2 = pow(B_m, 2.0) + (C * (A * -4.0));
double tmp;
if (B_m <= 2.7e-92) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else if (B_m <= 1.1e-77) {
tmp = t_1;
} else if (B_m <= 680000.0) {
tmp = -1.0 / (t_2 / sqrt((2.0 * (t_2 * (2.0 * (A * F))))));
} else if (B_m <= 4.1e+46) {
tmp = t_1;
} else {
tmp = exp(((log(-F) + log(B_m)) * 0.5)) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (4.0d0 * a) * c
t_1 = (sqrt(2.0d0) / b_m) * -exp((0.5d0 * (log(((f * (-0.5d0)) / c)) + (2.0d0 * log(b_m)))))
t_2 = (b_m ** 2.0d0) + (c * (a * (-4.0d0)))
if (b_m <= 2.7d-92) then
tmp = sqrt(((2.0d0 * (((b_m ** 2.0d0) - t_0) * f)) * (2.0d0 * a))) / (t_0 - (b_m ** 2.0d0))
else if (b_m <= 1.1d-77) then
tmp = t_1
else if (b_m <= 680000.0d0) then
tmp = (-1.0d0) / (t_2 / sqrt((2.0d0 * (t_2 * (2.0d0 * (a * f))))))
else if (b_m <= 4.1d+46) then
tmp = t_1
else
tmp = exp(((log(-f) + log(b_m)) * 0.5d0)) * (sqrt(2.0d0) / -b_m)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = (Math.sqrt(2.0) / B_m) * -Math.exp((0.5 * (Math.log(((F * -0.5) / C)) + (2.0 * Math.log(B_m)))));
double t_2 = Math.pow(B_m, 2.0) + (C * (A * -4.0));
double tmp;
if (B_m <= 2.7e-92) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - Math.pow(B_m, 2.0));
} else if (B_m <= 1.1e-77) {
tmp = t_1;
} else if (B_m <= 680000.0) {
tmp = -1.0 / (t_2 / Math.sqrt((2.0 * (t_2 * (2.0 * (A * F))))));
} else if (B_m <= 4.1e+46) {
tmp = t_1;
} else {
tmp = Math.exp(((Math.log(-F) + Math.log(B_m)) * 0.5)) * (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 = (4.0 * A) * C t_1 = (math.sqrt(2.0) / B_m) * -math.exp((0.5 * (math.log(((F * -0.5) / C)) + (2.0 * math.log(B_m))))) t_2 = math.pow(B_m, 2.0) + (C * (A * -4.0)) tmp = 0 if B_m <= 2.7e-92: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - math.pow(B_m, 2.0)) elif B_m <= 1.1e-77: tmp = t_1 elif B_m <= 680000.0: tmp = -1.0 / (t_2 / math.sqrt((2.0 * (t_2 * (2.0 * (A * F)))))) elif B_m <= 4.1e+46: tmp = t_1 else: tmp = math.exp(((math.log(-F) + math.log(B_m)) * 0.5)) * (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(Float64(4.0 * A) * C) t_1 = Float64(Float64(sqrt(2.0) / B_m) * Float64(-exp(Float64(0.5 * Float64(log(Float64(Float64(F * -0.5) / C)) + Float64(2.0 * log(B_m))))))) t_2 = Float64((B_m ^ 2.0) + Float64(C * Float64(A * -4.0))) tmp = 0.0 if (B_m <= 2.7e-92) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); elseif (B_m <= 1.1e-77) tmp = t_1; elseif (B_m <= 680000.0) tmp = Float64(-1.0 / Float64(t_2 / sqrt(Float64(2.0 * Float64(t_2 * Float64(2.0 * Float64(A * F))))))); elseif (B_m <= 4.1e+46) tmp = t_1; else tmp = Float64(exp(Float64(Float64(log(Float64(-F)) + log(B_m)) * 0.5)) * 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 = (4.0 * A) * C;
t_1 = (sqrt(2.0) / B_m) * -exp((0.5 * (log(((F * -0.5) / C)) + (2.0 * log(B_m)))));
t_2 = (B_m ^ 2.0) + (C * (A * -4.0));
tmp = 0.0;
if (B_m <= 2.7e-92)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - (B_m ^ 2.0));
elseif (B_m <= 1.1e-77)
tmp = t_1;
elseif (B_m <= 680000.0)
tmp = -1.0 / (t_2 / sqrt((2.0 * (t_2 * (2.0 * (A * F))))));
elseif (B_m <= 4.1e+46)
tmp = t_1;
else
tmp = exp(((log(-F) + log(B_m)) * 0.5)) * (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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Exp[N[(0.5 * N[(N[Log[N[(N[(F * -0.5), $MachinePrecision] / C), $MachinePrecision]], $MachinePrecision] + N[(2.0 * N[Log[B$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 2.7e-92], 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 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.1e-77], t$95$1, If[LessEqual[B$95$m, 680000.0], N[(-1.0 / N[(t$95$2 / N[Sqrt[N[(2.0 * N[(t$95$2 * N[(2.0 * N[(A * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 4.1e+46], t$95$1, N[(N[Exp[N[(N[(N[Log[(-F)], $MachinePrecision] + N[Log[B$95$m], $MachinePrecision]), $MachinePrecision] * 0.5), $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 := \left(4 \cdot A\right) \cdot C\\
t_1 := \frac{\sqrt{2}}{B\_m} \cdot \left(-e^{0.5 \cdot \left(\log \left(\frac{F \cdot -0.5}{C}\right) + 2 \cdot \log B\_m\right)}\right)\\
t_2 := {B\_m}^{2} + C \cdot \left(A \cdot -4\right)\\
\mathbf{if}\;B\_m \leq 2.7 \cdot 10^{-92}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 1.1 \cdot 10^{-77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;B\_m \leq 680000:\\
\;\;\;\;\frac{-1}{\frac{t\_2}{\sqrt{2 \cdot \left(t\_2 \cdot \left(2 \cdot \left(A \cdot F\right)\right)\right)}}}\\
\mathbf{elif}\;B\_m \leq 4.1 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\log \left(-F\right) + \log B\_m\right) \cdot 0.5} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 2.69999999999999995e-92Initial program 22.3%
Taylor expanded in A around -inf 15.8%
if 2.69999999999999995e-92 < B < 1.10000000000000003e-77 or 6.8e5 < B < 4.1e46Initial program 30.0%
Taylor expanded in A around 0 29.0%
mul-1-neg29.0%
unpow229.0%
unpow229.0%
hypot-define29.0%
Simplified29.0%
pow1/229.0%
pow-to-exp27.4%
Applied egg-rr27.4%
Taylor expanded in B around 0 26.7%
associate-*r/26.7%
Simplified26.7%
if 1.10000000000000003e-77 < B < 6.8e5Initial program 40.8%
Taylor expanded in C around inf 7.7%
mul-1-neg7.7%
associate--l+7.7%
associate-*r/7.7%
Simplified7.7%
clear-num7.7%
inv-pow7.7%
Applied egg-rr7.7%
unpow-17.7%
cancel-sign-sub-inv7.7%
metadata-eval7.7%
associate-*r*7.7%
associate-*l*13.2%
cancel-sign-sub-inv13.2%
metadata-eval13.2%
associate-*r*13.2%
Simplified13.2%
Taylor expanded in A around inf 12.6%
*-commutative12.6%
Simplified12.6%
if 4.1e46 < B Initial program 12.6%
Taylor expanded in A around 0 18.7%
mul-1-neg18.7%
unpow218.7%
unpow218.7%
hypot-define52.7%
Simplified52.7%
pow1/252.7%
pow-to-exp49.8%
Applied egg-rr49.8%
Taylor expanded in B around inf 56.0%
mul-1-neg56.0%
mul-1-neg56.0%
log-rec56.0%
remove-double-neg56.0%
Simplified56.0%
Final simplification25.3%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C)))
(if (<= B_m 28500.0)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(if (<= B_m 1.9e+48)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* -0.5 (/ (* (pow B_m 2.0) F) C)))))
(* (exp (* (+ (log (- F)) (log B_m)) 0.5)) (/ (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 = (4.0 * A) * C;
double tmp;
if (B_m <= 28500.0) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else if (B_m <= 1.9e+48) {
tmp = (sqrt(2.0) / B_m) * -sqrt((-0.5 * ((pow(B_m, 2.0) * F) / C)));
} else {
tmp = exp(((log(-F) + log(B_m)) * 0.5)) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (4.0d0 * a) * c
if (b_m <= 28500.0d0) then
tmp = sqrt(((2.0d0 * (((b_m ** 2.0d0) - t_0) * f)) * (2.0d0 * a))) / (t_0 - (b_m ** 2.0d0))
else if (b_m <= 1.9d+48) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt(((-0.5d0) * (((b_m ** 2.0d0) * f) / c)))
else
tmp = exp(((log(-f) + log(b_m)) * 0.5d0)) * (sqrt(2.0d0) / -b_m)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (B_m <= 28500.0) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - Math.pow(B_m, 2.0));
} else if (B_m <= 1.9e+48) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((-0.5 * ((Math.pow(B_m, 2.0) * F) / C)));
} else {
tmp = Math.exp(((Math.log(-F) + Math.log(B_m)) * 0.5)) * (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 = (4.0 * A) * C tmp = 0 if B_m <= 28500.0: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - math.pow(B_m, 2.0)) elif B_m <= 1.9e+48: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((-0.5 * ((math.pow(B_m, 2.0) * F) / C))) else: tmp = math.exp(((math.log(-F) + math.log(B_m)) * 0.5)) * (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(Float64(4.0 * A) * C) tmp = 0.0 if (B_m <= 28500.0) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); elseif (B_m <= 1.9e+48) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(-0.5 * Float64(Float64((B_m ^ 2.0) * F) / C))))); else tmp = Float64(exp(Float64(Float64(log(Float64(-F)) + log(B_m)) * 0.5)) * 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 = (4.0 * A) * C;
tmp = 0.0;
if (B_m <= 28500.0)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - (B_m ^ 2.0));
elseif (B_m <= 1.9e+48)
tmp = (sqrt(2.0) / B_m) * -sqrt((-0.5 * (((B_m ^ 2.0) * F) / C)));
else
tmp = exp(((log(-F) + log(B_m)) * 0.5)) * (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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[B$95$m, 28500.0], 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 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.9e+48], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(-0.5 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * F), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Exp[N[(N[(N[Log[(-F)], $MachinePrecision] + N[Log[B$95$m], $MachinePrecision]), $MachinePrecision] * 0.5), $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 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;B\_m \leq 28500:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 1.9 \cdot 10^{+48}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{-0.5 \cdot \frac{{B\_m}^{2} \cdot F}{C}}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\log \left(-F\right) + \log B\_m\right) \cdot 0.5} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 28500Initial program 24.3%
Taylor expanded in A around -inf 14.7%
if 28500 < B < 1.9e48Initial program 27.9%
Taylor expanded in A around 0 28.7%
mul-1-neg28.7%
unpow228.7%
unpow228.7%
hypot-define28.7%
Simplified28.7%
Taylor expanded in C around inf 39.5%
if 1.9e48 < B Initial program 12.6%
Taylor expanded in A around 0 18.7%
mul-1-neg18.7%
unpow218.7%
unpow218.7%
hypot-define52.7%
Simplified52.7%
pow1/252.7%
pow-to-exp49.8%
Applied egg-rr49.8%
Taylor expanded in B around inf 56.0%
mul-1-neg56.0%
mul-1-neg56.0%
log-rec56.0%
remove-double-neg56.0%
Simplified56.0%
Final simplification25.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C)))
(if (<= B_m 39000.0)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 A)))
(- t_0 (pow B_m 2.0)))
(if (<= B_m 1.85e+47)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* -0.5 (/ (* (pow B_m 2.0) F) C)))))
(* (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 = (4.0 * A) * C;
double tmp;
if (B_m <= 39000.0) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - pow(B_m, 2.0));
} else if (B_m <= 1.85e+47) {
tmp = (sqrt(2.0) / B_m) * -sqrt((-0.5 * ((pow(B_m, 2.0) * F) / C)));
} 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 = (4.0 * A) * C;
double tmp;
if (B_m <= 39000.0) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - Math.pow(B_m, 2.0));
} else if (B_m <= 1.85e+47) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((-0.5 * ((Math.pow(B_m, 2.0) * F) / C)));
} 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 = (4.0 * A) * C tmp = 0 if B_m <= 39000.0: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - math.pow(B_m, 2.0)) elif B_m <= 1.85e+47: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((-0.5 * ((math.pow(B_m, 2.0) * F) / C))) 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(Float64(4.0 * A) * C) tmp = 0.0 if (B_m <= 39000.0) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * A))) / Float64(t_0 - (B_m ^ 2.0))); elseif (B_m <= 1.85e+47) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(-0.5 * Float64(Float64((B_m ^ 2.0) * F) / C))))); 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 = (4.0 * A) * C;
tmp = 0.0;
if (B_m <= 39000.0)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * A))) / (t_0 - (B_m ^ 2.0));
elseif (B_m <= 1.85e+47)
tmp = (sqrt(2.0) / B_m) * -sqrt((-0.5 * (((B_m ^ 2.0) * F) / C)));
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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[B$95$m, 39000.0], 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 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.85e+47], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(-0.5 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * F), $MachinePrecision] / C), $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 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;B\_m \leq 39000:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 1.85 \cdot 10^{+47}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{-0.5 \cdot \frac{{B\_m}^{2} \cdot F}{C}}\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 B < 39000Initial program 24.3%
Taylor expanded in A around -inf 14.7%
if 39000 < B < 1.8500000000000002e47Initial program 27.9%
Taylor expanded in A around 0 28.7%
mul-1-neg28.7%
unpow228.7%
unpow228.7%
hypot-define28.7%
Simplified28.7%
Taylor expanded in C around inf 39.5%
if 1.8500000000000002e47 < B Initial program 12.6%
Taylor expanded in C around 0 20.8%
mul-1-neg20.8%
+-commutative20.8%
unpow220.8%
unpow220.8%
hypot-define52.9%
Simplified52.9%
Final simplification24.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 (<= B_m 1.4e+47) (* (/ (sqrt 2.0) B_m) (- (sqrt (* -0.5 (/ (* (pow B_m 2.0) F) C))))) (* (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 (B_m <= 1.4e+47) {
tmp = (sqrt(2.0) / B_m) * -sqrt((-0.5 * ((pow(B_m, 2.0) * F) / C)));
} 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 tmp;
if (B_m <= 1.4e+47) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((-0.5 * ((Math.pow(B_m, 2.0) * F) / C)));
} 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): tmp = 0 if B_m <= 1.4e+47: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((-0.5 * ((math.pow(B_m, 2.0) * F) / C))) 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) tmp = 0.0 if (B_m <= 1.4e+47) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(-0.5 * Float64(Float64((B_m ^ 2.0) * F) / C))))); 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)
tmp = 0.0;
if (B_m <= 1.4e+47)
tmp = (sqrt(2.0) / B_m) * -sqrt((-0.5 * (((B_m ^ 2.0) * F) / C)));
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_] := If[LessEqual[B$95$m, 1.4e+47], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(-0.5 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * F), $MachinePrecision] / C), $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}
\mathbf{if}\;B\_m \leq 1.4 \cdot 10^{+47}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{-0.5 \cdot \frac{{B\_m}^{2} \cdot F}{C}}\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 B < 1.39999999999999994e47Initial program 24.4%
Taylor expanded in A around 0 7.0%
mul-1-neg7.0%
unpow27.0%
unpow27.0%
hypot-define7.7%
Simplified7.7%
Taylor expanded in C around inf 7.5%
if 1.39999999999999994e47 < B Initial program 12.6%
Taylor expanded in C around 0 20.8%
mul-1-neg20.8%
+-commutative20.8%
unpow220.8%
unpow220.8%
hypot-define52.9%
Simplified52.9%
Final simplification17.9%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= A -4.7e+197) (* -2.0 (expm1 (log1p (/ (sqrt (* A F)) B_m)))) (/ (sqrt (* 2.0 (* F (- C (hypot B_m C))))) (- 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 (A <= -4.7e+197) {
tmp = -2.0 * expm1(log1p((sqrt((A * F)) / B_m)));
} else {
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (A <= -4.7e+197) {
tmp = -2.0 * Math.expm1(Math.log1p((Math.sqrt((A * F)) / B_m)));
} else {
tmp = Math.sqrt((2.0 * (F * (C - Math.hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if A <= -4.7e+197: tmp = -2.0 * math.expm1(math.log1p((math.sqrt((A * F)) / B_m))) else: tmp = math.sqrt((2.0 * (F * (C - math.hypot(B_m, C))))) / -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 (A <= -4.7e+197) tmp = Float64(-2.0 * expm1(log1p(Float64(sqrt(Float64(A * F)) / B_m)))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C - hypot(B_m, C))))) / 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[A, -4.7e+197], N[(-2.0 * N[(Exp[N[Log[1 + N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -4.7 \cdot 10^{+197}:\\
\;\;\;\;-2 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sqrt{A \cdot F}}{B\_m}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -4.6999999999999999e197Initial program 2.1%
Simplified13.4%
Taylor expanded in A around -inf 1.9%
Taylor expanded in A around 0 8.8%
expm1-log1p-u8.5%
expm1-undefine2.7%
un-div-inv2.7%
Applied egg-rr2.7%
expm1-define8.6%
*-commutative8.6%
Simplified8.6%
if -4.6999999999999999e197 < A Initial program 23.1%
Taylor expanded in A around 0 10.2%
mul-1-neg10.2%
unpow210.2%
unpow210.2%
hypot-define18.8%
Simplified18.8%
associate-*l/18.8%
pow1/218.8%
pow1/218.8%
pow-prod-down18.9%
Applied egg-rr18.9%
unpow1/218.9%
Simplified18.9%
Final simplification18.2%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (* (sqrt (* 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) {
return sqrt((F * (A - hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((F * (A - Math.hypot(B_m, A)))) * (Math.sqrt(2.0) / -B_m);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt((F * (A - math.hypot(B_m, A)))) * (math.sqrt(2.0) / -B_m)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(sqrt(Float64(F * Float64(A - hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-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 * (A - hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[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])\\
\\
\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}
\end{array}
Initial program 21.7%
Taylor expanded in C around 0 9.8%
mul-1-neg9.8%
+-commutative9.8%
unpow29.8%
unpow29.8%
hypot-define17.7%
Simplified17.7%
Final simplification17.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 (<= A -1e+198) (* -2.0 (/ (sqrt (* A F)) B_m)) (/ (sqrt (* 2.0 (* F (- C (hypot B_m C))))) (- 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 (A <= -1e+198) {
tmp = -2.0 * (sqrt((A * F)) / B_m);
} else {
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (A <= -1e+198) {
tmp = -2.0 * (Math.sqrt((A * F)) / B_m);
} else {
tmp = Math.sqrt((2.0 * (F * (C - Math.hypot(B_m, C))))) / -B_m;
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if A <= -1e+198: tmp = -2.0 * (math.sqrt((A * F)) / B_m) else: tmp = math.sqrt((2.0 * (F * (C - math.hypot(B_m, C))))) / -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 (A <= -1e+198) tmp = Float64(-2.0 * Float64(sqrt(Float64(A * F)) / B_m)); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C - hypot(B_m, C))))) / 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)
tmp = 0.0;
if (A <= -1e+198)
tmp = -2.0 * (sqrt((A * F)) / B_m);
else
tmp = sqrt((2.0 * (F * (C - hypot(B_m, C))))) / -B_m;
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[A, -1e+198], N[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(C - N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1 \cdot 10^{+198}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{A \cdot F}}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C - \mathsf{hypot}\left(B\_m, C\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -1.00000000000000002e198Initial program 2.1%
Simplified13.4%
Taylor expanded in A around -inf 1.9%
Taylor expanded in A around 0 8.8%
Taylor expanded in A around -inf 0.0%
mul-1-neg0.0%
associate-*r/0.0%
distribute-neg-frac0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt8.9%
distribute-lft-neg-in8.9%
metadata-eval8.9%
*-lft-identity8.9%
*-commutative8.9%
Simplified8.9%
if -1.00000000000000002e198 < A Initial program 23.1%
Taylor expanded in A around 0 10.2%
mul-1-neg10.2%
unpow210.2%
unpow210.2%
hypot-define18.8%
Simplified18.8%
associate-*l/18.8%
pow1/218.8%
pow1/218.8%
pow-prod-down18.9%
Applied egg-rr18.9%
unpow1/218.9%
Simplified18.9%
Final simplification18.2%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= A -2.7e+197) (* -2.0 (/ (sqrt (* A F)) B_m)) (* (sqrt (* B_m (- F))) (/ (sqrt 2.0) (- B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (A <= -2.7e+197) {
tmp = -2.0 * (sqrt((A * F)) / B_m);
} else {
tmp = sqrt((B_m * -F)) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (a <= (-2.7d+197)) then
tmp = (-2.0d0) * (sqrt((a * f)) / b_m)
else
tmp = sqrt((b_m * -f)) * (sqrt(2.0d0) / -b_m)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (A <= -2.7e+197) {
tmp = -2.0 * (Math.sqrt((A * F)) / B_m);
} else {
tmp = Math.sqrt((B_m * -F)) * (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): tmp = 0 if A <= -2.7e+197: tmp = -2.0 * (math.sqrt((A * F)) / B_m) else: tmp = math.sqrt((B_m * -F)) * (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) tmp = 0.0 if (A <= -2.7e+197) tmp = Float64(-2.0 * Float64(sqrt(Float64(A * F)) / B_m)); else tmp = Float64(sqrt(Float64(B_m * Float64(-F))) * 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)
tmp = 0.0;
if (A <= -2.7e+197)
tmp = -2.0 * (sqrt((A * F)) / B_m);
else
tmp = sqrt((B_m * -F)) * (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_] := If[LessEqual[A, -2.7e+197], N[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(B$95$m * (-F)), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2.7 \cdot 10^{+197}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{A \cdot F}}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{B\_m \cdot \left(-F\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if A < -2.7e197Initial program 2.1%
Simplified13.4%
Taylor expanded in A around -inf 1.9%
Taylor expanded in A around 0 8.8%
Taylor expanded in A around -inf 0.0%
mul-1-neg0.0%
associate-*r/0.0%
distribute-neg-frac0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt8.9%
distribute-lft-neg-in8.9%
metadata-eval8.9%
*-lft-identity8.9%
*-commutative8.9%
Simplified8.9%
if -2.7e197 < A Initial program 23.1%
Taylor expanded in A around 0 10.2%
mul-1-neg10.2%
unpow210.2%
unpow210.2%
hypot-define18.8%
Simplified18.8%
Taylor expanded in C around 0 16.6%
associate-*r*16.6%
mul-1-neg16.6%
Simplified16.6%
Final simplification16.1%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (* -2.0 (* (pow (* A F) 0.5) (/ 1.0 B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -2.0 * (pow((A * F), 0.5) * (1.0 / B_m));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (-2.0d0) * (((a * f) ** 0.5d0) * (1.0d0 / b_m))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -2.0 * (Math.pow((A * F), 0.5) * (1.0 / B_m));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -2.0 * (math.pow((A * F), 0.5) * (1.0 / B_m))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) * Float64(1.0 / B_m))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -2.0 * (((A * F) ^ 0.5) * (1.0 / B_m));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] * N[(1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-2 \cdot \left({\left(A \cdot F\right)}^{0.5} \cdot \frac{1}{B\_m}\right)
\end{array}
Initial program 21.7%
Simplified22.9%
Taylor expanded in A around -inf 7.3%
Taylor expanded in A around 0 2.4%
pow1/22.6%
Applied egg-rr2.6%
Final simplification2.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 (* -2.0 (/ (sqrt (* A F)) B_m)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -2.0 * (sqrt((A * F)) / B_m);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (-2.0d0) * (sqrt((a * f)) / b_m)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -2.0 * (Math.sqrt((A * F)) / B_m);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -2.0 * (math.sqrt((A * F)) / B_m)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-2.0 * Float64(sqrt(Float64(A * F)) / B_m)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -2.0 * (sqrt((A * F)) / B_m);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-2 \cdot \frac{\sqrt{A \cdot F}}{B\_m}
\end{array}
Initial program 21.7%
Simplified22.9%
Taylor expanded in A around -inf 7.3%
Taylor expanded in A around 0 2.4%
Taylor expanded in A around -inf 0.0%
mul-1-neg0.0%
associate-*r/0.0%
distribute-neg-frac0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt2.4%
distribute-lft-neg-in2.4%
metadata-eval2.4%
*-lft-identity2.4%
*-commutative2.4%
Simplified2.4%
Final simplification2.4%
herbie shell --seed 2024077
(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))))