
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
(t_1 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_2
(/
(-
(sqrt
(*
(* 2.0 (* t_1 F))
(+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))))))
t_1))
(t_3
(/
(*
(sqrt (+ A (+ C (hypot (- A C) B_m))))
(- (sqrt (* 2.0 (* F t_0)))))
t_1)))
(if (<= t_2 -5e-212)
t_3
(if (<= t_2 0.0)
(/
(-
(sqrt (* (* t_0 (* 2.0 F)) (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))))
t_0)
(if (<= t_2 INFINITY)
t_3
(*
(/ (sqrt 2.0) B_m)
(* (sqrt (+ A (hypot B_m A))) (- (sqrt F)))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_2 = -sqrt(((2.0 * (t_1 * F)) * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_1;
double t_3 = (sqrt((A + (C + hypot((A - C), B_m)))) * -sqrt((2.0 * (F * t_0)))) / t_1;
double tmp;
if (t_2 <= -5e-212) {
tmp = t_3;
} else if (t_2 <= 0.0) {
tmp = -sqrt(((t_0 * (2.0 * F)) * (A + (A + (-0.5 * (pow(B_m, 2.0) / C)))))) / t_0;
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_3;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((A + hypot(B_m, A))) * -sqrt(F));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_2 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_1 * F)) * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_1) t_3 = Float64(Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * Float64(-sqrt(Float64(2.0 * Float64(F * t_0))))) / t_1) tmp = 0.0 if (t_2 <= -5e-212) tmp = t_3; elseif (t_2 <= 0.0) tmp = Float64(Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))))) / t_0); elseif (t_2 <= Inf) tmp = t_3; else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(A + hypot(B_m, A))) * Float64(-sqrt(F)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-212], t$95$3, If[LessEqual[t$95$2, 0.0], N[((-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[t$95$2, Infinity], t$95$3, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_2 := \frac{-\sqrt{\left(2 \cdot \left(t_1 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_1}\\
t_3 := \frac{\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B_m\right)\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot t_0\right)}\right)}{t_1}\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{-212}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\frac{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{{B_m}^{2}}{C}\right)\right)}}{t_0}\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B_m, A\right)} \cdot \left(-\sqrt{F}\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))) < -5.00000000000000043e-212 or -0.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))) < +inf.0Initial program 49.8%
sqrt-prod55.7%
associate-*r*55.7%
associate-*l*55.7%
associate-+l+55.7%
unpow255.7%
unpow255.7%
hypot-def72.7%
Applied egg-rr72.7%
*-commutative72.7%
associate-*l*72.7%
*-commutative72.7%
unpow272.7%
fma-neg72.7%
distribute-lft-neg-in72.7%
metadata-eval72.7%
*-commutative72.7%
associate-*l*72.7%
Simplified72.7%
if -5.00000000000000043e-212 < (/.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))) < -0.0Initial program 3.3%
Simplified6.8%
Taylor expanded in C around -inf 34.1%
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 1.8%
mul-1-neg1.8%
distribute-rgt-neg-in1.8%
+-commutative1.8%
unpow21.8%
unpow21.8%
hypot-def18.6%
Simplified18.6%
pow1/218.6%
*-commutative18.6%
unpow-prod-down26.9%
pow1/226.9%
pow1/226.9%
Applied egg-rr26.9%
Final simplification49.3%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* -4.0 (* A C)))))
(if (<= (pow B_m 2.0) 1e+134)
(/ (- (sqrt (* (* 2.0 t_0) (* F (+ (+ A C) (hypot (- A C) B_m)))))) t_0)
(* (- (/ (sqrt 2.0) B_m)) (* (sqrt (+ A (hypot B_m A))) (sqrt F))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (-4.0 * (A * C)));
double tmp;
if (pow(B_m, 2.0) <= 1e+134) {
tmp = -sqrt(((2.0 * t_0) * (F * ((A + C) + hypot((A - C), B_m))))) / t_0;
} else {
tmp = -(sqrt(2.0) / B_m) * (sqrt((A + hypot(B_m, A))) * sqrt(F));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(-4.0 * Float64(A * C))) tmp = 0.0 if ((B_m ^ 2.0) <= 1e+134) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * t_0) * Float64(F * Float64(Float64(A + C) + hypot(Float64(A - C), B_m)))))) / t_0); else tmp = Float64(Float64(-Float64(sqrt(2.0) / B_m)) * Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+134], N[((-N[Sqrt[N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(F * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]) * N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B_m, B_m, -4 \cdot \left(A \cdot C\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 10^{+134}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot t_0\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B_m\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{\sqrt{2}}{B_m}\right) \cdot \left(\sqrt{A + \mathsf{hypot}\left(B_m, A\right)} \cdot \sqrt{F}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.99999999999999921e133Initial program 33.8%
neg-sub033.8%
div-sub33.8%
associate-*l*33.8%
Applied egg-rr42.7%
div042.7%
neg-sub042.7%
distribute-neg-frac42.7%
Simplified40.7%
if 9.99999999999999921e133 < (pow.f64 B 2) Initial program 9.0%
Taylor expanded in C around 0 10.9%
mul-1-neg10.9%
distribute-rgt-neg-in10.9%
+-commutative10.9%
unpow210.9%
unpow210.9%
hypot-def27.4%
Simplified27.4%
pow1/227.4%
*-commutative27.4%
unpow-prod-down37.5%
pow1/237.5%
pow1/237.5%
Applied egg-rr37.5%
Final simplification39.4%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C))))
(if (<= (pow B_m 2.0) 5e-106)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0)
(* (- (/ (sqrt 2.0) B_m)) (* (sqrt (+ A (hypot B_m A))) (sqrt F))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double tmp;
if (pow(B_m, 2.0) <= 5e-106) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else {
tmp = -(sqrt(2.0) / B_m) * (sqrt((A + hypot(B_m, A))) * sqrt(F));
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = Math.pow(B_m, 2.0) - ((4.0 * A) * C);
double tmp;
if (Math.pow(B_m, 2.0) <= 5e-106) {
tmp = -Math.sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else {
tmp = -(Math.sqrt(2.0) / B_m) * (Math.sqrt((A + Math.hypot(B_m, A))) * Math.sqrt(F));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.pow(B_m, 2.0) - ((4.0 * A) * C) tmp = 0 if math.pow(B_m, 2.0) <= 5e-106: tmp = -math.sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0 else: tmp = -(math.sqrt(2.0) / B_m) * (math.sqrt((A + math.hypot(B_m, A))) * math.sqrt(F)) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-106) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0); else tmp = Float64(Float64(-Float64(sqrt(2.0) / B_m)) * Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = (B_m ^ 2.0) - ((4.0 * A) * C); tmp = 0.0; if ((B_m ^ 2.0) <= 5e-106) tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0; else tmp = -(sqrt(2.0) / B_m) * (sqrt((A + hypot(B_m, A))) * sqrt(F)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-106], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]) * N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B_m}^{2} \leq 5 \cdot 10^{-106}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{\sqrt{2}}{B_m}\right) \cdot \left(\sqrt{A + \mathsf{hypot}\left(B_m, A\right)} \cdot \sqrt{F}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999983e-106Initial program 19.6%
Taylor expanded in A around -inf 28.7%
if 4.99999999999999983e-106 < (pow.f64 B 2) Initial program 26.0%
Taylor expanded in C around 0 19.9%
mul-1-neg19.9%
distribute-rgt-neg-in19.9%
+-commutative19.9%
unpow219.9%
unpow219.9%
hypot-def31.8%
Simplified31.8%
pow1/231.8%
*-commutative31.8%
unpow-prod-down38.6%
pow1/238.6%
pow1/238.6%
Applied egg-rr38.6%
Final simplification34.8%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
(t_1
(/
(- (sqrt (* (* t_0 (* 2.0 F)) (+ A (+ C (hypot B_m (- A C)))))))
t_0))
(t_2 (/ (sqrt 2.0) B_m)))
(if (<= B_m 2.9e-147)
t_1
(if (<= B_m 2.9e-122)
(* t_2 (* (sqrt F) (- (sqrt (/ (* (pow B_m 2.0) -0.5) A)))))
(if (<= B_m 1.02e+67)
t_1
(* t_2 (* (sqrt (+ A (hypot B_m A))) (- (sqrt F)))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double t_1 = -sqrt(((t_0 * (2.0 * F)) * (A + (C + hypot(B_m, (A - C)))))) / t_0;
double t_2 = sqrt(2.0) / B_m;
double tmp;
if (B_m <= 2.9e-147) {
tmp = t_1;
} else if (B_m <= 2.9e-122) {
tmp = t_2 * (sqrt(F) * -sqrt(((pow(B_m, 2.0) * -0.5) / A)));
} else if (B_m <= 1.02e+67) {
tmp = t_1;
} else {
tmp = t_2 * (sqrt((A + hypot(B_m, A))) * -sqrt(F));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = Float64(Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(A + Float64(C + hypot(B_m, Float64(A - C))))))) / t_0) t_2 = Float64(sqrt(2.0) / B_m) tmp = 0.0 if (B_m <= 2.9e-147) tmp = t_1; elseif (B_m <= 2.9e-122) tmp = Float64(t_2 * Float64(sqrt(F) * Float64(-sqrt(Float64(Float64((B_m ^ 2.0) * -0.5) / A))))); elseif (B_m <= 1.02e+67) tmp = t_1; else tmp = Float64(t_2 * Float64(sqrt(Float64(A + hypot(B_m, A))) * Float64(-sqrt(F)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, If[LessEqual[B$95$m, 2.9e-147], t$95$1, If[LessEqual[B$95$m, 2.9e-122], N[(t$95$2 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * -0.5), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.02e+67], t$95$1, N[(t$95$2 * N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \frac{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B_m, A - C\right)\right)\right)}}{t_0}\\
t_2 := \frac{\sqrt{2}}{B_m}\\
\mathbf{if}\;B_m \leq 2.9 \cdot 10^{-147}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B_m \leq 2.9 \cdot 10^{-122}:\\
\;\;\;\;t_2 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{\frac{{B_m}^{2} \cdot -0.5}{A}}\right)\right)\\
\mathbf{elif}\;B_m \leq 1.02 \cdot 10^{+67}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(\sqrt{A + \mathsf{hypot}\left(B_m, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 2.9000000000000001e-147 or 2.9000000000000002e-122 < B < 1.02000000000000002e67Initial program 28.0%
Simplified34.8%
if 2.9000000000000001e-147 < B < 2.9000000000000002e-122Initial program 1.6%
Taylor expanded in C around 0 9.4%
mul-1-neg9.4%
distribute-rgt-neg-in9.4%
+-commutative9.4%
unpow29.4%
unpow29.4%
hypot-def9.4%
Simplified9.4%
pow1/29.4%
*-commutative9.4%
unpow-prod-down30.0%
pow1/230.0%
pow1/230.0%
Applied egg-rr30.0%
Taylor expanded in A around -inf 28.7%
associate-*r/18.2%
Simplified29.0%
if 1.02000000000000002e67 < B Initial program 10.9%
Taylor expanded in C around 0 19.5%
mul-1-neg19.5%
distribute-rgt-neg-in19.5%
+-commutative19.5%
unpow219.5%
unpow219.5%
hypot-def49.4%
Simplified49.4%
pow1/249.4%
*-commutative49.4%
unpow-prod-down68.3%
pow1/268.3%
pow1/268.3%
Applied egg-rr68.3%
Final simplification41.9%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C))))
(if (<= (pow B_m 2.0) 5e-106)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0)
(* (/ (sqrt F) (sqrt B_m)) (- (sqrt 2.0))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double tmp;
if (pow(B_m, 2.0) <= 5e-106) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else {
tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b_m ** 2.0d0) - ((4.0d0 * a) * c)
if ((b_m ** 2.0d0) <= 5d-106) then
tmp = -sqrt(((2.0d0 * (t_0 * f)) * (2.0d0 * c))) / t_0
else
tmp = (sqrt(f) / sqrt(b_m)) * -sqrt(2.0d0)
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = Math.pow(B_m, 2.0) - ((4.0 * A) * C);
double tmp;
if (Math.pow(B_m, 2.0) <= 5e-106) {
tmp = -Math.sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else {
tmp = (Math.sqrt(F) / Math.sqrt(B_m)) * -Math.sqrt(2.0);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.pow(B_m, 2.0) - ((4.0 * A) * C) tmp = 0 if math.pow(B_m, 2.0) <= 5e-106: tmp = -math.sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0 else: tmp = (math.sqrt(F) / math.sqrt(B_m)) * -math.sqrt(2.0) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-106) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0); else tmp = Float64(Float64(sqrt(F) / sqrt(B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = (B_m ^ 2.0) - ((4.0 * A) * C); tmp = 0.0; if ((B_m ^ 2.0) <= 5e-106) tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0; else tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-106], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B_m}^{2} \leq 5 \cdot 10^{-106}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{B_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999983e-106Initial program 19.6%
Taylor expanded in A around -inf 28.7%
if 4.99999999999999983e-106 < (pow.f64 B 2) Initial program 26.0%
Taylor expanded in C around 0 19.9%
mul-1-neg19.9%
distribute-rgt-neg-in19.9%
+-commutative19.9%
unpow219.9%
unpow219.9%
hypot-def31.8%
Simplified31.8%
Taylor expanded in A around 0 26.8%
mul-1-neg26.8%
Simplified26.8%
sqrt-div33.0%
Applied egg-rr33.0%
Final simplification31.3%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B_m)))
(if (<= A -7.6e+102)
(* t_0 (- (sqrt (* -0.5 (/ (* (pow B_m 2.0) F) A)))))
(if (<= A 1.35e+167)
(* (/ (sqrt F) (sqrt B_m)) (- (sqrt 2.0)))
(* t_0 (* (sqrt F) (- (sqrt (* 2.0 A)))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt(2.0) / B_m;
double tmp;
if (A <= -7.6e+102) {
tmp = t_0 * -sqrt((-0.5 * ((pow(B_m, 2.0) * F) / A)));
} else if (A <= 1.35e+167) {
tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0);
} else {
tmp = t_0 * (sqrt(F) * -sqrt((2.0 * A)));
}
return tmp;
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(2.0d0) / b_m
if (a <= (-7.6d+102)) then
tmp = t_0 * -sqrt(((-0.5d0) * (((b_m ** 2.0d0) * f) / a)))
else if (a <= 1.35d+167) then
tmp = (sqrt(f) / sqrt(b_m)) * -sqrt(2.0d0)
else
tmp = t_0 * (sqrt(f) * -sqrt((2.0d0 * a)))
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = Math.sqrt(2.0) / B_m;
double tmp;
if (A <= -7.6e+102) {
tmp = t_0 * -Math.sqrt((-0.5 * ((Math.pow(B_m, 2.0) * F) / A)));
} else if (A <= 1.35e+167) {
tmp = (Math.sqrt(F) / Math.sqrt(B_m)) * -Math.sqrt(2.0);
} else {
tmp = t_0 * (Math.sqrt(F) * -Math.sqrt((2.0 * A)));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.sqrt(2.0) / B_m tmp = 0 if A <= -7.6e+102: tmp = t_0 * -math.sqrt((-0.5 * ((math.pow(B_m, 2.0) * F) / A))) elif A <= 1.35e+167: tmp = (math.sqrt(F) / math.sqrt(B_m)) * -math.sqrt(2.0) else: tmp = t_0 * (math.sqrt(F) * -math.sqrt((2.0 * A))) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(sqrt(2.0) / B_m) tmp = 0.0 if (A <= -7.6e+102) tmp = Float64(t_0 * Float64(-sqrt(Float64(-0.5 * Float64(Float64((B_m ^ 2.0) * F) / A))))); elseif (A <= 1.35e+167) tmp = Float64(Float64(sqrt(F) / sqrt(B_m)) * Float64(-sqrt(2.0))); else tmp = Float64(t_0 * Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 * A))))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = sqrt(2.0) / B_m; tmp = 0.0; if (A <= -7.6e+102) tmp = t_0 * -sqrt((-0.5 * (((B_m ^ 2.0) * F) / A))); elseif (A <= 1.35e+167) tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0); else tmp = t_0 * (sqrt(F) * -sqrt((2.0 * A))); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, If[LessEqual[A, -7.6e+102], N[(t$95$0 * (-N[Sqrt[N[(-0.5 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * F), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[A, 1.35e+167], N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(2.0 * A), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B_m}\\
\mathbf{if}\;A \leq -7.6 \cdot 10^{+102}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{-0.5 \cdot \frac{{B_m}^{2} \cdot F}{A}}\right)\\
\mathbf{elif}\;A \leq 1.35 \cdot 10^{+167}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{B_m}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{2 \cdot A}\right)\right)\\
\end{array}
\end{array}
if A < -7.59999999999999958e102Initial program 2.6%
Taylor expanded in C around 0 3.3%
mul-1-neg3.3%
distribute-rgt-neg-in3.3%
+-commutative3.3%
unpow23.3%
unpow23.3%
hypot-def5.2%
Simplified5.2%
Taylor expanded in A around -inf 22.2%
if -7.59999999999999958e102 < A < 1.35000000000000003e167Initial program 30.4%
Taylor expanded in C around 0 17.3%
mul-1-neg17.3%
distribute-rgt-neg-in17.3%
+-commutative17.3%
unpow217.3%
unpow217.3%
hypot-def24.8%
Simplified24.8%
Taylor expanded in A around 0 23.6%
mul-1-neg23.6%
Simplified23.6%
sqrt-div28.6%
Applied egg-rr28.6%
if 1.35000000000000003e167 < A Initial program 1.5%
Taylor expanded in C around 0 1.7%
mul-1-neg1.7%
distribute-rgt-neg-in1.7%
+-commutative1.7%
unpow21.7%
unpow21.7%
hypot-def19.1%
Simplified19.1%
pow1/219.2%
*-commutative19.2%
unpow-prod-down27.6%
pow1/227.6%
pow1/227.6%
Applied egg-rr27.6%
Taylor expanded in A around inf 27.6%
*-commutative27.6%
Simplified27.6%
Final simplification27.6%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B_m)))
(if (<= A -4.2e+102)
(* t_0 (- (sqrt (* F (/ (* (pow B_m 2.0) -0.5) A)))))
(if (<= A 1.6e+167)
(* (/ (sqrt F) (sqrt B_m)) (- (sqrt 2.0)))
(* t_0 (* (sqrt F) (- (sqrt (* 2.0 A)))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt(2.0) / B_m;
double tmp;
if (A <= -4.2e+102) {
tmp = t_0 * -sqrt((F * ((pow(B_m, 2.0) * -0.5) / A)));
} else if (A <= 1.6e+167) {
tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0);
} else {
tmp = t_0 * (sqrt(F) * -sqrt((2.0 * A)));
}
return tmp;
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(2.0d0) / b_m
if (a <= (-4.2d+102)) then
tmp = t_0 * -sqrt((f * (((b_m ** 2.0d0) * (-0.5d0)) / a)))
else if (a <= 1.6d+167) then
tmp = (sqrt(f) / sqrt(b_m)) * -sqrt(2.0d0)
else
tmp = t_0 * (sqrt(f) * -sqrt((2.0d0 * a)))
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = Math.sqrt(2.0) / B_m;
double tmp;
if (A <= -4.2e+102) {
tmp = t_0 * -Math.sqrt((F * ((Math.pow(B_m, 2.0) * -0.5) / A)));
} else if (A <= 1.6e+167) {
tmp = (Math.sqrt(F) / Math.sqrt(B_m)) * -Math.sqrt(2.0);
} else {
tmp = t_0 * (Math.sqrt(F) * -Math.sqrt((2.0 * A)));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.sqrt(2.0) / B_m tmp = 0 if A <= -4.2e+102: tmp = t_0 * -math.sqrt((F * ((math.pow(B_m, 2.0) * -0.5) / A))) elif A <= 1.6e+167: tmp = (math.sqrt(F) / math.sqrt(B_m)) * -math.sqrt(2.0) else: tmp = t_0 * (math.sqrt(F) * -math.sqrt((2.0 * A))) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(sqrt(2.0) / B_m) tmp = 0.0 if (A <= -4.2e+102) tmp = Float64(t_0 * Float64(-sqrt(Float64(F * Float64(Float64((B_m ^ 2.0) * -0.5) / A))))); elseif (A <= 1.6e+167) tmp = Float64(Float64(sqrt(F) / sqrt(B_m)) * Float64(-sqrt(2.0))); else tmp = Float64(t_0 * Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 * A))))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = sqrt(2.0) / B_m; tmp = 0.0; if (A <= -4.2e+102) tmp = t_0 * -sqrt((F * (((B_m ^ 2.0) * -0.5) / A))); elseif (A <= 1.6e+167) tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0); else tmp = t_0 * (sqrt(F) * -sqrt((2.0 * A))); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, If[LessEqual[A, -4.2e+102], N[(t$95$0 * (-N[Sqrt[N[(F * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * -0.5), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[A, 1.6e+167], N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(2.0 * A), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B_m}\\
\mathbf{if}\;A \leq -4.2 \cdot 10^{+102}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{F \cdot \frac{{B_m}^{2} \cdot -0.5}{A}}\right)\\
\mathbf{elif}\;A \leq 1.6 \cdot 10^{+167}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{B_m}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{2 \cdot A}\right)\right)\\
\end{array}
\end{array}
if A < -4.20000000000000003e102Initial program 2.6%
Taylor expanded in C around 0 3.3%
mul-1-neg3.3%
distribute-rgt-neg-in3.3%
+-commutative3.3%
unpow23.3%
unpow23.3%
hypot-def5.2%
Simplified5.2%
Taylor expanded in A around -inf 22.2%
associate-*r/22.2%
Simplified22.2%
if -4.20000000000000003e102 < A < 1.5999999999999999e167Initial program 30.4%
Taylor expanded in C around 0 17.3%
mul-1-neg17.3%
distribute-rgt-neg-in17.3%
+-commutative17.3%
unpow217.3%
unpow217.3%
hypot-def24.8%
Simplified24.8%
Taylor expanded in A around 0 23.6%
mul-1-neg23.6%
Simplified23.6%
sqrt-div28.6%
Applied egg-rr28.6%
if 1.5999999999999999e167 < A Initial program 1.5%
Taylor expanded in C around 0 1.7%
mul-1-neg1.7%
distribute-rgt-neg-in1.7%
+-commutative1.7%
unpow21.7%
unpow21.7%
hypot-def19.1%
Simplified19.1%
pow1/219.2%
*-commutative19.2%
unpow-prod-down27.6%
pow1/227.6%
pow1/227.6%
Applied egg-rr27.6%
Taylor expanded in A around inf 27.6%
*-commutative27.6%
Simplified27.6%
Final simplification27.6%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= A 1.05e+167) (* (/ (sqrt F) (sqrt B_m)) (- (sqrt 2.0))) (* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (* 2.0 A)))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (A <= 1.05e+167) {
tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0);
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((2.0 * A)));
}
return tmp;
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (a <= 1.05d+167) then
tmp = (sqrt(f) / sqrt(b_m)) * -sqrt(2.0d0)
else
tmp = (sqrt(2.0d0) / b_m) * (sqrt(f) * -sqrt((2.0d0 * a)))
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (A <= 1.05e+167) {
tmp = (Math.sqrt(F) / Math.sqrt(B_m)) * -Math.sqrt(2.0);
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt(F) * -Math.sqrt((2.0 * A)));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if A <= 1.05e+167: tmp = (math.sqrt(F) / math.sqrt(B_m)) * -math.sqrt(2.0) else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt(F) * -math.sqrt((2.0 * A))) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (A <= 1.05e+167) tmp = Float64(Float64(sqrt(F) / sqrt(B_m)) * Float64(-sqrt(2.0))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 * A))))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (A <= 1.05e+167) tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0); else tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((2.0 * A))); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[A, 1.05e+167], N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(2.0 * A), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;A \leq 1.05 \cdot 10^{+167}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{B_m}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{2 \cdot A}\right)\right)\\
\end{array}
\end{array}
if A < 1.05e167Initial program 25.7%
Taylor expanded in C around 0 15.0%
mul-1-neg15.0%
distribute-rgt-neg-in15.0%
+-commutative15.0%
unpow215.0%
unpow215.0%
hypot-def21.6%
Simplified21.6%
Taylor expanded in A around 0 20.1%
mul-1-neg20.1%
Simplified20.1%
sqrt-div24.3%
Applied egg-rr24.3%
if 1.05e167 < A Initial program 1.5%
Taylor expanded in C around 0 1.7%
mul-1-neg1.7%
distribute-rgt-neg-in1.7%
+-commutative1.7%
unpow21.7%
unpow21.7%
hypot-def19.1%
Simplified19.1%
pow1/219.2%
*-commutative19.2%
unpow-prod-down27.6%
pow1/227.6%
pow1/227.6%
Applied egg-rr27.6%
Taylor expanded in A around inf 27.6%
*-commutative27.6%
Simplified27.6%
Final simplification24.6%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (* (/ (sqrt F) (sqrt B_m)) (- (sqrt 2.0))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return (sqrt(F) / sqrt(B_m)) * -sqrt(2.0);
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (sqrt(f) / sqrt(b_m)) * -sqrt(2.0d0)
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return (Math.sqrt(F) / Math.sqrt(B_m)) * -Math.sqrt(2.0);
}
B_m = math.fabs(B) def code(A, B_m, C, F): return (math.sqrt(F) / math.sqrt(B_m)) * -math.sqrt(2.0)
B_m = abs(B) function code(A, B_m, C, F) return Float64(Float64(sqrt(F) / sqrt(B_m)) * Float64(-sqrt(2.0))) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\frac{\sqrt{F}}{\sqrt{B_m}} \cdot \left(-\sqrt{2}\right)
\end{array}
Initial program 23.5%
Taylor expanded in C around 0 13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
+-commutative13.8%
unpow213.8%
unpow213.8%
hypot-def21.3%
Simplified21.3%
Taylor expanded in A around 0 18.6%
mul-1-neg18.6%
Simplified18.6%
sqrt-div22.4%
Applied egg-rr22.4%
Final simplification22.4%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 7.8e-51) (* (/ (sqrt 2.0) B_m) (- (sqrt (* B_m F)))) (- (pow (* 2.0 (/ F B_m)) 0.5))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 7.8e-51) {
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
} else {
tmp = -pow((2.0 * (F / B_m)), 0.5);
}
return tmp;
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 7.8d-51) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((b_m * f))
else
tmp = -((2.0d0 * (f / b_m)) ** 0.5d0)
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 7.8e-51) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((B_m * F));
} else {
tmp = -Math.pow((2.0 * (F / B_m)), 0.5);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= 7.8e-51: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((B_m * F)) else: tmp = -math.pow((2.0 * (F / B_m)), 0.5) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= 7.8e-51) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(B_m * F)))); else tmp = Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= 7.8e-51) tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F)); else tmp = -((2.0 * (F / B_m)) ^ 0.5); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 7.8e-51], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq 7.8 \cdot 10^{-51}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{B_m \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B_m}\right)}^{0.5}\\
\end{array}
\end{array}
if F < 7.7999999999999995e-51Initial program 30.0%
Taylor expanded in C around 0 14.6%
mul-1-neg14.6%
distribute-rgt-neg-in14.6%
+-commutative14.6%
unpow214.6%
unpow214.6%
hypot-def26.4%
Simplified26.4%
Taylor expanded in A around 0 21.8%
if 7.7999999999999995e-51 < F Initial program 17.4%
Taylor expanded in C around 0 13.0%
mul-1-neg13.0%
distribute-rgt-neg-in13.0%
+-commutative13.0%
unpow213.0%
unpow213.0%
hypot-def16.5%
Simplified16.5%
Taylor expanded in A around 0 22.3%
mul-1-neg22.3%
Simplified22.3%
sqrt-unprod22.3%
pow1/222.6%
Applied egg-rr22.6%
Final simplification22.2%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (- (pow (* 2.0 (/ F B_m)) 0.5)))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return -pow((2.0 * (F / B_m)), 0.5);
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -((2.0d0 * (f / b_m)) ** 0.5d0)
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return -Math.pow((2.0 * (F / B_m)), 0.5);
}
B_m = math.fabs(B) def code(A, B_m, C, F): return -math.pow((2.0 * (F / B_m)), 0.5)
B_m = abs(B) function code(A, B_m, C, F) return Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = -((2.0 * (F / B_m)) ^ 0.5); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
-{\left(2 \cdot \frac{F}{B_m}\right)}^{0.5}
\end{array}
Initial program 23.5%
Taylor expanded in C around 0 13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
+-commutative13.8%
unpow213.8%
unpow213.8%
hypot-def21.3%
Simplified21.3%
Taylor expanded in A around 0 18.6%
mul-1-neg18.6%
Simplified18.6%
sqrt-unprod18.6%
pow1/218.8%
Applied egg-rr18.8%
Final simplification18.8%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (- (sqrt (* 2.0 (/ F B_m)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return -sqrt((2.0 * (F / B_m)));
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((2.0d0 * (f / b_m)))
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((2.0 * (F / B_m)));
}
B_m = math.fabs(B) def code(A, B_m, C, F): return -math.sqrt((2.0 * (F / B_m)))
B_m = abs(B) function code(A, B_m, C, F) return Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = -sqrt((2.0 * (F / B_m))); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
-\sqrt{2 \cdot \frac{F}{B_m}}
\end{array}
Initial program 23.5%
Taylor expanded in C around 0 13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
+-commutative13.8%
unpow213.8%
unpow213.8%
hypot-def21.3%
Simplified21.3%
Taylor expanded in A around 0 18.6%
mul-1-neg18.6%
Simplified18.6%
sqrt-unprod18.6%
Applied egg-rr18.6%
Final simplification18.6%
herbie shell --seed 2024020
(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))))