
(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 17 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
(if (<= (pow B_m 2.0) 2e+151)
(/
(-
(pow
(cbrt
(*
(sqrt (+ A (+ C (hypot (- A C) B_m))))
(sqrt (* (* 2.0 F) (fma B_m B_m (* C (* A -4.0)))))))
3.0))
(- (pow B_m 2.0) (* C (* A 4.0))))
(* (* (sqrt (+ A (hypot B_m A))) (sqrt F)) (/ (- (sqrt 2.0)) B_m))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 2e+151) {
tmp = -pow(cbrt((sqrt((A + (C + hypot((A - C), B_m)))) * sqrt(((2.0 * F) * fma(B_m, B_m, (C * (A * -4.0))))))), 3.0) / (pow(B_m, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 2e+151) tmp = Float64(Float64(-(cbrt(Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * sqrt(Float64(Float64(2.0 * F) * fma(B_m, B_m, Float64(C * Float64(A * -4.0))))))) ^ 3.0)) / Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+151], N[((-N[Power[N[Power[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[(N[(2.0 * F), $MachinePrecision] * N[(B$95$m * B$95$m + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]) / N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{+151}:\\
\;\;\;\;\frac{-{\left(\sqrt[3]{\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B_m\right)\right)} \cdot \sqrt{\left(2 \cdot F\right) \cdot \mathsf{fma}\left(B_m, B_m, C \cdot \left(A \cdot -4\right)\right)}}\right)}^{3}}{{B_m}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B_m}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 2.00000000000000003e151Initial program 31.0%
add-sqr-sqrt31.0%
sqr-neg31.0%
sqrt-unprod0.7%
add-sqr-sqrt1.3%
add-cube-cbrt1.3%
Applied egg-rr38.9%
Applied egg-rr46.3%
if 2.00000000000000003e151 < (pow.f64 B 2) Initial program 8.5%
Taylor expanded in C around 0 5.3%
mul-1-neg5.3%
*-commutative5.3%
distribute-rgt-neg-in5.3%
+-commutative5.3%
unpow25.3%
unpow25.3%
hypot-def21.5%
Simplified21.5%
pow1/221.5%
*-commutative21.5%
unpow-prod-down38.0%
pow1/238.0%
pow1/238.0%
Applied egg-rr38.0%
Final simplification43.4%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* C (* A 4.0))))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2 (* (* 2.0 F) t_1)))
(if (<= (pow B_m 2.0) 1.7e-320)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 C)))) t_0)
(if (<= (pow B_m 2.0) 1e-214)
(/ (- (sqrt (* t_2 (+ A A)))) t_1)
(if (<= (pow B_m 2.0) 2e+100)
(/ (- (sqrt (* t_2 (+ A (+ C (hypot B_m (- A C))))))) t_1)
(*
(* (sqrt F) (sqrt (+ C (hypot B_m C))))
(* (sqrt 2.0) (/ -1.0 B_m))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - (C * (A * 4.0));
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = (2.0 * F) * t_1;
double tmp;
if (pow(B_m, 2.0) <= 1.7e-320) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else if (pow(B_m, 2.0) <= 1e-214) {
tmp = -sqrt((t_2 * (A + A))) / t_1;
} else if (pow(B_m, 2.0) <= 2e+100) {
tmp = -sqrt((t_2 * (A + (C + hypot(B_m, (A - C)))))) / t_1;
} else {
tmp = (sqrt(F) * sqrt((C + hypot(B_m, C)))) * (sqrt(2.0) * (-1.0 / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0))) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(Float64(2.0 * F) * t_1) tmp = 0.0 if ((B_m ^ 2.0) <= 1.7e-320) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * C)))) / t_0); elseif ((B_m ^ 2.0) <= 1e-214) tmp = Float64(Float64(-sqrt(Float64(t_2 * Float64(A + A)))) / t_1); elseif ((B_m ^ 2.0) <= 2e+100) tmp = Float64(Float64(-sqrt(Float64(t_2 * Float64(A + Float64(C + hypot(B_m, Float64(A - C))))))) / t_1); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C)))) * Float64(sqrt(2.0) * Float64(-1.0 / B_m))); 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[(C * N[(A * 4.0), $MachinePrecision]), $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[(2.0 * F), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1.7e-320], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-214], N[((-N[Sqrt[N[(t$95$2 * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+100], N[((-N[Sqrt[N[(t$95$2 * N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - C \cdot \left(A \cdot 4\right)\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := \left(2 \cdot F\right) \cdot t_1\\
\mathbf{if}\;{B_m}^{2} \leq 1.7 \cdot 10^{-320}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;{B_m}^{2} \leq 10^{-214}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(A + A\right)}}{t_1}\\
\mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{+100}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B_m, A - C\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B_m, C\right)}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B_m}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.70008e-320Initial program 13.3%
Taylor expanded in A around -inf 31.0%
if 1.70008e-320 < (pow.f64 B 2) < 9.99999999999999913e-215Initial program 21.9%
Simplified32.4%
Taylor expanded in A around inf 47.9%
distribute-rgt1-in47.9%
metadata-eval47.9%
mul0-lft47.9%
Simplified47.9%
if 9.99999999999999913e-215 < (pow.f64 B 2) < 2.00000000000000003e100Initial program 48.4%
Simplified53.8%
if 2.00000000000000003e100 < (pow.f64 B 2) Initial program 10.7%
Taylor expanded in A around 0 7.2%
mul-1-neg7.2%
*-commutative7.2%
distribute-rgt-neg-in7.2%
unpow27.2%
unpow27.2%
hypot-def23.5%
Simplified23.5%
pow1/223.5%
*-commutative23.5%
unpow-prod-down37.8%
pow1/237.8%
pow1/237.8%
Applied egg-rr37.8%
div-inv37.8%
Applied egg-rr37.8%
Final simplification41.4%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* C (* A 4.0))))
(t_1 (fma B_m B_m (* C (* A -4.0)))))
(if (<= (pow B_m 2.0) 1.7e-320)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 C)))) t_0)
(if (<= (pow B_m 2.0) 2e+100)
(/ (- (sqrt (* (* 2.0 F) (* (+ A (+ C (hypot (- A C) B_m))) t_1)))) t_1)
(*
(* (sqrt F) (sqrt (+ C (hypot B_m C))))
(* (sqrt 2.0) (/ -1.0 B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - (C * (A * 4.0));
double t_1 = fma(B_m, B_m, (C * (A * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 1.7e-320) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else if (pow(B_m, 2.0) <= 2e+100) {
tmp = -sqrt(((2.0 * F) * ((A + (C + hypot((A - C), B_m))) * t_1))) / t_1;
} else {
tmp = (sqrt(F) * sqrt((C + hypot(B_m, C)))) * (sqrt(2.0) * (-1.0 / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0))) t_1 = fma(B_m, B_m, Float64(C * Float64(A * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 1.7e-320) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * C)))) / t_0); elseif ((B_m ^ 2.0) <= 2e+100) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * F) * Float64(Float64(A + Float64(C + hypot(Float64(A - C), B_m))) * t_1)))) / t_1); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C)))) * Float64(sqrt(2.0) * Float64(-1.0 / B_m))); 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[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1.7e-320], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+100], N[((-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - C \cdot \left(A \cdot 4\right)\\
t_1 := \mathsf{fma}\left(B_m, B_m, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 1.7 \cdot 10^{-320}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{+100}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot F\right) \cdot \left(\left(A + \left(C + \mathsf{hypot}\left(A - C, B_m\right)\right)\right) \cdot t_1\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B_m, C\right)}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B_m}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.70008e-320Initial program 13.3%
Taylor expanded in A around -inf 31.0%
if 1.70008e-320 < (pow.f64 B 2) < 2.00000000000000003e100Initial program 44.1%
add-sqr-sqrt44.1%
sqr-neg44.1%
sqrt-unprod0.7%
add-sqr-sqrt1.4%
add-cube-cbrt1.4%
Applied egg-rr49.6%
Applied egg-rr6.0%
expm1-def21.3%
expm1-log1p50.3%
associate-*l*47.0%
Simplified47.0%
if 2.00000000000000003e100 < (pow.f64 B 2) Initial program 10.7%
Taylor expanded in A around 0 7.2%
mul-1-neg7.2%
*-commutative7.2%
distribute-rgt-neg-in7.2%
unpow27.2%
unpow27.2%
hypot-def23.5%
Simplified23.5%
pow1/223.5%
*-commutative23.5%
unpow-prod-down37.8%
pow1/237.8%
pow1/237.8%
Applied egg-rr37.8%
div-inv37.8%
Applied egg-rr37.8%
Final simplification39.4%
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))))
(t_1 (- (pow B_m 2.0) (* C (* A 4.0)))))
(if (<= (pow B_m 2.0) 0.0)
(/ (- (sqrt (* (* 2.0 (* F t_1)) (* 2.0 C)))) t_1)
(if (<= (pow B_m 2.0) 2e+100)
(/ (- (sqrt (* (* 2.0 t_0) (* F (+ (hypot (- A C) B_m) (+ A C)))))) t_0)
(*
(* (sqrt F) (sqrt (+ C (hypot B_m C))))
(* (sqrt 2.0) (/ -1.0 B_m)))))))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 t_1 = pow(B_m, 2.0) - (C * (A * 4.0));
double tmp;
if (pow(B_m, 2.0) <= 0.0) {
tmp = -sqrt(((2.0 * (F * t_1)) * (2.0 * C))) / t_1;
} else if (pow(B_m, 2.0) <= 2e+100) {
tmp = -sqrt(((2.0 * t_0) * (F * (hypot((A - C), B_m) + (A + C))))) / t_0;
} else {
tmp = (sqrt(F) * sqrt((C + hypot(B_m, C)))) * (sqrt(2.0) * (-1.0 / B_m));
}
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))) t_1 = Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 0.0) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(2.0 * C)))) / t_1); elseif ((B_m ^ 2.0) <= 2e+100) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * t_0) * Float64(F * Float64(hypot(Float64(A - C), B_m) + Float64(A + C)))))) / t_0); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C)))) * Float64(sqrt(2.0) * Float64(-1.0 / B_m))); 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]}, Block[{t$95$1 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 0.0], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+100], N[((-N[Sqrt[N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(F * N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / B$95$m), $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)\\
t_1 := {B_m}^{2} - C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;{B_m}^{2} \leq 0:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(2 \cdot C\right)}}{t_1}\\
\mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{+100}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot t_0\right) \cdot \left(F \cdot \left(\mathsf{hypot}\left(A - C, B_m\right) + \left(A + C\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B_m, C\right)}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B_m}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 0.0Initial program 13.6%
Taylor expanded in A around -inf 30.3%
if 0.0 < (pow.f64 B 2) < 2.00000000000000003e100Initial program 43.2%
neg-sub043.2%
div-sub43.2%
associate-*l*43.2%
Applied egg-rr50.3%
div050.3%
neg-sub050.3%
distribute-neg-frac50.3%
Simplified49.7%
if 2.00000000000000003e100 < (pow.f64 B 2) Initial program 10.7%
Taylor expanded in A around 0 7.2%
mul-1-neg7.2%
*-commutative7.2%
distribute-rgt-neg-in7.2%
unpow27.2%
unpow27.2%
hypot-def23.5%
Simplified23.5%
pow1/223.5%
*-commutative23.5%
unpow-prod-down37.8%
pow1/237.8%
pow1/237.8%
Applied egg-rr37.8%
div-inv37.8%
Applied egg-rr37.8%
Final simplification40.3%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 2e+151)
(/
(*
(sqrt (* 2.0 (* F (fma B_m B_m (* -4.0 (* A C))))))
(- (sqrt (+ (hypot (- A C) B_m) (+ A C)))))
(- (pow B_m 2.0) (* C (* A 4.0))))
(* (* (sqrt (+ A (hypot B_m A))) (sqrt F)) (/ (- (sqrt 2.0)) B_m))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 2e+151) {
tmp = (sqrt((2.0 * (F * fma(B_m, B_m, (-4.0 * (A * C)))))) * -sqrt((hypot((A - C), B_m) + (A + C)))) / (pow(B_m, 2.0) - (C * (A * 4.0)));
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 2e+151) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B_m, B_m, Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(hypot(Float64(A - C), B_m) + Float64(A + C))))) / Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m)); end return tmp end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+151], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision] + N[(A + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B_m, B_m, -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{\mathsf{hypot}\left(A - C, B_m\right) + \left(A + C\right)}\right)}{{B_m}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B_m}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 2.00000000000000003e151Initial program 31.0%
sqrt-prod33.4%
associate-*r*33.4%
associate-*l*33.4%
associate-+l+34.0%
unpow234.0%
unpow234.0%
hypot-def47.0%
Applied egg-rr47.0%
*-commutative47.0%
associate-+r+46.0%
+-commutative46.0%
associate-*l*46.0%
*-commutative46.0%
unpow246.0%
fma-neg46.0%
distribute-lft-neg-in46.0%
metadata-eval46.0%
*-commutative46.0%
*-commutative46.0%
Simplified46.0%
if 2.00000000000000003e151 < (pow.f64 B 2) Initial program 8.5%
Taylor expanded in C around 0 5.3%
mul-1-neg5.3%
*-commutative5.3%
distribute-rgt-neg-in5.3%
+-commutative5.3%
unpow25.3%
unpow25.3%
hypot-def21.5%
Simplified21.5%
pow1/221.5%
*-commutative21.5%
unpow-prod-down38.0%
pow1/238.0%
pow1/238.0%
Applied egg-rr38.0%
Final simplification43.2%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* C (* A 4.0))))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 1.7e-320)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 C)))) t_0)
(if (<= (pow B_m 2.0) 4e-198)
(/ (- (sqrt (* (* (* 2.0 F) t_1) (+ A A)))) t_1)
(*
(* (sqrt F) (sqrt (+ C (hypot B_m C))))
(* (sqrt 2.0) (/ -1.0 B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - (C * (A * 4.0));
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 1.7e-320) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else if (pow(B_m, 2.0) <= 4e-198) {
tmp = -sqrt((((2.0 * F) * t_1) * (A + A))) / t_1;
} else {
tmp = (sqrt(F) * sqrt((C + hypot(B_m, C)))) * (sqrt(2.0) * (-1.0 / B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0))) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 1.7e-320) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * C)))) / t_0); elseif ((B_m ^ 2.0) <= 4e-198) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * F) * t_1) * Float64(A + A)))) / t_1); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C)))) * Float64(sqrt(2.0) * Float64(-1.0 / B_m))); 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[(C * N[(A * 4.0), $MachinePrecision]), $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], 1.7e-320], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-198], N[((-N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - C \cdot \left(A \cdot 4\right)\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 1.7 \cdot 10^{-320}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;{B_m}^{2} \leq 4 \cdot 10^{-198}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot F\right) \cdot t_1\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B_m, C\right)}\right) \cdot \left(\sqrt{2} \cdot \frac{-1}{B_m}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.70008e-320Initial program 13.3%
Taylor expanded in A around -inf 31.0%
if 1.70008e-320 < (pow.f64 B 2) < 3.9999999999999996e-198Initial program 20.7%
Simplified36.6%
Taylor expanded in A around inf 51.1%
distribute-rgt1-in51.1%
metadata-eval51.1%
mul0-lft51.1%
Simplified51.1%
if 3.9999999999999996e-198 < (pow.f64 B 2) Initial program 27.0%
Taylor expanded in A around 0 10.2%
mul-1-neg10.2%
*-commutative10.2%
distribute-rgt-neg-in10.2%
unpow210.2%
unpow210.2%
hypot-def19.6%
Simplified19.6%
pow1/219.7%
*-commutative19.7%
unpow-prod-down28.9%
pow1/228.9%
pow1/228.9%
Applied egg-rr28.9%
div-inv28.9%
Applied egg-rr28.9%
Final simplification30.8%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* C (* A 4.0))))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 1.7e-320)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 C)))) t_0)
(if (<= (pow B_m 2.0) 4e-198)
(/ (- (sqrt (* (* (* 2.0 F) t_1) (+ A A)))) t_1)
(* (/ (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) - (C * (A * 4.0));
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 1.7e-320) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else if (pow(B_m, 2.0) <= 4e-198) {
tmp = -sqrt((((2.0 * F) * t_1) * (A + A))) / t_1;
} 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(C * Float64(A * 4.0))) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 1.7e-320) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * C)))) / t_0); elseif ((B_m ^ 2.0) <= 4e-198) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * F) * t_1) * Float64(A + A)))) / t_1); 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[(C * N[(A * 4.0), $MachinePrecision]), $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], 1.7e-320], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e-198], N[((-N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], 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} - C \cdot \left(A \cdot 4\right)\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 1.7 \cdot 10^{-320}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;{B_m}^{2} \leq 4 \cdot 10^{-198}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot F\right) \cdot t_1\right) \cdot \left(A + A\right)}}{t_1}\\
\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) < 1.70008e-320Initial program 13.3%
Taylor expanded in A around -inf 31.0%
if 1.70008e-320 < (pow.f64 B 2) < 3.9999999999999996e-198Initial program 20.7%
Simplified36.6%
Taylor expanded in A around inf 51.1%
distribute-rgt1-in51.1%
metadata-eval51.1%
mul0-lft51.1%
Simplified51.1%
if 3.9999999999999996e-198 < (pow.f64 B 2) Initial program 27.0%
Taylor expanded in A around 0 10.2%
mul-1-neg10.2%
*-commutative10.2%
distribute-rgt-neg-in10.2%
unpow210.2%
unpow210.2%
hypot-def19.6%
Simplified19.6%
pow1/219.7%
*-commutative19.7%
unpow-prod-down28.9%
pow1/228.9%
pow1/228.9%
Applied egg-rr28.9%
Final simplification30.8%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* C (* A 4.0))))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 1.15e-180)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 C)))) t_0)
(if (<= B_m 1.45e-96)
(/ (- (sqrt (* (* (* 2.0 F) t_1) (+ A A)))) t_1)
(* (* (sqrt (+ A (hypot B_m A))) (sqrt F)) (/ (- (sqrt 2.0)) B_m))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - (C * (A * 4.0));
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 1.15e-180) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else if (B_m <= 1.45e-96) {
tmp = -sqrt((((2.0 * F) * t_1) * (A + A))) / t_1;
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * (-sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0))) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 1.15e-180) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * C)))) / t_0); elseif (B_m <= 1.45e-96) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * F) * t_1) * Float64(A + A)))) / t_1); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m)); 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[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 1.15e-180], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 1.45e-96], N[((-N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - C \cdot \left(A \cdot 4\right)\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B_m \leq 1.15 \cdot 10^{-180}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;B_m \leq 1.45 \cdot 10^{-96}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot F\right) \cdot t_1\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B_m, A\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B_m}\\
\end{array}
\end{array}
if B < 1.14999999999999998e-180Initial program 25.3%
Taylor expanded in A around -inf 18.5%
if 1.14999999999999998e-180 < B < 1.44999999999999997e-96Initial program 11.1%
Simplified25.6%
Taylor expanded in A around inf 28.3%
distribute-rgt1-in28.3%
metadata-eval28.3%
mul0-lft28.3%
Simplified28.3%
if 1.44999999999999997e-96 < B Initial program 21.6%
Taylor expanded in C around 0 20.6%
mul-1-neg20.6%
*-commutative20.6%
distribute-rgt-neg-in20.6%
+-commutative20.6%
unpow220.6%
unpow220.6%
hypot-def37.0%
Simplified37.0%
pow1/237.0%
*-commutative37.0%
unpow-prod-down56.0%
pow1/256.0%
pow1/256.0%
Applied egg-rr56.0%
Final simplification31.8%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* C (* A 4.0))))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 2.95e-180)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 C)))) t_0)
(if (<= B_m 9.5e-99)
(/ (- (sqrt (* (* (* 2.0 F) t_1) (+ A A)))) t_1)
(* (/ (- (sqrt 2.0)) B_m) (* (sqrt F) (sqrt B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - (C * (A * 4.0));
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 2.95e-180) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else if (B_m <= 9.5e-99) {
tmp = -sqrt((((2.0 * F) * t_1) * (A + A))) / t_1;
} else {
tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt(B_m));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0))) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 2.95e-180) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * C)))) / t_0); elseif (B_m <= 9.5e-99) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * F) * t_1) * Float64(A + A)))) / t_1); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * Float64(sqrt(F) * sqrt(B_m))); 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[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 2.95e-180], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 9.5e-99], N[((-N[Sqrt[N[(N[(N[(2.0 * F), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - C \cdot \left(A \cdot 4\right)\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B_m \leq 2.95 \cdot 10^{-180}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;B_m \leq 9.5 \cdot 10^{-99}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot F\right) \cdot t_1\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B_m} \cdot \left(\sqrt{F} \cdot \sqrt{B_m}\right)\\
\end{array}
\end{array}
if B < 2.9500000000000001e-180Initial program 25.3%
Taylor expanded in A around -inf 18.5%
if 2.9500000000000001e-180 < B < 9.5000000000000008e-99Initial program 11.1%
Simplified25.6%
Taylor expanded in A around inf 28.3%
distribute-rgt1-in28.3%
metadata-eval28.3%
mul0-lft28.3%
Simplified28.3%
if 9.5000000000000008e-99 < B Initial program 21.6%
Taylor expanded in A around 0 19.0%
mul-1-neg19.0%
*-commutative19.0%
distribute-rgt-neg-in19.0%
unpow219.0%
unpow219.0%
hypot-def37.1%
Simplified37.1%
pow1/237.2%
*-commutative37.2%
unpow-prod-down55.8%
pow1/255.8%
pow1/255.8%
Applied egg-rr55.8%
Taylor expanded in C around 0 48.9%
Final simplification29.4%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* C (* A 4.0)))))
(if (<= B_m 2.9e-180)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (* 2.0 C)))) t_0)
(if (<= B_m 1.8e-138)
(sqrt (- (/ F C)))
(* (/ (- (sqrt 2.0)) B_m) (* (sqrt F) (sqrt B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - (C * (A * 4.0));
double tmp;
if (B_m <= 2.9e-180) {
tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else if (B_m <= 1.8e-138) {
tmp = sqrt(-(F / C));
} else {
tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt(B_m));
}
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) - (c * (a * 4.0d0))
if (b_m <= 2.9d-180) then
tmp = -sqrt(((2.0d0 * (f * t_0)) * (2.0d0 * c))) / t_0
else if (b_m <= 1.8d-138) then
tmp = sqrt(-(f / c))
else
tmp = (-sqrt(2.0d0) / b_m) * (sqrt(f) * sqrt(b_m))
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) - (C * (A * 4.0));
double tmp;
if (B_m <= 2.9e-180) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0;
} else if (B_m <= 1.8e-138) {
tmp = Math.sqrt(-(F / C));
} else {
tmp = (-Math.sqrt(2.0) / B_m) * (Math.sqrt(F) * Math.sqrt(B_m));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.pow(B_m, 2.0) - (C * (A * 4.0)) tmp = 0 if B_m <= 2.9e-180: tmp = -math.sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0 elif B_m <= 1.8e-138: tmp = math.sqrt(-(F / C)) else: tmp = (-math.sqrt(2.0) / B_m) * (math.sqrt(F) * math.sqrt(B_m)) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(C * Float64(A * 4.0))) tmp = 0.0 if (B_m <= 2.9e-180) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(2.0 * C)))) / t_0); elseif (B_m <= 1.8e-138) tmp = sqrt(Float64(-Float64(F / C))); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * Float64(sqrt(F) * sqrt(B_m))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = (B_m ^ 2.0) - (C * (A * 4.0)); tmp = 0.0; if (B_m <= 2.9e-180) tmp = -sqrt(((2.0 * (F * t_0)) * (2.0 * C))) / t_0; elseif (B_m <= 1.8e-138) tmp = sqrt(-(F / C)); else tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt(B_m)); 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[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 2.9e-180], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 1.8e-138], N[Sqrt[(-N[(F / C), $MachinePrecision])], $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B_m}^{2} - C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;B_m \leq 2.9 \cdot 10^{-180}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\
\mathbf{elif}\;B_m \leq 1.8 \cdot 10^{-138}:\\
\;\;\;\;\sqrt{-\frac{F}{C}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B_m} \cdot \left(\sqrt{F} \cdot \sqrt{B_m}\right)\\
\end{array}
\end{array}
if B < 2.8999999999999998e-180Initial program 25.3%
Taylor expanded in A around -inf 18.5%
if 2.8999999999999998e-180 < B < 1.80000000000000009e-138Initial program 4.9%
add-sqr-sqrt4.1%
sqrt-unprod4.4%
frac-times0.8%
Applied egg-rr1.9%
associate-/l*2.3%
associate-*l*2.3%
*-commutative2.3%
unpow22.3%
fma-neg2.3%
distribute-lft-neg-in2.3%
metadata-eval2.3%
*-commutative2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in B around 0 38.1%
mul-1-neg38.1%
Simplified38.1%
if 1.80000000000000009e-138 < B Initial program 21.9%
Taylor expanded in A around 0 18.3%
mul-1-neg18.3%
*-commutative18.3%
distribute-rgt-neg-in18.3%
unpow218.3%
unpow218.3%
hypot-def35.7%
Simplified35.7%
pow1/235.7%
*-commutative35.7%
unpow-prod-down53.5%
pow1/253.5%
pow1/253.5%
Applied egg-rr53.5%
Taylor expanded in C around 0 47.0%
Final simplification29.5%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 1.9e-180)
(sqrt (/ (- F) A))
(if (<= B_m 1.9e-138)
(sqrt (- (/ F C)))
(* (/ (- (sqrt 2.0)) B_m) (* (sqrt F) (sqrt B_m))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.9e-180) {
tmp = sqrt((-F / A));
} else if (B_m <= 1.9e-138) {
tmp = sqrt(-(F / C));
} else {
tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt(B_m));
}
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 (b_m <= 1.9d-180) then
tmp = sqrt((-f / a))
else if (b_m <= 1.9d-138) then
tmp = sqrt(-(f / c))
else
tmp = (-sqrt(2.0d0) / b_m) * (sqrt(f) * sqrt(b_m))
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 (B_m <= 1.9e-180) {
tmp = Math.sqrt((-F / A));
} else if (B_m <= 1.9e-138) {
tmp = Math.sqrt(-(F / C));
} else {
tmp = (-Math.sqrt(2.0) / B_m) * (Math.sqrt(F) * Math.sqrt(B_m));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.9e-180: tmp = math.sqrt((-F / A)) elif B_m <= 1.9e-138: tmp = math.sqrt(-(F / C)) else: tmp = (-math.sqrt(2.0) / B_m) * (math.sqrt(F) * math.sqrt(B_m)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.9e-180) tmp = sqrt(Float64(Float64(-F) / A)); elseif (B_m <= 1.9e-138) tmp = sqrt(Float64(-Float64(F / C))); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * Float64(sqrt(F) * sqrt(B_m))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (B_m <= 1.9e-180) tmp = sqrt((-F / A)); elseif (B_m <= 1.9e-138) tmp = sqrt(-(F / C)); else tmp = (-sqrt(2.0) / B_m) * (sqrt(F) * sqrt(B_m)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.9e-180], N[Sqrt[N[((-F) / A), $MachinePrecision]], $MachinePrecision], If[LessEqual[B$95$m, 1.9e-138], N[Sqrt[(-N[(F / C), $MachinePrecision])], $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;B_m \leq 1.9 \cdot 10^{-180}:\\
\;\;\;\;\sqrt{\frac{-F}{A}}\\
\mathbf{elif}\;B_m \leq 1.9 \cdot 10^{-138}:\\
\;\;\;\;\sqrt{-\frac{F}{C}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B_m} \cdot \left(\sqrt{F} \cdot \sqrt{B_m}\right)\\
\end{array}
\end{array}
if B < 1.9e-180Initial program 25.3%
add-sqr-sqrt5.3%
sqrt-unprod4.6%
frac-times3.7%
Applied egg-rr4.2%
associate-/l*4.9%
associate-*l*4.9%
*-commutative4.9%
unpow24.9%
fma-neg4.9%
distribute-lft-neg-in4.9%
metadata-eval4.9%
*-commutative4.9%
*-commutative4.9%
Simplified4.9%
Taylor expanded in C around inf 11.8%
mul-1-neg11.8%
Simplified11.8%
if 1.9e-180 < B < 1.9000000000000001e-138Initial program 4.9%
add-sqr-sqrt4.1%
sqrt-unprod4.4%
frac-times0.8%
Applied egg-rr1.9%
associate-/l*2.3%
associate-*l*2.3%
*-commutative2.3%
unpow22.3%
fma-neg2.3%
distribute-lft-neg-in2.3%
metadata-eval2.3%
*-commutative2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in B around 0 38.1%
mul-1-neg38.1%
Simplified38.1%
if 1.9000000000000001e-138 < B Initial program 21.9%
Taylor expanded in A around 0 18.3%
mul-1-neg18.3%
*-commutative18.3%
distribute-rgt-neg-in18.3%
unpow218.3%
unpow218.3%
hypot-def35.7%
Simplified35.7%
pow1/235.7%
*-commutative35.7%
unpow-prod-down53.5%
pow1/253.5%
pow1/253.5%
Applied egg-rr53.5%
Taylor expanded in C around 0 47.0%
Final simplification25.5%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F -2e-290)
(sqrt (- (/ F C)))
(if (<= F 1.1e-56)
(* (/ (- (sqrt 2.0)) B_m) (sqrt (* B_m F)))
(* (sqrt 2.0) (- (sqrt (/ F B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -2e-290) {
tmp = sqrt(-(F / C));
} else if (F <= 1.1e-56) {
tmp = (-sqrt(2.0) / B_m) * sqrt((B_m * F));
} else {
tmp = sqrt(2.0) * -sqrt((F / B_m));
}
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 <= (-2d-290)) then
tmp = sqrt(-(f / c))
else if (f <= 1.1d-56) then
tmp = (-sqrt(2.0d0) / b_m) * sqrt((b_m * f))
else
tmp = sqrt(2.0d0) * -sqrt((f / b_m))
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 <= -2e-290) {
tmp = Math.sqrt(-(F / C));
} else if (F <= 1.1e-56) {
tmp = (-Math.sqrt(2.0) / B_m) * Math.sqrt((B_m * F));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B_m));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= -2e-290: tmp = math.sqrt(-(F / C)) elif F <= 1.1e-56: tmp = (-math.sqrt(2.0) / B_m) * math.sqrt((B_m * F)) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B_m)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -2e-290) tmp = sqrt(Float64(-Float64(F / C))); elseif (F <= 1.1e-56) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B_m) * sqrt(Float64(B_m * F))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= -2e-290) tmp = sqrt(-(F / C)); elseif (F <= 1.1e-56) tmp = (-sqrt(2.0) / B_m) * sqrt((B_m * F)); else tmp = sqrt(2.0) * -sqrt((F / B_m)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -2e-290], N[Sqrt[(-N[(F / C), $MachinePrecision])], $MachinePrecision], If[LessEqual[F, 1.1e-56], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision] * N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{-290}:\\
\;\;\;\;\sqrt{-\frac{F}{C}}\\
\mathbf{elif}\;F \leq 1.1 \cdot 10^{-56}:\\
\;\;\;\;\frac{-\sqrt{2}}{B_m} \cdot \sqrt{B_m \cdot F}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\end{array}
\end{array}
if F < -2.0000000000000001e-290Initial program 41.1%
add-sqr-sqrt40.8%
sqrt-unprod29.8%
frac-times25.0%
Applied egg-rr25.2%
associate-/l*29.5%
associate-*l*29.5%
*-commutative29.5%
unpow229.5%
fma-neg29.5%
distribute-lft-neg-in29.5%
metadata-eval29.5%
*-commutative29.5%
*-commutative29.5%
Simplified29.5%
Taylor expanded in B around 0 50.9%
mul-1-neg50.9%
Simplified50.9%
if -2.0000000000000001e-290 < F < 1.10000000000000002e-56Initial program 23.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.8%
Simplified18.8%
Taylor expanded in C around 0 15.4%
if 1.10000000000000002e-56 < F Initial program 20.1%
Taylor expanded in A around 0 7.5%
mul-1-neg7.5%
*-commutative7.5%
distribute-rgt-neg-in7.5%
unpow27.5%
unpow27.5%
hypot-def14.0%
Simplified14.0%
Taylor expanded in C around 0 19.8%
mul-1-neg19.8%
Simplified19.8%
Final simplification21.3%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F -2e-310) (sqrt (- (/ F C))) (* (sqrt 2.0) (- (sqrt (/ F B_m))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -2e-310) {
tmp = sqrt(-(F / C));
} else {
tmp = sqrt(2.0) * -sqrt((F / B_m));
}
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 <= (-2d-310)) then
tmp = sqrt(-(f / c))
else
tmp = sqrt(2.0d0) * -sqrt((f / b_m))
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 <= -2e-310) {
tmp = Math.sqrt(-(F / C));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B_m));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= -2e-310: tmp = math.sqrt(-(F / C)) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B_m)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -2e-310) tmp = sqrt(Float64(-Float64(F / C))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B_m)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= -2e-310) tmp = sqrt(-(F / C)); else tmp = sqrt(2.0) * -sqrt((F / B_m)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -2e-310], N[Sqrt[(-N[(F / C), $MachinePrecision])], $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{-\frac{F}{C}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B_m}}\right)\\
\end{array}
\end{array}
if F < -1.999999999999994e-310Initial program 39.6%
add-sqr-sqrt39.3%
sqrt-unprod28.7%
frac-times24.1%
Applied egg-rr24.4%
associate-/l*28.5%
associate-*l*28.5%
*-commutative28.5%
unpow228.5%
fma-neg28.5%
distribute-lft-neg-in28.5%
metadata-eval28.5%
*-commutative28.5%
*-commutative28.5%
Simplified28.5%
Taylor expanded in B around 0 49.1%
mul-1-neg49.1%
Simplified49.1%
if -1.999999999999994e-310 < F Initial program 21.3%
Taylor expanded in A around 0 8.6%
mul-1-neg8.6%
*-commutative8.6%
distribute-rgt-neg-in8.6%
unpow28.6%
unpow28.6%
hypot-def16.0%
Simplified16.0%
Taylor expanded in C around 0 16.7%
mul-1-neg16.7%
Simplified16.7%
Final simplification20.0%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (sqrt (- (/ F C)))))
(if (<= C -2.2e+42)
t_0
(if (<= C 6.5e-293)
(sqrt (/ (- F) A))
(if (<= C 26000000000000.0) t_0 (* (/ 2.0 B_m) (- (sqrt (* C F)))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt(-(F / C));
double tmp;
if (C <= -2.2e+42) {
tmp = t_0;
} else if (C <= 6.5e-293) {
tmp = sqrt((-F / A));
} else if (C <= 26000000000000.0) {
tmp = t_0;
} else {
tmp = (2.0 / B_m) * -sqrt((C * F));
}
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(-(f / c))
if (c <= (-2.2d+42)) then
tmp = t_0
else if (c <= 6.5d-293) then
tmp = sqrt((-f / a))
else if (c <= 26000000000000.0d0) then
tmp = t_0
else
tmp = (2.0d0 / b_m) * -sqrt((c * f))
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(-(F / C));
double tmp;
if (C <= -2.2e+42) {
tmp = t_0;
} else if (C <= 6.5e-293) {
tmp = Math.sqrt((-F / A));
} else if (C <= 26000000000000.0) {
tmp = t_0;
} else {
tmp = (2.0 / B_m) * -Math.sqrt((C * F));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.sqrt(-(F / C)) tmp = 0 if C <= -2.2e+42: tmp = t_0 elif C <= 6.5e-293: tmp = math.sqrt((-F / A)) elif C <= 26000000000000.0: tmp = t_0 else: tmp = (2.0 / B_m) * -math.sqrt((C * F)) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = sqrt(Float64(-Float64(F / C))) tmp = 0.0 if (C <= -2.2e+42) tmp = t_0; elseif (C <= 6.5e-293) tmp = sqrt(Float64(Float64(-F) / A)); elseif (C <= 26000000000000.0) tmp = t_0; else tmp = Float64(Float64(2.0 / B_m) * Float64(-sqrt(Float64(C * F)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = sqrt(-(F / C)); tmp = 0.0; if (C <= -2.2e+42) tmp = t_0; elseif (C <= 6.5e-293) tmp = sqrt((-F / A)); elseif (C <= 26000000000000.0) tmp = t_0; else tmp = (2.0 / B_m) * -sqrt((C * F)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[Sqrt[(-N[(F / C), $MachinePrecision])], $MachinePrecision]}, If[LessEqual[C, -2.2e+42], t$95$0, If[LessEqual[C, 6.5e-293], N[Sqrt[N[((-F) / A), $MachinePrecision]], $MachinePrecision], If[LessEqual[C, 26000000000000.0], t$95$0, N[(N[(2.0 / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \sqrt{-\frac{F}{C}}\\
\mathbf{if}\;C \leq -2.2 \cdot 10^{+42}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;C \leq 6.5 \cdot 10^{-293}:\\
\;\;\;\;\sqrt{\frac{-F}{A}}\\
\mathbf{elif}\;C \leq 26000000000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{B_m} \cdot \left(-\sqrt{C \cdot F}\right)\\
\end{array}
\end{array}
if C < -2.2000000000000001e42 or 6.50000000000000033e-293 < C < 2.6e13Initial program 21.2%
add-sqr-sqrt6.5%
sqrt-unprod5.2%
frac-times4.3%
Applied egg-rr4.8%
associate-/l*5.6%
associate-*l*5.6%
*-commutative5.6%
unpow25.6%
fma-neg5.6%
distribute-lft-neg-in5.6%
metadata-eval5.6%
*-commutative5.6%
*-commutative5.6%
Simplified5.6%
Taylor expanded in B around 0 15.4%
mul-1-neg15.4%
Simplified15.4%
if -2.2000000000000001e42 < C < 6.50000000000000033e-293Initial program 24.8%
add-sqr-sqrt1.1%
sqrt-unprod1.6%
frac-times0.9%
Applied egg-rr1.4%
associate-/l*1.4%
associate-*l*1.4%
*-commutative1.4%
unpow21.4%
fma-neg1.4%
distribute-lft-neg-in1.4%
metadata-eval1.4%
*-commutative1.4%
*-commutative1.4%
Simplified1.4%
Taylor expanded in C around inf 17.6%
mul-1-neg17.6%
Simplified17.6%
if 2.6e13 < C Initial program 24.9%
Taylor expanded in A around 0 5.9%
mul-1-neg5.9%
*-commutative5.9%
distribute-rgt-neg-in5.9%
unpow25.9%
unpow25.9%
hypot-def13.5%
Simplified13.5%
pow1/213.7%
*-commutative13.7%
unpow-prod-down24.7%
pow1/224.7%
pow1/224.7%
Applied egg-rr24.7%
Taylor expanded in B around 0 12.0%
mul-1-neg12.0%
distribute-rgt-neg-in12.0%
unpow212.0%
rem-square-sqrt12.1%
Simplified12.1%
Final simplification15.5%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (or (<= A -1.35e-51) (and (not (<= A 5.2e-242)) (<= A 3.4e+15))) (sqrt (/ (- F) A)) (sqrt (- (/ F C)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if ((A <= -1.35e-51) || (!(A <= 5.2e-242) && (A <= 3.4e+15))) {
tmp = sqrt((-F / A));
} else {
tmp = sqrt(-(F / C));
}
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.35d-51)) .or. (.not. (a <= 5.2d-242)) .and. (a <= 3.4d+15)) then
tmp = sqrt((-f / a))
else
tmp = sqrt(-(f / c))
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.35e-51) || (!(A <= 5.2e-242) && (A <= 3.4e+15))) {
tmp = Math.sqrt((-F / A));
} else {
tmp = Math.sqrt(-(F / C));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if (A <= -1.35e-51) or (not (A <= 5.2e-242) and (A <= 3.4e+15)): tmp = math.sqrt((-F / A)) else: tmp = math.sqrt(-(F / C)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if ((A <= -1.35e-51) || (!(A <= 5.2e-242) && (A <= 3.4e+15))) tmp = sqrt(Float64(Float64(-F) / A)); else tmp = sqrt(Float64(-Float64(F / C))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if ((A <= -1.35e-51) || (~((A <= 5.2e-242)) && (A <= 3.4e+15))) tmp = sqrt((-F / A)); else tmp = sqrt(-(F / C)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[Or[LessEqual[A, -1.35e-51], And[N[Not[LessEqual[A, 5.2e-242]], $MachinePrecision], LessEqual[A, 3.4e+15]]], N[Sqrt[N[((-F) / A), $MachinePrecision]], $MachinePrecision], N[Sqrt[(-N[(F / C), $MachinePrecision])], $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.35 \cdot 10^{-51} \lor \neg \left(A \leq 5.2 \cdot 10^{-242}\right) \land A \leq 3.4 \cdot 10^{+15}:\\
\;\;\;\;\sqrt{\frac{-F}{A}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{-\frac{F}{C}}\\
\end{array}
\end{array}
if A < -1.3499999999999999e-51 or 5.20000000000000034e-242 < A < 3.4e15Initial program 19.8%
add-sqr-sqrt4.6%
sqrt-unprod3.6%
frac-times2.7%
Applied egg-rr3.2%
associate-/l*3.3%
associate-*l*3.3%
*-commutative3.3%
unpow23.3%
fma-neg3.3%
distribute-lft-neg-in3.3%
metadata-eval3.3%
*-commutative3.3%
*-commutative3.3%
Simplified3.4%
Taylor expanded in C around inf 19.7%
mul-1-neg19.7%
Simplified19.7%
if -1.3499999999999999e-51 < A < 5.20000000000000034e-242 or 3.4e15 < A Initial program 26.6%
add-sqr-sqrt4.6%
sqrt-unprod4.3%
frac-times3.8%
Applied egg-rr4.1%
associate-/l*5.0%
associate-*l*5.0%
*-commutative5.0%
unpow25.0%
fma-neg5.0%
distribute-lft-neg-in5.0%
metadata-eval5.0%
*-commutative5.0%
*-commutative5.0%
Simplified4.9%
Taylor expanded in B around 0 14.0%
mul-1-neg14.0%
Simplified14.0%
Final simplification16.9%
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 23.2%
add-sqr-sqrt4.6%
sqrt-unprod4.0%
frac-times3.2%
Applied egg-rr3.7%
associate-/l*4.1%
associate-*l*4.1%
*-commutative4.1%
unpow24.1%
fma-neg4.1%
distribute-lft-neg-in4.1%
metadata-eval4.1%
*-commutative4.1%
*-commutative4.1%
Simplified4.1%
Taylor expanded in C around inf 10.9%
mul-1-neg10.9%
Simplified10.9%
Final simplification10.9%
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(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 23.2%
add-sqr-sqrt4.6%
sqrt-unprod4.0%
frac-times3.2%
Applied egg-rr3.7%
associate-/l*4.1%
associate-*l*4.1%
*-commutative4.1%
unpow24.1%
fma-neg4.1%
distribute-lft-neg-in4.1%
metadata-eval4.1%
*-commutative4.1%
*-commutative4.1%
Simplified4.1%
Taylor expanded in C around inf 10.9%
mul-1-neg10.9%
Simplified10.9%
expm1-log1p-u10.7%
expm1-udef6.8%
add-sqr-sqrt6.8%
sqrt-unprod6.8%
sqr-neg6.8%
sqrt-unprod1.4%
add-sqr-sqrt1.4%
Applied egg-rr1.4%
expm1-def1.2%
expm1-log1p1.2%
Simplified1.2%
Final simplification1.2%
herbie shell --seed 2023334
(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))))