
(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 9 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
(/
(* (sqrt (+ (+ A C) (hypot (- A C) B_m))) (sqrt (* t_0 (* 2.0 F))))
(- t_0)))
(t_2 (* (* 4.0 A) C))
(t_3 (- (pow B_m 2.0) t_2))
(t_4 (* t_3 F))
(t_5
(/
(sqrt
(*
(* 2.0 t_4)
(+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
(- t_2 (pow B_m 2.0)))))
(if (<= t_5 -5e-194)
t_1
(if (<= t_5 1e-63)
(*
(sqrt (* 2.0 (* t_4 (fma 2.0 A (/ (* (pow B_m 2.0) -0.5) C)))))
(/ -1.0 t_3))
(if (<= t_5 INFINITY) t_1 (* (sqrt (/ F B_m)) (- (sqrt 2.0))))))))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((t_0 * (2.0 * F)))) / -t_0;
double t_2 = (4.0 * A) * C;
double t_3 = pow(B_m, 2.0) - t_2;
double t_4 = t_3 * F;
double t_5 = sqrt(((2.0 * t_4) * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_2 - pow(B_m, 2.0));
double tmp;
if (t_5 <= -5e-194) {
tmp = t_1;
} else if (t_5 <= 1e-63) {
tmp = sqrt((2.0 * (t_4 * fma(2.0, A, ((pow(B_m, 2.0) * -0.5) / C))))) * (-1.0 / t_3);
} else if (t_5 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_1 = Float64(Float64(sqrt(Float64(Float64(A + C) + hypot(Float64(A - C), B_m))) * sqrt(Float64(t_0 * Float64(2.0 * F)))) / Float64(-t_0)) t_2 = Float64(Float64(4.0 * A) * C) t_3 = Float64((B_m ^ 2.0) - t_2) t_4 = Float64(t_3 * F) t_5 = Float64(sqrt(Float64(Float64(2.0 * t_4) * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_2 - (B_m ^ 2.0))) tmp = 0.0 if (t_5 <= -5e-194) tmp = t_1; elseif (t_5 <= 1e-63) tmp = Float64(sqrt(Float64(2.0 * Float64(t_4 * fma(2.0, A, Float64(Float64((B_m ^ 2.0) * -0.5) / C))))) * Float64(-1.0 / t_3)); elseif (t_5 <= Inf) tmp = t_1; else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); 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[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-t$95$0)), $MachinePrecision]}, Block[{t$95$2 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * F), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[N[(N[(2.0 * t$95$4), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$2 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, -5e-194], t$95$1, If[LessEqual[t$95$5, 1e-63], N[(N[Sqrt[N[(2.0 * N[(t$95$4 * N[(2.0 * A + N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * -0.5), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, Infinity], t$95$1, 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}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \frac{\sqrt{\left(A + C\right) + \mathsf{hypot}\left(A - C, B\_m\right)} \cdot \sqrt{t\_0 \cdot \left(2 \cdot F\right)}}{-t\_0}\\
t_2 := \left(4 \cdot A\right) \cdot C\\
t_3 := {B\_m}^{2} - t\_2\\
t_4 := t\_3 \cdot F\\
t_5 := \frac{\sqrt{\left(2 \cdot t\_4\right) \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_2 - {B\_m}^{2}}\\
\mathbf{if}\;t\_5 \leq -5 \cdot 10^{-194}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_5 \leq 10^{-63}:\\
\;\;\;\;\sqrt{2 \cdot \left(t\_4 \cdot \mathsf{fma}\left(2, A, \frac{{B\_m}^{2} \cdot -0.5}{C}\right)\right)} \cdot \frac{-1}{t\_3}\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -5.0000000000000002e-194 or 1.00000000000000007e-63 < (/.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 43.8%
Simplified51.5%
pow1/251.5%
*-commutative51.5%
unpow-prod-down64.8%
pow1/264.8%
+-commutative64.8%
hypot-undefine47.4%
unpow247.4%
unpow247.4%
+-commutative47.4%
unpow247.4%
unpow247.4%
hypot-define64.8%
pow1/264.8%
*-commutative64.8%
Applied egg-rr64.8%
if -5.0000000000000002e-194 < (/.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))) < 1.00000000000000007e-63Initial program 16.2%
Taylor expanded in C around -inf 61.1%
div-inv61.2%
Applied egg-rr61.2%
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%
Simplified0.6%
Taylor expanded in B around inf 1.0%
Taylor expanded in A around 0 20.3%
mul-1-neg20.3%
Simplified20.3%
Final simplification42.5%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C)) (t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= F -5e-310)
(/
(* (sqrt (+ (+ A C) (hypot (- A C) B_m))) (sqrt (* t_1 (* 2.0 F))))
(- t_1))
(if (<= F 2.5e+49)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot B_m C))))))
(if (<= F 1.1e+58)
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_0) F))
(+ (* -0.5 (/ (pow B_m 2.0) C)) (* 2.0 A))))
(- t_0 (pow B_m 2.0)))
(* (sqrt (/ F B_m)) (- (sqrt 2.0))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (F <= -5e-310) {
tmp = (sqrt(((A + C) + hypot((A - C), B_m))) * sqrt((t_1 * (2.0 * F)))) / -t_1;
} else if (F <= 2.5e+49) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C))));
} else if (F <= 1.1e+58) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * ((-0.5 * (pow(B_m, 2.0) / C)) + (2.0 * A)))) / (t_0 - pow(B_m, 2.0));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (F <= -5e-310) tmp = Float64(Float64(sqrt(Float64(Float64(A + C) + hypot(Float64(A - C), B_m))) * sqrt(Float64(t_1 * Float64(2.0 * F)))) / Float64(-t_1)); elseif (F <= 2.5e+49) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))); elseif (F <= 1.1e+58) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / C)) + Float64(2.0 * A)))) / Float64(t_0 - (B_m ^ 2.0))); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e-310], N[(N[(N[Sqrt[N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[F, 2.5e+49], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 1.1e+58], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision] + N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $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}
t_0 := \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}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{\left(A + C\right) + \mathsf{hypot}\left(A - C, B\_m\right)} \cdot \sqrt{t\_1 \cdot \left(2 \cdot F\right)}}{-t\_1}\\
\mathbf{elif}\;F \leq 2.5 \cdot 10^{+49}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{elif}\;F \leq 1.1 \cdot 10^{+58}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{C} + 2 \cdot A\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 38.3%
Simplified59.5%
pow1/259.5%
*-commutative59.5%
unpow-prod-down70.2%
pow1/270.2%
+-commutative70.2%
hypot-undefine38.2%
unpow238.2%
unpow238.2%
+-commutative38.2%
unpow238.2%
unpow238.2%
hypot-define70.2%
pow1/270.2%
*-commutative70.2%
Applied egg-rr70.2%
if -4.999999999999985e-310 < F < 2.5000000000000002e49Initial program 21.2%
Taylor expanded in A around 0 13.2%
mul-1-neg13.2%
unpow213.2%
unpow213.2%
hypot-define32.4%
Simplified32.4%
if 2.5000000000000002e49 < F < 1.1e58Initial program 51.5%
Taylor expanded in C around -inf 83.1%
if 1.1e58 < F Initial program 9.2%
Simplified9.4%
Taylor expanded in B around inf 1.8%
Taylor expanded in A around 0 20.4%
mul-1-neg20.4%
Simplified20.4%
Final simplification32.8%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))) (t_1 (* (* 4.0 A) C)))
(if (<= F 9.5e-294)
(/ (sqrt (* (* t_0 (* 2.0 F)) (+ (+ A C) (hypot B_m (- A C))))) (- t_0))
(if (<= F 1.04e+49)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot B_m C))))))
(if (<= F 1.1e+58)
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_1) F))
(+ (* -0.5 (/ (pow B_m 2.0) C)) (* 2.0 A))))
(- t_1 (pow B_m 2.0)))
(* (sqrt (/ F B_m)) (- (sqrt 2.0))))))))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 = (4.0 * A) * C;
double tmp;
if (F <= 9.5e-294) {
tmp = sqrt(((t_0 * (2.0 * F)) * ((A + C) + hypot(B_m, (A - C))))) / -t_0;
} else if (F <= 1.04e+49) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C))));
} else if (F <= 1.1e+58) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_1) * F)) * ((-0.5 * (pow(B_m, 2.0) / C)) + (2.0 * A)))) / (t_1 - pow(B_m, 2.0));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
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(4.0 * A) * C) tmp = 0.0 if (F <= 9.5e-294) tmp = Float64(sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(Float64(A + C) + hypot(B_m, Float64(A - C))))) / Float64(-t_0)); elseif (F <= 1.04e+49) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))); elseif (F <= 1.1e+58) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_1) * F)) * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / C)) + Float64(2.0 * A)))) / Float64(t_1 - (B_m ^ 2.0))); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); 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[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[F, 9.5e-294], N[(N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[F, 1.04e+49], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 1.1e+58], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision] + N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$1 - N[Power[B$95$m, 2.0], $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}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;F \leq 9.5 \cdot 10^{-294}:\\
\;\;\;\;\frac{\sqrt{\left(t\_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)}}{-t\_0}\\
\mathbf{elif}\;F \leq 1.04 \cdot 10^{+49}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{elif}\;F \leq 1.1 \cdot 10^{+58}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_1\right) \cdot F\right)\right) \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{C} + 2 \cdot A\right)}}{t\_1 - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < 9.499999999999999e-294Initial program 39.1%
Simplified59.2%
if 9.499999999999999e-294 < F < 1.03999999999999998e49Initial program 20.8%
Taylor expanded in A around 0 12.6%
mul-1-neg12.6%
unpow212.6%
unpow212.6%
hypot-define32.1%
Simplified32.1%
if 1.03999999999999998e49 < F < 1.1e58Initial program 51.5%
Taylor expanded in C around -inf 83.1%
if 1.1e58 < F Initial program 9.2%
Simplified9.4%
Taylor expanded in B around inf 1.8%
Taylor expanded in A around 0 20.4%
mul-1-neg20.4%
Simplified20.4%
Final simplification31.7%
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)))))
(if (<= F 9.5e-294)
(/ (sqrt (* (* t_0 (* 2.0 F)) (+ (+ A C) (hypot B_m (- A C))))) (- t_0))
(if (<= F 1.95e+46)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot B_m C))))))
(* (sqrt (/ F B_m)) (- (sqrt 2.0)))))))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 tmp;
if (F <= 9.5e-294) {
tmp = sqrt(((t_0 * (2.0 * F)) * ((A + C) + hypot(B_m, (A - C))))) / -t_0;
} else if (F <= 1.95e+46) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C))));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
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))) tmp = 0.0 if (F <= 9.5e-294) tmp = Float64(sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(Float64(A + C) + hypot(B_m, Float64(A - C))))) / Float64(-t_0)); elseif (F <= 1.95e+46) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); 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]}, If[LessEqual[F, 9.5e-294], N[(N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[F, 1.95e+46], N[(N[(N[Sqrt[2.0], $MachinePrecision] / 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] * (-N[Sqrt[2.0], $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)\\
\mathbf{if}\;F \leq 9.5 \cdot 10^{-294}:\\
\;\;\;\;\frac{\sqrt{\left(t\_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)}}{-t\_0}\\
\mathbf{elif}\;F \leq 1.95 \cdot 10^{+46}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < 9.499999999999999e-294Initial program 39.1%
Simplified59.2%
if 9.499999999999999e-294 < F < 1.94999999999999997e46Initial program 20.8%
Taylor expanded in A around 0 12.6%
mul-1-neg12.6%
unpow212.6%
unpow212.6%
hypot-define32.1%
Simplified32.1%
if 1.94999999999999997e46 < F Initial program 11.5%
Simplified11.7%
Taylor expanded in B around inf 1.9%
Taylor expanded in A around 0 19.6%
mul-1-neg19.6%
Simplified19.6%
Final simplification29.9%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F -5e-310)
(/
(sqrt (* (+ (+ A C) (hypot B_m (- A C))) (* -8.0 (* A (* C F)))))
(- (fma B_m B_m (* A (* C -4.0)))))
(if (<= F 1.4e+43)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot B_m C))))))
(* (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((((A + C) + hypot(B_m, (A - C))) * (-8.0 * (A * (C * F))))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else if (F <= 1.4e+43) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C))));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -5e-310) tmp = Float64(sqrt(Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) * Float64(-8.0 * Float64(A * Float64(C * F))))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif (F <= 1.4e+43) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -5e-310], N[(N[Sqrt[N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(-8.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 1.4e+43], N[(N[(N[Sqrt[2.0], $MachinePrecision] / 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] * (-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}:\\
\;\;\;\;\frac{\sqrt{\left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right) \cdot \left(-8 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;F \leq 1.4 \cdot 10^{+43}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 38.3%
Simplified59.5%
Taylor expanded in B around 0 51.3%
if -4.999999999999985e-310 < F < 1.40000000000000009e43Initial program 21.2%
Taylor expanded in A around 0 13.2%
mul-1-neg13.2%
unpow213.2%
unpow213.2%
hypot-define32.4%
Simplified32.4%
if 1.40000000000000009e43 < F Initial program 11.5%
Simplified11.7%
Taylor expanded in B around inf 1.9%
Taylor expanded in A around 0 19.6%
mul-1-neg19.6%
Simplified19.6%
Final simplification29.0%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F -5e-310)
(/
(sqrt (* (* C F) (* -16.0 (pow A 2.0))))
(- (* 4.0 (* A C)) (pow B_m 2.0)))
(if (<= F 1.7e+43)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot B_m C))))))
(* (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(((C * F) * (-16.0 * pow(A, 2.0)))) / ((4.0 * (A * C)) - pow(B_m, 2.0));
} else if (F <= 1.7e+43) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C))));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
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(((C * F) * (-16.0 * Math.pow(A, 2.0)))) / ((4.0 * (A * C)) - Math.pow(B_m, 2.0));
} else if (F <= 1.7e+43) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (C + Math.hypot(B_m, C))));
} 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(((C * F) * (-16.0 * math.pow(A, 2.0)))) / ((4.0 * (A * C)) - math.pow(B_m, 2.0)) elif F <= 1.7e+43: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (C + math.hypot(B_m, C)))) 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 = Float64(sqrt(Float64(Float64(C * F) * Float64(-16.0 * (A ^ 2.0)))) / Float64(Float64(4.0 * Float64(A * C)) - (B_m ^ 2.0))); elseif (F <= 1.7e+43) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))); 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(((C * F) * (-16.0 * (A ^ 2.0)))) / ((4.0 * (A * C)) - (B_m ^ 2.0)); elseif (F <= 1.7e+43) tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C)))); 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[(N[Sqrt[N[(N[(C * F), $MachinePrecision] * N[(-16.0 * N[Power[A, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.7e+43], N[(N[(N[Sqrt[2.0], $MachinePrecision] / 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] * (-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}:\\
\;\;\;\;\frac{\sqrt{\left(C \cdot F\right) \cdot \left(-16 \cdot {A}^{2}\right)}}{4 \cdot \left(A \cdot C\right) - {B\_m}^{2}}\\
\mathbf{elif}\;F \leq 1.7 \cdot 10^{+43}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < -4.999999999999985e-310Initial program 38.3%
Simplified55.9%
Taylor expanded in A around inf 27.6%
associate-*r*27.6%
Simplified27.6%
if -4.999999999999985e-310 < F < 1.70000000000000006e43Initial program 21.2%
Taylor expanded in A around 0 13.2%
mul-1-neg13.2%
unpow213.2%
unpow213.2%
hypot-define32.4%
Simplified32.4%
if 1.70000000000000006e43 < F Initial program 11.5%
Simplified11.7%
Taylor expanded in B around inf 1.9%
Taylor expanded in A around 0 19.6%
mul-1-neg19.6%
Simplified19.6%
Final simplification26.5%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 1.35e+17) (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ A (hypot B_m 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 <= 1.35e+17) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A + hypot(B_m, A))));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.35e+17) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (A + Math.hypot(B_m, 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 <= 1.35e+17: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (A + math.hypot(B_m, 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 <= 1.35e+17) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A + hypot(B_m, 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 <= 1.35e+17) tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A + hypot(B_m, 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, 1.35e+17], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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 1.35 \cdot 10^{+17}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < 1.35e17Initial program 23.8%
Taylor expanded in C around 0 8.0%
mul-1-neg8.0%
+-commutative8.0%
unpow28.0%
unpow28.0%
hypot-define24.5%
Simplified24.5%
if 1.35e17 < F Initial program 13.6%
Simplified13.8%
Taylor expanded in B around inf 2.7%
Taylor expanded in A around 0 19.3%
mul-1-neg19.3%
Simplified19.3%
Final simplification22.0%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (<= F 2.15e+43) (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot B_m C)))))) (* (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 <= 2.15e+43) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C))));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 2.15e+43) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (C + Math.hypot(B_m, C))));
} 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 <= 2.15e+43: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (C + math.hypot(B_m, C)))) 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 <= 2.15e+43) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))); 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 <= 2.15e+43) tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C)))); 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, 2.15e+43], N[(N[(N[Sqrt[2.0], $MachinePrecision] / 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] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq 2.15 \cdot 10^{+43}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < 2.15e43Initial program 24.3%
Taylor expanded in A around 0 10.8%
mul-1-neg10.8%
unpow210.8%
unpow210.8%
hypot-define26.5%
Simplified26.5%
if 2.15e43 < F Initial program 11.5%
Simplified11.7%
Taylor expanded in B around inf 1.9%
Taylor expanded in A around 0 19.6%
mul-1-neg19.6%
Simplified19.6%
Final simplification23.6%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (* (sqrt (/ F B_m)) (- (sqrt 2.0))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return sqrt((F / B_m)) * -sqrt(2.0);
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((f / b_m)) * -sqrt(2.0d0)
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
B_m = math.fabs(B) def code(A, B_m, C, F): return math.sqrt((F / B_m)) * -math.sqrt(2.0)
B_m = abs(B) function code(A, B_m, C, F) return Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = sqrt((F / B_m)) * -sqrt(2.0); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)
\end{array}
Initial program 19.0%
Simplified20.9%
Taylor expanded in B around inf 4.7%
Taylor expanded in A around 0 16.4%
mul-1-neg16.4%
Simplified16.4%
Final simplification16.4%
herbie shell --seed 2024039
(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))))