
(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
(/
(- (* A (* 4.0 C)) (* B_m B_m))
(* A (sqrt (* F (+ (* C -16.0) (* 4.0 (/ (* B_m B_m) A))))))))
(t_1 (* (* A C) -4.0))
(t_2 (+ (* B_m B_m) 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)))))
(if (<= t_4 -5e-208)
(*
(/ (sqrt t_2) (- (- 0.0 (* B_m B_m)) t_1))
(sqrt (* (+ A (- C (hypot B_m (- A C)))) (* 2.0 F))))
(if (<= t_4 1e+215)
(/
(sqrt (* t_2 (* (* 2.0 F) (+ A (+ A (* -0.5 (/ (* B_m B_m) C)))))))
(- (* 4.0 (* A C)) (* B_m B_m)))
(if (<= t_4 INFINITY)
(pow (* t_0 t_0) -0.5)
(/ (pow (* 2.0 (* F (- A (hypot B_m A)))) 0.5) (- 0.0 B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = ((A * (4.0 * C)) - (B_m * B_m)) / (A * sqrt((F * ((C * -16.0) + (4.0 * ((B_m * B_m) / A))))));
double t_1 = (A * C) * -4.0;
double t_2 = (B_m * B_m) + 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 tmp;
if (t_4 <= -5e-208) {
tmp = (sqrt(t_2) / ((0.0 - (B_m * B_m)) - t_1)) * sqrt(((A + (C - hypot(B_m, (A - C)))) * (2.0 * F)));
} else if (t_4 <= 1e+215) {
tmp = sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / ((4.0 * (A * C)) - (B_m * B_m));
} else if (t_4 <= ((double) INFINITY)) {
tmp = pow((t_0 * t_0), -0.5);
} else {
tmp = pow((2.0 * (F * (A - hypot(B_m, A)))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = ((A * (4.0 * C)) - (B_m * B_m)) / (A * Math.sqrt((F * ((C * -16.0) + (4.0 * ((B_m * B_m) / A))))));
double t_1 = (A * C) * -4.0;
double t_2 = (B_m * B_m) + t_1;
double t_3 = (4.0 * A) * C;
double t_4 = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_3) * F)) * ((A + C) - Math.sqrt((Math.pow(B_m, 2.0) + Math.pow((A - C), 2.0)))))) / (t_3 - Math.pow(B_m, 2.0));
double tmp;
if (t_4 <= -5e-208) {
tmp = (Math.sqrt(t_2) / ((0.0 - (B_m * B_m)) - t_1)) * Math.sqrt(((A + (C - Math.hypot(B_m, (A - C)))) * (2.0 * F)));
} else if (t_4 <= 1e+215) {
tmp = Math.sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / ((4.0 * (A * C)) - (B_m * B_m));
} else if (t_4 <= Double.POSITIVE_INFINITY) {
tmp = Math.pow((t_0 * t_0), -0.5);
} else {
tmp = Math.pow((2.0 * (F * (A - Math.hypot(B_m, A)))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = ((A * (4.0 * C)) - (B_m * B_m)) / (A * math.sqrt((F * ((C * -16.0) + (4.0 * ((B_m * B_m) / A)))))) t_1 = (A * C) * -4.0 t_2 = (B_m * B_m) + t_1 t_3 = (4.0 * A) * C t_4 = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_3) * F)) * ((A + C) - math.sqrt((math.pow(B_m, 2.0) + math.pow((A - C), 2.0)))))) / (t_3 - math.pow(B_m, 2.0)) tmp = 0 if t_4 <= -5e-208: tmp = (math.sqrt(t_2) / ((0.0 - (B_m * B_m)) - t_1)) * math.sqrt(((A + (C - math.hypot(B_m, (A - C)))) * (2.0 * F))) elif t_4 <= 1e+215: tmp = math.sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / ((4.0 * (A * C)) - (B_m * B_m)) elif t_4 <= math.inf: tmp = math.pow((t_0 * t_0), -0.5) else: tmp = math.pow((2.0 * (F * (A - math.hypot(B_m, A)))), 0.5) / (0.0 - B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(Float64(A * Float64(4.0 * C)) - Float64(B_m * B_m)) / Float64(A * sqrt(Float64(F * Float64(Float64(C * -16.0) + Float64(4.0 * Float64(Float64(B_m * B_m) / A))))))) t_1 = Float64(Float64(A * C) * -4.0) t_2 = Float64(Float64(B_m * B_m) + 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))) tmp = 0.0 if (t_4 <= -5e-208) tmp = Float64(Float64(sqrt(t_2) / Float64(Float64(0.0 - Float64(B_m * B_m)) - t_1)) * sqrt(Float64(Float64(A + Float64(C - hypot(B_m, Float64(A - C)))) * Float64(2.0 * F)))); elseif (t_4 <= 1e+215) tmp = Float64(sqrt(Float64(t_2 * Float64(Float64(2.0 * F) * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64(B_m * B_m) / C))))))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m))); elseif (t_4 <= Inf) tmp = Float64(t_0 * t_0) ^ -0.5; else tmp = Float64((Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A)))) ^ 0.5) / Float64(0.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)
t_0 = ((A * (4.0 * C)) - (B_m * B_m)) / (A * sqrt((F * ((C * -16.0) + (4.0 * ((B_m * B_m) / A))))));
t_1 = (A * C) * -4.0;
t_2 = (B_m * B_m) + t_1;
t_3 = (4.0 * A) * C;
t_4 = sqrt(((2.0 * (((B_m ^ 2.0) - t_3) * F)) * ((A + C) - sqrt(((B_m ^ 2.0) + ((A - C) ^ 2.0)))))) / (t_3 - (B_m ^ 2.0));
tmp = 0.0;
if (t_4 <= -5e-208)
tmp = (sqrt(t_2) / ((0.0 - (B_m * B_m)) - t_1)) * sqrt(((A + (C - hypot(B_m, (A - C)))) * (2.0 * F)));
elseif (t_4 <= 1e+215)
tmp = sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / ((4.0 * (A * C)) - (B_m * B_m));
elseif (t_4 <= Inf)
tmp = (t_0 * t_0) ^ -0.5;
else
tmp = ((2.0 * (F * (A - hypot(B_m, A)))) ^ 0.5) / (0.0 - B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(N[(A * N[(4.0 * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision] / N[(A * N[Sqrt[N[(F * N[(N[(C * -16.0), $MachinePrecision] + N[(4.0 * N[(N[(B$95$m * B$95$m), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B$95$m * B$95$m), $MachinePrecision] + t$95$1), $MachinePrecision]}, 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]}, If[LessEqual[t$95$4, -5e-208], N[(N[(N[Sqrt[t$95$2], $MachinePrecision] / N[(N[(0.0 - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 1e+215], N[(N[Sqrt[N[(t$95$2 * N[(N[(2.0 * F), $MachinePrecision] * N[(A + N[(A + N[(-0.5 * N[(N[(B$95$m * B$95$m), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], -0.5], $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{A \cdot \left(4 \cdot C\right) - B\_m \cdot B\_m}{A \cdot \sqrt{F \cdot \left(C \cdot -16 + 4 \cdot \frac{B\_m \cdot B\_m}{A}\right)}}\\
t_1 := \left(A \cdot C\right) \cdot -4\\
t_2 := B\_m \cdot B\_m + 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}}\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{-208}:\\
\;\;\;\;\frac{\sqrt{t\_2}}{\left(0 - B\_m \cdot B\_m\right) - t\_1} \cdot \sqrt{\left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}\\
\mathbf{elif}\;t\_4 \leq 10^{+215}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(\left(2 \cdot F\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{B\_m \cdot B\_m}{C}\right)\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)\right)}^{0.5}}{0 - 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))) < -4.99999999999999963e-208Initial program 41.4%
Applied egg-rr65.6%
if -4.99999999999999963e-208 < (/.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))) < 9.99999999999999907e214Initial program 27.1%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
Simplified27.2%
Taylor expanded in C around inf
associate--l+N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6431.2%
Simplified31.2%
if 9.99999999999999907e214 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < +inf.0Initial program 3.6%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
Simplified29.7%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f643.8%
Simplified3.8%
clear-numN/A
metadata-evalN/A
/-lowering-/.f64N/A
metadata-evalN/A
pow1/2N/A
unpow-prod-downN/A
associate-/r*N/A
/-lowering-/.f64N/A
Applied egg-rr1.5%
inv-powN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr56.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
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6422.4%
Simplified22.4%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr22.5%
Final simplification40.5%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* 4.0 (* A C)))
(t_1 (- t_0 (* B_m B_m)))
(t_2 (+ (* B_m B_m) (* (* A C) -4.0))))
(if (<= B_m 3.4e-90)
(/ (sqrt (* t_2 (* (* 2.0 F) (+ A A)))) t_1)
(if (<= B_m 1300000000000.0)
(*
(sqrt (/ (* F (+ A (- C (hypot B_m (- A C))))) (- (* B_m B_m) t_0)))
(- 0.0 (sqrt 2.0)))
(if (<= B_m 1.25e+37)
(/
(sqrt (* t_2 (* (* 2.0 F) (+ A (+ A (* -0.5 (/ (* B_m B_m) C)))))))
t_1)
(/ (pow (* 2.0 (* F (- A (hypot B_m A)))) 0.5) (- 0.0 B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = t_0 - (B_m * B_m);
double t_2 = (B_m * B_m) + ((A * C) * -4.0);
double tmp;
if (B_m <= 3.4e-90) {
tmp = sqrt((t_2 * ((2.0 * F) * (A + A)))) / t_1;
} else if (B_m <= 1300000000000.0) {
tmp = sqrt(((F * (A + (C - hypot(B_m, (A - C))))) / ((B_m * B_m) - t_0))) * (0.0 - sqrt(2.0));
} else if (B_m <= 1.25e+37) {
tmp = sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / t_1;
} else {
tmp = pow((2.0 * (F * (A - hypot(B_m, A)))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = t_0 - (B_m * B_m);
double t_2 = (B_m * B_m) + ((A * C) * -4.0);
double tmp;
if (B_m <= 3.4e-90) {
tmp = Math.sqrt((t_2 * ((2.0 * F) * (A + A)))) / t_1;
} else if (B_m <= 1300000000000.0) {
tmp = Math.sqrt(((F * (A + (C - Math.hypot(B_m, (A - C))))) / ((B_m * B_m) - t_0))) * (0.0 - Math.sqrt(2.0));
} else if (B_m <= 1.25e+37) {
tmp = Math.sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / t_1;
} else {
tmp = Math.pow((2.0 * (F * (A - Math.hypot(B_m, A)))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = 4.0 * (A * C) t_1 = t_0 - (B_m * B_m) t_2 = (B_m * B_m) + ((A * C) * -4.0) tmp = 0 if B_m <= 3.4e-90: tmp = math.sqrt((t_2 * ((2.0 * F) * (A + A)))) / t_1 elif B_m <= 1300000000000.0: tmp = math.sqrt(((F * (A + (C - math.hypot(B_m, (A - C))))) / ((B_m * B_m) - t_0))) * (0.0 - math.sqrt(2.0)) elif B_m <= 1.25e+37: tmp = math.sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / t_1 else: tmp = math.pow((2.0 * (F * (A - math.hypot(B_m, A)))), 0.5) / (0.0 - B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(4.0 * Float64(A * C)) t_1 = Float64(t_0 - Float64(B_m * B_m)) t_2 = Float64(Float64(B_m * B_m) + Float64(Float64(A * C) * -4.0)) tmp = 0.0 if (B_m <= 3.4e-90) tmp = Float64(sqrt(Float64(t_2 * Float64(Float64(2.0 * F) * Float64(A + A)))) / t_1); elseif (B_m <= 1300000000000.0) tmp = Float64(sqrt(Float64(Float64(F * Float64(A + Float64(C - hypot(B_m, Float64(A - C))))) / Float64(Float64(B_m * B_m) - t_0))) * Float64(0.0 - sqrt(2.0))); elseif (B_m <= 1.25e+37) tmp = Float64(sqrt(Float64(t_2 * Float64(Float64(2.0 * F) * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64(B_m * B_m) / C))))))) / t_1); else tmp = Float64((Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A)))) ^ 0.5) / Float64(0.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)
t_0 = 4.0 * (A * C);
t_1 = t_0 - (B_m * B_m);
t_2 = (B_m * B_m) + ((A * C) * -4.0);
tmp = 0.0;
if (B_m <= 3.4e-90)
tmp = sqrt((t_2 * ((2.0 * F) * (A + A)))) / t_1;
elseif (B_m <= 1300000000000.0)
tmp = sqrt(((F * (A + (C - hypot(B_m, (A - C))))) / ((B_m * B_m) - t_0))) * (0.0 - sqrt(2.0));
elseif (B_m <= 1.25e+37)
tmp = sqrt((t_2 * ((2.0 * F) * (A + (A + (-0.5 * ((B_m * B_m) / C))))))) / t_1;
else
tmp = ((2.0 * (F * (A - hypot(B_m, A)))) ^ 0.5) / (0.0 - B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B$95$m * B$95$m), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 3.4e-90], N[(N[Sqrt[N[(t$95$2 * N[(N[(2.0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 1300000000000.0], N[(N[Sqrt[N[(N[(F * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(B$95$m * B$95$m), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.25e+37], N[(N[Sqrt[N[(t$95$2 * N[(N[(2.0 * F), $MachinePrecision] * N[(A + N[(A + N[(-0.5 * N[(N[(B$95$m * B$95$m), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
t_1 := t\_0 - B\_m \cdot B\_m\\
t_2 := B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\\
\mathbf{if}\;B\_m \leq 3.4 \cdot 10^{-90}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{t\_1}\\
\mathbf{elif}\;B\_m \leq 1300000000000:\\
\;\;\;\;\sqrt{\frac{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)}{B\_m \cdot B\_m - t\_0}} \cdot \left(0 - \sqrt{2}\right)\\
\mathbf{elif}\;B\_m \leq 1.25 \cdot 10^{+37}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(\left(2 \cdot F\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{B\_m \cdot B\_m}{C}\right)\right)\right)}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)\right)}^{0.5}}{0 - B\_m}\\
\end{array}
\end{array}
if B < 3.39999999999999994e-90Initial program 21.8%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
Simplified26.9%
Taylor expanded in C around inf
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-lowering-+.f6417.7%
Simplified17.7%
if 3.39999999999999994e-90 < B < 1.3e12Initial program 32.1%
Taylor expanded in F around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
Simplified59.0%
if 1.3e12 < B < 1.24999999999999997e37Initial program 2.7%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
Simplified35.5%
Taylor expanded in C around inf
associate--l+N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6438.2%
Simplified38.2%
if 1.24999999999999997e37 < B Initial program 8.3%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6449.3%
Simplified49.3%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr49.5%
Final simplification29.3%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 1.4e-34)
(/
(sqrt (* (+ (* B_m B_m) (* (* A C) -4.0)) (* (* 2.0 F) (+ A A))))
(- (* 4.0 (* A C)) (* B_m B_m)))
(/ (pow (* 2.0 (* F (- A (hypot B_m A)))) 0.5) (- 0.0 B_m))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.4e-34) {
tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
} else {
tmp = pow((2.0 * (F * (A - hypot(B_m, A)))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.4e-34) {
tmp = Math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
} else {
tmp = Math.pow((2.0 * (F * (A - Math.hypot(B_m, A)))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.4e-34: tmp = math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m)) else: tmp = math.pow((2.0 * (F * (A - math.hypot(B_m, A)))), 0.5) / (0.0 - B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.4e-34) tmp = Float64(sqrt(Float64(Float64(Float64(B_m * B_m) + Float64(Float64(A * C) * -4.0)) * Float64(Float64(2.0 * F) * Float64(A + A)))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m))); else tmp = Float64((Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A)))) ^ 0.5) / Float64(0.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 (B_m <= 1.4e-34)
tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
else
tmp = ((2.0 * (F * (A - hypot(B_m, A)))) ^ 0.5) / (0.0 - B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.4e-34], N[(N[Sqrt[N[(N[(N[(B$95$m * B$95$m), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.4 \cdot 10^{-34}:\\
\;\;\;\;\frac{\sqrt{\left(B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)\right)}^{0.5}}{0 - B\_m}\\
\end{array}
\end{array}
if B < 1.39999999999999998e-34Initial program 21.1%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
Simplified26.3%
Taylor expanded in C around inf
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-lowering-+.f6417.2%
Simplified17.2%
if 1.39999999999999998e-34 < B Initial program 14.3%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6449.8%
Simplified49.8%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr50.0%
Final simplification26.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 1.7e-34)
(/
(sqrt (* (+ (* B_m B_m) (* (* A C) -4.0)) (* (* 2.0 F) (+ A A))))
(- (* 4.0 (* A C)) (* B_m B_m)))
(/ (sqrt (* (* 2.0 F) (- A (hypot A B_m)))) (- 0.0 B_m))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.7e-34) {
tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
} else {
tmp = sqrt(((2.0 * F) * (A - hypot(A, B_m)))) / (0.0 - B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.7e-34) {
tmp = Math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
} else {
tmp = Math.sqrt(((2.0 * F) * (A - Math.hypot(A, B_m)))) / (0.0 - B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.7e-34: tmp = math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m)) else: tmp = math.sqrt(((2.0 * F) * (A - math.hypot(A, B_m)))) / (0.0 - B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.7e-34) tmp = Float64(sqrt(Float64(Float64(Float64(B_m * B_m) + Float64(Float64(A * C) * -4.0)) * Float64(Float64(2.0 * F) * Float64(A + A)))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m))); else tmp = Float64(sqrt(Float64(Float64(2.0 * F) * Float64(A - hypot(A, B_m)))) / Float64(0.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 (B_m <= 1.7e-34)
tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
else
tmp = sqrt(((2.0 * F) * (A - hypot(A, B_m)))) / (0.0 - B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.7e-34], N[(N[Sqrt[N[(N[(N[(B$95$m * B$95$m), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.7 \cdot 10^{-34}:\\
\;\;\;\;\frac{\sqrt{\left(B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)}}{0 - B\_m}\\
\end{array}
\end{array}
if B < 1.7e-34Initial program 21.1%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
Simplified26.3%
Taylor expanded in C around inf
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-lowering-+.f6417.2%
Simplified17.2%
if 1.7e-34 < B Initial program 14.3%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6449.8%
Simplified49.8%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr50.0%
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-hypot.f64N/A
*-lowering-*.f6450.0%
Applied egg-rr50.0%
Final simplification26.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 1.5e-34)
(/
(sqrt (* (+ (* B_m B_m) (* (* A C) -4.0)) (* (* 2.0 F) (+ A A))))
(- (* 4.0 (* A C)) (* B_m B_m)))
(/ (pow (* 2.0 (* F (- A B_m))) 0.5) (- 0.0 B_m))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.5e-34) {
tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
} else {
tmp = pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 1.5d-34) then
tmp = sqrt((((b_m * b_m) + ((a * c) * (-4.0d0))) * ((2.0d0 * f) * (a + a)))) / ((4.0d0 * (a * c)) - (b_m * b_m))
else
tmp = ((2.0d0 * (f * (a - b_m))) ** 0.5d0) / (0.0d0 - b_m)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.5e-34) {
tmp = Math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
} else {
tmp = Math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.5e-34: tmp = math.sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m)) else: tmp = math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.5e-34) tmp = Float64(sqrt(Float64(Float64(Float64(B_m * B_m) + Float64(Float64(A * C) * -4.0)) * Float64(Float64(2.0 * F) * Float64(A + A)))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m))); else tmp = Float64((Float64(2.0 * Float64(F * Float64(A - B_m))) ^ 0.5) / Float64(0.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 (B_m <= 1.5e-34)
tmp = sqrt((((B_m * B_m) + ((A * C) * -4.0)) * ((2.0 * F) * (A + A)))) / ((4.0 * (A * C)) - (B_m * B_m));
else
tmp = ((2.0 * (F * (A - B_m))) ^ 0.5) / (0.0 - B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.5e-34], N[(N[Sqrt[N[(N[(N[(B$95$m * B$95$m), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.5 \cdot 10^{-34}:\\
\;\;\;\;\frac{\sqrt{\left(B\_m \cdot B\_m + \left(A \cdot C\right) \cdot -4\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + A\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\
\end{array}
\end{array}
if B < 1.5e-34Initial program 21.1%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
Simplified26.3%
Taylor expanded in C around inf
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-lowering-+.f6417.2%
Simplified17.2%
if 1.5e-34 < B Initial program 14.3%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6449.8%
Simplified49.8%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr50.0%
Taylor expanded in A around 0
--lowering--.f6447.5%
Simplified47.5%
Final simplification26.2%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 7.2e-35)
(/
(sqrt (* (* A -8.0) (* (+ A A) (* C F))))
(- (* 4.0 (* A C)) (* B_m B_m)))
(/ (pow (* 2.0 (* F (- A B_m))) 0.5) (- 0.0 B_m))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 7.2e-35) {
tmp = sqrt(((A * -8.0) * ((A + A) * (C * F)))) / ((4.0 * (A * C)) - (B_m * B_m));
} else {
tmp = pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 7.2d-35) then
tmp = sqrt(((a * (-8.0d0)) * ((a + a) * (c * f)))) / ((4.0d0 * (a * c)) - (b_m * b_m))
else
tmp = ((2.0d0 * (f * (a - b_m))) ** 0.5d0) / (0.0d0 - b_m)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 7.2e-35) {
tmp = Math.sqrt(((A * -8.0) * ((A + A) * (C * F)))) / ((4.0 * (A * C)) - (B_m * B_m));
} else {
tmp = Math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 7.2e-35: tmp = math.sqrt(((A * -8.0) * ((A + A) * (C * F)))) / ((4.0 * (A * C)) - (B_m * B_m)) else: tmp = math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 7.2e-35) tmp = Float64(sqrt(Float64(Float64(A * -8.0) * Float64(Float64(A + A) * Float64(C * F)))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m))); else tmp = Float64((Float64(2.0 * Float64(F * Float64(A - B_m))) ^ 0.5) / Float64(0.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 (B_m <= 7.2e-35)
tmp = sqrt(((A * -8.0) * ((A + A) * (C * F)))) / ((4.0 * (A * C)) - (B_m * B_m));
else
tmp = ((2.0 * (F * (A - B_m))) ^ 0.5) / (0.0 - B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 7.2e-35], N[(N[Sqrt[N[(N[(A * -8.0), $MachinePrecision] * N[(N[(A + A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 7.2 \cdot 10^{-35}:\\
\;\;\;\;\frac{\sqrt{\left(A \cdot -8\right) \cdot \left(\left(A + A\right) \cdot \left(C \cdot F\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\
\end{array}
\end{array}
if B < 7.20000000000000038e-35Initial program 21.1%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
Simplified26.3%
Taylor expanded in C around inf
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-lowering-+.f6414.8%
Simplified14.8%
if 7.20000000000000038e-35 < B Initial program 14.3%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6449.8%
Simplified49.8%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr50.0%
Taylor expanded in A around 0
--lowering--.f6447.5%
Simplified47.5%
Final simplification24.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 5e-108) (/ (sqrt (* -16.0 (* F (* C (* A A))))) (- (* 4.0 (* A C)) (* B_m B_m))) (/ (pow (* 2.0 (* F (- A B_m))) 0.5) (- 0.0 B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 5e-108) {
tmp = sqrt((-16.0 * (F * (C * (A * A))))) / ((4.0 * (A * C)) - (B_m * B_m));
} else {
tmp = pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 5d-108) then
tmp = sqrt(((-16.0d0) * (f * (c * (a * a))))) / ((4.0d0 * (a * c)) - (b_m * b_m))
else
tmp = ((2.0d0 * (f * (a - b_m))) ** 0.5d0) / (0.0d0 - b_m)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 5e-108) {
tmp = Math.sqrt((-16.0 * (F * (C * (A * A))))) / ((4.0 * (A * C)) - (B_m * B_m));
} else {
tmp = Math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 5e-108: tmp = math.sqrt((-16.0 * (F * (C * (A * A))))) / ((4.0 * (A * C)) - (B_m * B_m)) else: tmp = math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 5e-108) tmp = Float64(sqrt(Float64(-16.0 * Float64(F * Float64(C * Float64(A * A))))) / Float64(Float64(4.0 * Float64(A * C)) - Float64(B_m * B_m))); else tmp = Float64((Float64(2.0 * Float64(F * Float64(A - B_m))) ^ 0.5) / Float64(0.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 (B_m <= 5e-108)
tmp = sqrt((-16.0 * (F * (C * (A * A))))) / ((4.0 * (A * C)) - (B_m * B_m));
else
tmp = ((2.0 * (F * (A - B_m))) ^ 0.5) / (0.0 - B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 5e-108], N[(N[Sqrt[N[(-16.0 * N[(F * N[(C * N[(A * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 5 \cdot 10^{-108}:\\
\;\;\;\;\frac{\sqrt{-16 \cdot \left(F \cdot \left(C \cdot \left(A \cdot A\right)\right)\right)}}{4 \cdot \left(A \cdot C\right) - B\_m \cdot B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\
\end{array}
\end{array}
if B < 5e-108Initial program 20.9%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
Simplified26.0%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6413.1%
Simplified13.1%
if 5e-108 < B Initial program 15.6%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6446.9%
Simplified46.9%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr47.1%
Taylor expanded in A around 0
--lowering--.f6443.1%
Simplified43.1%
Final simplification23.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.95e-65) (/ -1.0 (/ (/ (- (* B_m B_m) (* A (* 4.0 C))) A) (sqrt (* -16.0 (* C F))))) (/ (pow (* 2.0 (* F (- A B_m))) 0.5) (- 0.0 B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.95e-65) {
tmp = -1.0 / ((((B_m * B_m) - (A * (4.0 * C))) / A) / sqrt((-16.0 * (C * F))));
} else {
tmp = pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 1.95d-65) then
tmp = (-1.0d0) / ((((b_m * b_m) - (a * (4.0d0 * c))) / a) / sqrt(((-16.0d0) * (c * f))))
else
tmp = ((2.0d0 * (f * (a - b_m))) ** 0.5d0) / (0.0d0 - b_m)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.95e-65) {
tmp = -1.0 / ((((B_m * B_m) - (A * (4.0 * C))) / A) / Math.sqrt((-16.0 * (C * F))));
} else {
tmp = Math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.95e-65: tmp = -1.0 / ((((B_m * B_m) - (A * (4.0 * C))) / A) / math.sqrt((-16.0 * (C * F)))) else: tmp = math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.95e-65) tmp = Float64(-1.0 / Float64(Float64(Float64(Float64(B_m * B_m) - Float64(A * Float64(4.0 * C))) / A) / sqrt(Float64(-16.0 * Float64(C * F))))); else tmp = Float64((Float64(2.0 * Float64(F * Float64(A - B_m))) ^ 0.5) / Float64(0.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 (B_m <= 1.95e-65)
tmp = -1.0 / ((((B_m * B_m) - (A * (4.0 * C))) / A) / sqrt((-16.0 * (C * F))));
else
tmp = ((2.0 * (F * (A - B_m))) ^ 0.5) / (0.0 - B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.95e-65], N[(-1.0 / N[(N[(N[(N[(B$95$m * B$95$m), $MachinePrecision] - N[(A * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / A), $MachinePrecision] / N[Sqrt[N[(-16.0 * N[(C * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(2.0 * N[(F * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.95 \cdot 10^{-65}:\\
\;\;\;\;\frac{-1}{\frac{\frac{B\_m \cdot B\_m - A \cdot \left(4 \cdot C\right)}{A}}{\sqrt{-16 \cdot \left(C \cdot F\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}\\
\end{array}
\end{array}
if B < 1.9500000000000002e-65Initial program 21.7%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
Simplified27.1%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6413.2%
Simplified13.2%
clear-numN/A
metadata-evalN/A
/-lowering-/.f64N/A
metadata-evalN/A
pow1/2N/A
unpow-prod-downN/A
associate-/r*N/A
/-lowering-/.f64N/A
Applied egg-rr6.7%
Taylor expanded in C around inf
*-lowering-*.f64N/A
*-lowering-*.f647.2%
Simplified7.2%
if 1.9500000000000002e-65 < B Initial program 13.5%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6447.7%
Simplified47.7%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr47.8%
Taylor expanded in A around 0
--lowering--.f6445.5%
Simplified45.5%
Final simplification19.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 (/ (pow (* 2.0 (* F (- A B_m))) 0.5) (- 0.0 B_m)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = ((2.0d0 * (f * (a - b_m))) ** 0.5d0) / (0.0d0 - b_m)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return Math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.pow((2.0 * (F * (A - B_m))), 0.5) / (0.0 - B_m)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64((Float64(2.0 * Float64(F * Float64(A - B_m))) ^ 0.5) / Float64(0.0 - B_m)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = ((2.0 * (F * (A - B_m))) ^ 0.5) / (0.0 - B_m);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[Power[N[(2.0 * N[(F * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{{\left(2 \cdot \left(F \cdot \left(A - B\_m\right)\right)\right)}^{0.5}}{0 - B\_m}
\end{array}
Initial program 19.1%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6419.0%
Simplified19.0%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr19.1%
Taylor expanded in A around 0
--lowering--.f6416.5%
Simplified16.5%
Final simplification16.5%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (/ (sqrt (* (* 2.0 F) (- A B_m))) (- 0.0 B_m)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt(((2.0 * F) * (A - B_m))) / (0.0 - B_m);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt(((2.0d0 * f) * (a - b_m))) / (0.0d0 - b_m)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt(((2.0 * F) * (A - B_m))) / (0.0 - B_m);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt(((2.0 * F) * (A - B_m))) / (0.0 - B_m)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(sqrt(Float64(Float64(2.0 * F) * Float64(A - B_m))) / Float64(0.0 - B_m)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt(((2.0 * F) * (A - B_m))) / (0.0 - B_m);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(A - B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - B\_m\right)}}{0 - B\_m}
\end{array}
Initial program 19.1%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6419.0%
Simplified19.0%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr19.1%
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-hypot.f64N/A
*-lowering-*.f6419.0%
Applied egg-rr19.0%
Taylor expanded in A around 0
--lowering--.f6416.3%
Simplified16.3%
Final simplification16.3%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (/ (sqrt (* -2.0 (* B_m F))) (- 0.0 B_m)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt((-2.0 * (B_m * F))) / (0.0 - B_m);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt(((-2.0d0) * (b_m * f))) / (0.0d0 - b_m)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((-2.0 * (B_m * F))) / (0.0 - B_m);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt((-2.0 * (B_m * F))) / (0.0 - B_m)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(0.0 - B_m)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt((-2.0 * (B_m * F))) / (0.0 - B_m);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - B$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{0 - B\_m}
\end{array}
Initial program 19.1%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6419.0%
Simplified19.0%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr19.1%
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-hypot.f64N/A
*-lowering-*.f6419.0%
Applied egg-rr19.0%
Taylor expanded in A around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6417.0%
Simplified17.0%
Final simplification17.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 (* A 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((A * 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((a * 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((A * 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((A * 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(A * 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((A * 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[(A * 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{A \cdot F}
\end{array}
Initial program 19.1%
distribute-frac-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
Simplified23.9%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f649.4%
Simplified9.4%
Taylor expanded in A around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f643.4%
Simplified3.4%
pow1/2N/A
pow-to-expN/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f643.2%
Applied egg-rr3.2%
*-commutativeN/A
associate-*r*N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
exp-prodN/A
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
rem-exp-logN/A
*-commutativeN/A
*-lowering-*.f643.4%
Applied egg-rr3.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 (- 0.0 (sqrt (/ F A))))
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 0.0 - sqrt((F / A));
}
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 = 0.0d0 - sqrt((f / a))
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 0.0 - Math.sqrt((F / A));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return 0.0 - math.sqrt((F / A))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(0.0 - sqrt(Float64(F / A))) 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 = 0.0 - sqrt((F / A));
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[(0.0 - N[Sqrt[N[(F / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
0 - \sqrt{\frac{F}{A}}
\end{array}
Initial program 19.1%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6419.0%
Simplified19.0%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr19.1%
Taylor expanded in A around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.5%
Simplified2.5%
Taylor expanded in B around -inf
associate-*r*N/A
neg-mul-1N/A
unpow2N/A
rem-square-sqrtN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identityN/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f642.6%
Simplified2.6%
Final simplification2.6%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (sqrt (/ F A)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt((F / A));
}
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 / a))
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 / A));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt((F / A))
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 / A)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt((F / A));
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 / A), $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}{A}}
\end{array}
Initial program 19.1%
Taylor expanded in C around 0
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f6419.0%
Simplified19.0%
associate-*l*N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr19.1%
Taylor expanded in A around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.5%
Simplified2.5%
Taylor expanded in A around 0
associate-*r*N/A
neg-mul-1N/A
unpow2N/A
rem-square-sqrtN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identityN/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f641.0%
Simplified1.0%
herbie shell --seed 2024191
(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))))