
(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 10 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}
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (pow (fma (- A C) (- A C) (* B B)) 0.25))
(t_1 (* (* 4.0 A) C))
(t_2 (* 2.0 (* (- (pow B 2.0) t_1) F)))
(t_3 (- t_1 (pow B 2.0)))
(t_4
(/
(sqrt (* t_2 (- (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0))))))
t_3))
(t_5 (/ (* (sqrt 2.0) (sqrt 2.0)) C))
(t_6 (* -0.25 (* t_5 (* (sqrt (* F -4.0)) (sqrt C)))))
(t_7 (fma B B (* A (* C -4.0)))))
(if (<= t_4 (- INFINITY))
t_6
(if (<= t_4 -4e-201)
(/ (sqrt (* t_2 (fma t_0 (- 0.0 t_0) (+ A C)))) t_3)
(if (<= t_4 4e+226)
(/
(sqrt (* (fma (* B B) (/ -0.5 C) (+ A A)) (* t_7 (* 2.0 F))))
(- 0.0 t_7))
(if (<= t_4 INFINITY)
(* -0.25 (* t_5 (* (sqrt (* C -2.0)) (sqrt (+ F F)))))
t_6))))))assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
double t_0 = pow(fma((A - C), (A - C), (B * B)), 0.25);
double t_1 = (4.0 * A) * C;
double t_2 = 2.0 * ((pow(B, 2.0) - t_1) * F);
double t_3 = t_1 - pow(B, 2.0);
double t_4 = sqrt((t_2 * ((A + C) - sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_3;
double t_5 = (sqrt(2.0) * sqrt(2.0)) / C;
double t_6 = -0.25 * (t_5 * (sqrt((F * -4.0)) * sqrt(C)));
double t_7 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = t_6;
} else if (t_4 <= -4e-201) {
tmp = sqrt((t_2 * fma(t_0, (0.0 - t_0), (A + C)))) / t_3;
} else if (t_4 <= 4e+226) {
tmp = sqrt((fma((B * B), (-0.5 / C), (A + A)) * (t_7 * (2.0 * F)))) / (0.0 - t_7);
} else if (t_4 <= ((double) INFINITY)) {
tmp = -0.25 * (t_5 * (sqrt((C * -2.0)) * sqrt((F + F))));
} else {
tmp = t_6;
}
return tmp;
}
A, B, C, F = sort([A, B, C, F]) function code(A, B, C, F) t_0 = fma(Float64(A - C), Float64(A - C), Float64(B * B)) ^ 0.25 t_1 = Float64(Float64(4.0 * A) * C) t_2 = Float64(2.0 * Float64(Float64((B ^ 2.0) - t_1) * F)) t_3 = Float64(t_1 - (B ^ 2.0)) t_4 = Float64(sqrt(Float64(t_2 * Float64(Float64(A + C) - sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / t_3) t_5 = Float64(Float64(sqrt(2.0) * sqrt(2.0)) / C) t_6 = Float64(-0.25 * Float64(t_5 * Float64(sqrt(Float64(F * -4.0)) * sqrt(C)))) t_7 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = t_6; elseif (t_4 <= -4e-201) tmp = Float64(sqrt(Float64(t_2 * fma(t_0, Float64(0.0 - t_0), Float64(A + C)))) / t_3); elseif (t_4 <= 4e+226) tmp = Float64(sqrt(Float64(fma(Float64(B * B), Float64(-0.5 / C), Float64(A + A)) * Float64(t_7 * Float64(2.0 * F)))) / Float64(0.0 - t_7)); elseif (t_4 <= Inf) tmp = Float64(-0.25 * Float64(t_5 * Float64(sqrt(Float64(C * -2.0)) * sqrt(Float64(F + F))))); else tmp = t_6; end return tmp end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Power[N[(N[(A - C), $MachinePrecision] * N[(A - C), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(N[(N[Power[B, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 - N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(t$95$2 * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]}, Block[{t$95$6 = N[(-0.25 * N[(t$95$5 * N[(N[Sqrt[N[(F * -4.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$6, If[LessEqual[t$95$4, -4e-201], N[(N[Sqrt[N[(t$95$2 * N[(t$95$0 * N[(0.0 - t$95$0), $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$4, 4e+226], N[(N[Sqrt[N[(N[(N[(B * B), $MachinePrecision] * N[(-0.5 / C), $MachinePrecision] + N[(A + A), $MachinePrecision]), $MachinePrecision] * N[(t$95$7 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - t$95$7), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(-0.25 * N[(t$95$5 * N[(N[Sqrt[N[(C * -2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(F + F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$6]]]]]]]]]]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(A - C, A - C, B \cdot B\right)\right)}^{0.25}\\
t_1 := \left(4 \cdot A\right) \cdot C\\
t_2 := 2 \cdot \left(\left({B}^{2} - t\_1\right) \cdot F\right)\\
t_3 := t\_1 - {B}^{2}\\
t_4 := \frac{\sqrt{t\_2 \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_3}\\
t_5 := \frac{\sqrt{2} \cdot \sqrt{2}}{C}\\
t_6 := -0.25 \cdot \left(t\_5 \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)\right)\\
t_7 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_4 \leq -4 \cdot 10^{-201}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \mathsf{fma}\left(t\_0, 0 - t\_0, A + C\right)}}{t\_3}\\
\mathbf{elif}\;t\_4 \leq 4 \cdot 10^{+226}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B \cdot B, \frac{-0.5}{C}, A + A\right) \cdot \left(t\_7 \cdot \left(2 \cdot F\right)\right)}}{0 - t\_7}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;-0.25 \cdot \left(t\_5 \cdot \left(\sqrt{C \cdot -2} \cdot \sqrt{F + F}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_6\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -inf.0 or +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 1.2%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr0.2%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6413.0
Simplified13.0%
distribute-rgt-outN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f6417.8
Applied egg-rr17.8%
if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -3.99999999999999978e-201Initial program 98.7%
sub-negN/A
+-commutativeN/A
pow1/2N/A
sqr-powN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr98.8%
if -3.99999999999999978e-201 < (/.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))) < 3.99999999999999985e226Initial program 27.4%
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
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6433.6
Simplified33.6%
distribute-frac-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
Applied egg-rr33.6%
if 3.99999999999999985e226 < (/.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 8.4%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr0.2%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6469.9
Simplified69.9%
distribute-rgt-inN/A
distribute-lft-outN/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6474.4
Applied egg-rr74.4%
Final simplification37.8%
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0))))
(t_1 (* (* 4.0 A) C))
(t_2
(/
(sqrt
(*
(* 2.0 (* (- (pow B 2.0) t_1) F))
(- (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0))))))
(- t_1 (pow B 2.0))))
(t_3 (/ (* (sqrt 2.0) (sqrt 2.0)) C))
(t_4 (* -0.25 (* t_3 (* (sqrt (* F -4.0)) (sqrt C)))))
(t_5 (fma B B (* -4.0 (* A C)))))
(if (<= t_2 (- INFINITY))
t_4
(if (<= t_2 -4e-201)
(/
(sqrt
(*
(* (* 2.0 F) t_5)
(- (+ A C) (sqrt (fma (- A C) (- A C) (* B B))))))
(- 0.0 t_5))
(if (<= t_2 4e+226)
(/
(sqrt (* (fma (* B B) (/ -0.5 C) (+ A A)) (* t_0 (* 2.0 F))))
(- 0.0 t_0))
(if (<= t_2 INFINITY)
(* -0.25 (* t_3 (* (sqrt (* C -2.0)) (sqrt (+ F F)))))
t_4))))))assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double t_1 = (4.0 * A) * C;
double t_2 = sqrt(((2.0 * ((pow(B, 2.0) - t_1) * F)) * ((A + C) - sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / (t_1 - pow(B, 2.0));
double t_3 = (sqrt(2.0) * sqrt(2.0)) / C;
double t_4 = -0.25 * (t_3 * (sqrt((F * -4.0)) * sqrt(C)));
double t_5 = fma(B, B, (-4.0 * (A * C)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_2 <= -4e-201) {
tmp = sqrt((((2.0 * F) * t_5) * ((A + C) - sqrt(fma((A - C), (A - C), (B * B)))))) / (0.0 - t_5);
} else if (t_2 <= 4e+226) {
tmp = sqrt((fma((B * B), (-0.5 / C), (A + A)) * (t_0 * (2.0 * F)))) / (0.0 - t_0);
} else if (t_2 <= ((double) INFINITY)) {
tmp = -0.25 * (t_3 * (sqrt((C * -2.0)) * sqrt((F + F))));
} else {
tmp = t_4;
}
return tmp;
}
A, B, C, F = sort([A, B, C, F]) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = Float64(Float64(4.0 * A) * C) t_2 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B ^ 2.0) - t_1) * F)) * Float64(Float64(A + C) - sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_1 - (B ^ 2.0))) t_3 = Float64(Float64(sqrt(2.0) * sqrt(2.0)) / C) t_4 = Float64(-0.25 * Float64(t_3 * Float64(sqrt(Float64(F * -4.0)) * sqrt(C)))) t_5 = fma(B, B, Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_4; elseif (t_2 <= -4e-201) tmp = Float64(sqrt(Float64(Float64(Float64(2.0 * F) * t_5) * Float64(Float64(A + C) - sqrt(fma(Float64(A - C), Float64(A - C), Float64(B * B)))))) / Float64(0.0 - t_5)); elseif (t_2 <= 4e+226) tmp = Float64(sqrt(Float64(fma(Float64(B * B), Float64(-0.5 / C), Float64(A + A)) * Float64(t_0 * Float64(2.0 * F)))) / Float64(0.0 - t_0)); elseif (t_2 <= Inf) tmp = Float64(-0.25 * Float64(t_3 * Float64(sqrt(Float64(C * -2.0)) * sqrt(Float64(F + F))))); else tmp = t_4; end return tmp end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$1 - N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]}, Block[{t$95$4 = N[(-0.25 * N[(t$95$3 * N[(N[Sqrt[N[(F * -4.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$4, If[LessEqual[t$95$2, -4e-201], N[(N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$5), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[(A - C), $MachinePrecision] * N[(A - C), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - t$95$5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+226], N[(N[Sqrt[N[(N[(N[(B * B), $MachinePrecision] * N[(-0.5 / C), $MachinePrecision] + N[(A + A), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(0.0 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(-0.25 * N[(t$95$3 * N[(N[Sqrt[N[(C * -2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(F + F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]]]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \left(4 \cdot A\right) \cdot C\\
t_2 := \frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - t\_1\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_1 - {B}^{2}}\\
t_3 := \frac{\sqrt{2} \cdot \sqrt{2}}{C}\\
t_4 := -0.25 \cdot \left(t\_3 \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)\right)\\
t_5 := \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_2 \leq -4 \cdot 10^{-201}:\\
\;\;\;\;\frac{\sqrt{\left(\left(2 \cdot F\right) \cdot t\_5\right) \cdot \left(\left(A + C\right) - \sqrt{\mathsf{fma}\left(A - C, A - C, B \cdot B\right)}\right)}}{0 - t\_5}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+226}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B \cdot B, \frac{-0.5}{C}, A + A\right) \cdot \left(t\_0 \cdot \left(2 \cdot F\right)\right)}}{0 - t\_0}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;-0.25 \cdot \left(t\_3 \cdot \left(\sqrt{C \cdot -2} \cdot \sqrt{F + F}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -inf.0 or +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 1.2%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr0.2%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6413.0
Simplified13.0%
distribute-rgt-outN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f6417.8
Applied egg-rr17.8%
if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -3.99999999999999978e-201Initial program 98.7%
distribute-frac-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
Applied egg-rr98.7%
if -3.99999999999999978e-201 < (/.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))) < 3.99999999999999985e226Initial program 27.4%
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
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6433.6
Simplified33.6%
distribute-frac-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
Applied egg-rr33.6%
if 3.99999999999999985e226 < (/.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 8.4%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr0.2%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6469.9
Simplified69.9%
distribute-rgt-inN/A
distribute-lft-outN/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6474.4
Applied egg-rr74.4%
Final simplification37.8%
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (* (sqrt 2.0) (sqrt 2.0)) C)))
(if (<= C -2.9e-230)
(* -0.25 (* t_0 (* (sqrt (* C -2.0)) (sqrt (+ F F)))))
(if (<= C 5.8e-281)
(* (sqrt (* F (- A (sqrt (fma A A (* B B)))))) (/ (sqrt 2.0) (- 0.0 B)))
(* -0.25 (* t_0 (* (sqrt (* F -4.0)) (sqrt C))))))))assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
double t_0 = (sqrt(2.0) * sqrt(2.0)) / C;
double tmp;
if (C <= -2.9e-230) {
tmp = -0.25 * (t_0 * (sqrt((C * -2.0)) * sqrt((F + F))));
} else if (C <= 5.8e-281) {
tmp = sqrt((F * (A - sqrt(fma(A, A, (B * B)))))) * (sqrt(2.0) / (0.0 - B));
} else {
tmp = -0.25 * (t_0 * (sqrt((F * -4.0)) * sqrt(C)));
}
return tmp;
}
A, B, C, F = sort([A, B, C, F]) function code(A, B, C, F) t_0 = Float64(Float64(sqrt(2.0) * sqrt(2.0)) / C) tmp = 0.0 if (C <= -2.9e-230) tmp = Float64(-0.25 * Float64(t_0 * Float64(sqrt(Float64(C * -2.0)) * sqrt(Float64(F + F))))); elseif (C <= 5.8e-281) tmp = Float64(sqrt(Float64(F * Float64(A - sqrt(fma(A, A, Float64(B * B)))))) * Float64(sqrt(2.0) / Float64(0.0 - B))); else tmp = Float64(-0.25 * Float64(t_0 * Float64(sqrt(Float64(F * -4.0)) * sqrt(C)))); end return tmp end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]}, If[LessEqual[C, -2.9e-230], N[(-0.25 * N[(t$95$0 * N[(N[Sqrt[N[(C * -2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(F + F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 5.8e-281], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[N[(A * A + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / N[(0.0 - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(t$95$0 * N[(N[Sqrt[N[(F * -4.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2} \cdot \sqrt{2}}{C}\\
\mathbf{if}\;C \leq -2.9 \cdot 10^{-230}:\\
\;\;\;\;-0.25 \cdot \left(t\_0 \cdot \left(\sqrt{C \cdot -2} \cdot \sqrt{F + F}\right)\right)\\
\mathbf{elif}\;C \leq 5.8 \cdot 10^{-281}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)}\right)} \cdot \frac{\sqrt{2}}{0 - B}\\
\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(t\_0 \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)\right)\\
\end{array}
\end{array}
if C < -2.90000000000000005e-230Initial program 24.2%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr7.1%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6413.6
Simplified13.6%
distribute-rgt-inN/A
distribute-lft-outN/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lowering-+.f6415.2
Applied egg-rr15.2%
if -2.90000000000000005e-230 < C < 5.7999999999999998e-281Initial program 28.8%
frac-2negN/A
remove-double-negN/A
pow1/2N/A
associate-*l*N/A
unpow-prod-downN/A
neg-mul-1N/A
times-fracN/A
Applied egg-rr28.6%
Taylor expanded in C 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-*.f6411.6
Simplified11.6%
if 5.7999999999999998e-281 < C Initial program 17.8%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr10.7%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6428.5
Simplified28.5%
distribute-rgt-outN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f6436.9
Applied egg-rr36.9%
Final simplification24.7%
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= C -3.05e-235)
(* -0.25 (* (/ 2.0 C) (sqrt (* F (* C -4.0)))))
(if (<= C 7e-281)
(* (sqrt (* F (- A (sqrt (fma A A (* B B)))))) (/ (sqrt 2.0) (- 0.0 B)))
(*
-0.25
(* (/ (* (sqrt 2.0) (sqrt 2.0)) C) (* (sqrt (* F -4.0)) (sqrt C)))))))assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
double tmp;
if (C <= -3.05e-235) {
tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
} else if (C <= 7e-281) {
tmp = sqrt((F * (A - sqrt(fma(A, A, (B * B)))))) * (sqrt(2.0) / (0.0 - B));
} else {
tmp = -0.25 * (((sqrt(2.0) * sqrt(2.0)) / C) * (sqrt((F * -4.0)) * sqrt(C)));
}
return tmp;
}
A, B, C, F = sort([A, B, C, F]) function code(A, B, C, F) tmp = 0.0 if (C <= -3.05e-235) tmp = Float64(-0.25 * Float64(Float64(2.0 / C) * sqrt(Float64(F * Float64(C * -4.0))))); elseif (C <= 7e-281) tmp = Float64(sqrt(Float64(F * Float64(A - sqrt(fma(A, A, Float64(B * B)))))) * Float64(sqrt(2.0) / Float64(0.0 - B))); else tmp = Float64(-0.25 * Float64(Float64(Float64(sqrt(2.0) * sqrt(2.0)) / C) * Float64(sqrt(Float64(F * -4.0)) * sqrt(C)))); end return tmp end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[C, -3.05e-235], N[(-0.25 * N[(N[(2.0 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 7e-281], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[N[(A * A + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / N[(0.0 - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision] * N[(N[Sqrt[N[(F * -4.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq -3.05 \cdot 10^{-235}:\\
\;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)\\
\mathbf{elif}\;C \leq 7 \cdot 10^{-281}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)}\right)} \cdot \frac{\sqrt{2}}{0 - B}\\
\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\frac{\sqrt{2} \cdot \sqrt{2}}{C} \cdot \left(\sqrt{F \cdot -4} \cdot \sqrt{C}\right)\right)\\
\end{array}
\end{array}
if C < -3.04999999999999994e-235Initial program 24.5%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr6.9%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6414.1
Simplified14.1%
rem-square-sqrt14.3
Applied egg-rr14.3%
distribute-rgt-outN/A
*-lowering-*.f64N/A
metadata-eval14.3
Applied egg-rr14.3%
if -3.04999999999999994e-235 < C < 7.00000000000000044e-281Initial program 28.0%
frac-2negN/A
remove-double-negN/A
pow1/2N/A
associate-*l*N/A
unpow-prod-downN/A
neg-mul-1N/A
times-fracN/A
Applied egg-rr27.8%
Taylor expanded in C 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-*.f6412.7
Simplified12.7%
if 7.00000000000000044e-281 < C Initial program 17.8%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr10.7%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6428.5
Simplified28.5%
distribute-rgt-outN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f6436.9
Applied egg-rr36.9%
Final simplification24.5%
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= F -3.9e-79)
(* (sqrt (/ (* F -0.5) C)) (- 0.0 (sqrt 2.0)))
(if (<= F -1.7e-144)
(/ (* (sqrt 2.0) (sqrt (* F (- A (sqrt (fma B B (* A A))))))) (- 0.0 B))
(* -0.25 (* (/ 2.0 C) (sqrt (* F (* C -4.0))))))))assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -3.9e-79) {
tmp = sqrt(((F * -0.5) / C)) * (0.0 - sqrt(2.0));
} else if (F <= -1.7e-144) {
tmp = (sqrt(2.0) * sqrt((F * (A - sqrt(fma(B, B, (A * A))))))) / (0.0 - B);
} else {
tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
}
return tmp;
}
A, B, C, F = sort([A, B, C, F]) function code(A, B, C, F) tmp = 0.0 if (F <= -3.9e-79) tmp = Float64(sqrt(Float64(Float64(F * -0.5) / C)) * Float64(0.0 - sqrt(2.0))); elseif (F <= -1.7e-144) tmp = Float64(Float64(sqrt(2.0) * sqrt(Float64(F * Float64(A - sqrt(fma(B, B, Float64(A * A))))))) / Float64(0.0 - B)); else tmp = Float64(-0.25 * Float64(Float64(2.0 / C) * sqrt(Float64(F * Float64(C * -4.0))))); end return tmp end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[F, -3.9e-79], N[(N[Sqrt[N[(N[(F * -0.5), $MachinePrecision] / C), $MachinePrecision]], $MachinePrecision] * N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.7e-144], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F * N[(A - N[Sqrt[N[(B * B + N[(A * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(0.0 - B), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(N[(2.0 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.9 \cdot 10^{-79}:\\
\;\;\;\;\sqrt{\frac{F \cdot -0.5}{C}} \cdot \left(0 - \sqrt{2}\right)\\
\mathbf{elif}\;F \leq -1.7 \cdot 10^{-144}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(B, B, A \cdot A\right)}\right)}}{0 - B}\\
\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)\\
\end{array}
\end{array}
if F < -3.90000000000000006e-79Initial program 13.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
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6418.6
Simplified18.6%
Taylor expanded in F around 0
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f64N/A
Simplified13.2%
Taylor expanded in B around 0
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6417.5
Simplified17.5%
if -3.90000000000000006e-79 < F < -1.70000000000000009e-144Initial program 41.9%
Taylor expanded in C around 0
mul-1-negN/A
associate-*l/N/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
Simplified15.8%
if -1.70000000000000009e-144 < F Initial program 26.8%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr10.2%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6430.8
Simplified30.8%
rem-square-sqrt31.2
Applied egg-rr31.2%
distribute-rgt-outN/A
*-lowering-*.f64N/A
metadata-eval31.2
Applied egg-rr31.2%
Final simplification22.8%
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= F -4.8e-79)
(* (sqrt (/ (* F -0.5) C)) (- 0.0 (sqrt 2.0)))
(if (<= F -1.7e-144)
(* (sqrt (* F (- A (sqrt (fma A A (* B B)))))) (/ (sqrt 2.0) (- 0.0 B)))
(* -0.25 (* (/ 2.0 C) (sqrt (* F (* C -4.0))))))))assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -4.8e-79) {
tmp = sqrt(((F * -0.5) / C)) * (0.0 - sqrt(2.0));
} else if (F <= -1.7e-144) {
tmp = sqrt((F * (A - sqrt(fma(A, A, (B * B)))))) * (sqrt(2.0) / (0.0 - B));
} else {
tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
}
return tmp;
}
A, B, C, F = sort([A, B, C, F]) function code(A, B, C, F) tmp = 0.0 if (F <= -4.8e-79) tmp = Float64(sqrt(Float64(Float64(F * -0.5) / C)) * Float64(0.0 - sqrt(2.0))); elseif (F <= -1.7e-144) tmp = Float64(sqrt(Float64(F * Float64(A - sqrt(fma(A, A, Float64(B * B)))))) * Float64(sqrt(2.0) / Float64(0.0 - B))); else tmp = Float64(-0.25 * Float64(Float64(2.0 / C) * sqrt(Float64(F * Float64(C * -4.0))))); end return tmp end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[F, -4.8e-79], N[(N[Sqrt[N[(N[(F * -0.5), $MachinePrecision] / C), $MachinePrecision]], $MachinePrecision] * N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.7e-144], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[N[(A * A + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / N[(0.0 - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(N[(2.0 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.8 \cdot 10^{-79}:\\
\;\;\;\;\sqrt{\frac{F \cdot -0.5}{C}} \cdot \left(0 - \sqrt{2}\right)\\
\mathbf{elif}\;F \leq -1.7 \cdot 10^{-144}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)}\right)} \cdot \frac{\sqrt{2}}{0 - B}\\
\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)\\
\end{array}
\end{array}
if F < -4.80000000000000011e-79Initial program 13.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
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6418.6
Simplified18.6%
Taylor expanded in F around 0
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f64N/A
Simplified13.2%
Taylor expanded in B around 0
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6417.5
Simplified17.5%
if -4.80000000000000011e-79 < F < -1.70000000000000009e-144Initial program 41.9%
frac-2negN/A
remove-double-negN/A
pow1/2N/A
associate-*l*N/A
unpow-prod-downN/A
neg-mul-1N/A
times-fracN/A
Applied egg-rr41.6%
Taylor expanded in C 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-*.f6415.7
Simplified15.7%
if -1.70000000000000009e-144 < F Initial program 26.8%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr10.2%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6430.8
Simplified30.8%
rem-square-sqrt31.2
Applied egg-rr31.2%
distribute-rgt-outN/A
*-lowering-*.f64N/A
metadata-eval31.2
Applied egg-rr31.2%
Final simplification22.8%
NOTE: A, B, C, and F should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= F -5.2e-122) (* (sqrt (/ (* F -0.5) C)) (- 0.0 (sqrt 2.0))) (* -0.25 (* (/ 2.0 C) (sqrt (* F (* C -4.0)))))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -5.2e-122) {
tmp = sqrt(((F * -0.5) / C)) * (0.0 - sqrt(2.0));
} else {
tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
}
return tmp;
}
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
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) :: tmp
if (f <= (-5.2d-122)) then
tmp = sqrt(((f * (-0.5d0)) / c)) * (0.0d0 - sqrt(2.0d0))
else
tmp = (-0.25d0) * ((2.0d0 / c) * sqrt((f * (c * (-4.0d0)))))
end if
code = tmp
end function
assert A < B && B < C && C < F;
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= -5.2e-122) {
tmp = Math.sqrt(((F * -0.5) / C)) * (0.0 - Math.sqrt(2.0));
} else {
tmp = -0.25 * ((2.0 / C) * Math.sqrt((F * (C * -4.0))));
}
return tmp;
}
[A, B, C, F] = sort([A, B, C, F]) def code(A, B, C, F): tmp = 0 if F <= -5.2e-122: tmp = math.sqrt(((F * -0.5) / C)) * (0.0 - math.sqrt(2.0)) else: tmp = -0.25 * ((2.0 / C) * math.sqrt((F * (C * -4.0)))) return tmp
A, B, C, F = sort([A, B, C, F]) function code(A, B, C, F) tmp = 0.0 if (F <= -5.2e-122) tmp = Float64(sqrt(Float64(Float64(F * -0.5) / C)) * Float64(0.0 - sqrt(2.0))); else tmp = Float64(-0.25 * Float64(Float64(2.0 / C) * sqrt(Float64(F * Float64(C * -4.0))))); end return tmp end
A, B, C, F = num2cell(sort([A, B, C, F])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (F <= -5.2e-122)
tmp = sqrt(((F * -0.5) / C)) * (0.0 - sqrt(2.0));
else
tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
end
tmp_2 = tmp;
end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[F, -5.2e-122], N[(N[Sqrt[N[(N[(F * -0.5), $MachinePrecision] / C), $MachinePrecision]], $MachinePrecision] * N[(0.0 - N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(N[(2.0 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.2 \cdot 10^{-122}:\\
\;\;\;\;\sqrt{\frac{F \cdot -0.5}{C}} \cdot \left(0 - \sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)\\
\end{array}
\end{array}
if F < -5.1999999999999995e-122Initial program 16.4%
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
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6417.6
Simplified17.6%
Taylor expanded in F around 0
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f64N/A
Simplified12.8%
Taylor expanded in B around 0
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6416.7
Simplified16.7%
if -5.1999999999999995e-122 < F Initial program 28.5%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr11.8%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6428.7
Simplified28.7%
rem-square-sqrt29.1
Applied egg-rr29.1%
distribute-rgt-outN/A
*-lowering-*.f64N/A
metadata-eval29.1
Applied egg-rr29.1%
Final simplification22.2%
NOTE: A, B, C, and F should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* -0.25 (* (/ 2.0 C) (sqrt (* F (* C -4.0))))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
return -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
}
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
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
code = (-0.25d0) * ((2.0d0 / c) * sqrt((f * (c * (-4.0d0)))))
end function
assert A < B && B < C && C < F;
public static double code(double A, double B, double C, double F) {
return -0.25 * ((2.0 / C) * Math.sqrt((F * (C * -4.0))));
}
[A, B, C, F] = sort([A, B, C, F]) def code(A, B, C, F): return -0.25 * ((2.0 / C) * math.sqrt((F * (C * -4.0))))
A, B, C, F = sort([A, B, C, F]) function code(A, B, C, F) return Float64(-0.25 * Float64(Float64(2.0 / C) * sqrt(Float64(F * Float64(C * -4.0))))) end
A, B, C, F = num2cell(sort([A, B, C, F])){:}
function tmp = code(A, B, C, F)
tmp = -0.25 * ((2.0 / C) * sqrt((F * (C * -4.0))));
end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(-0.25 * N[(N[(2.0 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
-0.25 \cdot \left(\frac{2}{C} \cdot \sqrt{F \cdot \left(C \cdot -4\right)}\right)
\end{array}
Initial program 21.8%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr9.9%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6420.7
Simplified20.7%
rem-square-sqrt21.0
Applied egg-rr21.0%
distribute-rgt-outN/A
*-lowering-*.f64N/A
metadata-eval21.0
Applied egg-rr21.0%
NOTE: A, B, C, and F should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* (/ -0.5 C) (sqrt (* F (+ A A)))))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
return (-0.5 / C) * sqrt((F * (A + A)));
}
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
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
code = ((-0.5d0) / c) * sqrt((f * (a + a)))
end function
assert A < B && B < C && C < F;
public static double code(double A, double B, double C, double F) {
return (-0.5 / C) * Math.sqrt((F * (A + A)));
}
[A, B, C, F] = sort([A, B, C, F]) def code(A, B, C, F): return (-0.5 / C) * math.sqrt((F * (A + A)))
A, B, C, F = sort([A, B, C, F]) function code(A, B, C, F) return Float64(Float64(-0.5 / C) * sqrt(Float64(F * Float64(A + A)))) end
A, B, C, F = num2cell(sort([A, B, C, F])){:}
function tmp = code(A, B, C, F)
tmp = (-0.5 / C) * sqrt((F * (A + A)));
end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[(-0.5 / C), $MachinePrecision] * N[Sqrt[N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\frac{-0.5}{C} \cdot \sqrt{F \cdot \left(A + A\right)}
\end{array}
Initial program 21.8%
*-commutativeN/A
flip--N/A
associate-*l/N/A
sqrt-divN/A
/-lowering-/.f64N/A
Applied egg-rr9.9%
Taylor expanded in A around -inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6420.7
Simplified20.7%
associate-*l*N/A
rem-square-sqrtN/A
associate-*r/N/A
metadata-evalN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f641.8
Applied egg-rr1.8%
NOTE: A, B, C, and F should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (sqrt (/ (* 2.0 F) B)))
assert(A < B && B < C && C < F);
double code(double A, double B, double C, double F) {
return sqrt(((2.0 * F) / B));
}
NOTE: A, B, C, and F should be sorted in increasing order before calling this function.
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
code = sqrt(((2.0d0 * f) / b))
end function
assert A < B && B < C && C < F;
public static double code(double A, double B, double C, double F) {
return Math.sqrt(((2.0 * F) / B));
}
[A, B, C, F] = sort([A, B, C, F]) def code(A, B, C, F): return math.sqrt(((2.0 * F) / B))
A, B, C, F = sort([A, B, C, F]) function code(A, B, C, F) return sqrt(Float64(Float64(2.0 * F) / B)) end
A, B, C, F = num2cell(sort([A, B, C, F])){:}
function tmp = code(A, B, C, F)
tmp = sqrt(((2.0 * F) / B));
end
NOTE: A, B, C, and F should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
[A, B, C, F] = \mathsf{sort}([A, B, C, F])\\
\\
\sqrt{\frac{2 \cdot F}{B}}
\end{array}
Initial program 21.8%
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
unpow2N/A
rem-square-sqrtN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f641.9
Simplified1.9%
mul-1-negN/A
remove-double-negN/A
sqrt-lowering-sqrt.f641.9
Applied egg-rr1.9%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f641.9
Applied egg-rr1.9%
herbie shell --seed 2024196
(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))))