
(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 19 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: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (+ A C) (hypot (- A C) B)))
(t_1 (fma B B (* A (* C -4.0))))
(t_2 (* F t_1))
(t_3 (- (pow B 2.0) (* (* 4.0 A) C)))
(t_4
(/
(-
(sqrt
(*
(* 2.0 (* t_3 F))
(+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
t_3)))
(if (<= t_4 -5e-179)
(/ (* (sqrt t_0) (* (pow (* 2.0 t_1) 0.5) (- (sqrt F)))) t_1)
(if (<= t_4 5e-90)
(/
(- (sqrt (* t_2 (* 2.0 (+ A (+ A (* -0.5 (/ (pow B 2.0) C))))))))
t_1)
(if (<= t_4 INFINITY)
(/ (* (sqrt t_2) (- (sqrt (* 2.0 t_0)))) t_1)
(*
(/ (sqrt 2.0) B)
(* (pow F 0.25) (* (sqrt (+ A (hypot B A))) (- (pow F 0.25))))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (A + C) + hypot((A - C), B);
double t_1 = fma(B, B, (A * (C * -4.0)));
double t_2 = F * t_1;
double t_3 = pow(B, 2.0) - ((4.0 * A) * C);
double t_4 = -sqrt(((2.0 * (t_3 * F)) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_3;
double tmp;
if (t_4 <= -5e-179) {
tmp = (sqrt(t_0) * (pow((2.0 * t_1), 0.5) * -sqrt(F))) / t_1;
} else if (t_4 <= 5e-90) {
tmp = -sqrt((t_2 * (2.0 * (A + (A + (-0.5 * (pow(B, 2.0) / C))))))) / t_1;
} else if (t_4 <= ((double) INFINITY)) {
tmp = (sqrt(t_2) * -sqrt((2.0 * t_0))) / t_1;
} else {
tmp = (sqrt(2.0) / B) * (pow(F, 0.25) * (sqrt((A + hypot(B, A))) * -pow(F, 0.25)));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(A + C) + hypot(Float64(A - C), B)) t_1 = fma(B, B, Float64(A * Float64(C * -4.0))) t_2 = Float64(F * t_1) t_3 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_4 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_3 * F)) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_3) tmp = 0.0 if (t_4 <= -5e-179) tmp = Float64(Float64(sqrt(t_0) * Float64((Float64(2.0 * t_1) ^ 0.5) * Float64(-sqrt(F)))) / t_1); elseif (t_4 <= 5e-90) tmp = Float64(Float64(-sqrt(Float64(t_2 * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B ^ 2.0) / C)))))))) / t_1); elseif (t_4 <= Inf) tmp = Float64(Float64(sqrt(t_2) * Float64(-sqrt(Float64(2.0 * t_0)))) / t_1); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64((F ^ 0.25) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-(F ^ 0.25))))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(F * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $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, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision]}, If[LessEqual[t$95$4, -5e-179], N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * N[(N[Power[N[(2.0 * t$95$1), $MachinePrecision], 0.5], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$4, 5e-90], N[((-N[Sqrt[N[(t$95$2 * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[Power[B, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(N[(N[Sqrt[t$95$2], $MachinePrecision] * (-N[Sqrt[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Power[F, 0.25], $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Power[F, 0.25], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\\
t_1 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := F \cdot t_1\\
t_3 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_4 := \frac{-\sqrt{\left(2 \cdot \left(t_3 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_3}\\
\mathbf{if}\;t_4 \leq -5 \cdot 10^{-179}:\\
\;\;\;\;\frac{\sqrt{t_0} \cdot \left({\left(2 \cdot t_1\right)}^{0.5} \cdot \left(-\sqrt{F}\right)\right)}{t_1}\\
\mathbf{elif}\;t_4 \leq 5 \cdot 10^{-90}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B}^{2}}{C}\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;\frac{\sqrt{t_2} \cdot \left(-\sqrt{2 \cdot t_0}\right)}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left({F}^{0.25} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-{F}^{0.25}\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -4.9999999999999998e-179Initial program 33.1%
Simplified43.0%
pow1/243.0%
associate-*r*43.0%
unpow-prod-down59.6%
*-commutative59.6%
pow1/259.6%
associate-+r+58.6%
hypot-udef40.7%
unpow240.7%
unpow240.7%
+-commutative40.7%
+-commutative40.7%
Applied egg-rr58.6%
associate-*l*58.6%
unpow-prod-down67.5%
pow1/267.5%
Applied egg-rr67.5%
if -4.9999999999999998e-179 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < 5.00000000000000019e-90Initial program 8.7%
Simplified11.6%
Taylor expanded in C around -inf 38.6%
if 5.00000000000000019e-90 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0Initial program 31.0%
Simplified47.7%
sqrt-prod61.6%
*-commutative61.6%
associate-+r+61.6%
hypot-udef33.8%
unpow233.8%
unpow233.8%
+-commutative33.8%
+-commutative33.8%
unpow233.8%
unpow233.8%
hypot-def61.6%
Applied egg-rr61.6%
+-commutative61.6%
Simplified61.6%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 0.0%
Taylor expanded in C around 0 2.0%
mul-1-neg2.0%
distribute-rgt-neg-in2.0%
+-commutative2.0%
unpow22.0%
unpow22.0%
hypot-def21.6%
Simplified21.6%
pow1/221.6%
pow-to-exp20.3%
Applied egg-rr20.3%
exp-to-pow21.6%
pow1/221.6%
sqrt-prod29.3%
add-sqr-sqrt29.3%
associate-*l*29.3%
pow1/229.3%
sqrt-pow129.3%
metadata-eval29.3%
pow1/229.3%
sqrt-pow129.3%
metadata-eval29.3%
Applied egg-rr29.3%
Final simplification45.8%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))) (t_1 (* F t_0)))
(if (<= (pow B 2.0) 0.0)
(/ (- (sqrt (* t_1 (* 2.0 (+ A A))))) t_0)
(if (<= (pow B 2.0) 2e-78)
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ (+ A C) (hypot (- A C) B))))))) t_0)
(if (<= (pow B 2.0) 5000000.0)
(/ (* (pow (* 2.0 t_1) 0.5) (- (sqrt (* 2.0 C)))) t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (sqrt F)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double t_1 = F * t_0;
double tmp;
if (pow(B, 2.0) <= 0.0) {
tmp = -sqrt((t_1 * (2.0 * (A + A)))) / t_0;
} else if (pow(B, 2.0) <= 2e-78) {
tmp = -sqrt((2.0 * (t_0 * (F * ((A + C) + hypot((A - C), B)))))) / t_0;
} else if (pow(B, 2.0) <= 5000000.0) {
tmp = (pow((2.0 * t_1), 0.5) * -sqrt((2.0 * C))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = Float64(F * t_0) tmp = 0.0 if ((B ^ 2.0) <= 0.0) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * Float64(A + A))))) / t_0); elseif ((B ^ 2.0) <= 2e-78) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(Float64(A + C) + hypot(Float64(A - C), B))))))) / t_0); elseif ((B ^ 2.0) <= 5000000.0) tmp = Float64(Float64((Float64(2.0 * t_1) ^ 0.5) * Float64(-sqrt(Float64(2.0 * C)))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-sqrt(F)))); end return tmp end
NOTE: B should be positive 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[(F * t$95$0), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 0.0], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-78], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5000000.0], N[(N[(N[Power[N[(2.0 * t$95$1), $MachinePrecision], 0.5], $MachinePrecision] * (-N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := F \cdot t_0\\
\mathbf{if}\;{B}^{2} \leq 0:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{-78}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 5000000:\\
\;\;\;\;\frac{{\left(2 \cdot t_1\right)}^{0.5} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 0.0Initial program 9.4%
Simplified22.9%
Taylor expanded in A around inf 25.3%
distribute-rgt1-in25.3%
metadata-eval25.3%
mul0-lft25.3%
Simplified25.3%
if 0.0 < (pow.f64 B 2) < 2e-78Initial program 26.3%
expm1-log1p-u12.9%
expm1-udef9.0%
Applied egg-rr9.8%
Simplified30.9%
if 2e-78 < (pow.f64 B 2) < 5e6Initial program 17.2%
Simplified22.2%
pow1/222.2%
associate-*r*22.2%
unpow-prod-down25.1%
*-commutative25.1%
pow1/225.1%
associate-+r+24.9%
hypot-udef24.6%
unpow224.6%
unpow224.6%
+-commutative24.6%
+-commutative24.6%
Applied egg-rr24.9%
Taylor expanded in A around -inf 39.0%
if 5e6 < (pow.f64 B 2) Initial program 12.3%
Taylor expanded in C around 0 11.3%
mul-1-neg11.3%
distribute-rgt-neg-in11.3%
+-commutative11.3%
unpow211.3%
unpow211.3%
hypot-def28.4%
Simplified28.4%
pow1/228.4%
*-commutative28.4%
unpow-prod-down37.2%
pow1/237.2%
pow1/237.2%
Applied egg-rr37.2%
Final simplification33.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 2e-96)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A (+ C (hypot B (- A C)))))))) t_0)
(if (<= (pow B 2.0) 4e+197)
(/
(*
(sqrt (+ (+ A C) (hypot (- A C) B)))
(* (sqrt F) (* B (- (sqrt 2.0)))))
t_0)
(*
(/ (sqrt 2.0) B)
(* (pow F 0.25) (* (sqrt (+ A (hypot B A))) (- (pow F 0.25)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 2e-96) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + (C + hypot(B, (A - C))))))) / t_0;
} else if (pow(B, 2.0) <= 4e+197) {
tmp = (sqrt(((A + C) + hypot((A - C), B))) * (sqrt(F) * (B * -sqrt(2.0)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (pow(F, 0.25) * (sqrt((A + hypot(B, A))) * -pow(F, 0.25)));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 2e-96) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + Float64(C + hypot(B, Float64(A - C)))))))) / t_0); elseif ((B ^ 2.0) <= 4e+197) tmp = Float64(Float64(sqrt(Float64(Float64(A + C) + hypot(Float64(A - C), B))) * Float64(sqrt(F) * Float64(B * Float64(-sqrt(2.0))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64((F ^ 0.25) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-(F ^ 0.25))))); end return tmp end
NOTE: B should be positive 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]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-96], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 4e+197], N[(N[(N[Sqrt[N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[(B * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Power[F, 0.25], $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Power[F, 0.25], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{-96}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 4 \cdot 10^{+197}:\\
\;\;\;\;\frac{\sqrt{\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)} \cdot \left(\sqrt{F} \cdot \left(B \cdot \left(-\sqrt{2}\right)\right)\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left({F}^{0.25} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-{F}^{0.25}\right)\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.9999999999999998e-96Initial program 16.3%
Simplified27.5%
if 1.9999999999999998e-96 < (pow.f64 B 2) < 3.9999999999999998e197Initial program 25.7%
Simplified29.2%
pow1/229.2%
associate-*r*29.2%
unpow-prod-down46.9%
*-commutative46.9%
pow1/246.9%
associate-+r+46.7%
hypot-udef33.6%
unpow233.6%
unpow233.6%
+-commutative33.6%
+-commutative33.6%
Applied egg-rr46.7%
Taylor expanded in B around inf 32.5%
if 3.9999999999999998e197 < (pow.f64 B 2) Initial program 4.9%
Taylor expanded in C around 0 4.2%
mul-1-neg4.2%
distribute-rgt-neg-in4.2%
+-commutative4.2%
unpow24.2%
unpow24.2%
hypot-def28.5%
Simplified28.5%
pow1/228.5%
pow-to-exp26.7%
Applied egg-rr26.7%
exp-to-pow28.5%
pow1/228.5%
sqrt-prod40.6%
add-sqr-sqrt40.6%
associate-*l*40.6%
pow1/240.6%
sqrt-pow140.6%
metadata-eval40.6%
pow1/240.6%
sqrt-pow140.6%
metadata-eval40.6%
Applied egg-rr40.6%
Final simplification33.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 1e+183)
(/
(- (* (sqrt (+ (+ A C) (hypot (- A C) B))) (pow (* 2.0 (* F t_0)) 0.5)))
t_0)
(*
(/ (sqrt 2.0) B)
(* (pow F 0.25) (* (sqrt (+ A (hypot B A))) (- (pow F 0.25))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 1e+183) {
tmp = -(sqrt(((A + C) + hypot((A - C), B))) * pow((2.0 * (F * t_0)), 0.5)) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (pow(F, 0.25) * (sqrt((A + hypot(B, A))) * -pow(F, 0.25)));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 1e+183) tmp = Float64(Float64(-Float64(sqrt(Float64(Float64(A + C) + hypot(Float64(A - C), B))) * (Float64(2.0 * Float64(F * t_0)) ^ 0.5))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64((F ^ 0.25) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-(F ^ 0.25))))); end return tmp end
NOTE: B should be positive 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]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+183], N[((-N[(N[Sqrt[N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Power[F, 0.25], $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Power[F, 0.25], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 10^{+183}:\\
\;\;\;\;\frac{-\sqrt{\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)} \cdot {\left(2 \cdot \left(F \cdot t_0\right)\right)}^{0.5}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left({F}^{0.25} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-{F}^{0.25}\right)\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.99999999999999947e182Initial program 19.8%
Simplified28.4%
pow1/228.4%
associate-*r*28.4%
unpow-prod-down39.9%
*-commutative39.9%
pow1/239.9%
associate-+r+38.8%
hypot-udef26.0%
unpow226.0%
unpow226.0%
+-commutative26.0%
+-commutative26.0%
Applied egg-rr38.8%
if 9.99999999999999947e182 < (pow.f64 B 2) Initial program 4.9%
Taylor expanded in C around 0 5.2%
mul-1-neg5.2%
distribute-rgt-neg-in5.2%
+-commutative5.2%
unpow25.2%
unpow25.2%
hypot-def29.0%
Simplified29.0%
pow1/229.0%
pow-to-exp27.1%
Applied egg-rr27.1%
exp-to-pow29.0%
pow1/229.0%
sqrt-prod40.8%
add-sqr-sqrt40.8%
associate-*l*40.8%
pow1/240.8%
sqrt-pow140.8%
metadata-eval40.8%
pow1/240.8%
sqrt-pow140.8%
metadata-eval40.8%
Applied egg-rr40.8%
Final simplification39.5%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 1e+183)
(/
(* (sqrt (* F t_0)) (- (sqrt (* 2.0 (+ (+ A C) (hypot (- A C) B))))))
t_0)
(*
(/ (sqrt 2.0) B)
(* (pow F 0.25) (* (sqrt (+ A (hypot B A))) (- (pow F 0.25))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 1e+183) {
tmp = (sqrt((F * t_0)) * -sqrt((2.0 * ((A + C) + hypot((A - C), B))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (pow(F, 0.25) * (sqrt((A + hypot(B, A))) * -pow(F, 0.25)));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 1e+183) tmp = Float64(Float64(sqrt(Float64(F * t_0)) * Float64(-sqrt(Float64(2.0 * Float64(Float64(A + C) + hypot(Float64(A - C), B)))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64((F ^ 0.25) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-(F ^ 0.25))))); end return tmp end
NOTE: B should be positive 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]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+183], N[(N[(N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Power[F, 0.25], $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Power[F, 0.25], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 10^{+183}:\\
\;\;\;\;\frac{\sqrt{F \cdot t_0} \cdot \left(-\sqrt{2 \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left({F}^{0.25} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-{F}^{0.25}\right)\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.99999999999999947e182Initial program 19.8%
Simplified28.4%
sqrt-prod39.2%
*-commutative39.2%
associate-+r+38.1%
hypot-udef25.9%
unpow225.9%
unpow225.9%
+-commutative25.9%
+-commutative25.9%
unpow225.9%
unpow225.9%
hypot-def38.1%
Applied egg-rr38.1%
+-commutative38.1%
Simplified38.1%
if 9.99999999999999947e182 < (pow.f64 B 2) Initial program 4.9%
Taylor expanded in C around 0 5.2%
mul-1-neg5.2%
distribute-rgt-neg-in5.2%
+-commutative5.2%
unpow25.2%
unpow25.2%
hypot-def29.0%
Simplified29.0%
pow1/229.0%
pow-to-exp27.1%
Applied egg-rr27.1%
exp-to-pow29.0%
pow1/229.0%
sqrt-prod40.8%
add-sqr-sqrt40.8%
associate-*l*40.8%
pow1/240.8%
sqrt-pow140.8%
metadata-eval40.8%
pow1/240.8%
sqrt-pow140.8%
metadata-eval40.8%
Applied egg-rr40.8%
Final simplification39.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 2e+33)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A (+ C (hypot B (- A C)))))))) t_0)
(*
(/ (sqrt 2.0) B)
(* (pow F 0.25) (* (sqrt (+ A (hypot B A))) (- (pow F 0.25))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 2e+33) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + (C + hypot(B, (A - C))))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (pow(F, 0.25) * (sqrt((A + hypot(B, A))) * -pow(F, 0.25)));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 2e+33) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + Float64(C + hypot(B, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64((F ^ 0.25) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-(F ^ 0.25))))); end return tmp end
NOTE: B should be positive 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]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e+33], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Power[F, 0.25], $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Power[F, 0.25], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{+33}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left({F}^{0.25} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-{F}^{0.25}\right)\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.9999999999999999e33Initial program 17.7%
Simplified27.7%
if 1.9999999999999999e33 < (pow.f64 B 2) Initial program 11.2%
Taylor expanded in C around 0 10.8%
mul-1-neg10.8%
distribute-rgt-neg-in10.8%
+-commutative10.8%
unpow210.8%
unpow210.8%
hypot-def28.7%
Simplified28.7%
pow1/228.7%
pow-to-exp26.9%
Applied egg-rr26.9%
exp-to-pow28.7%
pow1/228.7%
sqrt-prod37.8%
add-sqr-sqrt37.8%
associate-*l*37.8%
pow1/237.8%
sqrt-pow137.8%
metadata-eval37.8%
pow1/237.8%
sqrt-pow137.8%
metadata-eval37.8%
Applied egg-rr37.8%
Final simplification32.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 2e+33)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A (+ C (hypot B (- A C)))))))) t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (sqrt F)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 2e+33) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + (C + hypot(B, (A - C))))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 2e+33) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + Float64(C + hypot(B, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-sqrt(F)))); end return tmp end
NOTE: B should be positive 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]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e+33], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{+33}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.9999999999999999e33Initial program 17.7%
Simplified27.7%
if 1.9999999999999999e33 < (pow.f64 B 2) Initial program 11.2%
Taylor expanded in C around 0 10.8%
mul-1-neg10.8%
distribute-rgt-neg-in10.8%
+-commutative10.8%
unpow210.8%
unpow210.8%
hypot-def28.7%
Simplified28.7%
pow1/228.7%
*-commutative28.7%
unpow-prod-down37.8%
pow1/237.8%
pow1/237.8%
Applied egg-rr37.8%
Final simplification32.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B)))
(if (<= (pow B 2.0) 5e-30)
(/
(- (sqrt (* (* 2.0 C) (* 2.0 (* -4.0 (* A (* C F)))))))
(- (pow B 2.0) (* (* 4.0 A) C)))
(if (<= (pow B 2.0) 5e+216)
(* t_0 (- (sqrt (* F (+ C (hypot B C))))))
(* t_0 (- (* (sqrt F) (sqrt B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(2.0) / B;
double tmp;
if (pow(B, 2.0) <= 5e-30) {
tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (pow(B, 2.0) - ((4.0 * A) * C));
} else if (pow(B, 2.0) <= 5e+216) {
tmp = t_0 * -sqrt((F * (C + hypot(B, C))));
} else {
tmp = t_0 * -(sqrt(F) * sqrt(B));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt(2.0) / B;
double tmp;
if (Math.pow(B, 2.0) <= 5e-30) {
tmp = -Math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (Math.pow(B, 2.0) - ((4.0 * A) * C));
} else if (Math.pow(B, 2.0) <= 5e+216) {
tmp = t_0 * -Math.sqrt((F * (C + Math.hypot(B, C))));
} else {
tmp = t_0 * -(Math.sqrt(F) * Math.sqrt(B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = math.sqrt(2.0) / B tmp = 0 if math.pow(B, 2.0) <= 5e-30: tmp = -math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (math.pow(B, 2.0) - ((4.0 * A) * C)) elif math.pow(B, 2.0) <= 5e+216: tmp = t_0 * -math.sqrt((F * (C + math.hypot(B, C)))) else: tmp = t_0 * -(math.sqrt(F) * math.sqrt(B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(sqrt(2.0) / B) tmp = 0.0 if ((B ^ 2.0) <= 5e-30) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * C) * Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F))))))) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))); elseif ((B ^ 2.0) <= 5e+216) tmp = Float64(t_0 * Float64(-sqrt(Float64(F * Float64(C + hypot(B, C)))))); else tmp = Float64(t_0 * Float64(-Float64(sqrt(F) * sqrt(B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = sqrt(2.0) / B; tmp = 0.0; if ((B ^ 2.0) <= 5e-30) tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / ((B ^ 2.0) - ((4.0 * A) * C)); elseif ((B ^ 2.0) <= 5e+216) tmp = t_0 * -sqrt((F * (C + hypot(B, C)))); else tmp = t_0 * -(sqrt(F) * sqrt(B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-30], N[((-N[Sqrt[N[(N[(2.0 * C), $MachinePrecision] * N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e+216], N[(t$95$0 * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(t$95$0 * (-N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[B], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B}\\
\mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-30}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot C\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{elif}\;{B}^{2} \leq 5 \cdot 10^{+216}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{F} \cdot \sqrt{B}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999972e-30Initial program 15.9%
Taylor expanded in A around -inf 19.0%
Taylor expanded in B around 0 18.5%
*-commutative18.5%
Simplified18.5%
if 4.99999999999999972e-30 < (pow.f64 B 2) < 4.9999999999999998e216Initial program 30.2%
Taylor expanded in A around 0 26.9%
mul-1-neg26.9%
distribute-rgt-neg-in26.9%
unpow226.9%
unpow226.9%
hypot-def29.2%
Simplified29.2%
if 4.9999999999999998e216 < (pow.f64 B 2) Initial program 2.7%
Taylor expanded in C around 0 3.1%
mul-1-neg3.1%
distribute-rgt-neg-in3.1%
+-commutative3.1%
unpow23.1%
unpow23.1%
hypot-def28.7%
Simplified28.7%
pow1/228.7%
*-commutative28.7%
unpow-prod-down41.3%
pow1/241.3%
pow1/241.3%
Applied egg-rr41.3%
Taylor expanded in A around 0 39.0%
Final simplification27.5%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))) (t_1 (/ (sqrt 2.0) B)))
(if (<= (pow B 2.0) 5e-36)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A A))))) t_0)
(if (<= (pow B 2.0) 5e+216)
(* t_1 (- (sqrt (* F (+ C (hypot B C))))))
(* t_1 (- (* (sqrt F) (sqrt B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double t_1 = sqrt(2.0) / B;
double tmp;
if (pow(B, 2.0) <= 5e-36) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + A)))) / t_0;
} else if (pow(B, 2.0) <= 5e+216) {
tmp = t_1 * -sqrt((F * (C + hypot(B, C))));
} else {
tmp = t_1 * -(sqrt(F) * sqrt(B));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = Float64(sqrt(2.0) / B) tmp = 0.0 if ((B ^ 2.0) <= 5e-36) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + A))))) / t_0); elseif ((B ^ 2.0) <= 5e+216) tmp = Float64(t_1 * Float64(-sqrt(Float64(F * Float64(C + hypot(B, C)))))); else tmp = Float64(t_1 * Float64(-Float64(sqrt(F) * sqrt(B)))); end return tmp end
NOTE: B should be positive 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[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-36], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e+216], N[(t$95$1 * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(t$95$1 * (-N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[B], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \frac{\sqrt{2}}{B}\\
\mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 5 \cdot 10^{+216}:\\
\;\;\;\;t_1 \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(-\sqrt{F} \cdot \sqrt{B}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.00000000000000004e-36Initial program 16.0%
Simplified26.9%
Taylor expanded in A around inf 25.0%
distribute-rgt1-in25.0%
metadata-eval25.0%
mul0-lft25.0%
Simplified25.0%
if 5.00000000000000004e-36 < (pow.f64 B 2) < 4.9999999999999998e216Initial program 29.6%
Taylor expanded in A around 0 26.4%
mul-1-neg26.4%
distribute-rgt-neg-in26.4%
unpow226.4%
unpow226.4%
hypot-def28.7%
Simplified28.7%
if 4.9999999999999998e216 < (pow.f64 B 2) Initial program 2.7%
Taylor expanded in C around 0 3.1%
mul-1-neg3.1%
distribute-rgt-neg-in3.1%
+-commutative3.1%
unpow23.1%
unpow23.1%
hypot-def28.7%
Simplified28.7%
pow1/228.7%
*-commutative28.7%
unpow-prod-down41.3%
pow1/241.3%
pow1/241.3%
Applied egg-rr41.3%
Taylor expanded in A around 0 39.0%
Final simplification30.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 5e-36)
(/ (- (sqrt (* (* F t_0) (* 2.0 (+ A A))))) t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ A (hypot B A))) (- (sqrt F)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 5e-36) {
tmp = -sqrt(((F * t_0) * (2.0 * (A + A)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((A + hypot(B, A))) * -sqrt(F));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 5e-36) tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(A + A))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(A + hypot(B, A))) * Float64(-sqrt(F)))); end return tmp end
NOTE: B should be positive 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]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-36], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5.00000000000000004e-36Initial program 16.0%
Simplified26.9%
Taylor expanded in A around inf 25.0%
distribute-rgt1-in25.0%
metadata-eval25.0%
mul0-lft25.0%
Simplified25.0%
if 5.00000000000000004e-36 < (pow.f64 B 2) Initial program 13.3%
Taylor expanded in C around 0 11.6%
mul-1-neg11.6%
distribute-rgt-neg-in11.6%
+-commutative11.6%
unpow211.6%
unpow211.6%
hypot-def27.9%
Simplified27.9%
pow1/227.9%
*-commutative27.9%
unpow-prod-down36.3%
pow1/236.3%
pow1/236.3%
Applied egg-rr36.3%
Final simplification31.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* 4.0 (* A C)))))
(if (<= (pow B 2.0) 5000000.0)
(- (/ (sqrt (* 2.0 (* (* 2.0 C) (* F t_0)))) t_0))
(* (/ (sqrt 2.0) B) (- (* (sqrt F) (sqrt B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - (4.0 * (A * C));
double tmp;
if (pow(B, 2.0) <= 5000000.0) {
tmp = -(sqrt((2.0 * ((2.0 * C) * (F * t_0)))) / t_0);
} else {
tmp = (sqrt(2.0) / B) * -(sqrt(F) * sqrt(B));
}
return tmp;
}
NOTE: B should be positive 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) :: t_0
real(8) :: tmp
t_0 = (b ** 2.0d0) - (4.0d0 * (a * c))
if ((b ** 2.0d0) <= 5000000.0d0) then
tmp = -(sqrt((2.0d0 * ((2.0d0 * c) * (f * t_0)))) / t_0)
else
tmp = (sqrt(2.0d0) / b) * -(sqrt(f) * sqrt(b))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - (4.0 * (A * C));
double tmp;
if (Math.pow(B, 2.0) <= 5000000.0) {
tmp = -(Math.sqrt((2.0 * ((2.0 * C) * (F * t_0)))) / t_0);
} else {
tmp = (Math.sqrt(2.0) / B) * -(Math.sqrt(F) * Math.sqrt(B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = math.pow(B, 2.0) - (4.0 * (A * C)) tmp = 0 if math.pow(B, 2.0) <= 5000000.0: tmp = -(math.sqrt((2.0 * ((2.0 * C) * (F * t_0)))) / t_0) else: tmp = (math.sqrt(2.0) / B) * -(math.sqrt(F) * math.sqrt(B)) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if ((B ^ 2.0) <= 5000000.0) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(2.0 * C) * Float64(F * t_0)))) / t_0)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-Float64(sqrt(F) * sqrt(B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B ^ 2.0) - (4.0 * (A * C)); tmp = 0.0; if ((B ^ 2.0) <= 5000000.0) tmp = -(sqrt((2.0 * ((2.0 * C) * (F * t_0)))) / t_0); else tmp = (sqrt(2.0) / B) * -(sqrt(F) * sqrt(B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5000000.0], (-N[(N[Sqrt[N[(2.0 * N[(N[(2.0 * C), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[B], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := {B}^{2} - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;{B}^{2} \leq 5000000:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(2 \cdot C\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F} \cdot \sqrt{B}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 5e6Initial program 16.8%
Taylor expanded in A around -inf 19.7%
distribute-frac-neg19.7%
associate-*l*19.7%
*-commutative19.7%
associate-*l*19.8%
associate-*l*19.8%
Applied egg-rr19.8%
if 5e6 < (pow.f64 B 2) Initial program 12.3%
Taylor expanded in C around 0 11.3%
mul-1-neg11.3%
distribute-rgt-neg-in11.3%
+-commutative11.3%
unpow211.3%
unpow211.3%
hypot-def28.4%
Simplified28.4%
pow1/228.4%
*-commutative28.4%
unpow-prod-down37.2%
pow1/237.2%
pow1/237.2%
Applied egg-rr37.2%
Taylor expanded in A around 0 33.6%
Final simplification26.8%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= (pow B 2.0) 5e-30)
(/
(- (sqrt (* (* 2.0 C) (* 2.0 (* -4.0 (* A (* C F)))))))
(- (pow B 2.0) (* (* 4.0 A) C)))
(* (/ (sqrt 2.0) B) (- (* (sqrt F) (sqrt B))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (pow(B, 2.0) <= 5e-30) {
tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (pow(B, 2.0) - ((4.0 * A) * C));
} else {
tmp = (sqrt(2.0) / B) * -(sqrt(F) * sqrt(B));
}
return tmp;
}
NOTE: B should be positive 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 ((b ** 2.0d0) <= 5d-30) then
tmp = -sqrt(((2.0d0 * c) * (2.0d0 * ((-4.0d0) * (a * (c * f)))))) / ((b ** 2.0d0) - ((4.0d0 * a) * c))
else
tmp = (sqrt(2.0d0) / b) * -(sqrt(f) * sqrt(b))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (Math.pow(B, 2.0) <= 5e-30) {
tmp = -Math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (Math.pow(B, 2.0) - ((4.0 * A) * C));
} else {
tmp = (Math.sqrt(2.0) / B) * -(Math.sqrt(F) * Math.sqrt(B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if math.pow(B, 2.0) <= 5e-30: tmp = -math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (math.pow(B, 2.0) - ((4.0 * A) * C)) else: tmp = (math.sqrt(2.0) / B) * -(math.sqrt(F) * math.sqrt(B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if ((B ^ 2.0) <= 5e-30) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * C) * Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F))))))) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-Float64(sqrt(F) * sqrt(B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if ((B ^ 2.0) <= 5e-30) tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / ((B ^ 2.0) - ((4.0 * A) * C)); else tmp = (sqrt(2.0) / B) * -(sqrt(F) * sqrt(B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-30], N[((-N[Sqrt[N[(N[(2.0 * C), $MachinePrecision] * N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[B], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;{B}^{2} \leq 5 \cdot 10^{-30}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot C\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F} \cdot \sqrt{B}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999972e-30Initial program 15.9%
Taylor expanded in A around -inf 19.0%
Taylor expanded in B around 0 18.5%
*-commutative18.5%
Simplified18.5%
if 4.99999999999999972e-30 < (pow.f64 B 2) Initial program 13.4%
Taylor expanded in C around 0 11.7%
mul-1-neg11.7%
distribute-rgt-neg-in11.7%
+-commutative11.7%
unpow211.7%
unpow211.7%
hypot-def28.1%
Simplified28.1%
pow1/228.1%
*-commutative28.1%
unpow-prod-down36.6%
pow1/236.6%
pow1/236.6%
Applied egg-rr36.6%
Taylor expanded in A around 0 33.1%
Final simplification26.3%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(if (<= F -3.2e-261)
(/
(- (sqrt (* (* 2.0 C) (* 2.0 (* -4.0 (* A (* C F)))))))
(- (pow B 2.0) (* (* 4.0 A) C)))
(if (<= F 1e+30)
(* (/ (sqrt 2.0) B) (- (sqrt (* B F))))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= -3.2e-261) {
tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (pow(B, 2.0) - ((4.0 * A) * C));
} else if (F <= 1e+30) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: B should be positive 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 <= (-3.2d-261)) then
tmp = -sqrt(((2.0d0 * c) * (2.0d0 * ((-4.0d0) * (a * (c * f)))))) / ((b ** 2.0d0) - ((4.0d0 * a) * c))
else if (f <= 1d+30) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= -3.2e-261) {
tmp = -Math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (Math.pow(B, 2.0) - ((4.0 * A) * C));
} else if (F <= 1e+30) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= -3.2e-261: tmp = -math.sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / (math.pow(B, 2.0) - ((4.0 * A) * C)) elif F <= 1e+30: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= -3.2e-261) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * C) * Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F))))))) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))); elseif (F <= 1e+30) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= -3.2e-261) tmp = -sqrt(((2.0 * C) * (2.0 * (-4.0 * (A * (C * F)))))) / ((B ^ 2.0) - ((4.0 * A) * C)); elseif (F <= 1e+30) tmp = (sqrt(2.0) / B) * -sqrt((B * F)); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, -3.2e-261], N[((-N[Sqrt[N[(N[(2.0 * C), $MachinePrecision] * N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1e+30], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.2 \cdot 10^{-261}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot C\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\
\mathbf{elif}\;F \leq 10^{+30}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < -3.20000000000000004e-261Initial program 24.4%
Taylor expanded in A around -inf 17.0%
Taylor expanded in B around 0 17.2%
*-commutative17.2%
Simplified17.2%
if -3.20000000000000004e-261 < F < 1e30Initial program 14.8%
Taylor expanded in C around 0 9.9%
mul-1-neg9.9%
distribute-rgt-neg-in9.9%
+-commutative9.9%
unpow29.9%
unpow29.9%
hypot-def25.9%
Simplified25.9%
Taylor expanded in A around 0 23.6%
if 1e30 < F Initial program 11.9%
Taylor expanded in C around 0 8.4%
mul-1-neg8.4%
distribute-rgt-neg-in8.4%
+-commutative8.4%
unpow28.4%
unpow28.4%
hypot-def11.4%
Simplified11.4%
Taylor expanded in A around 0 18.6%
mul-1-neg18.6%
Simplified18.6%
Final simplification21.0%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= A 1e+230) (* (sqrt 2.0) (- (sqrt (/ F B)))) (* (* (sqrt F) (sqrt A)) (/ (- 2.0) B))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (A <= 1e+230) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else {
tmp = (sqrt(F) * sqrt(A)) * (-2.0 / B);
}
return tmp;
}
NOTE: B should be positive 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 (a <= 1d+230) then
tmp = sqrt(2.0d0) * -sqrt((f / b))
else
tmp = (sqrt(f) * sqrt(a)) * (-2.0d0 / b)
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (A <= 1e+230) {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
} else {
tmp = (Math.sqrt(F) * Math.sqrt(A)) * (-2.0 / B);
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if A <= 1e+230: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) else: tmp = (math.sqrt(F) * math.sqrt(A)) * (-2.0 / B) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (A <= 1e+230) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); else tmp = Float64(Float64(sqrt(F) * sqrt(A)) * Float64(Float64(-2.0) / B)); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (A <= 1e+230) tmp = sqrt(2.0) * -sqrt((F / B)); else tmp = (sqrt(F) * sqrt(A)) * (-2.0 / B); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[A, 1e+230], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[A], $MachinePrecision]), $MachinePrecision] * N[((-2.0) / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq 10^{+230}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{A}\right) \cdot \frac{-2}{B}\\
\end{array}
\end{array}
if A < 1.0000000000000001e230Initial program 15.2%
Taylor expanded in C around 0 8.8%
mul-1-neg8.8%
distribute-rgt-neg-in8.8%
+-commutative8.8%
unpow28.8%
unpow28.8%
hypot-def18.2%
Simplified18.2%
Taylor expanded in A around 0 15.5%
mul-1-neg15.5%
Simplified15.5%
if 1.0000000000000001e230 < A Initial program 1.1%
Taylor expanded in C around 0 1.2%
mul-1-neg1.2%
distribute-rgt-neg-in1.2%
+-commutative1.2%
unpow21.2%
unpow21.2%
hypot-def9.7%
Simplified9.7%
Taylor expanded in B around 0 9.6%
mul-1-neg9.6%
*-commutative9.6%
unpow29.6%
rem-square-sqrt9.7%
Simplified9.7%
sqrt-prod17.7%
Applied egg-rr17.7%
Final simplification15.6%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= F 3.2e+30) (* (/ (sqrt 2.0) B) (- (sqrt (* B F)))) (* (sqrt 2.0) (- (sqrt (/ F B))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (F <= 3.2e+30) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: B should be positive 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 <= 3.2d+30) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (F <= 3.2e+30) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if F <= 3.2e+30: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (F <= 3.2e+30) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (F <= 3.2e+30) tmp = (sqrt(2.0) / B) * -sqrt((B * F)); else tmp = sqrt(2.0) * -sqrt((F / B)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[F, 3.2e+30], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 3.2 \cdot 10^{+30}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if F < 3.19999999999999973e30Initial program 16.3%
Taylor expanded in C around 0 8.4%
mul-1-neg8.4%
distribute-rgt-neg-in8.4%
+-commutative8.4%
unpow28.4%
unpow28.4%
hypot-def21.9%
Simplified21.9%
Taylor expanded in A around 0 20.5%
if 3.19999999999999973e30 < F Initial program 11.9%
Taylor expanded in C around 0 8.4%
mul-1-neg8.4%
distribute-rgt-neg-in8.4%
+-commutative8.4%
unpow28.4%
unpow28.4%
hypot-def11.4%
Simplified11.4%
Taylor expanded in A around 0 18.6%
mul-1-neg18.6%
Simplified18.6%
Final simplification19.7%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (sqrt 2.0) (- (sqrt (/ F B)))))
B = abs(B);
double code(double A, double B, double C, double F) {
return sqrt(2.0) * -sqrt((F / B));
}
NOTE: B should be positive 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) * -sqrt((f / b))
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return Math.sqrt(2.0) * -Math.sqrt((F / B));
}
B = abs(B) def code(A, B, C, F): return math.sqrt(2.0) * -math.sqrt((F / B))
B = abs(B) function code(A, B, C, F) return Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = sqrt(2.0) * -sqrt((F / B)); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)
\end{array}
Initial program 14.5%
Taylor expanded in C around 0 8.4%
mul-1-neg8.4%
distribute-rgt-neg-in8.4%
+-commutative8.4%
unpow28.4%
unpow28.4%
hypot-def17.8%
Simplified17.8%
Taylor expanded in A around 0 14.9%
mul-1-neg14.9%
Simplified14.9%
Final simplification14.9%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= C 8.2e-308) (* (/ 2.0 B) (- (pow (* A F) 0.5))) (* (* -2.0 (/ 1.0 B)) (sqrt (* C F)))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (C <= 8.2e-308) {
tmp = (2.0 / B) * -pow((A * F), 0.5);
} else {
tmp = (-2.0 * (1.0 / B)) * sqrt((C * F));
}
return tmp;
}
NOTE: B should be positive 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 (c <= 8.2d-308) then
tmp = (2.0d0 / b) * -((a * f) ** 0.5d0)
else
tmp = ((-2.0d0) * (1.0d0 / b)) * sqrt((c * f))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (C <= 8.2e-308) {
tmp = (2.0 / B) * -Math.pow((A * F), 0.5);
} else {
tmp = (-2.0 * (1.0 / B)) * Math.sqrt((C * F));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if C <= 8.2e-308: tmp = (2.0 / B) * -math.pow((A * F), 0.5) else: tmp = (-2.0 * (1.0 / B)) * math.sqrt((C * F)) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (C <= 8.2e-308) tmp = Float64(Float64(2.0 / B) * Float64(-(Float64(A * F) ^ 0.5))); else tmp = Float64(Float64(-2.0 * Float64(1.0 / B)) * sqrt(Float64(C * F))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (C <= 8.2e-308) tmp = (2.0 / B) * -((A * F) ^ 0.5); else tmp = (-2.0 * (1.0 / B)) * sqrt((C * F)); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[C, 8.2e-308], N[(N[(2.0 / B), $MachinePrecision] * (-N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision], N[(N[(-2.0 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 8.2 \cdot 10^{-308}:\\
\;\;\;\;\frac{2}{B} \cdot \left(-{\left(A \cdot F\right)}^{0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \frac{1}{B}\right) \cdot \sqrt{C \cdot F}\\
\end{array}
\end{array}
if C < 8.19999999999999965e-308Initial program 12.1%
Taylor expanded in C around 0 9.2%
mul-1-neg9.2%
distribute-rgt-neg-in9.2%
+-commutative9.2%
unpow29.2%
unpow29.2%
hypot-def19.9%
Simplified19.9%
Taylor expanded in B around 0 2.9%
mul-1-neg2.9%
*-commutative2.9%
unpow22.9%
rem-square-sqrt2.9%
Simplified2.9%
pow1/23.0%
*-commutative3.0%
Applied egg-rr3.0%
if 8.19999999999999965e-308 < C Initial program 17.1%
Taylor expanded in A around -inf 19.1%
Taylor expanded in B around inf 6.4%
associate-*r*6.4%
*-commutative6.4%
Simplified6.4%
Final simplification4.6%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (* (/ 2.0 B) (- (pow (* A F) 0.5))))
B = abs(B);
double code(double A, double B, double C, double F) {
return (2.0 / B) * -pow((A * F), 0.5);
}
NOTE: B should be positive 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 = (2.0d0 / b) * -((a * f) ** 0.5d0)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return (2.0 / B) * -Math.pow((A * F), 0.5);
}
B = abs(B) def code(A, B, C, F): return (2.0 / B) * -math.pow((A * F), 0.5)
B = abs(B) function code(A, B, C, F) return Float64(Float64(2.0 / B) * Float64(-(Float64(A * F) ^ 0.5))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = (2.0 / B) * -((A * F) ^ 0.5); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[(2.0 / B), $MachinePrecision] * (-N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\frac{2}{B} \cdot \left(-{\left(A \cdot F\right)}^{0.5}\right)
\end{array}
Initial program 14.5%
Taylor expanded in C around 0 8.4%
mul-1-neg8.4%
distribute-rgt-neg-in8.4%
+-commutative8.4%
unpow28.4%
unpow28.4%
hypot-def17.8%
Simplified17.8%
Taylor expanded in B around 0 2.2%
mul-1-neg2.2%
*-commutative2.2%
unpow22.2%
rem-square-sqrt2.2%
Simplified2.2%
pow1/22.4%
*-commutative2.4%
Applied egg-rr2.4%
Final simplification2.4%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (/ (* -2.0 (sqrt (* A F))) B))
B = abs(B);
double code(double A, double B, double C, double F) {
return (-2.0 * sqrt((A * F))) / B;
}
NOTE: B should be positive 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 = ((-2.0d0) * sqrt((a * f))) / b
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return (-2.0 * Math.sqrt((A * F))) / B;
}
B = abs(B) def code(A, B, C, F): return (-2.0 * math.sqrt((A * F))) / B
B = abs(B) function code(A, B, C, F) return Float64(Float64(-2.0 * sqrt(Float64(A * F))) / B) end
B = abs(B) function tmp = code(A, B, C, F) tmp = (-2.0 * sqrt((A * F))) / B; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := N[(N[(-2.0 * N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\frac{-2 \cdot \sqrt{A \cdot F}}{B}
\end{array}
Initial program 14.5%
Taylor expanded in C around 0 8.4%
mul-1-neg8.4%
distribute-rgt-neg-in8.4%
+-commutative8.4%
unpow28.4%
unpow28.4%
hypot-def17.8%
Simplified17.8%
pow1/217.8%
*-commutative17.8%
unpow-prod-down22.6%
pow1/222.6%
pow1/222.6%
Applied egg-rr22.6%
Taylor expanded in B around 0 2.2%
mul-1-neg2.2%
associate-*r/2.2%
distribute-neg-frac2.2%
unpow22.2%
rem-square-sqrt2.2%
distribute-rgt-neg-in2.2%
metadata-eval2.2%
Simplified2.2%
Final simplification2.2%
herbie shell --seed 2023306
(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))))