
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
(t_1 (hypot B_m (- A C)))
(t_2 (- t_0))
(t_3 (* (* 4.0 A) C))
(t_4
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_3) F))
(- (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
(- t_3 (pow B_m 2.0))))
(t_5 (* F t_0)))
(if (<= t_4 (- INFINITY))
(-
(sqrt (* 2.0 (* F (/ (- (+ A C) t_1) (fma B_m B_m (* -4.0 (* A C))))))))
(if (<= t_4 -1e-189)
(/ (sqrt (* t_5 (* 2.0 (+ A (- C t_1))))) t_2)
(if (<= t_4 5e+131)
(/
(sqrt (* t_5 (* 2.0 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))))
t_2)
(if (<= t_4 INFINITY)
(/ (sqrt F) (sqrt (- C)))
(* (/ (sqrt 2.0) B_m) (* (sqrt (- F)) (- (sqrt B_m))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = hypot(B_m, (A - C));
double t_2 = -t_0;
double t_3 = (4.0 * A) * C;
double t_4 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_3) * F)) * ((A + C) - sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_3 - pow(B_m, 2.0));
double t_5 = F * t_0;
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = -sqrt((2.0 * (F * (((A + C) - t_1) / fma(B_m, B_m, (-4.0 * (A * C)))))));
} else if (t_4 <= -1e-189) {
tmp = sqrt((t_5 * (2.0 * (A + (C - t_1))))) / t_2;
} else if (t_4 <= 5e+131) {
tmp = sqrt((t_5 * (2.0 * (A + (A + (-0.5 * (pow(B_m, 2.0) / C))))))) / t_2;
} else if (t_4 <= ((double) INFINITY)) {
tmp = sqrt(F) / sqrt(-C);
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(-F) * -sqrt(B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = hypot(B_m, Float64(A - C)) t_2 = Float64(-t_0) t_3 = Float64(Float64(4.0 * A) * C) t_4 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_3) * F)) * Float64(Float64(A + C) - sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_3 - (B_m ^ 2.0))) t_5 = Float64(F * t_0) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(Float64(Float64(A + C) - t_1) / fma(B_m, B_m, Float64(-4.0 * Float64(A * C)))))))); elseif (t_4 <= -1e-189) tmp = Float64(sqrt(Float64(t_5 * Float64(2.0 * Float64(A + Float64(C - t_1))))) / t_2); elseif (t_4 <= 5e+131) tmp = Float64(sqrt(Float64(t_5 * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))))) / t_2); elseif (t_4 <= Inf) tmp = Float64(sqrt(F) / sqrt(Float64(-C))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(-F)) * Float64(-sqrt(B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(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 = (-t$95$0)}, Block[{t$95$3 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$3), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$3 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(F * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], (-N[Sqrt[N[(2.0 * N[(F * N[(N[(N[(A + C), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[t$95$4, -1e-189], N[(N[Sqrt[N[(t$95$5 * N[(2.0 * N[(A + N[(C - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$4, 5e+131], N[(N[Sqrt[N[(t$95$5 * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[(-C)], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[(-F)], $MachinePrecision] * (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
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 := -t\_0\\
t_3 := \left(4 \cdot A\right) \cdot C\\
t_4 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_3\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_3 - {B\_m}^{2}}\\
t_5 := F \cdot t\_0\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{\left(A + C\right) - t\_1}{\mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)}\right)}\\
\mathbf{elif}\;t\_4 \leq -1 \cdot 10^{-189}:\\
\;\;\;\;\frac{\sqrt{t\_5 \cdot \left(2 \cdot \left(A + \left(C - t\_1\right)\right)\right)}}{t\_2}\\
\mathbf{elif}\;t\_4 \leq 5 \cdot 10^{+131}:\\
\;\;\;\;\frac{\sqrt{t\_5 \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\right)\right)}}{t\_2}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{-C}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{-F} \cdot \left(-\sqrt{B\_m}\right)\right)\\
\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.3%
Taylor expanded in F around 0 18.9%
pow118.9%
Applied egg-rr67.6%
unpow167.6%
Simplified67.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.00000000000000007e-189Initial program 98.1%
Simplified98.1%
if -1.00000000000000007e-189 < (/.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))) < 4.99999999999999995e131Initial program 22.3%
Simplified24.2%
Taylor expanded in C around inf 35.4%
mul-1-neg35.4%
Simplified35.4%
if 4.99999999999999995e131 < (/.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 29.2%
Taylor expanded in F around 0 0.5%
pow10.5%
Applied egg-rr1.1%
unpow11.1%
Simplified1.1%
Taylor expanded in A around -inf 1.6%
mul-1-neg1.6%
Simplified1.6%
add-sqr-sqrt0.9%
sqrt-unprod30.0%
sqr-neg30.0%
add-sqr-sqrt30.0%
distribute-neg-frac230.0%
sqrt-div61.6%
Applied egg-rr61.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))) Initial program 0.0%
Taylor expanded in C around 0 1.8%
mul-1-neg1.8%
+-commutative1.8%
unpow21.8%
unpow21.8%
hypot-define15.4%
Simplified15.4%
Taylor expanded in A around 0 14.3%
mul-1-neg14.3%
Simplified14.3%
pow1/214.4%
distribute-rgt-neg-in14.4%
unpow-prod-down24.1%
pow1/224.1%
Applied egg-rr24.1%
unpow1/224.1%
*-commutative24.1%
Simplified24.1%
Final simplification48.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) 5e-86)
(/ (sqrt (* -8.0 (* (* A C) (* F (+ A A))))) (* 4.0 (* A C)))
(if (<= (pow B_m 2.0) 5e+300)
(-
(sqrt
(*
2.0
(*
F
(/ (- (+ A C) (hypot B_m (- A C))) (fma B_m B_m (* -4.0 (* A C))))))))
(* (/ (sqrt 2.0) B_m) (* (sqrt (- F)) (- (sqrt B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 5e-86) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (pow(B_m, 2.0) <= 5e+300) {
tmp = -sqrt((2.0 * (F * (((A + C) - hypot(B_m, (A - C))) / fma(B_m, B_m, (-4.0 * (A * C)))))));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(-F) * -sqrt(B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-86) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(4.0 * Float64(A * C))); elseif ((B_m ^ 2.0) <= 5e+300) tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(Float64(Float64(A + C) - hypot(B_m, Float64(A - C))) / fma(B_m, B_m, Float64(-4.0 * Float64(A * C)))))))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(-F)) * Float64(-sqrt(B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-86], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+300], (-N[Sqrt[N[(2.0 * N[(F * N[(N[(N[(A + C), $MachinePrecision] - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[(-F)], $MachinePrecision] * (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-86}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+300}:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{\left(A + C\right) - \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{-F} \cdot \left(-\sqrt{B\_m}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.9999999999999999e-86Initial program 20.4%
Simplified23.1%
Taylor expanded in C around inf 22.2%
Taylor expanded in C around inf 21.9%
associate-*r*21.8%
mul-1-neg21.8%
Simplified21.8%
if 4.9999999999999999e-86 < (pow.f64 B #s(literal 2 binary64)) < 5.00000000000000026e300Initial program 40.2%
Taylor expanded in F around 0 43.9%
pow143.9%
Applied egg-rr65.2%
unpow165.2%
Simplified65.2%
if 5.00000000000000026e300 < (pow.f64 B #s(literal 2 binary64)) Initial program 1.4%
Taylor expanded in C around 0 3.0%
mul-1-neg3.0%
+-commutative3.0%
unpow23.0%
unpow23.0%
hypot-define23.3%
Simplified23.3%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
Simplified21.9%
pow1/222.1%
distribute-rgt-neg-in22.1%
unpow-prod-down37.3%
pow1/237.3%
Applied egg-rr37.3%
unpow1/237.3%
*-commutative37.3%
Simplified37.3%
Final simplification39.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 5e-86)
(/ (sqrt (* -8.0 (* (* A C) (* F (+ A A))))) (* 4.0 (* A C)))
(if (<= (pow B_m 2.0) 5e+300)
(- (sqrt (* 2.0 (* F (/ (- A (hypot B_m A)) (pow B_m 2.0))))))
(* (/ (sqrt 2.0) B_m) (* (sqrt (- F)) (- (sqrt B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 5e-86) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (pow(B_m, 2.0) <= 5e+300) {
tmp = -sqrt((2.0 * (F * ((A - hypot(B_m, A)) / pow(B_m, 2.0)))));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(-F) * -sqrt(B_m));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (Math.pow(B_m, 2.0) <= 5e-86) {
tmp = Math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (Math.pow(B_m, 2.0) <= 5e+300) {
tmp = -Math.sqrt((2.0 * (F * ((A - Math.hypot(B_m, A)) / Math.pow(B_m, 2.0)))));
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt(-F) * -Math.sqrt(B_m));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if math.pow(B_m, 2.0) <= 5e-86: tmp = math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C)) elif math.pow(B_m, 2.0) <= 5e+300: tmp = -math.sqrt((2.0 * (F * ((A - math.hypot(B_m, A)) / math.pow(B_m, 2.0))))) else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt(-F) * -math.sqrt(B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-86) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(4.0 * Float64(A * C))); elseif ((B_m ^ 2.0) <= 5e+300) tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(Float64(A - hypot(B_m, A)) / (B_m ^ 2.0)))))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(-F)) * Float64(-sqrt(B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if ((B_m ^ 2.0) <= 5e-86)
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
elseif ((B_m ^ 2.0) <= 5e+300)
tmp = -sqrt((2.0 * (F * ((A - hypot(B_m, A)) / (B_m ^ 2.0)))));
else
tmp = (sqrt(2.0) / B_m) * (sqrt(-F) * -sqrt(B_m));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-86], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+300], (-N[Sqrt[N[(2.0 * N[(F * N[(N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision] / N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[(-F)], $MachinePrecision] * (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-86}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+300}:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{A - \mathsf{hypot}\left(B\_m, A\right)}{{B\_m}^{2}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{-F} \cdot \left(-\sqrt{B\_m}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.9999999999999999e-86Initial program 20.4%
Simplified23.1%
Taylor expanded in C around inf 22.2%
Taylor expanded in C around inf 21.9%
associate-*r*21.8%
mul-1-neg21.8%
Simplified21.8%
if 4.9999999999999999e-86 < (pow.f64 B #s(literal 2 binary64)) < 5.00000000000000026e300Initial program 40.2%
Taylor expanded in F around 0 43.9%
pow143.9%
Applied egg-rr65.2%
unpow165.2%
Simplified65.2%
Taylor expanded in C around 0 38.1%
associate-/l*43.2%
+-commutative43.2%
unpow243.2%
unpow243.2%
hypot-undefine49.9%
Simplified49.9%
if 5.00000000000000026e300 < (pow.f64 B #s(literal 2 binary64)) Initial program 1.4%
Taylor expanded in C around 0 3.0%
mul-1-neg3.0%
+-commutative3.0%
unpow23.0%
unpow23.0%
hypot-define23.3%
Simplified23.3%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
Simplified21.9%
pow1/222.1%
distribute-rgt-neg-in22.1%
unpow-prod-down37.3%
pow1/237.3%
Applied egg-rr37.3%
unpow1/237.3%
*-commutative37.3%
Simplified37.3%
Final simplification34.5%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 1.8e-42)
(/ (sqrt (* -8.0 (* (* A C) (* F (+ A A))))) (* 4.0 (* A C)))
(if (<= B_m 6.5e+174)
(/ -1.0 (/ B_m (sqrt (* (- A (hypot B_m A)) (* 2.0 F)))))
(* (/ (sqrt 2.0) B_m) (* (sqrt (- F)) (- (sqrt B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.8e-42) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (B_m <= 6.5e+174) {
tmp = -1.0 / (B_m / sqrt(((A - hypot(B_m, A)) * (2.0 * F))));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(-F) * -sqrt(B_m));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.8e-42) {
tmp = Math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (B_m <= 6.5e+174) {
tmp = -1.0 / (B_m / Math.sqrt(((A - Math.hypot(B_m, A)) * (2.0 * F))));
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt(-F) * -Math.sqrt(B_m));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.8e-42: tmp = math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C)) elif B_m <= 6.5e+174: tmp = -1.0 / (B_m / math.sqrt(((A - math.hypot(B_m, A)) * (2.0 * F)))) else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt(-F) * -math.sqrt(B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.8e-42) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(4.0 * Float64(A * C))); elseif (B_m <= 6.5e+174) tmp = Float64(-1.0 / Float64(B_m / sqrt(Float64(Float64(A - hypot(B_m, A)) * Float64(2.0 * F))))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(-F)) * Float64(-sqrt(B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 1.8e-42)
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
elseif (B_m <= 6.5e+174)
tmp = -1.0 / (B_m / sqrt(((A - hypot(B_m, A)) * (2.0 * F))));
else
tmp = (sqrt(2.0) / B_m) * (sqrt(-F) * -sqrt(B_m));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.8e-42], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 6.5e+174], N[(-1.0 / N[(B$95$m / N[Sqrt[N[(N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[(-F)], $MachinePrecision] * (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.8 \cdot 10^{-42}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B\_m \leq 6.5 \cdot 10^{+174}:\\
\;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{\left(A - \mathsf{hypot}\left(B\_m, A\right)\right) \cdot \left(2 \cdot F\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{-F} \cdot \left(-\sqrt{B\_m}\right)\right)\\
\end{array}
\end{array}
if B < 1.8000000000000001e-42Initial program 21.1%
Simplified20.0%
Taylor expanded in C around inf 14.5%
Taylor expanded in C around inf 14.9%
associate-*r*14.8%
mul-1-neg14.8%
Simplified14.8%
if 1.8000000000000001e-42 < B < 6.5000000000000001e174Initial program 34.9%
Taylor expanded in C around 0 35.1%
mul-1-neg35.1%
+-commutative35.1%
unpow235.1%
unpow235.1%
hypot-define39.5%
Simplified39.5%
add-exp-log36.8%
associate-*l/36.8%
pow1/236.8%
pow1/236.8%
pow-prod-down36.8%
Applied egg-rr36.8%
rem-exp-log39.7%
clear-num39.7%
unpow1/239.7%
associate-*r*39.7%
Applied egg-rr39.7%
if 6.5000000000000001e174 < B Initial program 0.0%
Taylor expanded in C around 0 2.5%
mul-1-neg2.5%
+-commutative2.5%
unpow22.5%
unpow22.5%
hypot-define42.8%
Simplified42.8%
Taylor expanded in A around 0 42.8%
mul-1-neg42.8%
Simplified42.8%
pow1/242.8%
distribute-rgt-neg-in42.8%
unpow-prod-down74.9%
pow1/274.9%
Applied egg-rr74.9%
unpow1/274.9%
*-commutative74.9%
Simplified74.9%
Final simplification27.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 (<= B_m 1.05e-42)
(/ (sqrt (* -8.0 (* (* A C) (* F (+ A A))))) (* 4.0 (* A C)))
(if (<= B_m 5.5e+188)
(/ -1.0 (/ B_m (sqrt (* (- A (hypot B_m A)) (* 2.0 F)))))
(- (sqrt (* 2.0 (/ (fma -1.0 F (* F (/ (+ A C) B_m))) 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.05e-42) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (B_m <= 5.5e+188) {
tmp = -1.0 / (B_m / sqrt(((A - hypot(B_m, A)) * (2.0 * F))));
} else {
tmp = -sqrt((2.0 * (fma(-1.0, F, (F * ((A + C) / B_m))) / 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.05e-42) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(4.0 * Float64(A * C))); elseif (B_m <= 5.5e+188) tmp = Float64(-1.0 / Float64(B_m / sqrt(Float64(Float64(A - hypot(B_m, A)) * Float64(2.0 * F))))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(fma(-1.0, F, Float64(F * Float64(Float64(A + C) / B_m))) / B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.05e-42], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 5.5e+188], N[(-1.0 / N[(B$95$m / N[Sqrt[N[(N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(N[(-1.0 * F + N[(F * N[(N[(A + C), $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.05 \cdot 10^{-42}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B\_m \leq 5.5 \cdot 10^{+188}:\\
\;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{\left(A - \mathsf{hypot}\left(B\_m, A\right)\right) \cdot \left(2 \cdot F\right)}}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{\mathsf{fma}\left(-1, F, F \cdot \frac{A + C}{B\_m}\right)}{B\_m}}\\
\end{array}
\end{array}
if B < 1.05000000000000003e-42Initial program 21.1%
Simplified20.0%
Taylor expanded in C around inf 14.5%
Taylor expanded in C around inf 14.9%
associate-*r*14.8%
mul-1-neg14.8%
Simplified14.8%
if 1.05000000000000003e-42 < B < 5.50000000000000013e188Initial program 33.5%
Taylor expanded in C around 0 33.8%
mul-1-neg33.8%
+-commutative33.8%
unpow233.8%
unpow233.8%
hypot-define38.3%
Simplified38.3%
add-exp-log35.7%
associate-*l/35.7%
pow1/235.7%
pow1/235.7%
pow-prod-down35.7%
Applied egg-rr35.7%
rem-exp-log38.5%
clear-num38.5%
unpow1/238.4%
associate-*r*38.4%
Applied egg-rr38.4%
if 5.50000000000000013e188 < B Initial program 0.0%
Taylor expanded in F around 0 0.0%
pow10.0%
Applied egg-rr4.5%
unpow14.5%
Simplified4.5%
Taylor expanded in B around inf 39.2%
fma-define39.2%
associate-/l*57.8%
Simplified57.8%
Final simplification25.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 2.1e-42)
(/ (sqrt (* -8.0 (* (* A C) (* F (+ A A))))) (* 4.0 (* A C)))
(if (<= B_m 2.6e+174)
(/ -1.0 (/ B_m (sqrt (* (- A (hypot B_m A)) (* 2.0 F)))))
(- (sqrt (* -2.0 (/ F B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 2.1e-42) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (B_m <= 2.6e+174) {
tmp = -1.0 / (B_m / sqrt(((A - hypot(B_m, A)) * (2.0 * F))));
} else {
tmp = -sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 2.1e-42) {
tmp = Math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (B_m <= 2.6e+174) {
tmp = -1.0 / (B_m / Math.sqrt(((A - Math.hypot(B_m, A)) * (2.0 * F))));
} else {
tmp = -Math.sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 2.1e-42: tmp = math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C)) elif B_m <= 2.6e+174: tmp = -1.0 / (B_m / math.sqrt(((A - math.hypot(B_m, A)) * (2.0 * F)))) else: tmp = -math.sqrt((-2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 2.1e-42) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(4.0 * Float64(A * C))); elseif (B_m <= 2.6e+174) tmp = Float64(-1.0 / Float64(B_m / sqrt(Float64(Float64(A - hypot(B_m, A)) * Float64(2.0 * F))))); else tmp = Float64(-sqrt(Float64(-2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 2.1e-42)
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
elseif (B_m <= 2.6e+174)
tmp = -1.0 / (B_m / sqrt(((A - hypot(B_m, A)) * (2.0 * F))));
else
tmp = -sqrt((-2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 2.1e-42], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2.6e+174], N[(-1.0 / N[(B$95$m / N[Sqrt[N[(N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(-2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 2.1 \cdot 10^{-42}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B\_m \leq 2.6 \cdot 10^{+174}:\\
\;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{\left(A - \mathsf{hypot}\left(B\_m, A\right)\right) \cdot \left(2 \cdot F\right)}}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{-2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if B < 2.10000000000000006e-42Initial program 21.1%
Simplified20.0%
Taylor expanded in C around inf 14.5%
Taylor expanded in C around inf 14.9%
associate-*r*14.8%
mul-1-neg14.8%
Simplified14.8%
if 2.10000000000000006e-42 < B < 2.5999999999999999e174Initial program 34.9%
Taylor expanded in C around 0 35.1%
mul-1-neg35.1%
+-commutative35.1%
unpow235.1%
unpow235.1%
hypot-define39.5%
Simplified39.5%
add-exp-log36.8%
associate-*l/36.8%
pow1/236.8%
pow1/236.8%
pow-prod-down36.8%
Applied egg-rr36.8%
rem-exp-log39.7%
clear-num39.7%
unpow1/239.7%
associate-*r*39.7%
Applied egg-rr39.7%
if 2.5999999999999999e174 < B Initial program 0.0%
Taylor expanded in F around 0 0.0%
pow10.0%
Applied egg-rr4.6%
unpow14.6%
Simplified4.6%
Taylor expanded in B around inf 54.0%
Final simplification24.8%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 2.6e-41)
(/ (sqrt (* -8.0 (* (* A C) (* F (+ A A))))) (* 4.0 (* A C)))
(if (<= B_m 3.9e+176)
(/ (sqrt (* 2.0 (* F (- A (hypot B_m A))))) (- B_m))
(- (sqrt (* -2.0 (/ F B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 2.6e-41) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (B_m <= 3.9e+176) {
tmp = sqrt((2.0 * (F * (A - hypot(B_m, A))))) / -B_m;
} else {
tmp = -sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 2.6e-41) {
tmp = Math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (B_m <= 3.9e+176) {
tmp = Math.sqrt((2.0 * (F * (A - Math.hypot(B_m, A))))) / -B_m;
} else {
tmp = -Math.sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 2.6e-41: tmp = math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C)) elif B_m <= 3.9e+176: tmp = math.sqrt((2.0 * (F * (A - math.hypot(B_m, A))))) / -B_m else: tmp = -math.sqrt((-2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 2.6e-41) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(4.0 * Float64(A * C))); elseif (B_m <= 3.9e+176) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A))))) / Float64(-B_m)); else tmp = Float64(-sqrt(Float64(-2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 2.6e-41)
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
elseif (B_m <= 3.9e+176)
tmp = sqrt((2.0 * (F * (A - hypot(B_m, A))))) / -B_m;
else
tmp = -sqrt((-2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 2.6e-41], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 3.9e+176], N[(N[Sqrt[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], (-N[Sqrt[N[(-2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 2.6 \cdot 10^{-41}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B\_m \leq 3.9 \cdot 10^{+176}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{-2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if B < 2.5999999999999999e-41Initial program 21.1%
Simplified20.0%
Taylor expanded in C around inf 14.5%
Taylor expanded in C around inf 14.9%
associate-*r*14.8%
mul-1-neg14.8%
Simplified14.8%
if 2.5999999999999999e-41 < B < 3.9000000000000001e176Initial program 34.9%
Taylor expanded in C around 0 35.1%
mul-1-neg35.1%
+-commutative35.1%
unpow235.1%
unpow235.1%
hypot-define39.5%
Simplified39.5%
neg-sub039.5%
associate-*l/39.6%
pow1/239.6%
pow1/239.6%
pow-prod-down39.7%
Applied egg-rr39.7%
neg-sub039.7%
distribute-neg-frac239.7%
unpow1/239.7%
Simplified39.7%
if 3.9000000000000001e176 < B Initial program 0.0%
Taylor expanded in F around 0 0.0%
pow10.0%
Applied egg-rr4.6%
unpow14.6%
Simplified4.6%
Taylor expanded in B around inf 54.0%
Final simplification24.8%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 1.25e-23)
(/ (sqrt (* -8.0 (* (* A C) (* F (+ A A))))) (* 4.0 (* A C)))
(if (<= B_m 7.4e+173)
(* (* (sqrt 2.0) (sqrt (* B_m (- F)))) (/ -1.0 B_m))
(- (sqrt (* -2.0 (/ F B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.25e-23) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (B_m <= 7.4e+173) {
tmp = (sqrt(2.0) * sqrt((B_m * -F))) * (-1.0 / B_m);
} else {
tmp = -sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 1.25d-23) then
tmp = sqrt(((-8.0d0) * ((a * c) * (f * (a + a))))) / (4.0d0 * (a * c))
else if (b_m <= 7.4d+173) then
tmp = (sqrt(2.0d0) * sqrt((b_m * -f))) * ((-1.0d0) / b_m)
else
tmp = -sqrt(((-2.0d0) * (f / b_m)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.25e-23) {
tmp = Math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (B_m <= 7.4e+173) {
tmp = (Math.sqrt(2.0) * Math.sqrt((B_m * -F))) * (-1.0 / B_m);
} else {
tmp = -Math.sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.25e-23: tmp = math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C)) elif B_m <= 7.4e+173: tmp = (math.sqrt(2.0) * math.sqrt((B_m * -F))) * (-1.0 / B_m) else: tmp = -math.sqrt((-2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.25e-23) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(4.0 * Float64(A * C))); elseif (B_m <= 7.4e+173) tmp = Float64(Float64(sqrt(2.0) * sqrt(Float64(B_m * Float64(-F)))) * Float64(-1.0 / B_m)); else tmp = Float64(-sqrt(Float64(-2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 1.25e-23)
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
elseif (B_m <= 7.4e+173)
tmp = (sqrt(2.0) * sqrt((B_m * -F))) * (-1.0 / B_m);
else
tmp = -sqrt((-2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.25e-23], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 7.4e+173], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(B$95$m * (-F)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(-2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.25 \cdot 10^{-23}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B\_m \leq 7.4 \cdot 10^{+173}:\\
\;\;\;\;\left(\sqrt{2} \cdot \sqrt{B\_m \cdot \left(-F\right)}\right) \cdot \frac{-1}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{-2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if B < 1.2500000000000001e-23Initial program 20.6%
Simplified20.1%
Taylor expanded in C around inf 14.3%
Taylor expanded in C around inf 15.7%
associate-*r*15.6%
mul-1-neg15.6%
Simplified15.6%
if 1.2500000000000001e-23 < B < 7.39999999999999972e173Initial program 38.5%
Taylor expanded in C around 0 38.7%
mul-1-neg38.7%
+-commutative38.7%
unpow238.7%
unpow238.7%
hypot-define43.5%
Simplified43.5%
clear-num43.5%
inv-pow43.5%
Applied egg-rr43.5%
unpow-143.5%
Simplified43.5%
distribute-rgt-neg-in43.5%
associate-/r/43.4%
Applied egg-rr43.4%
associate-*l*43.6%
Simplified43.6%
Taylor expanded in A around 0 40.0%
mul-1-neg40.0%
Simplified40.0%
if 7.39999999999999972e173 < B Initial program 0.0%
Taylor expanded in F around 0 0.0%
pow10.0%
Applied egg-rr4.6%
unpow14.6%
Simplified4.6%
Taylor expanded in B around inf 54.0%
Final simplification24.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 (<= B_m 4.5e-24)
(/ (sqrt (* -8.0 (* (* A C) (* F (+ A A))))) (* 4.0 (* A C)))
(if (<= B_m 6e+174)
(* (sqrt (* B_m (- F))) (/ (sqrt 2.0) (- B_m)))
(- (sqrt (* -2.0 (/ F B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 4.5e-24) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (B_m <= 6e+174) {
tmp = sqrt((B_m * -F)) * (sqrt(2.0) / -B_m);
} else {
tmp = -sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 4.5d-24) then
tmp = sqrt(((-8.0d0) * ((a * c) * (f * (a + a))))) / (4.0d0 * (a * c))
else if (b_m <= 6d+174) then
tmp = sqrt((b_m * -f)) * (sqrt(2.0d0) / -b_m)
else
tmp = -sqrt(((-2.0d0) * (f / b_m)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 4.5e-24) {
tmp = Math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else if (B_m <= 6e+174) {
tmp = Math.sqrt((B_m * -F)) * (Math.sqrt(2.0) / -B_m);
} else {
tmp = -Math.sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 4.5e-24: tmp = math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C)) elif B_m <= 6e+174: tmp = math.sqrt((B_m * -F)) * (math.sqrt(2.0) / -B_m) else: tmp = -math.sqrt((-2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 4.5e-24) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(4.0 * Float64(A * C))); elseif (B_m <= 6e+174) tmp = Float64(sqrt(Float64(B_m * Float64(-F))) * Float64(sqrt(2.0) / Float64(-B_m))); else tmp = Float64(-sqrt(Float64(-2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 4.5e-24)
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
elseif (B_m <= 6e+174)
tmp = sqrt((B_m * -F)) * (sqrt(2.0) / -B_m);
else
tmp = -sqrt((-2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 4.5e-24], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 6e+174], N[(N[Sqrt[N[(B$95$m * (-F)), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(-2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 4.5 \cdot 10^{-24}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B\_m \leq 6 \cdot 10^{+174}:\\
\;\;\;\;\sqrt{B\_m \cdot \left(-F\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{-2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if B < 4.4999999999999997e-24Initial program 20.6%
Simplified20.1%
Taylor expanded in C around inf 14.3%
Taylor expanded in C around inf 15.7%
associate-*r*15.6%
mul-1-neg15.6%
Simplified15.6%
if 4.4999999999999997e-24 < B < 6e174Initial program 38.5%
Taylor expanded in C around 0 38.7%
mul-1-neg38.7%
+-commutative38.7%
unpow238.7%
unpow238.7%
hypot-define43.5%
Simplified43.5%
Taylor expanded in A around 0 40.0%
mul-1-neg40.0%
Simplified40.0%
if 6e174 < B Initial program 0.0%
Taylor expanded in F around 0 0.0%
pow10.0%
Applied egg-rr4.6%
unpow14.6%
Simplified4.6%
Taylor expanded in B around inf 54.0%
Final simplification24.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 (<= B_m 4.6e-23) (/ (sqrt (* -8.0 (* (* A C) (* F (+ A A))))) (* 4.0 (* A C))) (- (sqrt (* -2.0 (/ F B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 4.6e-23) {
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else {
tmp = -sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 4.6d-23) then
tmp = sqrt(((-8.0d0) * ((a * c) * (f * (a + a))))) / (4.0d0 * (a * c))
else
tmp = -sqrt(((-2.0d0) * (f / b_m)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 4.6e-23) {
tmp = Math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
} else {
tmp = -Math.sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 4.6e-23: tmp = math.sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C)) else: tmp = -math.sqrt((-2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 4.6e-23) tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(A * C) * Float64(F * Float64(A + A))))) / Float64(4.0 * Float64(A * C))); else tmp = Float64(-sqrt(Float64(-2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 4.6e-23)
tmp = sqrt((-8.0 * ((A * C) * (F * (A + A))))) / (4.0 * (A * C));
else
tmp = -sqrt((-2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 4.6e-23], N[(N[Sqrt[N[(-8.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(-2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 4.6 \cdot 10^{-23}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{-2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if B < 4.6000000000000002e-23Initial program 20.6%
Simplified20.1%
Taylor expanded in C around inf 14.3%
Taylor expanded in C around inf 15.7%
associate-*r*15.6%
mul-1-neg15.6%
Simplified15.6%
if 4.6000000000000002e-23 < B Initial program 21.2%
Taylor expanded in F around 0 21.2%
pow121.2%
Applied egg-rr33.7%
unpow133.7%
Simplified33.7%
Taylor expanded in B around inf 45.2%
Final simplification24.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 (<= B_m 1.4e-7) (- (sqrt (/ F (- C)))) (- (sqrt (* -2.0 (/ F B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.4e-7) {
tmp = -sqrt((F / -C));
} else {
tmp = -sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 1.4d-7) then
tmp = -sqrt((f / -c))
else
tmp = -sqrt(((-2.0d0) * (f / b_m)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.4e-7) {
tmp = -Math.sqrt((F / -C));
} else {
tmp = -Math.sqrt((-2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.4e-7: tmp = -math.sqrt((F / -C)) else: tmp = -math.sqrt((-2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.4e-7) tmp = Float64(-sqrt(Float64(F / Float64(-C)))); else tmp = Float64(-sqrt(Float64(-2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 1.4e-7)
tmp = -sqrt((F / -C));
else
tmp = -sqrt((-2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.4e-7], (-N[Sqrt[N[(F / (-C)), $MachinePrecision]], $MachinePrecision]), (-N[Sqrt[N[(-2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.4 \cdot 10^{-7}:\\
\;\;\;\;-\sqrt{\frac{F}{-C}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{-2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if B < 1.4000000000000001e-7Initial program 21.3%
Taylor expanded in F around 0 18.3%
pow118.3%
Applied egg-rr30.3%
unpow130.3%
Simplified30.3%
Taylor expanded in A around -inf 15.6%
mul-1-neg15.6%
Simplified15.6%
if 1.4000000000000001e-7 < B Initial program 19.6%
Taylor expanded in F around 0 19.6%
pow119.6%
Applied egg-rr32.8%
unpow132.8%
Simplified32.8%
Taylor expanded in B around inf 46.0%
Final simplification24.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 (/ F (- C)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((F / -C));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((f / -c))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((F / -C));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((F / -C))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(F / Float64(-C)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((F / -C));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(F / (-C)), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{\frac{F}{-C}}
\end{array}
Initial program 20.8%
Taylor expanded in F around 0 18.7%
pow118.7%
Applied egg-rr31.0%
unpow131.0%
Simplified31.0%
Taylor expanded in A around -inf 13.0%
mul-1-neg13.0%
Simplified13.0%
Final simplification13.0%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (sqrt (/ F C))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((F / C));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((f / c))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((F / C));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((F / C))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(F / C))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((F / C));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(F / C), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{\frac{F}{C}}
\end{array}
Initial program 20.8%
Taylor expanded in F around 0 18.7%
pow118.7%
Applied egg-rr31.0%
unpow131.0%
Simplified31.0%
Taylor expanded in A around -inf 13.0%
mul-1-neg13.0%
Simplified13.0%
neg-sub013.0%
add-sqr-sqrt13.0%
sqrt-unprod9.9%
sqr-neg9.9%
sqrt-unprod2.9%
add-sqr-sqrt2.9%
Applied egg-rr2.9%
neg-sub02.9%
Simplified2.9%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (sqrt (/ F C)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt((F / C));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((f / c))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((F / C));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt((F / C))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return sqrt(Float64(F / C)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt((F / C));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[Sqrt[N[(F / C), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{\frac{F}{C}}
\end{array}
Initial program 20.8%
Taylor expanded in F around 0 18.7%
pow118.7%
Applied egg-rr31.0%
unpow131.0%
Simplified31.0%
Taylor expanded in A around -inf 13.0%
mul-1-neg13.0%
Simplified13.0%
*-un-lft-identity13.0%
add-sqr-sqrt0.7%
sqrt-unprod9.0%
sqr-neg9.0%
sqrt-unprod6.9%
sqr-neg6.9%
sqrt-unprod1.2%
add-sqr-sqrt1.2%
Applied egg-rr1.2%
*-lft-identity1.2%
Simplified1.2%
herbie shell --seed 2024118
(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))))