
(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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1 (fma C (* A -4.0) (* B B)))
(t_2 (- (pow B 2.0) (* (* 4.0 A) C)))
(t_3
(/
(-
(sqrt
(*
(* 2.0 (* t_2 F))
(+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
t_2))
(t_4
(/
(* (sqrt (* 2.0 (* F t_0))) (- (sqrt (+ C (+ A (hypot B (- A C)))))))
t_0)))
(if (<= t_3 -1e-204)
t_4
(if (<= t_3 2e+17)
(/
(- (sqrt (* 2.0 (* (* F t_1) (fma 2.0 C (* -0.5 (/ (* B B) A)))))))
t_1)
(if (<= t_3 INFINITY)
t_4
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt (+ A (hypot B A)))))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = fma(C, (A * -4.0), (B * B));
double t_2 = pow(B, 2.0) - ((4.0 * A) * C);
double t_3 = -sqrt(((2.0 * (t_2 * F)) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_2;
double t_4 = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (A + hypot(B, (A - C)))))) / t_0;
double tmp;
if (t_3 <= -1e-204) {
tmp = t_4;
} else if (t_3 <= 2e+17) {
tmp = -sqrt((2.0 * ((F * t_1) * fma(2.0, C, (-0.5 * ((B * B) / A)))))) / t_1;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_4;
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((A + hypot(B, A))));
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = fma(C, Float64(A * -4.0), Float64(B * B)) t_2 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_3 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_2) t_4 = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) * Float64(-sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))))) / t_0) tmp = 0.0 if (t_3 <= -1e-204) tmp = t_4; elseif (t_3 <= 2e+17) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_1) * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A))))))) / t_1); elseif (t_3 <= Inf) tmp = t_4; else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(Float64(A + hypot(B, A)))))); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C * N[(A * -4.0), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[t$95$3, -1e-204], t$95$4, If[LessEqual[t$95$3, 2e+17], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$4, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \mathsf{fma}\left(C, A \cdot -4, B \cdot B\right)\\
t_2 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_3 := \frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_2}\\
t_4 := \frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{t_0}\\
\mathbf{if}\;t_3 \leq -1 \cdot 10^{-204}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;t_3 \leq 2 \cdot 10^{+17}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_1\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)\right)}}{t_1}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_4\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(B, A\right)}\right)\right)\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -1e-204 or 2e17 < (/.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 40.8%
associate-*l*40.8%
unpow240.8%
+-commutative40.8%
unpow240.8%
associate-*l*40.8%
unpow240.8%
Simplified40.8%
sqrt-prod44.2%
*-commutative44.2%
*-commutative44.2%
associate-+l+44.2%
unpow244.2%
hypot-udef65.1%
associate-+r+65.0%
+-commutative65.0%
associate-+r+65.8%
Applied egg-rr65.8%
if -1e-204 < (/.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))) < 2e17Initial program 6.6%
Simplified12.4%
Taylor expanded in A around -inf 40.1%
fma-def40.1%
unpow240.1%
Simplified40.1%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 0.0%
Simplified0.6%
Taylor expanded in C around 0 1.8%
mul-1-neg1.8%
distribute-rgt-neg-in1.8%
unpow21.8%
unpow21.8%
hypot-def24.5%
Simplified24.5%
sqrt-prod34.2%
Applied egg-rr34.2%
Final simplification50.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B 1.18e+100)
(/
(* (sqrt (* 2.0 (* F t_0))) (- (sqrt (+ C (+ A (hypot B (- A C)))))))
t_0)
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt (+ A (hypot B A)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 1.18e+100) {
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (A + hypot(B, (A - C)))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((A + hypot(B, A))));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 1.18e+100) {
tmp = (Math.sqrt((2.0 * (F * t_0))) * -Math.sqrt((C + (A + Math.hypot(B, (A - C)))))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt(F) * -Math.sqrt((A + Math.hypot(B, A))));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 1.18e+100: tmp = (math.sqrt((2.0 * (F * t_0))) * -math.sqrt((C + (A + math.hypot(B, (A - C)))))) / t_0 else: tmp = (math.sqrt(2.0) / B) * (math.sqrt(F) * -math.sqrt((A + math.hypot(B, A)))) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= 1.18e+100) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) * Float64(-sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(Float64(A + hypot(B, A)))))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); tmp = 0.0; if (B <= 1.18e+100) tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (A + hypot(B, (A - C)))))) / t_0; else tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((A + hypot(B, A)))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.18e+100], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 1.18 \cdot 10^{+100}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(B, A\right)}\right)\right)\\
\end{array}
\end{array}
if B < 1.18e100Initial program 23.8%
associate-*l*23.8%
unpow223.8%
+-commutative23.8%
unpow223.8%
associate-*l*23.8%
unpow223.8%
Simplified23.8%
sqrt-prod25.7%
*-commutative25.7%
*-commutative25.7%
associate-+l+26.1%
unpow226.1%
hypot-udef37.9%
associate-+r+37.4%
+-commutative37.4%
associate-+r+38.5%
Applied egg-rr38.5%
if 1.18e100 < B Initial program 2.9%
Simplified2.9%
Taylor expanded in C around 0 7.2%
mul-1-neg7.2%
distribute-rgt-neg-in7.2%
unpow27.2%
unpow27.2%
hypot-def55.2%
Simplified55.2%
sqrt-prod81.2%
Applied egg-rr81.2%
Final simplification45.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B 9.4e+100)
(/
(* (sqrt (* 2.0 (* F t_0))) (- (sqrt (+ C (+ A (hypot B (- A C)))))))
t_0)
(/ (* (sqrt 2.0) (- (sqrt (* F (+ A (hypot B A)))))) B))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 9.4e+100) {
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (A + hypot(B, (A - C)))))) / t_0;
} else {
tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(B, A))))) / B;
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 9.4e+100) {
tmp = (Math.sqrt((2.0 * (F * t_0))) * -Math.sqrt((C + (A + Math.hypot(B, (A - C)))))) / t_0;
} else {
tmp = (Math.sqrt(2.0) * -Math.sqrt((F * (A + Math.hypot(B, A))))) / B;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 9.4e+100: tmp = (math.sqrt((2.0 * (F * t_0))) * -math.sqrt((C + (A + math.hypot(B, (A - C)))))) / t_0 else: tmp = (math.sqrt(2.0) * -math.sqrt((F * (A + math.hypot(B, A))))) / B return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= 9.4e+100) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) * Float64(-sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A + hypot(B, A)))))) / B); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); tmp = 0.0; if (B <= 9.4e+100) tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (A + hypot(B, (A - C)))))) / t_0; else tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(B, A))))) / B; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 9.4e+100], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 9.4 \cdot 10^{+100}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)}\right)}{B}\\
\end{array}
\end{array}
if B < 9.4e100Initial program 23.8%
associate-*l*23.8%
unpow223.8%
+-commutative23.8%
unpow223.8%
associate-*l*23.8%
unpow223.8%
Simplified23.8%
sqrt-prod25.7%
*-commutative25.7%
*-commutative25.7%
associate-+l+26.1%
unpow226.1%
hypot-udef37.9%
associate-+r+37.4%
+-commutative37.4%
associate-+r+38.5%
Applied egg-rr38.5%
if 9.4e100 < B Initial program 2.9%
Simplified2.9%
Taylor expanded in C around 0 7.2%
mul-1-neg7.2%
distribute-rgt-neg-in7.2%
unpow27.2%
unpow27.2%
hypot-def55.2%
Simplified55.2%
associate-*l/55.3%
Applied egg-rr55.3%
Final simplification41.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1 (fma B B (* C (* A -4.0))))
(t_2 (fma C (* A -4.0) (* B B))))
(if (<= B 1.035e-283)
(/ (- (sqrt (* (* 2.0 (* F t_1)) (+ A A)))) t_1)
(if (<= B 1.08e-74)
(/ (- (sqrt (* 2.0 (* (* F t_2) (+ C C))))) t_2)
(if (<= B 2.3e+46)
(/ (- (sqrt (* 2.0 (* (* F t_0) (+ C (+ A (hypot B (- A C)))))))) t_0)
(/ (* (sqrt 2.0) (- (sqrt (* F (+ A (hypot B A)))))) B))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = fma(B, B, (C * (A * -4.0)));
double t_2 = fma(C, (A * -4.0), (B * B));
double tmp;
if (B <= 1.035e-283) {
tmp = -sqrt(((2.0 * (F * t_1)) * (A + A))) / t_1;
} else if (B <= 1.08e-74) {
tmp = -sqrt((2.0 * ((F * t_2) * (C + C)))) / t_2;
} else if (B <= 2.3e+46) {
tmp = -sqrt((2.0 * ((F * t_0) * (C + (A + hypot(B, (A - C))))))) / t_0;
} else {
tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(B, A))))) / B;
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = fma(B, B, Float64(C * Float64(A * -4.0))) t_2 = fma(C, Float64(A * -4.0), Float64(B * B)) tmp = 0.0 if (B <= 1.035e-283) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(A + A)))) / t_1); elseif (B <= 1.08e-74) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_2) * Float64(C + C))))) / t_2); elseif (B <= 2.3e+46) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(C + Float64(A + hypot(B, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A + hypot(B, A)))))) / B); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(C * N[(A * -4.0), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.035e-283], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 1.08e-74], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$2), $MachinePrecision] * N[(C + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 2.3e+46], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_2 := \mathsf{fma}\left(C, A \cdot -4, B \cdot B\right)\\
\mathbf{if}\;B \leq 1.035 \cdot 10^{-283}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{elif}\;B \leq 1.08 \cdot 10^{-74}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_2\right) \cdot \left(C + C\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 2.3 \cdot 10^{+46}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)}\right)}{B}\\
\end{array}
\end{array}
if B < 1.035e-283Initial program 14.0%
Simplified21.6%
Taylor expanded in A around inf 13.1%
distribute-rgt1-in13.1%
metadata-eval13.1%
mul0-lft13.1%
Simplified13.1%
if 1.035e-283 < B < 1.0799999999999999e-74Initial program 25.5%
Simplified33.6%
Taylor expanded in A around -inf 40.9%
if 1.0799999999999999e-74 < B < 2.3000000000000001e46Initial program 48.3%
associate-*l*48.3%
unpow248.3%
+-commutative48.3%
unpow248.3%
associate-*l*48.3%
unpow248.3%
Simplified48.3%
distribute-frac-neg48.3%
Applied egg-rr57.4%
if 2.3000000000000001e46 < B Initial program 10.5%
Simplified12.5%
Taylor expanded in C around 0 16.1%
mul-1-neg16.1%
distribute-rgt-neg-in16.1%
unpow216.1%
unpow216.1%
hypot-def55.7%
Simplified55.7%
associate-*l/55.7%
Applied egg-rr55.7%
Final simplification33.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma C (* A -4.0) (* B B))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B 1.35e-74)
(/ (- (sqrt (* 2.0 (* (* F t_0) (+ C C))))) t_0)
(if (<= B 1.55e+47)
(/ (- (sqrt (* 2.0 (* (* F t_1) (+ C (+ A (hypot B (- A C)))))))) t_1)
(/ (* (sqrt 2.0) (- (sqrt (* F (+ A (hypot B A)))))) B)))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = fma(C, (A * -4.0), (B * B));
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 1.35e-74) {
tmp = -sqrt((2.0 * ((F * t_0) * (C + C)))) / t_0;
} else if (B <= 1.55e+47) {
tmp = -sqrt((2.0 * ((F * t_1) * (C + (A + hypot(B, (A - C))))))) / t_1;
} else {
tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(B, A))))) / B;
}
return tmp;
}
B = abs(B) function code(A, B, C, F) t_0 = fma(C, Float64(A * -4.0), Float64(B * B)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= 1.35e-74) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(C + C))))) / t_0); elseif (B <= 1.55e+47) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_1) * Float64(C + Float64(A + hypot(B, Float64(A - C)))))))) / t_1); else tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A + hypot(B, A)))))) / B); end return tmp end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(C * N[(A * -4.0), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.35e-74], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(C + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.55e+47], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$1), $MachinePrecision] * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(C, A \cdot -4, B \cdot B\right)\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 1.35 \cdot 10^{-74}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(C + C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.55 \cdot 10^{+47}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_1\right) \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)}\right)}{B}\\
\end{array}
\end{array}
if B < 1.35000000000000009e-74Initial program 17.5%
Simplified25.1%
Taylor expanded in A around -inf 22.5%
if 1.35000000000000009e-74 < B < 1.55e47Initial program 48.3%
associate-*l*48.3%
unpow248.3%
+-commutative48.3%
unpow248.3%
associate-*l*48.3%
unpow248.3%
Simplified48.3%
distribute-frac-neg48.3%
Applied egg-rr57.4%
if 1.55e47 < B Initial program 10.5%
Simplified12.5%
Taylor expanded in C around 0 16.1%
mul-1-neg16.1%
distribute-rgt-neg-in16.1%
unpow216.1%
unpow216.1%
hypot-def55.7%
Simplified55.7%
associate-*l/55.7%
Applied egg-rr55.7%
Final simplification33.9%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B 8.2e+49)
(/ (- (sqrt (* 2.0 (* (* F t_0) (+ C (+ A (hypot B (- A C)))))))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ A (hypot B A)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 8.2e+49) {
tmp = -sqrt((2.0 * ((F * t_0) * (C + (A + hypot(B, (A - C))))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A + hypot(B, A))));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 8.2e+49) {
tmp = -Math.sqrt((2.0 * ((F * t_0) * (C + (A + Math.hypot(B, (A - C))))))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A + Math.hypot(B, A))));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 8.2e+49: tmp = -math.sqrt((2.0 * ((F * t_0) * (C + (A + math.hypot(B, (A - C))))))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A + math.hypot(B, A)))) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= 8.2e+49) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(C + Float64(A + hypot(B, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A + hypot(B, A)))))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); tmp = 0.0; if (B <= 8.2e+49) tmp = -sqrt((2.0 * ((F * t_0) * (C + (A + hypot(B, (A - C))))))) / t_0; else tmp = (sqrt(2.0) / B) * -sqrt((F * (A + hypot(B, A)))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 8.2e+49], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 8.2 \cdot 10^{+49}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)}\right)\\
\end{array}
\end{array}
if B < 8.2e49Initial program 22.8%
associate-*l*22.8%
unpow222.8%
+-commutative22.8%
unpow222.8%
associate-*l*22.8%
unpow222.8%
Simplified22.8%
distribute-frac-neg22.8%
Applied egg-rr30.8%
if 8.2e49 < B Initial program 10.5%
Simplified12.5%
Taylor expanded in C around 0 16.1%
mul-1-neg16.1%
distribute-rgt-neg-in16.1%
unpow216.1%
unpow216.1%
hypot-def55.7%
Simplified55.7%
Final simplification35.6%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B 2.5e+48)
(/ (- (sqrt (* 2.0 (* (* F t_0) (+ C (+ A (hypot B (- A C)))))))) t_0)
(/ (* (sqrt 2.0) (- (sqrt (* F (+ A (hypot B A)))))) B))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 2.5e+48) {
tmp = -sqrt((2.0 * ((F * t_0) * (C + (A + hypot(B, (A - C))))))) / t_0;
} else {
tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(B, A))))) / B;
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 2.5e+48) {
tmp = -Math.sqrt((2.0 * ((F * t_0) * (C + (A + Math.hypot(B, (A - C))))))) / t_0;
} else {
tmp = (Math.sqrt(2.0) * -Math.sqrt((F * (A + Math.hypot(B, A))))) / B;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 2.5e+48: tmp = -math.sqrt((2.0 * ((F * t_0) * (C + (A + math.hypot(B, (A - C))))))) / t_0 else: tmp = (math.sqrt(2.0) * -math.sqrt((F * (A + math.hypot(B, A))))) / B return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= 2.5e+48) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(C + Float64(A + hypot(B, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(A + hypot(B, A)))))) / B); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); tmp = 0.0; if (B <= 2.5e+48) tmp = -sqrt((2.0 * ((F * t_0) * (C + (A + hypot(B, (A - C))))))) / t_0; else tmp = (sqrt(2.0) * -sqrt((F * (A + hypot(B, A))))) / B; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 2.5e+48], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 2.5 \cdot 10^{+48}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)}\right)}{B}\\
\end{array}
\end{array}
if B < 2.49999999999999987e48Initial program 22.8%
associate-*l*22.8%
unpow222.8%
+-commutative22.8%
unpow222.8%
associate-*l*22.8%
unpow222.8%
Simplified22.8%
distribute-frac-neg22.8%
Applied egg-rr30.8%
if 2.49999999999999987e48 < B Initial program 10.5%
Simplified12.5%
Taylor expanded in C around 0 16.1%
mul-1-neg16.1%
distribute-rgt-neg-in16.1%
unpow216.1%
unpow216.1%
hypot-def55.7%
Simplified55.7%
associate-*l/55.7%
Applied egg-rr55.7%
Final simplification35.6%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* 2.0 (* F t_0))))
(if (<= B 1.25e-128)
(/ (- (sqrt (* t_1 (+ (+ A C) (+ C (- (* 0.5 (/ (* B B) C)) A)))))) t_0)
(if (<= B 2.2e+47)
(/ (- (sqrt (* t_1 (+ (+ A C) (hypot B A))))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ B A)))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (B <= 1.25e-128) {
tmp = -sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0;
} else if (B <= 2.2e+47) {
tmp = -sqrt((t_1 * ((A + C) + hypot(B, A)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (B <= 1.25e-128) {
tmp = -Math.sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0;
} else if (B <= 2.2e+47) {
tmp = -Math.sqrt((t_1 * ((A + C) + Math.hypot(B, A)))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (B + A)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = 2.0 * (F * t_0) tmp = 0 if B <= 1.25e-128: tmp = -math.sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0 elif B <= 2.2e+47: tmp = -math.sqrt((t_1 * ((A + C) + math.hypot(B, A)))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (B + A))) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (B <= 1.25e-128) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + Float64(C + Float64(Float64(0.5 * Float64(Float64(B * B) / C)) - A)))))) / t_0); elseif (B <= 2.2e+47) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + hypot(B, A))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(B + A))))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); t_1 = 2.0 * (F * t_0); tmp = 0.0; if (B <= 1.25e-128) tmp = -sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0; elseif (B <= 2.2e+47) tmp = -sqrt((t_1 * ((A + C) + hypot(B, A)))) / t_0; else tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.25e-128], N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[(C + N[(N[(0.5 * N[(N[(B * B), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision] - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.2e+47], N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(B + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;B \leq 1.25 \cdot 10^{-128}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(\left(A + C\right) + \left(C + \left(0.5 \cdot \frac{B \cdot B}{C} - A\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.2 \cdot 10^{+47}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(B + A\right)}\right)\\
\end{array}
\end{array}
if B < 1.25e-128Initial program 15.9%
associate-*l*15.9%
unpow215.9%
+-commutative15.9%
unpow215.9%
associate-*l*15.9%
unpow215.9%
Simplified15.9%
Taylor expanded in C around inf 11.4%
mul-1-neg11.4%
unsub-neg11.4%
Simplified12.0%
if 1.25e-128 < B < 2.1999999999999999e47Initial program 42.8%
associate-*l*42.8%
unpow242.8%
+-commutative42.8%
unpow242.8%
associate-*l*42.8%
unpow242.8%
Simplified42.8%
Taylor expanded in C around 0 36.2%
unpow236.2%
unpow236.2%
hypot-def41.5%
Simplified41.5%
if 2.1999999999999999e47 < B Initial program 10.5%
Simplified12.5%
Taylor expanded in C around 0 16.1%
mul-1-neg16.1%
distribute-rgt-neg-in16.1%
unpow216.1%
unpow216.1%
hypot-def55.7%
Simplified55.7%
Taylor expanded in A around 0 53.7%
+-commutative53.7%
Simplified53.7%
Final simplification26.2%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B 5.2e+84)
(/ (- (sqrt (* 2.0 (* (* F t_0) (+ C (+ A (hypot B (- A C)))))))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ B A))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 5.2e+84) {
tmp = -sqrt((2.0 * ((F * t_0) * (C + (A + hypot(B, (A - C))))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
}
return tmp;
}
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 5.2e+84) {
tmp = -Math.sqrt((2.0 * ((F * t_0) * (C + (A + Math.hypot(B, (A - C))))))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (B + A)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 5.2e+84: tmp = -math.sqrt((2.0 * ((F * t_0) * (C + (A + math.hypot(B, (A - C))))))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (B + A))) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= 5.2e+84) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(C + Float64(A + hypot(B, Float64(A - C)))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(B + A))))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); tmp = 0.0; if (B <= 5.2e+84) tmp = -sqrt((2.0 * ((F * t_0) * (C + (A + hypot(B, (A - C))))))) / t_0; else tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 5.2e+84], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(B + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 5.2 \cdot 10^{+84}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(B + A\right)}\right)\\
\end{array}
\end{array}
if B < 5.2000000000000002e84Initial program 24.0%
associate-*l*24.0%
unpow224.0%
+-commutative24.0%
unpow224.0%
associate-*l*24.0%
unpow224.0%
Simplified24.0%
distribute-frac-neg24.0%
Applied egg-rr32.1%
if 5.2000000000000002e84 < B Initial program 2.9%
Simplified2.9%
Taylor expanded in C around 0 9.3%
mul-1-neg9.3%
distribute-rgt-neg-in9.3%
unpow29.3%
unpow29.3%
hypot-def55.1%
Simplified55.1%
Taylor expanded in A around 0 54.9%
+-commutative54.9%
Simplified54.9%
Final simplification35.9%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= F -5.2e-296)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A (+ A C))))) t_0)
(if (<= F 1.55e+24)
(* (/ (sqrt 2.0) B) (- (sqrt (* B F))))
(- (* (sqrt 2.0) (sqrt (/ F B))))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (F <= -5.2e-296) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0;
} else if (F <= 1.55e+24) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else {
tmp = -(sqrt(2.0) * sqrt((F / B)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
if (f <= (-5.2d-296)) then
tmp = -sqrt(((2.0d0 * (f * t_0)) * (a + (a + c)))) / t_0
else if (f <= 1.55d+24) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else
tmp = -(sqrt(2.0d0) * sqrt((f / b)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (F <= -5.2e-296) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0;
} else if (F <= 1.55e+24) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else {
tmp = -(Math.sqrt(2.0) * Math.sqrt((F / B)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if F <= -5.2e-296: tmp = -math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0 elif F <= 1.55e+24: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) else: tmp = -(math.sqrt(2.0) * math.sqrt((F / B))) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (F <= -5.2e-296) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + Float64(A + C))))) / t_0); elseif (F <= 1.55e+24) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); else tmp = Float64(-Float64(sqrt(2.0) * sqrt(Float64(F / B)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); tmp = 0.0; if (F <= -5.2e-296) tmp = -sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0; elseif (F <= 1.55e+24) tmp = (sqrt(2.0) / B) * -sqrt((B * F)); else tmp = -(sqrt(2.0) * sqrt((F / B))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5.2e-296], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 1.55e+24], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], (-N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;F \leq -5.2 \cdot 10^{-296}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{t_0}\\
\mathbf{elif}\;F \leq 1.55 \cdot 10^{+24}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2} \cdot \sqrt{\frac{F}{B}}\\
\end{array}
\end{array}
if F < -5.2000000000000001e-296Initial program 24.8%
associate-*l*24.8%
unpow224.8%
+-commutative24.8%
unpow224.8%
associate-*l*24.8%
unpow224.8%
Simplified24.8%
Taylor expanded in A around inf 25.4%
if -5.2000000000000001e-296 < F < 1.55000000000000005e24Initial program 22.5%
Simplified30.8%
Taylor expanded in C around 0 13.3%
mul-1-neg13.3%
distribute-rgt-neg-in13.3%
unpow213.3%
unpow213.3%
hypot-def29.1%
Simplified29.1%
Taylor expanded in A around 0 24.6%
if 1.55000000000000005e24 < F Initial program 16.2%
Simplified18.1%
Taylor expanded in C around 0 11.4%
mul-1-neg11.4%
distribute-rgt-neg-in11.4%
unpow211.4%
unpow211.4%
hypot-def14.8%
Simplified14.8%
Taylor expanded in A around 0 21.5%
associate-*r*21.5%
mul-1-neg21.5%
Simplified21.5%
Final simplification23.5%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* 2.0 (* F t_0))))
(if (<= C -2.8e-34)
(/ (- (sqrt (* t_1 (* A (+ 2.0 (* -0.5 (/ (* B B) (* C C)))))))) t_0)
(if (<= C 1060000000000.0)
(- (* (sqrt 2.0) (sqrt (/ F B))))
(/
(- (sqrt (* t_1 (+ (+ A C) (+ C (- (* 0.5 (/ (* B B) C)) A))))))
t_0)))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (C <= -2.8e-34) {
tmp = -sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0;
} else if (C <= 1060000000000.0) {
tmp = -(sqrt(2.0) * sqrt((F / B)));
} else {
tmp = -sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0;
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = 2.0d0 * (f * t_0)
if (c <= (-2.8d-34)) then
tmp = -sqrt((t_1 * (a * (2.0d0 + ((-0.5d0) * ((b * b) / (c * c))))))) / t_0
else if (c <= 1060000000000.0d0) then
tmp = -(sqrt(2.0d0) * sqrt((f / b)))
else
tmp = -sqrt((t_1 * ((a + c) + (c + ((0.5d0 * ((b * b) / c)) - a))))) / t_0
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (C <= -2.8e-34) {
tmp = -Math.sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0;
} else if (C <= 1060000000000.0) {
tmp = -(Math.sqrt(2.0) * Math.sqrt((F / B)));
} else {
tmp = -Math.sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = 2.0 * (F * t_0) tmp = 0 if C <= -2.8e-34: tmp = -math.sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0 elif C <= 1060000000000.0: tmp = -(math.sqrt(2.0) * math.sqrt((F / B))) else: tmp = -math.sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0 return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (C <= -2.8e-34) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A * Float64(2.0 + Float64(-0.5 * Float64(Float64(B * B) / Float64(C * C)))))))) / t_0); elseif (C <= 1060000000000.0) tmp = Float64(-Float64(sqrt(2.0) * sqrt(Float64(F / B)))); else tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + Float64(C + Float64(Float64(0.5 * Float64(Float64(B * B) / C)) - A)))))) / t_0); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); t_1 = 2.0 * (F * t_0); tmp = 0.0; if (C <= -2.8e-34) tmp = -sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0; elseif (C <= 1060000000000.0) tmp = -(sqrt(2.0) * sqrt((F / B))); else tmp = -sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -2.8e-34], N[((-N[Sqrt[N[(t$95$1 * N[(A * N[(2.0 + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[C, 1060000000000.0], (-N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[(C + N[(N[(0.5 * N[(N[(B * B), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision] - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;C \leq -2.8 \cdot 10^{-34}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(A \cdot \left(2 + -0.5 \cdot \frac{B \cdot B}{C \cdot C}\right)\right)}}{t_0}\\
\mathbf{elif}\;C \leq 1060000000000:\\
\;\;\;\;-\sqrt{2} \cdot \sqrt{\frac{F}{B}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(\left(A + C\right) + \left(C + \left(0.5 \cdot \frac{B \cdot B}{C} - A\right)\right)\right)}}{t_0}\\
\end{array}
\end{array}
if C < -2.79999999999999997e-34Initial program 6.9%
associate-*l*6.9%
unpow26.9%
+-commutative6.9%
unpow26.9%
associate-*l*6.9%
unpow26.9%
Simplified6.9%
Taylor expanded in C around -inf 4.4%
associate-+r+4.4%
mul-1-neg4.4%
sub-neg4.4%
distribute-lft-out4.4%
unpow24.4%
*-commutative4.4%
unpow24.4%
times-frac4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in A around inf 24.6%
unpow224.6%
unpow224.6%
Simplified24.6%
if -2.79999999999999997e-34 < C < 1.06e12Initial program 26.7%
Simplified33.3%
Taylor expanded in C around 0 16.7%
mul-1-neg16.7%
distribute-rgt-neg-in16.7%
unpow216.7%
unpow216.7%
hypot-def28.5%
Simplified28.5%
Taylor expanded in A around 0 21.1%
associate-*r*21.1%
mul-1-neg21.1%
Simplified21.1%
if 1.06e12 < C Initial program 21.6%
associate-*l*21.6%
unpow221.6%
+-commutative21.6%
unpow221.6%
associate-*l*21.6%
unpow221.6%
Simplified21.6%
Taylor expanded in C around inf 30.4%
mul-1-neg30.4%
unsub-neg30.4%
Simplified30.5%
Final simplification24.4%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* 2.0 (* F t_0))))
(if (<= C -1.8e-35)
(/ (- (sqrt (* t_1 (* A (+ 2.0 (* -0.5 (/ (* B B) (* C C)))))))) t_0)
(if (<= C 1.55e-40)
(/ (- (sqrt (* t_1 (+ A (+ A C))))) t_0)
(/
(- (sqrt (* t_1 (+ (+ A C) (+ C (- (* 0.5 (/ (* B B) C)) A))))))
t_0)))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (C <= -1.8e-35) {
tmp = -sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0;
} else if (C <= 1.55e-40) {
tmp = -sqrt((t_1 * (A + (A + C)))) / t_0;
} else {
tmp = -sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0;
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = 2.0d0 * (f * t_0)
if (c <= (-1.8d-35)) then
tmp = -sqrt((t_1 * (a * (2.0d0 + ((-0.5d0) * ((b * b) / (c * c))))))) / t_0
else if (c <= 1.55d-40) then
tmp = -sqrt((t_1 * (a + (a + c)))) / t_0
else
tmp = -sqrt((t_1 * ((a + c) + (c + ((0.5d0 * ((b * b) / c)) - a))))) / t_0
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (C <= -1.8e-35) {
tmp = -Math.sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0;
} else if (C <= 1.55e-40) {
tmp = -Math.sqrt((t_1 * (A + (A + C)))) / t_0;
} else {
tmp = -Math.sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = 2.0 * (F * t_0) tmp = 0 if C <= -1.8e-35: tmp = -math.sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0 elif C <= 1.55e-40: tmp = -math.sqrt((t_1 * (A + (A + C)))) / t_0 else: tmp = -math.sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0 return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (C <= -1.8e-35) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A * Float64(2.0 + Float64(-0.5 * Float64(Float64(B * B) / Float64(C * C)))))))) / t_0); elseif (C <= 1.55e-40) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + Float64(A + C))))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + Float64(C + Float64(Float64(0.5 * Float64(Float64(B * B) / C)) - A)))))) / t_0); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); t_1 = 2.0 * (F * t_0); tmp = 0.0; if (C <= -1.8e-35) tmp = -sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0; elseif (C <= 1.55e-40) tmp = -sqrt((t_1 * (A + (A + C)))) / t_0; else tmp = -sqrt((t_1 * ((A + C) + (C + ((0.5 * ((B * B) / C)) - A))))) / t_0; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -1.8e-35], N[((-N[Sqrt[N[(t$95$1 * N[(A * N[(2.0 + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[C, 1.55e-40], N[((-N[Sqrt[N[(t$95$1 * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[(C + N[(N[(0.5 * N[(N[(B * B), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision] - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;C \leq -1.8 \cdot 10^{-35}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(A \cdot \left(2 + -0.5 \cdot \frac{B \cdot B}{C \cdot C}\right)\right)}}{t_0}\\
\mathbf{elif}\;C \leq 1.55 \cdot 10^{-40}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(A + \left(A + C\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(\left(A + C\right) + \left(C + \left(0.5 \cdot \frac{B \cdot B}{C} - A\right)\right)\right)}}{t_0}\\
\end{array}
\end{array}
if C < -1.80000000000000009e-35Initial program 6.9%
associate-*l*6.9%
unpow26.9%
+-commutative6.9%
unpow26.9%
associate-*l*6.9%
unpow26.9%
Simplified6.9%
Taylor expanded in C around -inf 4.4%
associate-+r+4.4%
mul-1-neg4.4%
sub-neg4.4%
distribute-lft-out4.4%
unpow24.4%
*-commutative4.4%
unpow24.4%
times-frac4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in A around inf 24.6%
unpow224.6%
unpow224.6%
Simplified24.6%
if -1.80000000000000009e-35 < C < 1.55000000000000005e-40Initial program 28.9%
associate-*l*28.9%
unpow228.9%
+-commutative28.9%
unpow228.9%
associate-*l*28.9%
unpow228.9%
Simplified28.9%
Taylor expanded in A around inf 17.1%
if 1.55000000000000005e-40 < C Initial program 19.3%
associate-*l*19.3%
unpow219.3%
+-commutative19.3%
unpow219.3%
associate-*l*19.3%
unpow219.3%
Simplified19.3%
Taylor expanded in C around inf 26.3%
mul-1-neg26.3%
unsub-neg26.3%
Simplified26.6%
Final simplification21.9%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* 2.0 (* F t_0))))
(if (<= C -8e-42)
(/ (- (sqrt (* t_1 (* A (+ 2.0 (* -0.5 (/ (* B B) (* C C)))))))) t_0)
(if (<= C 8.2e-41)
(/ (- (sqrt (* t_1 (+ A (+ A C))))) t_0)
(/ (- (sqrt (* t_1 (+ (+ A C) (- C A))))) t_0)))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (C <= -8e-42) {
tmp = -sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0;
} else if (C <= 8.2e-41) {
tmp = -sqrt((t_1 * (A + (A + C)))) / t_0;
} else {
tmp = -sqrt((t_1 * ((A + C) + (C - A)))) / t_0;
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = 2.0d0 * (f * t_0)
if (c <= (-8d-42)) then
tmp = -sqrt((t_1 * (a * (2.0d0 + ((-0.5d0) * ((b * b) / (c * c))))))) / t_0
else if (c <= 8.2d-41) then
tmp = -sqrt((t_1 * (a + (a + c)))) / t_0
else
tmp = -sqrt((t_1 * ((a + c) + (c - a)))) / t_0
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (C <= -8e-42) {
tmp = -Math.sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0;
} else if (C <= 8.2e-41) {
tmp = -Math.sqrt((t_1 * (A + (A + C)))) / t_0;
} else {
tmp = -Math.sqrt((t_1 * ((A + C) + (C - A)))) / t_0;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = 2.0 * (F * t_0) tmp = 0 if C <= -8e-42: tmp = -math.sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0 elif C <= 8.2e-41: tmp = -math.sqrt((t_1 * (A + (A + C)))) / t_0 else: tmp = -math.sqrt((t_1 * ((A + C) + (C - A)))) / t_0 return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (C <= -8e-42) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A * Float64(2.0 + Float64(-0.5 * Float64(Float64(B * B) / Float64(C * C)))))))) / t_0); elseif (C <= 8.2e-41) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + Float64(A + C))))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + Float64(C - A))))) / t_0); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); t_1 = 2.0 * (F * t_0); tmp = 0.0; if (C <= -8e-42) tmp = -sqrt((t_1 * (A * (2.0 + (-0.5 * ((B * B) / (C * C))))))) / t_0; elseif (C <= 8.2e-41) tmp = -sqrt((t_1 * (A + (A + C)))) / t_0; else tmp = -sqrt((t_1 * ((A + C) + (C - A)))) / t_0; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -8e-42], N[((-N[Sqrt[N[(t$95$1 * N[(A * N[(2.0 + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[C, 8.2e-41], N[((-N[Sqrt[N[(t$95$1 * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;C \leq -8 \cdot 10^{-42}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(A \cdot \left(2 + -0.5 \cdot \frac{B \cdot B}{C \cdot C}\right)\right)}}{t_0}\\
\mathbf{elif}\;C \leq 8.2 \cdot 10^{-41}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(A + \left(A + C\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(\left(A + C\right) + \left(C - A\right)\right)}}{t_0}\\
\end{array}
\end{array}
if C < -8.0000000000000003e-42Initial program 6.9%
associate-*l*6.9%
unpow26.9%
+-commutative6.9%
unpow26.9%
associate-*l*6.9%
unpow26.9%
Simplified6.9%
Taylor expanded in C around -inf 4.4%
associate-+r+4.4%
mul-1-neg4.4%
sub-neg4.4%
distribute-lft-out4.4%
unpow24.4%
*-commutative4.4%
unpow24.4%
times-frac4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in A around inf 24.6%
unpow224.6%
unpow224.6%
Simplified24.6%
if -8.0000000000000003e-42 < C < 8.20000000000000028e-41Initial program 28.9%
associate-*l*28.9%
unpow228.9%
+-commutative28.9%
unpow228.9%
associate-*l*28.9%
unpow228.9%
Simplified28.9%
Taylor expanded in A around inf 17.1%
if 8.20000000000000028e-41 < C Initial program 19.3%
associate-*l*19.3%
unpow219.3%
+-commutative19.3%
unpow219.3%
associate-*l*19.3%
unpow219.3%
Simplified19.3%
Taylor expanded in A around -inf 26.5%
mul-1-neg26.5%
sub-neg26.5%
Simplified26.5%
Final simplification21.9%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* 2.0 (* F t_0))))
(if (<= C 2.4e-41)
(/ (- (sqrt (* t_1 (+ (+ A C) (- A C))))) t_0)
(/ (- (sqrt (* t_1 (+ (+ A C) (- C A))))) t_0))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (C <= 2.4e-41) {
tmp = -sqrt((t_1 * ((A + C) + (A - C)))) / t_0;
} else {
tmp = -sqrt((t_1 * ((A + C) + (C - A)))) / t_0;
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = 2.0d0 * (f * t_0)
if (c <= 2.4d-41) then
tmp = -sqrt((t_1 * ((a + c) + (a - c)))) / t_0
else
tmp = -sqrt((t_1 * ((a + c) + (c - a)))) / t_0
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (C <= 2.4e-41) {
tmp = -Math.sqrt((t_1 * ((A + C) + (A - C)))) / t_0;
} else {
tmp = -Math.sqrt((t_1 * ((A + C) + (C - A)))) / t_0;
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = 2.0 * (F * t_0) tmp = 0 if C <= 2.4e-41: tmp = -math.sqrt((t_1 * ((A + C) + (A - C)))) / t_0 else: tmp = -math.sqrt((t_1 * ((A + C) + (C - A)))) / t_0 return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (C <= 2.4e-41) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + Float64(A - C))))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + Float64(C - A))))) / t_0); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); t_1 = 2.0 * (F * t_0); tmp = 0.0; if (C <= 2.4e-41) tmp = -sqrt((t_1 * ((A + C) + (A - C)))) / t_0; else tmp = -sqrt((t_1 * ((A + C) + (C - A)))) / t_0; end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, 2.4e-41], N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[(A - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;C \leq 2.4 \cdot 10^{-41}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(\left(A + C\right) + \left(A - C\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(\left(A + C\right) + \left(C - A\right)\right)}}{t_0}\\
\end{array}
\end{array}
if C < 2.40000000000000022e-41Initial program 20.9%
associate-*l*20.9%
unpow220.9%
+-commutative20.9%
unpow220.9%
associate-*l*20.9%
unpow220.9%
Simplified20.9%
Taylor expanded in B around 0 12.4%
if 2.40000000000000022e-41 < C Initial program 19.3%
associate-*l*19.3%
unpow219.3%
+-commutative19.3%
unpow219.3%
associate-*l*19.3%
unpow219.3%
Simplified19.3%
Taylor expanded in A around -inf 26.5%
mul-1-neg26.5%
sub-neg26.5%
Simplified26.5%
Final simplification16.7%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B 1.32e+85)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A (+ A C))))) t_0)
(- (* (/ 2.0 B) (sqrt (* A F)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 1.32e+85) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0;
} else {
tmp = -((2.0 / B) * sqrt((A * F)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
if (b <= 1.32d+85) then
tmp = -sqrt(((2.0d0 * (f * t_0)) * (a + (a + c)))) / t_0
else
tmp = -((2.0d0 / b) * sqrt((a * f)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 1.32e+85) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0;
} else {
tmp = -((2.0 / B) * Math.sqrt((A * F)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 1.32e+85: tmp = -math.sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0 else: tmp = -((2.0 / B) * math.sqrt((A * F))) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= 1.32e+85) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + Float64(A + C))))) / t_0); else tmp = Float64(-Float64(Float64(2.0 / B) * sqrt(Float64(A * F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); tmp = 0.0; if (B <= 1.32e+85) tmp = -sqrt(((2.0 * (F * t_0)) * (A + (A + C)))) / t_0; else tmp = -((2.0 / B) * sqrt((A * F))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.32e+85], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], (-N[(N[(2.0 / B), $MachinePrecision] * N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 1.32 \cdot 10^{+85}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(A + C\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{2}{B} \cdot \sqrt{A \cdot F}\\
\end{array}
\end{array}
if B < 1.32000000000000007e85Initial program 24.0%
associate-*l*24.0%
unpow224.0%
+-commutative24.0%
unpow224.0%
associate-*l*24.0%
unpow224.0%
Simplified24.0%
Taylor expanded in A around inf 12.7%
if 1.32000000000000007e85 < B Initial program 2.9%
Simplified2.9%
Taylor expanded in C around 0 9.3%
mul-1-neg9.3%
distribute-rgt-neg-in9.3%
unpow29.3%
unpow29.3%
hypot-def55.1%
Simplified55.1%
Taylor expanded in B around 0 3.2%
associate-*r*3.2%
mul-1-neg3.2%
unpow23.2%
rem-square-sqrt3.2%
Simplified3.2%
Final simplification11.1%
NOTE: B should be positive before calling this function
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= A 1e-197)
(/ (- (sqrt (* C (* 2.0 (* F t_0))))) t_0)
(- (* (/ 2.0 B) (sqrt (* A F)))))))B = abs(B);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (A <= 1e-197) {
tmp = -sqrt((C * (2.0 * (F * t_0)))) / t_0;
} else {
tmp = -((2.0 / B) * sqrt((A * F)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
if (a <= 1d-197) then
tmp = -sqrt((c * (2.0d0 * (f * t_0)))) / t_0
else
tmp = -((2.0d0 / b) * sqrt((a * f)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (A <= 1e-197) {
tmp = -Math.sqrt((C * (2.0 * (F * t_0)))) / t_0;
} else {
tmp = -((2.0 / B) * Math.sqrt((A * F)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if A <= 1e-197: tmp = -math.sqrt((C * (2.0 * (F * t_0)))) / t_0 else: tmp = -((2.0 / B) * math.sqrt((A * F))) return tmp
B = abs(B) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (A <= 1e-197) tmp = Float64(Float64(-sqrt(Float64(C * Float64(2.0 * Float64(F * t_0))))) / t_0); else tmp = Float64(-Float64(Float64(2.0 / B) * sqrt(Float64(A * F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) t_0 = (B * B) - (4.0 * (A * C)); tmp = 0.0; if (A <= 1e-197) tmp = -sqrt((C * (2.0 * (F * t_0)))) / t_0; else tmp = -((2.0 / B) * sqrt((A * F))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, 1e-197], N[((-N[Sqrt[N[(C * N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], (-N[(N[(2.0 / B), $MachinePrecision] * N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;A \leq 10^{-197}:\\
\;\;\;\;\frac{-\sqrt{C \cdot \left(2 \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{2}{B} \cdot \sqrt{A \cdot F}\\
\end{array}
\end{array}
if A < 9.9999999999999999e-198Initial program 18.5%
associate-*l*18.5%
unpow218.5%
+-commutative18.5%
unpow218.5%
associate-*l*18.5%
unpow218.5%
Simplified18.5%
Taylor expanded in A around -inf 4.3%
mul-1-neg4.3%
Simplified4.3%
Taylor expanded in A around 0 6.7%
if 9.9999999999999999e-198 < A Initial program 23.4%
Simplified30.9%
Taylor expanded in C around 0 9.9%
mul-1-neg9.9%
distribute-rgt-neg-in9.9%
unpow29.9%
unpow29.9%
hypot-def20.6%
Simplified20.6%
Taylor expanded in B around 0 7.3%
associate-*r*7.3%
mul-1-neg7.3%
unpow27.3%
rem-square-sqrt7.3%
Simplified7.3%
Final simplification7.0%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (if (<= A 1.2e-235) (/ (- (sqrt (* (* A -8.0) (* F (* C C))))) (- (* B B) (* 4.0 (* A C)))) (- (* (/ 2.0 B) (sqrt (* A F))))))
B = abs(B);
double code(double A, double B, double C, double F) {
double tmp;
if (A <= 1.2e-235) {
tmp = -sqrt(((A * -8.0) * (F * (C * C)))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -((2.0 / B) * sqrt((A * F)));
}
return tmp;
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (a <= 1.2d-235) then
tmp = -sqrt(((a * (-8.0d0)) * (f * (c * c)))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = -((2.0d0 / b) * sqrt((a * f)))
end if
code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
double tmp;
if (A <= 1.2e-235) {
tmp = -Math.sqrt(((A * -8.0) * (F * (C * C)))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -((2.0 / B) * Math.sqrt((A * F)));
}
return tmp;
}
B = abs(B) def code(A, B, C, F): tmp = 0 if A <= 1.2e-235: tmp = -math.sqrt(((A * -8.0) * (F * (C * C)))) / ((B * B) - (4.0 * (A * C))) else: tmp = -((2.0 / B) * math.sqrt((A * F))) return tmp
B = abs(B) function code(A, B, C, F) tmp = 0.0 if (A <= 1.2e-235) tmp = Float64(Float64(-sqrt(Float64(Float64(A * -8.0) * Float64(F * Float64(C * C))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(-Float64(Float64(2.0 / B) * sqrt(Float64(A * F)))); end return tmp end
B = abs(B) function tmp_2 = code(A, B, C, F) tmp = 0.0; if (A <= 1.2e-235) tmp = -sqrt(((A * -8.0) * (F * (C * C)))) / ((B * B) - (4.0 * (A * C))); else tmp = -((2.0 / B) * sqrt((A * F))); end tmp_2 = tmp; end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := If[LessEqual[A, 1.2e-235], N[((-N[Sqrt[N[(N[(A * -8.0), $MachinePrecision] * N[(F * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[(2.0 / B), $MachinePrecision] * N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq 1.2 \cdot 10^{-235}:\\
\;\;\;\;\frac{-\sqrt{\left(A \cdot -8\right) \cdot \left(F \cdot \left(C \cdot C\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-\frac{2}{B} \cdot \sqrt{A \cdot F}\\
\end{array}
\end{array}
if A < 1.20000000000000005e-235Initial program 17.7%
associate-*l*17.7%
unpow217.7%
+-commutative17.7%
unpow217.7%
associate-*l*17.7%
unpow217.7%
Simplified17.7%
Taylor expanded in A around -inf 4.2%
mul-1-neg4.2%
Simplified4.2%
Taylor expanded in B around 0 5.9%
associate-*r*5.9%
*-commutative5.9%
unpow25.9%
Simplified5.9%
if 1.20000000000000005e-235 < A Initial program 24.3%
Simplified32.3%
Taylor expanded in C around 0 10.5%
mul-1-neg10.5%
distribute-rgt-neg-in10.5%
unpow210.5%
unpow210.5%
hypot-def20.6%
Simplified20.6%
Taylor expanded in B around 0 7.1%
associate-*r*7.1%
mul-1-neg7.1%
unpow27.1%
rem-square-sqrt7.1%
Simplified7.1%
Final simplification6.4%
NOTE: B should be positive before calling this function (FPCore (A B C F) :precision binary64 (- (* (/ 2.0 B) (sqrt (* A F)))))
B = abs(B);
double code(double A, double B, double C, double F) {
return -((2.0 / B) * sqrt((A * F)));
}
NOTE: B should be positive before calling this function
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -((2.0d0 / b) * sqrt((a * f)))
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
return -((2.0 / B) * Math.sqrt((A * F)));
}
B = abs(B) def code(A, B, C, F): return -((2.0 / B) * math.sqrt((A * F)))
B = abs(B) function code(A, B, C, F) return Float64(-Float64(Float64(2.0 / B) * sqrt(Float64(A * F)))) end
B = abs(B) function tmp = code(A, B, C, F) tmp = -((2.0 / B) * sqrt((A * F))); end
NOTE: B should be positive before calling this function code[A_, B_, C_, F_] := (-N[(N[(2.0 / B), $MachinePrecision] * N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])
\begin{array}{l}
B = |B|\\
\\
-\frac{2}{B} \cdot \sqrt{A \cdot F}
\end{array}
Initial program 20.4%
Simplified27.2%
Taylor expanded in C around 0 10.6%
mul-1-neg10.6%
distribute-rgt-neg-in10.6%
unpow210.6%
unpow210.6%
hypot-def19.1%
Simplified19.1%
Taylor expanded in B around 0 3.3%
associate-*r*3.3%
mul-1-neg3.3%
unpow23.3%
rem-square-sqrt3.3%
Simplified3.3%
Final simplification3.3%
herbie shell --seed 2023208
(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))))