
(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 11 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 (* -2.0 (sqrt C)))
(t_1 (fma -4.0 (* A C) (* B_m B_m)))
(t_2 (* (* 4.0 A) C))
(t_3 (- (pow B_m 2.0) t_2))
(t_4
(/
(sqrt
(*
(* 2.0 (* t_3 F))
(+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
(- t_2 (pow B_m 2.0))))
(t_5 (fma C (* A -4.0) (* B_m B_m))))
(if (<= t_4 -5e+138)
(/ (* (* t_0 (sqrt F)) (sqrt t_1)) t_3)
(if (<= t_4 -1e-187)
(/
-1.0
(/
t_5
(sqrt
(*
(fma
(- A C)
(* (+ A C) (/ 1.0 (- A C)))
(sqrt (fma (- A C) (- A C) (* B_m B_m))))
(* t_5 (* 2.0 F))))))
(if (<= t_4 2e+166)
(/
(sqrt (* 2.0 (* t_1 (* F (fma -0.5 (/ (* B_m B_m) A) (* 2.0 C))))))
(- t_1))
(if (<= t_4 INFINITY)
(* t_0 (/ (sqrt (* F t_1)) t_1))
(- (/ (sqrt F) (sqrt (* B_m 0.5))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = -2.0 * sqrt(C);
double t_1 = fma(-4.0, (A * C), (B_m * B_m));
double t_2 = (4.0 * A) * C;
double t_3 = pow(B_m, 2.0) - t_2;
double t_4 = sqrt(((2.0 * (t_3 * F)) * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_2 - pow(B_m, 2.0));
double t_5 = fma(C, (A * -4.0), (B_m * B_m));
double tmp;
if (t_4 <= -5e+138) {
tmp = ((t_0 * sqrt(F)) * sqrt(t_1)) / t_3;
} else if (t_4 <= -1e-187) {
tmp = -1.0 / (t_5 / sqrt((fma((A - C), ((A + C) * (1.0 / (A - C))), sqrt(fma((A - C), (A - C), (B_m * B_m)))) * (t_5 * (2.0 * F)))));
} else if (t_4 <= 2e+166) {
tmp = sqrt((2.0 * (t_1 * (F * fma(-0.5, ((B_m * B_m) / A), (2.0 * C)))))) / -t_1;
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_0 * (sqrt((F * t_1)) / t_1);
} else {
tmp = -(sqrt(F) / sqrt((B_m * 0.5)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(-2.0 * sqrt(C)) t_1 = fma(-4.0, Float64(A * C), Float64(B_m * B_m)) t_2 = Float64(Float64(4.0 * A) * C) t_3 = Float64((B_m ^ 2.0) - t_2) t_4 = Float64(sqrt(Float64(Float64(2.0 * Float64(t_3 * F)) * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_2 - (B_m ^ 2.0))) t_5 = fma(C, Float64(A * -4.0), Float64(B_m * B_m)) tmp = 0.0 if (t_4 <= -5e+138) tmp = Float64(Float64(Float64(t_0 * sqrt(F)) * sqrt(t_1)) / t_3); elseif (t_4 <= -1e-187) tmp = Float64(-1.0 / Float64(t_5 / sqrt(Float64(fma(Float64(A - C), Float64(Float64(A + C) * Float64(1.0 / Float64(A - C))), sqrt(fma(Float64(A - C), Float64(A - C), Float64(B_m * B_m)))) * Float64(t_5 * Float64(2.0 * F)))))); elseif (t_4 <= 2e+166) tmp = Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(F * fma(-0.5, Float64(Float64(B_m * B_m) / A), Float64(2.0 * C)))))) / Float64(-t_1)); elseif (t_4 <= Inf) tmp = Float64(t_0 * Float64(sqrt(Float64(F * t_1)) / t_1)); else tmp = Float64(-Float64(sqrt(F) / sqrt(Float64(B_m * 0.5)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(-2.0 * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(N[(2.0 * N[(t$95$3 * 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$2 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(C * N[(A * -4.0), $MachinePrecision] + N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -5e+138], N[(N[(N[(t$95$0 * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$4, -1e-187], N[(-1.0 / N[(t$95$5 / N[Sqrt[N[(N[(N[(A - C), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] * N[(1.0 / N[(A - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[(A - C), $MachinePrecision] * N[(A - C), $MachinePrecision] + N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$5 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2e+166], N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(-0.5 * N[(N[(B$95$m * B$95$m), $MachinePrecision] / A), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(t$95$0 * N[(N[Sqrt[N[(F * t$95$1), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[N[(B$95$m * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])]]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := -2 \cdot \sqrt{C}\\
t_1 := \mathsf{fma}\left(-4, A \cdot C, B\_m \cdot B\_m\right)\\
t_2 := \left(4 \cdot A\right) \cdot C\\
t_3 := {B\_m}^{2} - t\_2\\
t_4 := \frac{\sqrt{\left(2 \cdot \left(t\_3 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_2 - {B\_m}^{2}}\\
t_5 := \mathsf{fma}\left(C, A \cdot -4, B\_m \cdot B\_m\right)\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{+138}:\\
\;\;\;\;\frac{\left(t\_0 \cdot \sqrt{F}\right) \cdot \sqrt{t\_1}}{t\_3}\\
\mathbf{elif}\;t\_4 \leq -1 \cdot 10^{-187}:\\
\;\;\;\;\frac{-1}{\frac{t\_5}{\sqrt{\mathsf{fma}\left(A - C, \left(A + C\right) \cdot \frac{1}{A - C}, \sqrt{\mathsf{fma}\left(A - C, A - C, B\_m \cdot B\_m\right)}\right) \cdot \left(t\_5 \cdot \left(2 \cdot F\right)\right)}}}\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+166}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(t\_1 \cdot \left(F \cdot \mathsf{fma}\left(-0.5, \frac{B\_m \cdot B\_m}{A}, 2 \cdot C\right)\right)\right)}}{-t\_1}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_0 \cdot \frac{\sqrt{F \cdot t\_1}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{F}}{\sqrt{B\_m \cdot 0.5}}\\
\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.00000000000000016e138Initial program 12.1%
Taylor expanded in A around -inf
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6416.1
Simplified16.1%
*-commutativeN/A
associate-*r*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
Applied egg-rr20.8%
Taylor expanded in B around 0
*-lowering-*.f6424.7
Simplified24.7%
distribute-lft-neg-inN/A
pow1/2N/A
unpow-prod-downN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-prodN/A
metadata-evalN/A
pow1/2N/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6431.2
Applied egg-rr31.2%
if -5.00000000000000016e138 < (/.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))) < -1e-187Initial program 99.5%
distribute-frac-negN/A
neg-mul-1N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
Applied egg-rr99.4%
+-commutativeN/A
flip-+N/A
div-invN/A
difference-of-squaresN/A
*-commutativeN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.5
Applied egg-rr99.5%
if -1e-187 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < 1.99999999999999988e166Initial program 16.0%
Taylor expanded in A around -inf
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.2
Simplified37.2%
pow2N/A
sub-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
+-commutativeN/A
frac-2negN/A
remove-double-negN/A
/-lowering-/.f64N/A
Applied egg-rr37.2%
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr37.1%
if 1.99999999999999988e166 < (/.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 9.5%
Taylor expanded in A around -inf
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f649.4
Simplified9.4%
*-commutativeN/A
associate-*r*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
Applied egg-rr26.5%
Taylor expanded in B around 0
*-lowering-*.f6426.5
Simplified26.5%
distribute-lft-neg-inN/A
pow2N/A
associate-*l*N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
sqrt-prodN/A
metadata-evalN/A
pow1/2N/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
Applied egg-rr26.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 B around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
sqrt-lowering-sqrt.f6420.7
Simplified20.7%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6420.8
Applied egg-rr20.8%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6420.8
Applied egg-rr20.8%
pow1/2N/A
unpow-prod-downN/A
distribute-lft-neg-inN/A
pow1/2N/A
clear-numN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
div-invN/A
metadata-evalN/A
*-lowering-*.f6432.9
Applied egg-rr32.9%
Final simplification41.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 (<= (pow B_m 2.0) 2e-55)
(/ (sqrt (* -16.0 (* F (* A (* C C))))) (- (fma -4.0 (* A C) (* B_m B_m))))
(if (<= (pow B_m 2.0) 4e+105)
(* (sqrt (* F (+ C (sqrt (fma B_m B_m (* C C)))))) (/ (sqrt 2.0) (- B_m)))
(- (/ (sqrt F) (sqrt (* B_m 0.5)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 2e-55) {
tmp = sqrt((-16.0 * (F * (A * (C * C))))) / -fma(-4.0, (A * C), (B_m * B_m));
} else if (pow(B_m, 2.0) <= 4e+105) {
tmp = sqrt((F * (C + sqrt(fma(B_m, B_m, (C * C)))))) * (sqrt(2.0) / -B_m);
} else {
tmp = -(sqrt(F) / sqrt((B_m * 0.5)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-55) tmp = Float64(sqrt(Float64(-16.0 * Float64(F * Float64(A * Float64(C * C))))) / Float64(-fma(-4.0, Float64(A * C), Float64(B_m * B_m)))); elseif ((B_m ^ 2.0) <= 4e+105) tmp = Float64(sqrt(Float64(F * Float64(C + sqrt(fma(B_m, B_m, Float64(C * C)))))) * Float64(sqrt(2.0) / Float64(-B_m))); else tmp = Float64(-Float64(sqrt(F) / sqrt(Float64(B_m * 0.5)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-55], N[(N[Sqrt[N[(-16.0 * N[(F * N[(A * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+105], N[(N[Sqrt[N[(F * N[(C + N[Sqrt[N[(B$95$m * B$95$m + N[(C * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[N[(B$95$m * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-55}:\\
\;\;\;\;\frac{\sqrt{-16 \cdot \left(F \cdot \left(A \cdot \left(C \cdot C\right)\right)\right)}}{-\mathsf{fma}\left(-4, A \cdot C, B\_m \cdot B\_m\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+105}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \sqrt{\mathsf{fma}\left(B\_m, B\_m, C \cdot C\right)}\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{F}}{\sqrt{B\_m \cdot 0.5}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999999e-55Initial program 21.9%
Taylor expanded in A around -inf
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.5
Simplified28.5%
pow2N/A
sub-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
+-commutativeN/A
frac-2negN/A
remove-double-negN/A
/-lowering-/.f64N/A
Applied egg-rr28.5%
Taylor expanded in A around inf
*-lowering-*.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6418.9
Simplified18.9%
if 1.99999999999999999e-55 < (pow.f64 B #s(literal 2 binary64)) < 3.9999999999999998e105Initial program 40.7%
distribute-frac-negN/A
neg-mul-1N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
Applied egg-rr40.8%
Taylor expanded in A around 0
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f647.6
Simplified7.6%
if 3.9999999999999998e105 < (pow.f64 B #s(literal 2 binary64)) Initial program 8.2%
Taylor expanded in B around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
sqrt-lowering-sqrt.f6427.8
Simplified27.8%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6428.0
Applied egg-rr28.0%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6428.0
Applied egg-rr28.0%
pow1/2N/A
unpow-prod-downN/A
distribute-lft-neg-inN/A
pow1/2N/A
clear-numN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
div-invN/A
metadata-evalN/A
*-lowering-*.f6439.3
Applied egg-rr39.3%
Final simplification24.6%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma -4.0 (* A C) (* B_m B_m))))
(if (<= (pow B_m 2.0) 4e+133)
(/
(sqrt (* 2.0 (* (fma -0.5 (/ (* B_m B_m) A) (* 2.0 C)) (* F t_0))))
(- t_0))
(- (/ (sqrt F) (sqrt (* B_m 0.5)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(-4.0, (A * C), (B_m * B_m));
double tmp;
if (pow(B_m, 2.0) <= 4e+133) {
tmp = sqrt((2.0 * (fma(-0.5, ((B_m * B_m) / A), (2.0 * C)) * (F * t_0)))) / -t_0;
} else {
tmp = -(sqrt(F) / sqrt((B_m * 0.5)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(-4.0, Float64(A * C), Float64(B_m * B_m)) tmp = 0.0 if ((B_m ^ 2.0) <= 4e+133) tmp = Float64(sqrt(Float64(2.0 * Float64(fma(-0.5, Float64(Float64(B_m * B_m) / A), Float64(2.0 * C)) * Float64(F * t_0)))) / Float64(-t_0)); else tmp = Float64(-Float64(sqrt(F) / sqrt(Float64(B_m * 0.5)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+133], N[(N[Sqrt[N[(2.0 * N[(N[(-0.5 * N[(N[(B$95$m * B$95$m), $MachinePrecision] / A), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], (-N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[N[(B$95$m * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-4, A \cdot C, B\_m \cdot B\_m\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 4 \cdot 10^{+133}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\mathsf{fma}\left(-0.5, \frac{B\_m \cdot B\_m}{A}, 2 \cdot C\right) \cdot \left(F \cdot t\_0\right)\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{F}}{\sqrt{B\_m \cdot 0.5}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.0000000000000001e133Initial program 26.8%
Taylor expanded in A around -inf
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6425.1
Simplified25.1%
pow2N/A
sub-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
+-commutativeN/A
frac-2negN/A
remove-double-negN/A
/-lowering-/.f64N/A
Applied egg-rr25.1%
if 4.0000000000000001e133 < (pow.f64 B #s(literal 2 binary64)) Initial program 7.3%
Taylor expanded in B around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
sqrt-lowering-sqrt.f6427.6
Simplified27.6%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6427.8
Applied egg-rr27.8%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6427.8
Applied egg-rr27.8%
pow1/2N/A
unpow-prod-downN/A
distribute-lft-neg-inN/A
pow1/2N/A
clear-numN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
div-invN/A
metadata-evalN/A
*-lowering-*.f6439.4
Applied egg-rr39.4%
Final simplification30.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 -4.0 (* A C) (* B_m B_m))))
(if (<= (pow B_m 2.0) 4e+105)
(* -2.0 (/ (sqrt (* C (* F t_0))) t_0))
(- (/ (sqrt F) (sqrt (* B_m 0.5)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(-4.0, (A * C), (B_m * B_m));
double tmp;
if (pow(B_m, 2.0) <= 4e+105) {
tmp = -2.0 * (sqrt((C * (F * t_0))) / t_0);
} else {
tmp = -(sqrt(F) / sqrt((B_m * 0.5)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(-4.0, Float64(A * C), Float64(B_m * B_m)) tmp = 0.0 if ((B_m ^ 2.0) <= 4e+105) tmp = Float64(-2.0 * Float64(sqrt(Float64(C * Float64(F * t_0))) / t_0)); else tmp = Float64(-Float64(sqrt(F) / sqrt(Float64(B_m * 0.5)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+105], N[(-2.0 * N[(N[Sqrt[N[(C * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[N[(B$95$m * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-4, A \cdot C, B\_m \cdot B\_m\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 4 \cdot 10^{+105}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{C \cdot \left(F \cdot t\_0\right)}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{F}}{\sqrt{B\_m \cdot 0.5}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 3.9999999999999998e105Initial program 26.6%
Taylor expanded in A around -inf
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6425.5
Simplified25.5%
*-commutativeN/A
associate-*r*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
Applied egg-rr19.9%
Taylor expanded in B around 0
*-lowering-*.f6420.0
Simplified20.0%
Taylor expanded in F around 0
*-lowering-*.f64N/A
associate-*r/N/A
*-rgt-identityN/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
/-lowering-/.f64N/A
Simplified25.6%
if 3.9999999999999998e105 < (pow.f64 B #s(literal 2 binary64)) Initial program 8.2%
Taylor expanded in B around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
sqrt-lowering-sqrt.f6427.8
Simplified27.8%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6428.0
Applied egg-rr28.0%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6428.0
Applied egg-rr28.0%
pow1/2N/A
unpow-prod-downN/A
distribute-lft-neg-inN/A
pow1/2N/A
clear-numN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
div-invN/A
metadata-evalN/A
*-lowering-*.f6439.3
Applied egg-rr39.3%
Final simplification30.6%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= (pow B_m 2.0) 2e+76) (/ (sqrt (* -16.0 (* F (* A (* C C))))) (- (fma -4.0 (* A C) (* B_m B_m)))) (- (/ (sqrt F) (sqrt (* B_m 0.5))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 2e+76) {
tmp = sqrt((-16.0 * (F * (A * (C * C))))) / -fma(-4.0, (A * C), (B_m * B_m));
} else {
tmp = -(sqrt(F) / sqrt((B_m * 0.5)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 2e+76) tmp = Float64(sqrt(Float64(-16.0 * Float64(F * Float64(A * Float64(C * C))))) / Float64(-fma(-4.0, Float64(A * C), Float64(B_m * B_m)))); else tmp = Float64(-Float64(sqrt(F) / sqrt(Float64(B_m * 0.5)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+76], N[(N[Sqrt[N[(-16.0 * N[(F * N[(A * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], (-N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[N[(B$95$m * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{+76}:\\
\;\;\;\;\frac{\sqrt{-16 \cdot \left(F \cdot \left(A \cdot \left(C \cdot C\right)\right)\right)}}{-\mathsf{fma}\left(-4, A \cdot C, B\_m \cdot B\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{F}}{\sqrt{B\_m \cdot 0.5}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e76Initial program 26.8%
Taylor expanded in A around -inf
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6426.9
Simplified26.9%
pow2N/A
sub-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
+-commutativeN/A
frac-2negN/A
remove-double-negN/A
/-lowering-/.f64N/A
Applied egg-rr26.9%
Taylor expanded in A around inf
*-lowering-*.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6418.1
Simplified18.1%
if 2.0000000000000001e76 < (pow.f64 B #s(literal 2 binary64)) Initial program 9.7%
Taylor expanded in B around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
sqrt-lowering-sqrt.f6425.6
Simplified25.6%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6425.8
Applied egg-rr25.8%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6425.8
Applied egg-rr25.8%
pow1/2N/A
unpow-prod-downN/A
distribute-lft-neg-inN/A
pow1/2N/A
clear-numN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
div-invN/A
metadata-evalN/A
*-lowering-*.f6436.0
Applied egg-rr36.0%
Final simplification25.3%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (/ (sqrt F) (sqrt (* B_m 0.5)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -(sqrt(F) / sqrt((B_m * 0.5)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -(sqrt(f) / sqrt((b_m * 0.5d0)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -(Math.sqrt(F) / Math.sqrt((B_m * 0.5)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -(math.sqrt(F) / math.sqrt((B_m * 0.5)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-Float64(sqrt(F) / sqrt(Float64(B_m * 0.5)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -(sqrt(F) / sqrt((B_m * 0.5)));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[N[(B$95$m * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\frac{\sqrt{F}}{\sqrt{B\_m \cdot 0.5}}
\end{array}
Initial program 19.9%
Taylor expanded in B around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
sqrt-lowering-sqrt.f6412.2
Simplified12.2%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6412.3
Applied egg-rr12.3%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6412.3
Applied egg-rr12.3%
pow1/2N/A
unpow-prod-downN/A
distribute-lft-neg-inN/A
pow1/2N/A
clear-numN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
div-invN/A
metadata-evalN/A
*-lowering-*.f6416.8
Applied egg-rr16.8%
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 (* (- (sqrt F)) (sqrt (/ 2.0 B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt(F) * sqrt((2.0 / B_m));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt(f) * sqrt((2.0d0 / b_m))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt(F) * Math.sqrt((2.0 / B_m));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt(F) * math.sqrt((2.0 / B_m))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(Float64(-sqrt(F)) * sqrt(Float64(2.0 / B_m))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt(F) * sqrt((2.0 / B_m));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[((-N[Sqrt[F], $MachinePrecision]) * N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\left(-\sqrt{F}\right) \cdot \sqrt{\frac{2}{B\_m}}
\end{array}
Initial program 19.9%
Taylor expanded in B around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
sqrt-lowering-sqrt.f6412.2
Simplified12.2%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6412.3
Applied egg-rr12.3%
associate-*l/N/A
associate-/l*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6416.8
Applied egg-rr16.8%
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 (if (<= C 3.1e+84) (- (sqrt (/ F (* B_m 0.5)))) (* -2.0 (/ (sqrt (* C F)) B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 3.1e+84) {
tmp = -sqrt((F / (B_m * 0.5)));
} else {
tmp = -2.0 * (sqrt((C * F)) / B_m);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 3.1d+84) then
tmp = -sqrt((f / (b_m * 0.5d0)))
else
tmp = (-2.0d0) * (sqrt((c * f)) / b_m)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 3.1e+84) {
tmp = -Math.sqrt((F / (B_m * 0.5)));
} else {
tmp = -2.0 * (Math.sqrt((C * F)) / B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= 3.1e+84: tmp = -math.sqrt((F / (B_m * 0.5))) else: tmp = -2.0 * (math.sqrt((C * F)) / B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= 3.1e+84) tmp = Float64(-sqrt(Float64(F / Float64(B_m * 0.5)))); else tmp = Float64(-2.0 * Float64(sqrt(Float64(C * F)) / B_m)); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= 3.1e+84)
tmp = -sqrt((F / (B_m * 0.5)));
else
tmp = -2.0 * (sqrt((C * F)) / B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 3.1e+84], (-N[Sqrt[N[(F / N[(B$95$m * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(-2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 3.1 \cdot 10^{+84}:\\
\;\;\;\;-\sqrt{\frac{F}{B\_m \cdot 0.5}}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{C \cdot F}}{B\_m}\\
\end{array}
\end{array}
if C < 3.10000000000000003e84Initial program 19.4%
Taylor expanded in B around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
sqrt-lowering-sqrt.f6412.1
Simplified12.1%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6412.1
Applied egg-rr12.1%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6412.1
Applied egg-rr12.1%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
div-invN/A
metadata-evalN/A
*-lowering-*.f6412.2
Applied egg-rr12.2%
if 3.10000000000000003e84 < C Initial program 22.7%
Taylor expanded in A around -inf
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6430.2
Simplified30.2%
*-commutativeN/A
associate-*r*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
Applied egg-rr40.2%
Taylor expanded in B around 0
*-lowering-*.f6452.9
Simplified52.9%
Taylor expanded in C around 0
associate-*l/N/A
*-lft-identityN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f649.9
Simplified9.9%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (sqrt (/ F (* B_m 0.5)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((F / (B_m * 0.5)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((f / (b_m * 0.5d0)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((F / (B_m * 0.5)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((F / (B_m * 0.5)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(F / Float64(B_m * 0.5)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((F / (B_m * 0.5)));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(F / N[(B$95$m * 0.5), $MachinePrecision]), $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}{B\_m \cdot 0.5}}
\end{array}
Initial program 19.9%
Taylor expanded in B around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
sqrt-lowering-sqrt.f6412.2
Simplified12.2%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6412.3
Applied egg-rr12.3%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6412.3
Applied egg-rr12.3%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
div-invN/A
metadata-evalN/A
*-lowering-*.f6412.3
Applied egg-rr12.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 (/ F B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((2.0 * (F / B_m)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((2.0d0 * (f / b_m)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((2.0 * (F / B_m)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((2.0 * (F / B_m)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((2.0 * (F / B_m)));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{2 \cdot \frac{F}{B\_m}}
\end{array}
Initial program 19.9%
Taylor expanded in B around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
sqrt-lowering-sqrt.f6412.2
Simplified12.2%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6412.3
Applied egg-rr12.3%
Final simplification12.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 (* F (/ 2.0 B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((F * (2.0 / B_m)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((f * (2.0d0 / b_m)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((F * (2.0 / B_m)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((F * (2.0 / B_m)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(F * Float64(2.0 / B_m)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((F * (2.0 / B_m)));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(F * N[(2.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{F \cdot \frac{2}{B\_m}}
\end{array}
Initial program 19.9%
Taylor expanded in B around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
sqrt-lowering-sqrt.f6412.2
Simplified12.2%
distribute-rgt-neg-outN/A
neg-lowering-neg.f64N/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6412.3
Applied egg-rr12.3%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6412.3
Applied egg-rr12.3%
herbie shell --seed 2024204
(FPCore (A B C F)
:name "ABCF->ab-angle a"
:precision binary64
(/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))