
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* A (* C -4.0)))
(t_1 (fma B_m B_m t_0))
(t_2 (- t_1))
(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 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))
(t_6 (* F t_1)))
(if (<= t_4 (- INFINITY))
(/ (* (hypot B_m (sqrt t_0)) (sqrt (* (* 2.0 F) t_5))) t_2)
(if (<= t_4 -5e-216)
(* (sqrt (* (* 2.0 (- (+ A C) (hypot (- A C) B_m))) t_6)) (/ -1.0 t_1))
(if (<= t_4 INFINITY)
(/ (sqrt (* (* 2.0 t_5) t_6)) t_2)
(/ (sqrt (* (* 2.0 F) (- C (hypot 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 t_0 = A * (C * -4.0);
double t_1 = fma(B_m, B_m, t_0);
double t_2 = -t_1;
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 = A + (A + (-0.5 * (pow(B_m, 2.0) / C)));
double t_6 = F * t_1;
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = (hypot(B_m, sqrt(t_0)) * sqrt(((2.0 * F) * t_5))) / t_2;
} else if (t_4 <= -5e-216) {
tmp = sqrt(((2.0 * ((A + C) - hypot((A - C), B_m))) * t_6)) * (-1.0 / t_1);
} else if (t_4 <= ((double) INFINITY)) {
tmp = sqrt(((2.0 * t_5) * t_6)) / t_2;
} else {
tmp = sqrt(((2.0 * F) * (C - hypot(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) t_0 = Float64(A * Float64(C * -4.0)) t_1 = fma(B_m, B_m, t_0) t_2 = Float64(-t_1) 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(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C)))) t_6 = Float64(F * t_1) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(Float64(hypot(B_m, sqrt(t_0)) * sqrt(Float64(Float64(2.0 * F) * t_5))) / t_2); elseif (t_4 <= -5e-216) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64(A + C) - hypot(Float64(A - C), B_m))) * t_6)) * Float64(-1.0 / t_1)); elseif (t_4 <= Inf) tmp = Float64(sqrt(Float64(Float64(2.0 * t_5) * t_6)) / t_2); else tmp = Float64(sqrt(Float64(Float64(2.0 * F) * Float64(C - hypot(C, B_m)))) / Float64(-B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + t$95$0), $MachinePrecision]}, Block[{t$95$2 = (-t$95$1)}, 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[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(F * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision] * N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * t$95$5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$4, -5e-216], N[(N[Sqrt[N[(N[(2.0 * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$6), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(N[Sqrt[N[(N[(2.0 * t$95$5), $MachinePrecision] * t$95$6), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $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}
t_0 := A \cdot \left(C \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\
t_2 := -t\_1\\
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 := A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\\
t_6 := F \cdot t\_1\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right) \cdot \sqrt{\left(2 \cdot F\right) \cdot t\_5}}{t\_2}\\
\mathbf{elif}\;t\_4 \leq -5 \cdot 10^{-216}:\\
\;\;\;\;\sqrt{\left(2 \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(A - C, B\_m\right)\right)\right) \cdot t\_6} \cdot \frac{-1}{t\_1}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot t\_5\right) \cdot t\_6}}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(C - \mathsf{hypot}\left(C, B\_m\right)\right)}}{-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.1%
Simplified15.6%
Taylor expanded in C around inf 10.4%
mul-1-neg10.4%
Simplified10.4%
pow1/211.4%
associate-*l*11.4%
unpow-prod-down22.1%
pow1/222.1%
fma-undefine22.1%
add-sqr-sqrt22.0%
hypot-define22.0%
associate-*r*22.0%
associate-*r/22.0%
Applied egg-rr22.0%
associate-*l*22.0%
unpow1/221.4%
associate-*r*21.4%
associate-+r-21.4%
associate-*r/21.4%
Simplified21.4%
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))) < -5.00000000000000021e-216Initial program 99.5%
Simplified99.4%
div-inv99.5%
Applied egg-rr99.5%
if -5.00000000000000021e-216 < (/.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 30.1%
Simplified34.4%
Taylor expanded in C around inf 36.1%
mul-1-neg36.1%
Simplified36.1%
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 4.2%
mul-1-neg4.2%
+-commutative4.2%
unpow24.2%
unpow24.2%
hypot-define29.0%
Simplified29.0%
neg-sub029.0%
associate-*l/29.0%
pow1/229.0%
pow1/229.0%
pow-prod-down29.1%
Applied egg-rr29.1%
neg-sub029.1%
distribute-neg-frac229.1%
unpow1/229.0%
associate-*r*29.0%
Simplified29.0%
Final simplification36.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 (fma B_m B_m (* A (* C -4.0))))
(t_1 (* (* 4.0 A) C))
(t_2
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_1) F))
(- (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
(- t_1 (pow B_m 2.0))))
(t_3 (fma C (* A -4.0) (pow B_m 2.0))))
(if (<= t_2 -5e-216)
(/
(* (sqrt (* F (+ A (- C (hypot B_m (- A C)))))) (sqrt (* 2.0 t_3)))
(- t_3))
(if (<= t_2 INFINITY)
(/
(sqrt (* (* 2.0 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C))))) (* F t_0)))
(- t_0))
(/ (sqrt (* (* 2.0 F) (- C (hypot 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 t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = (4.0 * A) * C;
double t_2 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_1) * F)) * ((A + C) - sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_1 - pow(B_m, 2.0));
double t_3 = fma(C, (A * -4.0), pow(B_m, 2.0));
double tmp;
if (t_2 <= -5e-216) {
tmp = (sqrt((F * (A + (C - hypot(B_m, (A - C)))))) * sqrt((2.0 * t_3))) / -t_3;
} else if (t_2 <= ((double) INFINITY)) {
tmp = sqrt(((2.0 * (A + (A + (-0.5 * (pow(B_m, 2.0) / C))))) * (F * t_0))) / -t_0;
} else {
tmp = sqrt(((2.0 * F) * (C - hypot(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) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = Float64(Float64(4.0 * A) * C) t_2 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_1) * F)) * Float64(Float64(A + C) - sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_1 - (B_m ^ 2.0))) t_3 = fma(C, Float64(A * -4.0), (B_m ^ 2.0)) tmp = 0.0 if (t_2 <= -5e-216) tmp = Float64(Float64(sqrt(Float64(F * Float64(A + Float64(C - hypot(B_m, Float64(A - C)))))) * sqrt(Float64(2.0 * t_3))) / Float64(-t_3)); elseif (t_2 <= Inf) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))) * Float64(F * t_0))) / Float64(-t_0)); else tmp = Float64(sqrt(Float64(Float64(2.0 * F) * Float64(C - hypot(C, B_m)))) / 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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $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$1 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-216], N[(N[(N[Sqrt[N[(F * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-t$95$3)), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[Sqrt[N[(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] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $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}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \left(4 \cdot A\right) \cdot C\\
t_2 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_1\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_1 - {B\_m}^{2}}\\
t_3 := \mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-216}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot t\_3}}{-t\_3}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\right)\right) \cdot \left(F \cdot t\_0\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(C - \mathsf{hypot}\left(C, B\_m\right)\right)}}{-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))) < -5.00000000000000021e-216Initial program 37.1%
Simplified35.3%
pow1/235.3%
associate-*r*45.2%
unpow-prod-down60.0%
associate-+r-58.8%
hypot-undefine47.0%
unpow247.0%
unpow247.0%
+-commutative47.0%
unpow247.0%
unpow247.0%
hypot-define58.8%
pow1/258.8%
Applied egg-rr58.8%
unpow1/258.8%
associate-+r-60.0%
hypot-undefine47.0%
unpow247.0%
unpow247.0%
+-commutative47.0%
unpow247.0%
unpow247.0%
hypot-undefine60.0%
Simplified60.0%
if -5.00000000000000021e-216 < (/.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 30.1%
Simplified34.4%
Taylor expanded in C around inf 36.1%
mul-1-neg36.1%
Simplified36.1%
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 4.2%
mul-1-neg4.2%
+-commutative4.2%
unpow24.2%
unpow24.2%
hypot-define29.0%
Simplified29.0%
neg-sub029.0%
associate-*l/29.0%
pow1/229.0%
pow1/229.0%
pow-prod-down29.1%
Applied egg-rr29.1%
neg-sub029.1%
distribute-neg-frac229.1%
unpow1/229.0%
associate-*r*29.0%
Simplified29.0%
Final simplification39.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 (fma B_m B_m (* A (* C -4.0)))))
(if (<= F -2.5e+145)
(/ -1.0 (/ B_m (sqrt (* (pow B_m 2.0) (/ F (- C))))))
(if (<= F -1e-310)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A))))))
(if (<= F 8.5e+156)
(*
(sqrt (* (* 2.0 (- (+ A C) (hypot (- A C) B_m))) (* F t_0)))
(/ -1.0 t_0))
(/ (sqrt (* (- C (hypot C B_m)) (* F -2.0))) B_m))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (F <= -2.5e+145) {
tmp = -1.0 / (B_m / sqrt((pow(B_m, 2.0) * (F / -C))));
} else if (F <= -1e-310) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
} else if (F <= 8.5e+156) {
tmp = sqrt(((2.0 * ((A + C) - hypot((A - C), B_m))) * (F * t_0))) * (-1.0 / t_0);
} else {
tmp = sqrt(((C - hypot(C, B_m)) * (F * -2.0))) / B_m;
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (F <= -2.5e+145) tmp = Float64(-1.0 / Float64(B_m / sqrt(Float64((B_m ^ 2.0) * Float64(F / Float64(-C)))))); elseif (F <= -1e-310) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A)))))); elseif (F <= 8.5e+156) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64(A + C) - hypot(Float64(A - C), B_m))) * Float64(F * t_0))) * Float64(-1.0 / t_0)); else tmp = Float64(sqrt(Float64(Float64(C - hypot(C, B_m)) * Float64(F * -2.0))) / B_m); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.5e+145], N[(-1.0 / N[(B$95$m / N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] * N[(F / (-C)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1e-310], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 8.5e+156], N[(N[Sqrt[N[(N[(2.0 * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * -2.0), $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}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;F \leq -2.5 \cdot 10^{+145}:\\
\;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}}\\
\mathbf{elif}\;F \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\
\mathbf{elif}\;F \leq 8.5 \cdot 10^{+156}:\\
\;\;\;\;\sqrt{\left(2 \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(A - C, B\_m\right)\right)\right) \cdot \left(F \cdot t\_0\right)} \cdot \frac{-1}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(C - \mathsf{hypot}\left(C, B\_m\right)\right) \cdot \left(F \cdot -2\right)}}{B\_m}\\
\end{array}
\end{array}
if F < -2.49999999999999983e145Initial program 10.1%
Taylor expanded in A around 0 2.4%
mul-1-neg2.4%
+-commutative2.4%
unpow22.4%
unpow22.4%
hypot-define2.5%
Simplified2.5%
neg-sub02.5%
associate-*l/2.5%
pow1/22.5%
pow1/22.5%
pow-prod-down2.5%
Applied egg-rr2.5%
neg-sub02.5%
distribute-neg-frac22.5%
unpow1/22.5%
associate-*r*2.5%
Simplified2.5%
Taylor expanded in C around inf 6.7%
clear-num6.7%
inv-pow6.7%
mul-1-neg6.7%
associate-/l*6.5%
Applied egg-rr6.5%
unpow-16.5%
distribute-rgt-neg-in6.5%
distribute-neg-frac26.5%
Simplified6.5%
if -2.49999999999999983e145 < F < -9.999999999999969e-311Initial program 15.1%
Taylor expanded in C around 0 8.8%
mul-1-neg8.8%
+-commutative8.8%
unpow28.8%
unpow28.8%
hypot-define26.4%
Simplified26.4%
if -9.999999999999969e-311 < F < 8.49999999999999948e156Initial program 35.7%
Simplified56.4%
div-inv56.4%
Applied egg-rr65.7%
if 8.49999999999999948e156 < F Initial program 19.1%
Taylor expanded in A around 0 11.8%
mul-1-neg11.8%
+-commutative11.8%
unpow211.8%
unpow211.8%
hypot-define23.5%
Simplified23.5%
neg-sub023.5%
associate-*l/23.5%
pow1/223.5%
pow1/223.9%
pow-prod-down23.9%
Applied egg-rr23.9%
neg-sub023.9%
distribute-neg-frac223.9%
unpow1/223.5%
associate-*r*23.5%
Simplified23.5%
Applied egg-rr25.4%
+-lft-identity25.4%
associate-*r*25.4%
*-commutative25.4%
Simplified25.4%
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
(if (<= F -1.35e+145)
(/ -1.0 (/ B_m (sqrt (* (pow B_m 2.0) (/ F (- C))))))
(if (<= F -1e-310)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A))))))
(/ (sqrt (* (- C (hypot C B_m)) (* F -2.0))) B_m))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -1.35e+145) {
tmp = -1.0 / (B_m / sqrt((pow(B_m, 2.0) * (F / -C))));
} else if (F <= -1e-310) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
} else {
tmp = sqrt(((C - hypot(C, B_m)) * (F * -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 (F <= -1.35e+145) {
tmp = -1.0 / (B_m / Math.sqrt((Math.pow(B_m, 2.0) * (F / -C))));
} else if (F <= -1e-310) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (A - Math.hypot(B_m, A))));
} else {
tmp = Math.sqrt(((C - Math.hypot(C, B_m)) * (F * -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 F <= -1.35e+145: tmp = -1.0 / (B_m / math.sqrt((math.pow(B_m, 2.0) * (F / -C)))) elif F <= -1e-310: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (A - math.hypot(B_m, A)))) else: tmp = math.sqrt(((C - math.hypot(C, B_m)) * (F * -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 (F <= -1.35e+145) tmp = Float64(-1.0 / Float64(B_m / sqrt(Float64((B_m ^ 2.0) * Float64(F / Float64(-C)))))); elseif (F <= -1e-310) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A)))))); else tmp = Float64(sqrt(Float64(Float64(C - hypot(C, B_m)) * Float64(F * -2.0))) / B_m); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= -1.35e+145)
tmp = -1.0 / (B_m / sqrt(((B_m ^ 2.0) * (F / -C))));
elseif (F <= -1e-310)
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
else
tmp = sqrt(((C - hypot(C, B_m)) * (F * -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[F, -1.35e+145], N[(-1.0 / N[(B$95$m / N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] * N[(F / (-C)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1e-310], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * -2.0), $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}\;F \leq -1.35 \cdot 10^{+145}:\\
\;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}}\\
\mathbf{elif}\;F \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(C - \mathsf{hypot}\left(C, B\_m\right)\right) \cdot \left(F \cdot -2\right)}}{B\_m}\\
\end{array}
\end{array}
if F < -1.35000000000000011e145Initial program 10.1%
Taylor expanded in A around 0 2.4%
mul-1-neg2.4%
+-commutative2.4%
unpow22.4%
unpow22.4%
hypot-define2.5%
Simplified2.5%
neg-sub02.5%
associate-*l/2.5%
pow1/22.5%
pow1/22.5%
pow-prod-down2.5%
Applied egg-rr2.5%
neg-sub02.5%
distribute-neg-frac22.5%
unpow1/22.5%
associate-*r*2.5%
Simplified2.5%
Taylor expanded in C around inf 6.7%
clear-num6.7%
inv-pow6.7%
mul-1-neg6.7%
associate-/l*6.5%
Applied egg-rr6.5%
unpow-16.5%
distribute-rgt-neg-in6.5%
distribute-neg-frac26.5%
Simplified6.5%
if -1.35000000000000011e145 < F < -9.999999999999969e-311Initial program 15.1%
Taylor expanded in C around 0 8.8%
mul-1-neg8.8%
+-commutative8.8%
unpow28.8%
unpow28.8%
hypot-define26.4%
Simplified26.4%
if -9.999999999999969e-311 < F Initial program 31.0%
Taylor expanded in A around 0 11.8%
mul-1-neg11.8%
+-commutative11.8%
unpow211.8%
unpow211.8%
hypot-define23.4%
Simplified23.4%
neg-sub023.4%
associate-*l/23.4%
pow1/223.4%
pow1/223.6%
pow-prod-down23.6%
Applied egg-rr23.6%
neg-sub023.6%
distribute-neg-frac223.6%
unpow1/223.4%
associate-*r*23.4%
Simplified23.4%
Applied egg-rr25.6%
+-lft-identity25.6%
associate-*r*25.6%
*-commutative25.6%
Simplified25.6%
Final simplification21.8%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= F -1.3e+145)
(/ (sqrt (* (pow B_m 2.0) (/ F (- C)))) (- B_m))
(if (<= F -3.8e-307)
(/ (sqrt (* -2.0 (* B_m F))) (- B_m))
(/ (sqrt (* (- C (hypot C B_m)) (* F -2.0))) B_m))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -1.3e+145) {
tmp = sqrt((pow(B_m, 2.0) * (F / -C))) / -B_m;
} else if (F <= -3.8e-307) {
tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
} else {
tmp = sqrt(((C - hypot(C, B_m)) * (F * -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 (F <= -1.3e+145) {
tmp = Math.sqrt((Math.pow(B_m, 2.0) * (F / -C))) / -B_m;
} else if (F <= -3.8e-307) {
tmp = Math.sqrt((-2.0 * (B_m * F))) / -B_m;
} else {
tmp = Math.sqrt(((C - Math.hypot(C, B_m)) * (F * -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 F <= -1.3e+145: tmp = math.sqrt((math.pow(B_m, 2.0) * (F / -C))) / -B_m elif F <= -3.8e-307: tmp = math.sqrt((-2.0 * (B_m * F))) / -B_m else: tmp = math.sqrt(((C - math.hypot(C, B_m)) * (F * -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 (F <= -1.3e+145) tmp = Float64(sqrt(Float64((B_m ^ 2.0) * Float64(F / Float64(-C)))) / Float64(-B_m)); elseif (F <= -3.8e-307) tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(-B_m)); else tmp = Float64(sqrt(Float64(Float64(C - hypot(C, B_m)) * Float64(F * -2.0))) / B_m); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= -1.3e+145)
tmp = sqrt(((B_m ^ 2.0) * (F / -C))) / -B_m;
elseif (F <= -3.8e-307)
tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
else
tmp = sqrt(((C - hypot(C, B_m)) * (F * -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[F, -1.3e+145], N[(N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] * N[(F / (-C)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], If[LessEqual[F, -3.8e-307], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[N[(N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * -2.0), $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}\;F \leq -1.3 \cdot 10^{+145}:\\
\;\;\;\;\frac{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}{-B\_m}\\
\mathbf{elif}\;F \leq -3.8 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(C - \mathsf{hypot}\left(C, B\_m\right)\right) \cdot \left(F \cdot -2\right)}}{B\_m}\\
\end{array}
\end{array}
if F < -1.30000000000000001e145Initial program 10.1%
Taylor expanded in A around 0 2.4%
mul-1-neg2.4%
+-commutative2.4%
unpow22.4%
unpow22.4%
hypot-define2.5%
Simplified2.5%
neg-sub02.5%
associate-*l/2.5%
pow1/22.5%
pow1/22.5%
pow-prod-down2.5%
Applied egg-rr2.5%
neg-sub02.5%
distribute-neg-frac22.5%
unpow1/22.5%
associate-*r*2.5%
Simplified2.5%
Taylor expanded in C around inf 6.7%
mul-1-neg6.7%
associate-/l*6.5%
distribute-rgt-neg-in6.5%
distribute-neg-frac26.5%
Simplified6.5%
if -1.30000000000000001e145 < F < -3.79999999999999985e-307Initial program 15.2%
Taylor expanded in A around 0 9.0%
mul-1-neg9.0%
+-commutative9.0%
unpow29.0%
unpow29.0%
hypot-define27.8%
Simplified27.8%
neg-sub027.8%
associate-*l/27.8%
pow1/227.8%
pow1/227.8%
pow-prod-down27.9%
Applied egg-rr27.9%
neg-sub027.9%
distribute-neg-frac227.9%
unpow1/227.9%
associate-*r*27.9%
Simplified27.9%
Taylor expanded in C around 0 23.3%
if -3.79999999999999985e-307 < F Initial program 30.6%
Taylor expanded in A around 0 11.7%
mul-1-neg11.7%
+-commutative11.7%
unpow211.7%
unpow211.7%
hypot-define23.1%
Simplified23.1%
neg-sub023.1%
associate-*l/23.1%
pow1/223.1%
pow1/223.3%
pow-prod-down23.3%
Applied egg-rr23.3%
neg-sub023.3%
distribute-neg-frac223.3%
unpow1/223.1%
associate-*r*23.1%
Simplified23.1%
Applied egg-rr25.2%
+-lft-identity25.2%
associate-*r*25.2%
*-commutative25.2%
Simplified25.2%
Final simplification20.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 (<= F -5.1e+144) (/ -1.0 (/ B_m (sqrt (* (pow B_m 2.0) (/ F (- C)))))) (/ (sqrt (* (* 2.0 F) (- C (hypot 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 (F <= -5.1e+144) {
tmp = -1.0 / (B_m / sqrt((pow(B_m, 2.0) * (F / -C))));
} else {
tmp = sqrt(((2.0 * F) * (C - hypot(C, B_m)))) / -B_m;
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -5.1e+144) {
tmp = -1.0 / (B_m / Math.sqrt((Math.pow(B_m, 2.0) * (F / -C))));
} else {
tmp = Math.sqrt(((2.0 * F) * (C - Math.hypot(C, B_m)))) / -B_m;
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= -5.1e+144: tmp = -1.0 / (B_m / math.sqrt((math.pow(B_m, 2.0) * (F / -C)))) else: tmp = math.sqrt(((2.0 * F) * (C - math.hypot(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 (F <= -5.1e+144) tmp = Float64(-1.0 / Float64(B_m / sqrt(Float64((B_m ^ 2.0) * Float64(F / Float64(-C)))))); else tmp = Float64(sqrt(Float64(Float64(2.0 * F) * Float64(C - hypot(C, B_m)))) / 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 (F <= -5.1e+144)
tmp = -1.0 / (B_m / sqrt(((B_m ^ 2.0) * (F / -C))));
else
tmp = sqrt(((2.0 * F) * (C - hypot(C, B_m)))) / -B_m;
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -5.1e+144], N[(-1.0 / N[(B$95$m / N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] * N[(F / (-C)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $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}\;F \leq -5.1 \cdot 10^{+144}:\\
\;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(C - \mathsf{hypot}\left(C, B\_m\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if F < -5.0999999999999999e144Initial program 10.1%
Taylor expanded in A around 0 2.4%
mul-1-neg2.4%
+-commutative2.4%
unpow22.4%
unpow22.4%
hypot-define2.5%
Simplified2.5%
neg-sub02.5%
associate-*l/2.5%
pow1/22.5%
pow1/22.5%
pow-prod-down2.5%
Applied egg-rr2.5%
neg-sub02.5%
distribute-neg-frac22.5%
unpow1/22.5%
associate-*r*2.5%
Simplified2.5%
Taylor expanded in C around inf 6.7%
clear-num6.7%
inv-pow6.7%
mul-1-neg6.7%
associate-/l*6.5%
Applied egg-rr6.5%
unpow-16.5%
distribute-rgt-neg-in6.5%
distribute-neg-frac26.5%
Simplified6.5%
if -5.0999999999999999e144 < F Initial program 19.9%
Taylor expanded in A around 0 9.8%
mul-1-neg9.8%
+-commutative9.8%
unpow29.8%
unpow29.8%
hypot-define26.3%
Simplified26.3%
neg-sub026.3%
associate-*l/26.3%
pow1/226.3%
pow1/226.4%
pow-prod-down26.5%
Applied egg-rr26.5%
neg-sub026.5%
distribute-neg-frac226.5%
unpow1/226.4%
associate-*r*26.4%
Simplified26.4%
Final simplification22.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 (<= F -4.4e+144) (/ (sqrt (* (pow B_m 2.0) (/ F (- C)))) (- B_m)) (/ (sqrt (* (* 2.0 F) (- C (hypot 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 (F <= -4.4e+144) {
tmp = sqrt((pow(B_m, 2.0) * (F / -C))) / -B_m;
} else {
tmp = sqrt(((2.0 * F) * (C - hypot(C, B_m)))) / -B_m;
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -4.4e+144) {
tmp = Math.sqrt((Math.pow(B_m, 2.0) * (F / -C))) / -B_m;
} else {
tmp = Math.sqrt(((2.0 * F) * (C - Math.hypot(C, B_m)))) / -B_m;
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= -4.4e+144: tmp = math.sqrt((math.pow(B_m, 2.0) * (F / -C))) / -B_m else: tmp = math.sqrt(((2.0 * F) * (C - math.hypot(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 (F <= -4.4e+144) tmp = Float64(sqrt(Float64((B_m ^ 2.0) * Float64(F / Float64(-C)))) / Float64(-B_m)); else tmp = Float64(sqrt(Float64(Float64(2.0 * F) * Float64(C - hypot(C, B_m)))) / 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 (F <= -4.4e+144)
tmp = sqrt(((B_m ^ 2.0) * (F / -C))) / -B_m;
else
tmp = sqrt(((2.0 * F) * (C - hypot(C, B_m)))) / -B_m;
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -4.4e+144], N[(N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] * N[(F / (-C)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $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}\;F \leq -4.4 \cdot 10^{+144}:\\
\;\;\;\;\frac{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(C - \mathsf{hypot}\left(C, B\_m\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if F < -4.39999999999999976e144Initial program 10.1%
Taylor expanded in A around 0 2.4%
mul-1-neg2.4%
+-commutative2.4%
unpow22.4%
unpow22.4%
hypot-define2.5%
Simplified2.5%
neg-sub02.5%
associate-*l/2.5%
pow1/22.5%
pow1/22.5%
pow-prod-down2.5%
Applied egg-rr2.5%
neg-sub02.5%
distribute-neg-frac22.5%
unpow1/22.5%
associate-*r*2.5%
Simplified2.5%
Taylor expanded in C around inf 6.7%
mul-1-neg6.7%
associate-/l*6.5%
distribute-rgt-neg-in6.5%
distribute-neg-frac26.5%
Simplified6.5%
if -4.39999999999999976e144 < F Initial program 19.9%
Taylor expanded in A around 0 9.8%
mul-1-neg9.8%
+-commutative9.8%
unpow29.8%
unpow29.8%
hypot-define26.3%
Simplified26.3%
neg-sub026.3%
associate-*l/26.3%
pow1/226.3%
pow1/226.4%
pow-prod-down26.5%
Applied egg-rr26.5%
neg-sub026.5%
distribute-neg-frac226.5%
unpow1/226.4%
associate-*r*26.4%
Simplified26.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 (if (<= F -3.8e-307) (/ (sqrt (* -2.0 (* B_m F))) (- B_m)) (/ (sqrt (* (- C (hypot C B_m)) (* F -2.0))) B_m)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -3.8e-307) {
tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
} else {
tmp = sqrt(((C - hypot(C, B_m)) * (F * -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 (F <= -3.8e-307) {
tmp = Math.sqrt((-2.0 * (B_m * F))) / -B_m;
} else {
tmp = Math.sqrt(((C - Math.hypot(C, B_m)) * (F * -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 F <= -3.8e-307: tmp = math.sqrt((-2.0 * (B_m * F))) / -B_m else: tmp = math.sqrt(((C - math.hypot(C, B_m)) * (F * -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 (F <= -3.8e-307) tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(-B_m)); else tmp = Float64(sqrt(Float64(Float64(C - hypot(C, B_m)) * Float64(F * -2.0))) / B_m); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= -3.8e-307)
tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
else
tmp = sqrt(((C - hypot(C, B_m)) * (F * -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[F, -3.8e-307], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[N[(N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * -2.0), $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}\;F \leq -3.8 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(C - \mathsf{hypot}\left(C, B\_m\right)\right) \cdot \left(F \cdot -2\right)}}{B\_m}\\
\end{array}
\end{array}
if F < -3.79999999999999985e-307Initial program 13.7%
Taylor expanded in A around 0 7.0%
mul-1-neg7.0%
+-commutative7.0%
unpow27.0%
unpow27.0%
hypot-define20.4%
Simplified20.4%
neg-sub020.4%
associate-*l/20.4%
pow1/220.4%
pow1/220.4%
pow-prod-down20.5%
Applied egg-rr20.5%
neg-sub020.5%
distribute-neg-frac220.5%
unpow1/220.5%
associate-*r*20.5%
Simplified20.5%
Taylor expanded in C around 0 17.0%
if -3.79999999999999985e-307 < F Initial program 30.6%
Taylor expanded in A around 0 11.7%
mul-1-neg11.7%
+-commutative11.7%
unpow211.7%
unpow211.7%
hypot-define23.1%
Simplified23.1%
neg-sub023.1%
associate-*l/23.1%
pow1/223.1%
pow1/223.3%
pow-prod-down23.3%
Applied egg-rr23.3%
neg-sub023.3%
distribute-neg-frac223.3%
unpow1/223.1%
associate-*r*23.1%
Simplified23.1%
Applied egg-rr25.2%
+-lft-identity25.2%
associate-*r*25.2%
*-commutative25.2%
Simplified25.2%
Final simplification19.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 (<= F -1e-310) (/ (sqrt (* -2.0 (* B_m F))) (- B_m)) (/ (sqrt (/ (* (pow B_m 2.0) F) (- 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 (F <= -1e-310) {
tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
} else {
tmp = sqrt(((pow(B_m, 2.0) * F) / -C)) / B_m;
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= (-1d-310)) then
tmp = sqrt(((-2.0d0) * (b_m * f))) / -b_m
else
tmp = sqrt((((b_m ** 2.0d0) * f) / -c)) / b_m
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -1e-310) {
tmp = Math.sqrt((-2.0 * (B_m * F))) / -B_m;
} else {
tmp = Math.sqrt(((Math.pow(B_m, 2.0) * F) / -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 F <= -1e-310: tmp = math.sqrt((-2.0 * (B_m * F))) / -B_m else: tmp = math.sqrt(((math.pow(B_m, 2.0) * F) / -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 (F <= -1e-310) tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(-B_m)); else tmp = Float64(sqrt(Float64(Float64((B_m ^ 2.0) * F) / Float64(-C))) / B_m); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= -1e-310)
tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
else
tmp = sqrt((((B_m ^ 2.0) * F) / -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[F, -1e-310], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * F), $MachinePrecision] / (-C)), $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}\;F \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\frac{{B\_m}^{2} \cdot F}{-C}}}{B\_m}\\
\end{array}
\end{array}
if F < -9.999999999999969e-311Initial program 13.6%
Taylor expanded in A around 0 7.0%
mul-1-neg7.0%
+-commutative7.0%
unpow27.0%
unpow27.0%
hypot-define20.3%
Simplified20.3%
neg-sub020.3%
associate-*l/20.3%
pow1/220.3%
pow1/220.3%
pow-prod-down20.4%
Applied egg-rr20.4%
neg-sub020.4%
distribute-neg-frac220.4%
unpow1/220.4%
associate-*r*20.4%
Simplified20.4%
Taylor expanded in C around 0 16.9%
if -9.999999999999969e-311 < F Initial program 31.0%
Taylor expanded in A around 0 11.8%
mul-1-neg11.8%
+-commutative11.8%
unpow211.8%
unpow211.8%
hypot-define23.4%
Simplified23.4%
neg-sub023.4%
associate-*l/23.4%
pow1/223.4%
pow1/223.6%
pow-prod-down23.6%
Applied egg-rr23.6%
neg-sub023.6%
distribute-neg-frac223.6%
unpow1/223.4%
associate-*r*23.4%
Simplified23.4%
Taylor expanded in C around inf 39.6%
Applied egg-rr30.2%
+-lft-identity30.2%
Simplified30.2%
Final simplification20.1%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= F -3.8e-307) (/ (sqrt (* -2.0 (* B_m F))) (- B_m)) (sqrt (* F (* C (/ -4.0 (pow B_m -2.0)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -3.8e-307) {
tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
} else {
tmp = sqrt((F * (C * (-4.0 / pow(B_m, -2.0)))));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= (-3.8d-307)) then
tmp = sqrt(((-2.0d0) * (b_m * f))) / -b_m
else
tmp = sqrt((f * (c * ((-4.0d0) / (b_m ** (-2.0d0))))))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -3.8e-307) {
tmp = Math.sqrt((-2.0 * (B_m * F))) / -B_m;
} else {
tmp = Math.sqrt((F * (C * (-4.0 / Math.pow(B_m, -2.0)))));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= -3.8e-307: tmp = math.sqrt((-2.0 * (B_m * F))) / -B_m else: tmp = math.sqrt((F * (C * (-4.0 / math.pow(B_m, -2.0))))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= -3.8e-307) tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(-B_m)); else tmp = sqrt(Float64(F * Float64(C * Float64(-4.0 / (B_m ^ -2.0))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= -3.8e-307)
tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
else
tmp = sqrt((F * (C * (-4.0 / (B_m ^ -2.0)))));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -3.8e-307], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[Sqrt[N[(F * N[(C * N[(-4.0 / N[Power[B$95$m, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.8 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(C \cdot \frac{-4}{{B\_m}^{-2}}\right)}\\
\end{array}
\end{array}
if F < -3.79999999999999985e-307Initial program 13.7%
Taylor expanded in A around 0 7.0%
mul-1-neg7.0%
+-commutative7.0%
unpow27.0%
unpow27.0%
hypot-define20.4%
Simplified20.4%
neg-sub020.4%
associate-*l/20.4%
pow1/220.4%
pow1/220.4%
pow-prod-down20.5%
Applied egg-rr20.5%
neg-sub020.5%
distribute-neg-frac220.5%
unpow1/220.5%
associate-*r*20.5%
Simplified20.5%
Taylor expanded in C around 0 17.0%
if -3.79999999999999985e-307 < F Initial program 30.6%
Taylor expanded in A around 0 11.7%
mul-1-neg11.7%
+-commutative11.7%
unpow211.7%
unpow211.7%
hypot-define23.1%
Simplified23.1%
Taylor expanded in C around -inf 0.0%
unpow20.0%
rem-square-sqrt4.0%
unpow24.0%
rem-square-sqrt4.0%
metadata-eval4.0%
*-commutative4.0%
Simplified4.0%
Applied egg-rr29.9%
associate-*l*31.7%
Simplified31.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 (<= F 1.2e-102) (/ (sqrt (* -2.0 (* B_m F))) (- B_m)) (* (/ -2.0 B_m) (pow (* C F) -0.5))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.2e-102) {
tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
} else {
tmp = (-2.0 / B_m) * pow((C * F), -0.5);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 1.2d-102) then
tmp = sqrt(((-2.0d0) * (b_m * f))) / -b_m
else
tmp = ((-2.0d0) / b_m) * ((c * f) ** (-0.5d0))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.2e-102) {
tmp = Math.sqrt((-2.0 * (B_m * F))) / -B_m;
} else {
tmp = (-2.0 / B_m) * Math.pow((C * F), -0.5);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 1.2e-102: tmp = math.sqrt((-2.0 * (B_m * F))) / -B_m else: tmp = (-2.0 / B_m) * math.pow((C * F), -0.5) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 1.2e-102) tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(-B_m)); else tmp = Float64(Float64(-2.0 / B_m) * (Float64(C * F) ^ -0.5)); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 1.2e-102)
tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
else
tmp = (-2.0 / B_m) * ((C * F) ^ -0.5);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 1.2e-102], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[(-2.0 / B$95$m), $MachinePrecision] * N[Power[N[(C * F), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.2 \cdot 10^{-102}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{B\_m} \cdot {\left(C \cdot F\right)}^{-0.5}\\
\end{array}
\end{array}
if F < 1.2e-102Initial program 15.8%
Taylor expanded in A around 0 8.9%
mul-1-neg8.9%
+-commutative8.9%
unpow28.9%
unpow28.9%
hypot-define21.7%
Simplified21.7%
neg-sub021.7%
associate-*l/21.7%
pow1/221.7%
pow1/221.7%
pow-prod-down21.8%
Applied egg-rr21.8%
neg-sub021.8%
distribute-neg-frac221.8%
unpow1/221.8%
associate-*r*21.8%
Simplified21.8%
Taylor expanded in C around 0 18.3%
if 1.2e-102 < F Initial program 26.8%
Taylor expanded in A around 0 4.5%
mul-1-neg4.5%
+-commutative4.5%
unpow24.5%
unpow24.5%
hypot-define17.8%
Simplified17.8%
Taylor expanded in C around -inf 0.0%
unpow20.0%
rem-square-sqrt0.4%
unpow20.4%
rem-square-sqrt0.4%
metadata-eval0.4%
*-commutative0.4%
Simplified0.4%
Applied egg-rr9.7%
Final simplification16.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 (* (/ -2.0 B_m) (pow (* C F) -0.5)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return (-2.0 / B_m) * pow((C * F), -0.5);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = ((-2.0d0) / b_m) * ((c * f) ** (-0.5d0))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return (-2.0 / B_m) * Math.pow((C * F), -0.5);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return (-2.0 / B_m) * math.pow((C * F), -0.5)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(Float64(-2.0 / B_m) * (Float64(C * F) ^ -0.5)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = (-2.0 / B_m) * ((C * F) ^ -0.5);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[(-2.0 / B$95$m), $MachinePrecision] * N[Power[N[(C * F), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{-2}{B\_m} \cdot {\left(C \cdot F\right)}^{-0.5}
\end{array}
Initial program 17.7%
Taylor expanded in A around 0 8.1%
mul-1-neg8.1%
+-commutative8.1%
unpow28.1%
unpow28.1%
hypot-define21.0%
Simplified21.0%
Taylor expanded in C around -inf 0.0%
unpow20.0%
rem-square-sqrt3.8%
unpow23.8%
rem-square-sqrt3.9%
metadata-eval3.9%
*-commutative3.9%
Simplified3.9%
Applied egg-rr3.0%
Final simplification3.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 (* (/ -2.0 B_m) (sqrt (* C F))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return (-2.0 / B_m) * sqrt((C * F));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = ((-2.0d0) / b_m) * sqrt((c * f))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return (-2.0 / B_m) * Math.sqrt((C * F));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return (-2.0 / B_m) * math.sqrt((C * F))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(Float64(-2.0 / B_m) * sqrt(Float64(C * F))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = (-2.0 / B_m) * sqrt((C * F));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[(-2.0 / B$95$m), $MachinePrecision] * N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{-2}{B\_m} \cdot \sqrt{C \cdot F}
\end{array}
Initial program 17.7%
Taylor expanded in A around 0 8.1%
mul-1-neg8.1%
+-commutative8.1%
unpow28.1%
unpow28.1%
hypot-define21.0%
Simplified21.0%
Taylor expanded in C around -inf 0.0%
unpow20.0%
rem-square-sqrt3.8%
unpow23.8%
rem-square-sqrt3.9%
metadata-eval3.9%
*-commutative3.9%
Simplified3.9%
Final simplification3.9%
herbie shell --seed 2024170
(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))))