
(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 (* 2.0 (* t_1 F)))
(t_3
(/
(-
(sqrt
(* t_2 (+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))))))
t_1))
(t_4
(*
(sqrt (+ A (+ C (hypot (- A C) B_m))))
(- (sqrt (* 2.0 (* F t_0)))))))
(if (<= t_3 -2e-196)
(/ t_4 t_1)
(if (<= t_3 5e-35)
(/ (- (sqrt (* t_2 (+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C))))) t_1)
(if (<= t_3 INFINITY)
(/ t_4 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, (A * (C * -4.0)));
double t_1 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_2 = 2.0 * (t_1 * F);
double t_3 = -sqrt((t_2 * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_1;
double t_4 = sqrt((A + (C + hypot((A - C), B_m)))) * -sqrt((2.0 * (F * t_0)));
double tmp;
if (t_3 <= -2e-196) {
tmp = t_4 / t_1;
} else if (t_3 <= 5e-35) {
tmp = -sqrt((t_2 * ((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C)))) / t_1;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_4 / 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(A * Float64(C * -4.0))) t_1 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_2 = Float64(2.0 * Float64(t_1 * F)) t_3 = Float64(Float64(-sqrt(Float64(t_2 * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_1) t_4 = Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * Float64(-sqrt(Float64(2.0 * Float64(F * t_0))))) tmp = 0.0 if (t_3 <= -2e-196) tmp = Float64(t_4 / t_1); elseif (t_3 <= 5e-35) tmp = Float64(Float64(-sqrt(Float64(t_2 * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C))))) / t_1); elseif (t_3 <= Inf) tmp = Float64(t_4 / t_0); 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[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(t$95$2 * 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$4 = 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]}, If[LessEqual[t$95$3, -2e-196], N[(t$95$4 / t$95$1), $MachinePrecision], If[LessEqual[t$95$3, 5e-35], N[((-N[Sqrt[N[(t$95$2 * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(t$95$4 / 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, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_2 := 2 \cdot \left(t_1 \cdot F\right)\\
t_3 := \frac{-\sqrt{t_2 \cdot \left(\left(A + C\right) + \sqrt{{B_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_1}\\
t_4 := \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)\\
\mathbf{if}\;t_3 \leq -2 \cdot 10^{-196}:\\
\;\;\;\;\frac{t_4}{t_1}\\
\mathbf{elif}\;t_3 \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{A} + 2 \cdot C\right)}}{t_1}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;\frac{t_4}{t_0}\\
\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))) < -2.0000000000000001e-196Initial program 44.3%
sqrt-prod52.8%
associate-*r*52.8%
associate-*l*52.8%
associate-+l+52.8%
unpow252.8%
unpow252.8%
hypot-def65.3%
Applied egg-rr65.3%
associate-*l*65.3%
*-commutative65.3%
unpow265.3%
fma-neg65.3%
distribute-lft-neg-in65.3%
metadata-eval65.3%
*-commutative65.3%
associate-*l*65.3%
Simplified65.3%
if -2.0000000000000001e-196 < (/.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.99999999999999964e-35Initial program 8.1%
Taylor expanded in A around -inf 36.3%
if 4.99999999999999964e-35 < (/.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 34.4%
Simplified61.1%
add-cube-cbrt61.1%
pow361.1%
hypot-udef34.4%
unpow234.4%
unpow234.4%
+-commutative34.4%
unpow234.4%
unpow234.4%
hypot-def61.1%
Applied egg-rr61.1%
pow1/261.1%
*-commutative61.1%
unpow-prod-down80.8%
pow1/280.8%
rem-cube-cbrt81.3%
pow1/281.3%
associate-*r*81.3%
associate-*r*81.3%
*-commutative81.3%
*-commutative81.3%
*-commutative81.3%
*-commutative81.3%
Applied egg-rr81.3%
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.8%
mul-1-neg2.8%
distribute-rgt-neg-in2.8%
+-commutative2.8%
unpow22.8%
unpow22.8%
hypot-def13.3%
Simplified13.3%
pow1/213.3%
*-commutative13.3%
unpow-prod-down18.7%
pow1/218.7%
pow1/218.7%
Applied egg-rr18.7%
Final simplification42.0%
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)))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2 (/ (- (sqrt (* (* t_1 (* 2.0 F)) (+ A A)))) t_1)))
(if (<= (pow B_m 2.0) 5e-268)
t_2
(if (<= (pow B_m 2.0) 2e-225)
(sqrt (- (/ F A)))
(if (<= (pow B_m 2.0) 1e-88)
(/ (* (sqrt 2.0) (- (sqrt (* F (+ A (hypot B_m A)))))) B_m)
(if (<= (pow B_m 2.0) 5e-54)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0)
(if (<= (pow B_m 2.0) 5e-47)
t_2
(*
(/ (sqrt 2.0) B_m)
(* (sqrt (+ C (hypot B_m C))) (- (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 t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = -sqrt(((t_1 * (2.0 * F)) * (A + A))) / t_1;
double tmp;
if (pow(B_m, 2.0) <= 5e-268) {
tmp = t_2;
} else if (pow(B_m, 2.0) <= 2e-225) {
tmp = sqrt(-(F / A));
} else if (pow(B_m, 2.0) <= 1e-88) {
tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(B_m, A))))) / B_m;
} else if (pow(B_m, 2.0) <= 5e-54) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else if (pow(B_m, 2.0) <= 5e-47) {
tmp = t_2;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((C + hypot(B_m, C))) * -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)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + A)))) / t_1) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-268) tmp = t_2; elseif ((B_m ^ 2.0) <= 2e-225) tmp = sqrt(Float64(-Float64(F / A))); elseif ((B_m ^ 2.0) <= 1e-88) tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A + hypot(B_m, A)))))) / B_m); elseif ((B_m ^ 2.0) <= 5e-54) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0); elseif ((B_m ^ 2.0) <= 5e-47) tmp = t_2; else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(C + hypot(B_m, C))) * 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[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-268], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-225], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-88], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B$95$m), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-54], 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], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-47], t$95$2, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 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\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := \frac{-\sqrt{\left(t_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{if}\;{B_m}^{2} \leq 5 \cdot 10^{-268}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{-225}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{elif}\;{B_m}^{2} \leq 10^{-88}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B_m, A\right)\right)}\right)}{B_m}\\
\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{-54}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{-47}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B_m, C\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.9999999999999999e-268 or 5.00000000000000015e-54 < (pow.f64 B 2) < 5.00000000000000011e-47Initial program 19.2%
Simplified27.7%
Taylor expanded in A around inf 34.3%
distribute-rgt1-in34.3%
metadata-eval34.3%
mul0-lft34.3%
Simplified34.3%
if 4.9999999999999999e-268 < (pow.f64 B 2) < 1.9999999999999999e-225Initial program 13.6%
add-sqr-sqrt2.0%
sqrt-unprod2.3%
frac-times1.1%
Applied egg-rr1.6%
associate-/l*1.6%
associate-*l*1.6%
*-commutative1.6%
unpow21.6%
fma-neg1.6%
distribute-lft-neg-in1.6%
metadata-eval1.6%
*-commutative1.6%
*-commutative1.6%
Simplified1.6%
Taylor expanded in C around inf 55.9%
mul-1-neg55.9%
Simplified55.9%
if 1.9999999999999999e-225 < (pow.f64 B 2) < 9.99999999999999934e-89Initial program 22.0%
Taylor expanded in C around 0 27.3%
mul-1-neg27.3%
distribute-rgt-neg-in27.3%
+-commutative27.3%
unpow227.3%
unpow227.3%
hypot-def27.9%
Simplified27.9%
associate-*l/27.9%
Applied egg-rr27.9%
if 9.99999999999999934e-89 < (pow.f64 B 2) < 5.00000000000000015e-54Initial program 26.7%
Taylor expanded in A around -inf 45.3%
if 5.00000000000000011e-47 < (pow.f64 B 2) Initial program 17.7%
Taylor expanded in A around 0 14.0%
mul-1-neg14.0%
*-commutative14.0%
distribute-rgt-neg-in14.0%
unpow214.0%
unpow214.0%
hypot-def22.1%
Simplified22.1%
pow1/222.1%
*-commutative22.1%
unpow-prod-down27.9%
pow1/227.9%
pow1/227.9%
Applied egg-rr27.9%
Final simplification31.9%
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 (+ A (+ C (hypot (- A C) B_m))))
(- (sqrt (* 2.0 (* F t_0)))))
t_0)))
(if (<= (pow B_m 2.0) 5e-56)
t_1
(if (<= (pow B_m 2.0) 5e-47)
(/ (- (sqrt (* (* t_0 (* 2.0 F)) (+ A A)))) t_0)
(if (<= (pow B_m 2.0) 2e+170)
t_1
(*
(/ (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 = (sqrt((A + (C + hypot((A - C), B_m)))) * -sqrt((2.0 * (F * t_0)))) / t_0;
double tmp;
if (pow(B_m, 2.0) <= 5e-56) {
tmp = t_1;
} else if (pow(B_m, 2.0) <= 5e-47) {
tmp = -sqrt(((t_0 * (2.0 * F)) * (A + A))) / t_0;
} else if (pow(B_m, 2.0) <= 2e+170) {
tmp = t_1;
} 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(Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * Float64(-sqrt(Float64(2.0 * Float64(F * t_0))))) / t_0) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-56) tmp = t_1; elseif ((B_m ^ 2.0) <= 5e-47) tmp = Float64(Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(A + A)))) / t_0); elseif ((B_m ^ 2.0) <= 2e+170) tmp = t_1; 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[(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$0), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-56], t$95$1, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-47], N[((-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+170], t$95$1, 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 := \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_0}\\
\mathbf{if}\;{B_m}^{2} \leq 5 \cdot 10^{-56}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{-47}:\\
\;\;\;\;\frac{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t_0}\\
\mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{+170}:\\
\;\;\;\;t_1\\
\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 (pow.f64 B 2) < 4.99999999999999997e-56 or 5.00000000000000011e-47 < (pow.f64 B 2) < 2.00000000000000007e170Initial program 26.8%
Simplified33.6%
add-cube-cbrt33.0%
pow333.0%
hypot-udef26.9%
unpow226.9%
unpow226.9%
+-commutative26.9%
unpow226.9%
unpow226.9%
hypot-def33.0%
Applied egg-rr33.0%
pow1/233.1%
*-commutative33.1%
unpow-prod-down40.0%
pow1/240.0%
rem-cube-cbrt40.6%
pow1/240.6%
associate-*r*40.6%
associate-*r*40.6%
*-commutative40.6%
*-commutative40.6%
*-commutative40.6%
*-commutative40.6%
Applied egg-rr40.6%
if 4.99999999999999997e-56 < (pow.f64 B 2) < 5.00000000000000011e-47Initial program 11.1%
Simplified31.4%
Taylor expanded in A around inf 69.7%
distribute-rgt1-in69.7%
metadata-eval69.7%
mul0-lft69.7%
Simplified69.7%
if 2.00000000000000007e170 < (pow.f64 B 2) Initial program 3.6%
Taylor expanded in C around 0 6.3%
mul-1-neg6.3%
distribute-rgt-neg-in6.3%
+-commutative6.3%
unpow26.3%
unpow26.3%
hypot-def20.8%
Simplified20.8%
pow1/220.8%
*-commutative20.8%
unpow-prod-down30.6%
pow1/230.6%
pow1/230.6%
Applied egg-rr30.6%
Final simplification38.6%
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)))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 2e-253)
(/
(- (sqrt (* (* t_1 (* 2.0 F)) (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))))
t_1)
(if (<= (pow B_m 2.0) 1e-195)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0)
(if (<= (pow B_m 2.0) 2e+170)
(/
(- (sqrt (* (* 2.0 t_1) (* F (+ A (+ C (hypot (- A C) B_m)))))))
t_1)
(*
(/ (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 t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 2e-253) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + (A + (-0.5 * (pow(B_m, 2.0) / C)))))) / t_1;
} else if (pow(B_m, 2.0) <= 1e-195) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else if (pow(B_m, 2.0) <= 2e+170) {
tmp = -sqrt(((2.0 * t_1) * (F * (A + (C + hypot((A - C), B_m)))))) / t_1;
} 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 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-253) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))))) / t_1); elseif ((B_m ^ 2.0) <= 1e-195) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0); elseif ((B_m ^ 2.0) <= 2e+170) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * t_1) * Float64(F * Float64(A + Float64(C + hypot(Float64(A - C), B_m))))))) / t_1); 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[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-253], N[((-N[Sqrt[N[(N[(t$95$1 * 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$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-195], 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], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+170], N[((-N[Sqrt[N[(N[(2.0 * t$95$1), $MachinePrecision] * N[(F * N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $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\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-253}:\\
\;\;\;\;\frac{-\sqrt{\left(t_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{{B_m}^{2}}{C}\right)\right)}}{t_1}\\
\mathbf{elif}\;{B_m}^{2} \leq 10^{-195}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{+170}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot t_1\right) \cdot \left(F \cdot \left(A + \left(C + \mathsf{hypot}\left(A - C, B_m\right)\right)\right)\right)}}{t_1}\\
\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 (pow.f64 B 2) < 2.0000000000000001e-253Initial program 18.9%
Simplified25.6%
Taylor expanded in C around -inf 29.7%
if 2.0000000000000001e-253 < (pow.f64 B 2) < 1.0000000000000001e-195Initial program 11.0%
Taylor expanded in A around -inf 43.1%
if 1.0000000000000001e-195 < (pow.f64 B 2) < 2.00000000000000007e170Initial program 33.7%
neg-sub033.7%
div-sub33.7%
associate-*l*33.7%
Applied egg-rr42.0%
div042.0%
neg-sub042.0%
distribute-neg-frac42.0%
Simplified42.2%
if 2.00000000000000007e170 < (pow.f64 B 2) Initial program 3.6%
Taylor expanded in C around 0 6.3%
mul-1-neg6.3%
distribute-rgt-neg-in6.3%
+-commutative6.3%
unpow26.3%
unpow26.3%
hypot-def20.8%
Simplified20.8%
pow1/220.8%
*-commutative20.8%
unpow-prod-down30.6%
pow1/230.6%
pow1/230.6%
Applied egg-rr30.6%
Final simplification34.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)))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 4e-268)
(/
(- (sqrt (* (* t_1 (* 2.0 F)) (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))))
t_1)
(if (<= (pow B_m 2.0) 1e-195)
(/
(-
(sqrt
(* (* 2.0 (* t_0 F)) (+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C)))))
t_0)
(if (<= (pow B_m 2.0) 2e+170)
(/
(- (sqrt (* (* 2.0 t_1) (* F (+ A (+ C (hypot (- A C) B_m)))))))
t_1)
(*
(/ (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 t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 4e-268) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + (A + (-0.5 * (pow(B_m, 2.0) / C)))))) / t_1;
} else if (pow(B_m, 2.0) <= 1e-195) {
tmp = -sqrt(((2.0 * (t_0 * F)) * ((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C)))) / t_0;
} else if (pow(B_m, 2.0) <= 2e+170) {
tmp = -sqrt(((2.0 * t_1) * (F * (A + (C + hypot((A - C), B_m)))))) / t_1;
} 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 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 4e-268) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))))) / t_1); elseif ((B_m ^ 2.0) <= 1e-195) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C))))) / t_0); elseif ((B_m ^ 2.0) <= 2e+170) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * t_1) * Float64(F * Float64(A + Float64(C + hypot(Float64(A - C), B_m))))))) / t_1); 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[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-268], N[((-N[Sqrt[N[(N[(t$95$1 * 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$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-195], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+170], N[((-N[Sqrt[N[(N[(2.0 * t$95$1), $MachinePrecision] * N[(F * N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $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\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 4 \cdot 10^{-268}:\\
\;\;\;\;\frac{-\sqrt{\left(t_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{{B_m}^{2}}{C}\right)\right)}}{t_1}\\
\mathbf{elif}\;{B_m}^{2} \leq 10^{-195}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(-0.5 \cdot \frac{{B_m}^{2}}{A} + 2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{+170}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot t_1\right) \cdot \left(F \cdot \left(A + \left(C + \mathsf{hypot}\left(A - C, B_m\right)\right)\right)\right)}}{t_1}\\
\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 (pow.f64 B 2) < 3.99999999999999983e-268Initial program 20.0%
Simplified27.2%
Taylor expanded in C around -inf 30.2%
if 3.99999999999999983e-268 < (pow.f64 B 2) < 1.0000000000000001e-195Initial program 8.7%
Taylor expanded in A around -inf 37.3%
if 1.0000000000000001e-195 < (pow.f64 B 2) < 2.00000000000000007e170Initial program 33.7%
neg-sub033.7%
div-sub33.7%
associate-*l*33.7%
Applied egg-rr42.0%
div042.0%
neg-sub042.0%
distribute-neg-frac42.0%
Simplified42.2%
if 2.00000000000000007e170 < (pow.f64 B 2) Initial program 3.6%
Taylor expanded in C around 0 6.3%
mul-1-neg6.3%
distribute-rgt-neg-in6.3%
+-commutative6.3%
unpow26.3%
unpow26.3%
hypot-def20.8%
Simplified20.8%
pow1/220.8%
*-commutative20.8%
unpow-prod-down30.6%
pow1/230.6%
pow1/230.6%
Applied egg-rr30.6%
Final simplification35.0%
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)))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= C -3.3e+143)
(/ (- (sqrt (* (* t_1 (* 2.0 F)) (+ A A)))) t_1)
(if (<= C 5e-10)
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ A (hypot B_m A))) (- (sqrt F))))
(if (<= C 2.4e+203)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0)
(sqrt (- (/ F A))))))))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 t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (C <= -3.3e+143) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + A))) / t_1;
} else if (C <= 5e-10) {
tmp = (sqrt(2.0) / B_m) * (sqrt((A + hypot(B_m, A))) * -sqrt(F));
} else if (C <= 2.4e+203) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else {
tmp = sqrt(-(F / A));
}
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)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (C <= -3.3e+143) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + A)))) / t_1); elseif (C <= 5e-10) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(A + hypot(B_m, A))) * Float64(-sqrt(F)))); elseif (C <= 2.4e+203) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0); else tmp = sqrt(Float64(-Float64(F / A))); end return 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]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -3.3e+143], N[((-N[Sqrt[N[(N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[C, 5e-10], 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], If[LessEqual[C, 2.4e+203], 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[Sqrt[(-N[(F / A), $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\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;C \leq -3.3 \cdot 10^{+143}:\\
\;\;\;\;\frac{-\sqrt{\left(t_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{elif}\;C \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B_m, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\mathbf{elif}\;C \leq 2.4 \cdot 10^{+203}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\end{array}
\end{array}
if C < -3.3e143Initial program 0.8%
Simplified8.9%
Taylor expanded in A around inf 40.6%
distribute-rgt1-in40.6%
metadata-eval40.6%
mul0-lft40.6%
Simplified40.6%
if -3.3e143 < C < 5.00000000000000031e-10Initial program 22.4%
Taylor expanded in C around 0 15.1%
mul-1-neg15.1%
distribute-rgt-neg-in15.1%
+-commutative15.1%
unpow215.1%
unpow215.1%
hypot-def21.1%
Simplified21.1%
pow1/221.1%
*-commutative21.1%
unpow-prod-down25.8%
pow1/225.8%
pow1/225.8%
Applied egg-rr25.8%
if 5.00000000000000031e-10 < C < 2.4000000000000001e203Initial program 27.8%
Taylor expanded in A around -inf 43.0%
if 2.4000000000000001e203 < C Initial program 1.2%
add-sqr-sqrt0.5%
sqrt-unprod0.6%
frac-times0.0%
Applied egg-rr0.4%
associate-/l*0.6%
associate-*l*0.6%
*-commutative0.6%
unpow20.6%
fma-neg0.6%
distribute-lft-neg-in0.6%
metadata-eval0.6%
*-commutative0.6%
*-commutative0.6%
Simplified0.6%
Taylor expanded in C around inf 45.1%
mul-1-neg45.1%
Simplified45.1%
Final simplification31.5%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= F -5e-310)
(sqrt (- (/ F A)))
(if (<= F 9e+22)
(* (/ t_0 B_m) (sqrt (* F (+ C (hypot B_m C)))))
(* (sqrt (/ F B_m)) t_0)))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (F <= -5e-310) {
tmp = sqrt(-(F / A));
} else if (F <= 9e+22) {
tmp = (t_0 / B_m) * sqrt((F * (C + hypot(B_m, C))));
} else {
tmp = sqrt((F / B_m)) * t_0;
}
return tmp;
}
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);
double tmp;
if (F <= -5e-310) {
tmp = Math.sqrt(-(F / A));
} else if (F <= 9e+22) {
tmp = (t_0 / B_m) * Math.sqrt((F * (C + Math.hypot(B_m, C))));
} else {
tmp = Math.sqrt((F / B_m)) * t_0;
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if F <= -5e-310: tmp = math.sqrt(-(F / A)) elif F <= 9e+22: tmp = (t_0 / B_m) * math.sqrt((F * (C + math.hypot(B_m, C)))) else: tmp = math.sqrt((F / B_m)) * t_0 return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (F <= -5e-310) tmp = sqrt(Float64(-Float64(F / A))); elseif (F <= 9e+22) tmp = Float64(Float64(t_0 / B_m) * sqrt(Float64(F * Float64(C + hypot(B_m, C))))); else tmp = Float64(sqrt(Float64(F / B_m)) * t_0); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = -sqrt(2.0); tmp = 0.0; if (F <= -5e-310) tmp = sqrt(-(F / A)); elseif (F <= 9e+22) tmp = (t_0 / B_m) * sqrt((F * (C + hypot(B_m, C)))); else tmp = sqrt((F / B_m)) * t_0; end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, -5e-310], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], If[LessEqual[F, 9e+22], N[(N[(t$95$0 / B$95$m), $MachinePrecision] * N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{elif}\;F \leq 9 \cdot 10^{+22}:\\
\;\;\;\;\frac{t_0}{B_m} \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(B_m, C\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B_m}} \cdot t_0\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 25.7%
add-sqr-sqrt25.7%
sqrt-unprod20.3%
frac-times19.4%
Applied egg-rr23.0%
associate-/l*25.5%
associate-*l*25.5%
*-commutative25.5%
unpow225.5%
fma-neg25.5%
distribute-lft-neg-in25.5%
metadata-eval25.5%
*-commutative25.5%
*-commutative25.5%
Simplified25.5%
Taylor expanded in C around inf 53.4%
mul-1-neg53.4%
Simplified53.4%
if -4.999999999999985e-310 < F < 8.9999999999999996e22Initial program 18.0%
Taylor expanded in A around 0 10.1%
mul-1-neg10.1%
*-commutative10.1%
distribute-rgt-neg-in10.1%
unpow210.1%
unpow210.1%
hypot-def18.3%
Simplified18.3%
if 8.9999999999999996e22 < F Initial program 18.0%
Taylor expanded in C around 0 14.9%
mul-1-neg14.9%
distribute-rgt-neg-in14.9%
+-commutative14.9%
unpow214.9%
unpow214.9%
hypot-def17.0%
Simplified17.0%
Taylor expanded in A around 0 20.1%
mul-1-neg20.1%
Simplified20.1%
Final simplification23.5%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))))
(if (<= F -5e-310)
(sqrt (- (/ F A)))
(if (<= F 4.5e+95)
(* (sqrt (* F (+ A (hypot B_m A)))) (/ t_0 B_m))
(* (sqrt (/ F B_m)) t_0)))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = -sqrt(2.0);
double tmp;
if (F <= -5e-310) {
tmp = sqrt(-(F / A));
} else if (F <= 4.5e+95) {
tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m);
} else {
tmp = sqrt((F / B_m)) * t_0;
}
return tmp;
}
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);
double tmp;
if (F <= -5e-310) {
tmp = Math.sqrt(-(F / A));
} else if (F <= 4.5e+95) {
tmp = Math.sqrt((F * (A + Math.hypot(B_m, A)))) * (t_0 / B_m);
} else {
tmp = Math.sqrt((F / B_m)) * t_0;
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = -math.sqrt(2.0) tmp = 0 if F <= -5e-310: tmp = math.sqrt(-(F / A)) elif F <= 4.5e+95: tmp = math.sqrt((F * (A + math.hypot(B_m, A)))) * (t_0 / B_m) else: tmp = math.sqrt((F / B_m)) * t_0 return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(-sqrt(2.0)) tmp = 0.0 if (F <= -5e-310) tmp = sqrt(Float64(-Float64(F / A))); elseif (F <= 4.5e+95) tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(t_0 / B_m)); else tmp = Float64(sqrt(Float64(F / B_m)) * t_0); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = -sqrt(2.0); tmp = 0.0; if (F <= -5e-310) tmp = sqrt(-(F / A)); elseif (F <= 4.5e+95) tmp = sqrt((F * (A + hypot(B_m, A)))) * (t_0 / B_m); else tmp = sqrt((F / B_m)) * t_0; end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, -5e-310], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], If[LessEqual[F, 4.5e+95], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{elif}\;F \leq 4.5 \cdot 10^{+95}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B_m, A\right)\right)} \cdot \frac{t_0}{B_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B_m}} \cdot t_0\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 25.7%
add-sqr-sqrt25.7%
sqrt-unprod20.3%
frac-times19.4%
Applied egg-rr23.0%
associate-/l*25.5%
associate-*l*25.5%
*-commutative25.5%
unpow225.5%
fma-neg25.5%
distribute-lft-neg-in25.5%
metadata-eval25.5%
*-commutative25.5%
*-commutative25.5%
Simplified25.5%
Taylor expanded in C around inf 53.4%
mul-1-neg53.4%
Simplified53.4%
if -4.999999999999985e-310 < F < 4.50000000000000017e95Initial program 20.1%
Taylor expanded in C around 0 10.6%
mul-1-neg10.6%
distribute-rgt-neg-in10.6%
+-commutative10.6%
unpow210.6%
unpow210.6%
hypot-def18.7%
Simplified18.7%
if 4.50000000000000017e95 < F Initial program 14.4%
Taylor expanded in C around 0 17.1%
mul-1-neg17.1%
distribute-rgt-neg-in17.1%
+-commutative17.1%
unpow217.1%
unpow217.1%
hypot-def18.6%
Simplified18.6%
Taylor expanded in A around 0 23.3%
mul-1-neg23.3%
Simplified23.3%
Final simplification24.5%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F -5e-310)
(sqrt (- (/ F A)))
(if (<= F 1.6e+88)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* B_m F))))
(* (sqrt (/ F B_m)) (- (sqrt 2.0))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -5e-310) {
tmp = sqrt(-(F / A));
} else if (F <= 1.6e+88) {
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
} else {
tmp = sqrt((F / 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) :: tmp
if (f <= (-5d-310)) then
tmp = sqrt(-(f / a))
else if (f <= 1.6d+88) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((b_m * f))
else
tmp = sqrt((f / 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 tmp;
if (F <= -5e-310) {
tmp = Math.sqrt(-(F / A));
} else if (F <= 1.6e+88) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((B_m * F));
} else {
tmp = Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= -5e-310: tmp = math.sqrt(-(F / A)) elif F <= 1.6e+88: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((B_m * F)) else: tmp = math.sqrt((F / B_m)) * -math.sqrt(2.0) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -5e-310) tmp = sqrt(Float64(-Float64(F / A))); elseif (F <= 1.6e+88) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(B_m * F)))); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= -5e-310) tmp = sqrt(-(F / A)); elseif (F <= 1.6e+88) tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F)); else tmp = sqrt((F / B_m)) * -sqrt(2.0); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -5e-310], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], If[LessEqual[F, 1.6e+88], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{elif}\;F \leq 1.6 \cdot 10^{+88}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{B_m \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 25.7%
add-sqr-sqrt25.7%
sqrt-unprod20.3%
frac-times19.4%
Applied egg-rr23.0%
associate-/l*25.5%
associate-*l*25.5%
*-commutative25.5%
unpow225.5%
fma-neg25.5%
distribute-lft-neg-in25.5%
metadata-eval25.5%
*-commutative25.5%
*-commutative25.5%
Simplified25.5%
Taylor expanded in C around inf 53.4%
mul-1-neg53.4%
Simplified53.4%
if -4.999999999999985e-310 < F < 1.5999999999999999e88Initial program 20.3%
Taylor expanded in C around 0 10.7%
mul-1-neg10.7%
distribute-rgt-neg-in10.7%
+-commutative10.7%
unpow210.7%
unpow210.7%
hypot-def18.9%
Simplified18.9%
Taylor expanded in A around 0 15.6%
if 1.5999999999999999e88 < F Initial program 14.2%
Taylor expanded in C around 0 16.7%
mul-1-neg16.7%
distribute-rgt-neg-in16.7%
+-commutative16.7%
unpow216.7%
unpow216.7%
hypot-def18.3%
Simplified18.3%
Taylor expanded in A around 0 22.7%
mul-1-neg22.7%
Simplified22.7%
Final simplification22.7%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 3.9e-249) (sqrt (- (/ F A))) (* (sqrt (/ F B_m)) (- (sqrt 2.0)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 3.9e-249) {
tmp = sqrt(-(F / A));
} else {
tmp = sqrt((F / 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) :: tmp
if (f <= 3.9d-249) then
tmp = sqrt(-(f / a))
else
tmp = sqrt((f / 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 tmp;
if (F <= 3.9e-249) {
tmp = Math.sqrt(-(F / A));
} else {
tmp = Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= 3.9e-249: tmp = math.sqrt(-(F / A)) else: tmp = math.sqrt((F / B_m)) * -math.sqrt(2.0) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= 3.9e-249) tmp = sqrt(Float64(-Float64(F / A))); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= 3.9e-249) tmp = sqrt(-(F / A)); else tmp = sqrt((F / B_m)) * -sqrt(2.0); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 3.9e-249], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq 3.9 \cdot 10^{-249}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < 3.8999999999999999e-249Initial program 20.9%
add-sqr-sqrt16.8%
sqrt-unprod13.6%
frac-times13.0%
Applied egg-rr15.8%
associate-/l*17.4%
associate-*l*17.4%
*-commutative17.4%
unpow217.4%
fma-neg17.4%
distribute-lft-neg-in17.4%
metadata-eval17.4%
*-commutative17.4%
*-commutative17.4%
Simplified17.4%
Taylor expanded in C around inf 37.5%
mul-1-neg37.5%
Simplified37.5%
if 3.8999999999999999e-249 < F Initial program 18.4%
Taylor expanded in C around 0 13.3%
mul-1-neg13.3%
distribute-rgt-neg-in13.3%
+-commutative13.3%
unpow213.3%
unpow213.3%
hypot-def18.8%
Simplified18.8%
Taylor expanded in A around 0 17.0%
mul-1-neg17.0%
Simplified17.0%
Final simplification21.0%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (or (<= C -3.6e-7) (and (not (<= C 7.8e-209)) (<= C 3.5e-7))) (sqrt (- (/ F C))) (sqrt (- (/ F A)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if ((C <= -3.6e-7) || (!(C <= 7.8e-209) && (C <= 3.5e-7))) {
tmp = sqrt(-(F / C));
} else {
tmp = sqrt(-(F / 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 ((c <= (-3.6d-7)) .or. (.not. (c <= 7.8d-209)) .and. (c <= 3.5d-7)) then
tmp = sqrt(-(f / c))
else
tmp = sqrt(-(f / 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 ((C <= -3.6e-7) || (!(C <= 7.8e-209) && (C <= 3.5e-7))) {
tmp = Math.sqrt(-(F / C));
} else {
tmp = Math.sqrt(-(F / A));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if (C <= -3.6e-7) or (not (C <= 7.8e-209) and (C <= 3.5e-7)): tmp = math.sqrt(-(F / C)) else: tmp = math.sqrt(-(F / A)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if ((C <= -3.6e-7) || (!(C <= 7.8e-209) && (C <= 3.5e-7))) tmp = sqrt(Float64(-Float64(F / C))); else tmp = sqrt(Float64(-Float64(F / A))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if ((C <= -3.6e-7) || (~((C <= 7.8e-209)) && (C <= 3.5e-7))) tmp = sqrt(-(F / C)); else tmp = sqrt(-(F / A)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[Or[LessEqual[C, -3.6e-7], And[N[Not[LessEqual[C, 7.8e-209]], $MachinePrecision], LessEqual[C, 3.5e-7]]], N[Sqrt[(-N[(F / C), $MachinePrecision])], $MachinePrecision], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;C \leq -3.6 \cdot 10^{-7} \lor \neg \left(C \leq 7.8 \cdot 10^{-209}\right) \land C \leq 3.5 \cdot 10^{-7}:\\
\;\;\;\;\sqrt{-\frac{F}{C}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\end{array}
\end{array}
if C < -3.59999999999999994e-7 or 7.8000000000000001e-209 < C < 3.49999999999999984e-7Initial program 15.6%
add-sqr-sqrt4.3%
sqrt-unprod4.7%
frac-times4.4%
Applied egg-rr6.3%
associate-/l*7.1%
associate-*l*7.1%
*-commutative7.1%
unpow27.1%
fma-neg7.1%
distribute-lft-neg-in7.1%
metadata-eval7.1%
*-commutative7.1%
*-commutative7.1%
Simplified6.7%
Taylor expanded in B around 0 20.3%
mul-1-neg20.3%
Simplified20.3%
if -3.59999999999999994e-7 < C < 7.8000000000000001e-209 or 3.49999999999999984e-7 < C Initial program 21.5%
add-sqr-sqrt3.3%
sqrt-unprod2.5%
frac-times2.1%
Applied egg-rr2.5%
associate-/l*2.7%
associate-*l*2.7%
*-commutative2.7%
unpow22.7%
fma-neg2.7%
distribute-lft-neg-in2.7%
metadata-eval2.7%
*-commutative2.7%
*-commutative2.7%
Simplified2.7%
Taylor expanded in C around inf 17.5%
mul-1-neg17.5%
Simplified17.5%
Final simplification18.7%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (sqrt (- (/ F A))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return sqrt(-(F / A));
}
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 / a))
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt(-(F / A));
}
B_m = math.fabs(B) def code(A, B_m, C, F): return math.sqrt(-(F / A))
B_m = abs(B) function code(A, B_m, C, F) return sqrt(Float64(-Float64(F / A))) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = sqrt(-(F / A)); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\sqrt{-\frac{F}{A}}
\end{array}
Initial program 18.9%
add-sqr-sqrt3.7%
sqrt-unprod3.4%
frac-times3.1%
Applied egg-rr4.1%
associate-/l*4.6%
associate-*l*4.6%
*-commutative4.6%
unpow24.6%
fma-neg4.6%
distribute-lft-neg-in4.6%
metadata-eval4.6%
*-commutative4.6%
*-commutative4.6%
Simplified4.4%
Taylor expanded in C around inf 12.4%
mul-1-neg12.4%
Simplified12.4%
Final simplification12.4%
herbie shell --seed 2024019
(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))))