
(FPCore (a b c) :precision binary64 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c))))) (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (+ (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((b * b) - ((4.0d0 * a) * c)))
if (b >= 0.0d0) then
tmp = (2.0d0 * c) / (-b - t_0)
else
tmp = (-b + t_0) / (2.0d0 * a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - ((4.0 * a) * c))) tmp = 0 if b >= 0.0: tmp = (2.0 * c) / (-b - t_0) else: tmp = (-b + t_0) / (2.0 * a) return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0)); else tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt(((b * b) - ((4.0 * a) * c))); tmp = 0.0; if (b >= 0.0) tmp = (2.0 * c) / (-b - t_0); else tmp = (-b + t_0) / (2.0 * a); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c))))) (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (+ (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((b * b) - ((4.0d0 * a) * c)))
if (b >= 0.0d0) then
tmp = (2.0d0 * c) / (-b - t_0)
else
tmp = (-b + t_0) / (2.0d0 * a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - ((4.0 * a) * c))) tmp = 0 if b >= 0.0: tmp = (2.0 * c) / (-b - t_0) else: tmp = (-b + t_0) / (2.0 * a) return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0)); else tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt(((b * b) - ((4.0 * a) * c))); tmp = 0.0; if (b >= 0.0) tmp = (2.0 * c) / (-b - t_0); else tmp = (-b + t_0) / (2.0 * a); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (- (* b b) (* c (* a 4.0))))))
(if (<= b -2.2e+80)
(if (>= b 0.0)
(* c (/ -2.0 (+ b (sqrt (fma c (* a -4.0) (* b b))))))
(fma -1.0 (/ b a) (/ c b)))
(if (<= b 4e+92)
(if (>= b 0.0) (/ (* c 2.0) (- (- b) t_0)) (/ (- t_0 b) (* a 2.0)))
(if (>= b 0.0)
(/ (* c 2.0) (* 2.0 (- (* a (/ c b)) b)))
(/ (* b -2.0) (* a 2.0)))))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - (c * (a * 4.0))));
double tmp_1;
if (b <= -2.2e+80) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = c * (-2.0 / (b + sqrt(fma(c, (a * -4.0), (b * b)))));
} else {
tmp_2 = fma(-1.0, (b / a), (c / b));
}
tmp_1 = tmp_2;
} else if (b <= 4e+92) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * 2.0) / (-b - t_0);
} else {
tmp_3 = (t_0 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) tmp_1 = 0.0 if (b <= -2.2e+80) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(c * Float64(-2.0 / Float64(b + sqrt(fma(c, Float64(a * -4.0), Float64(b * b)))))); else tmp_2 = fma(-1.0, Float64(b / a), Float64(c / b)); end tmp_1 = tmp_2; elseif (b <= 4e+92) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(c * 2.0) / Float64(Float64(-b) - t_0)); else tmp_3 = Float64(Float64(t_0 - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * 2.0) / Float64(2.0 * Float64(Float64(a * Float64(c / b)) - b))); else tmp_1 = Float64(Float64(b * -2.0) / Float64(a * 2.0)); end return tmp_1 end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -2.2e+80], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(b / a), $MachinePrecision] + N[(c / b), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 4e+92], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[(2.0 * N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
\mathbf{if}\;b \leq -2.2 \cdot 10^{+80}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{b}{a}, \frac{c}{b}\right)\\
\end{array}\\
\mathbf{elif}\;b \leq 4 \cdot 10^{+92}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{2 \cdot \left(a \cdot \frac{c}{b} - b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 2}\\
\end{array}
\end{array}
if b < -2.20000000000000003e80Initial program 55.2%
Simplified55.2%
Taylor expanded in b around -inf 63.5%
associate-*r*63.5%
mul-1-neg63.5%
fma-define63.5%
fma-define63.5%
associate-/l*65.7%
Simplified65.7%
Taylor expanded in c around 0 91.7%
fma-define91.7%
Simplified91.7%
if -2.20000000000000003e80 < b < 4.0000000000000002e92Initial program 83.5%
if 4.0000000000000002e92 < b Initial program 56.6%
Taylor expanded in b around -inf 56.6%
*-commutative56.6%
Simplified56.6%
Taylor expanded in a around 0 93.5%
distribute-lft-out--93.5%
associate-/l*99.8%
Simplified99.8%
Final simplification89.0%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (- (* b b) (* c (* a 4.0))))))
(if (<= b -2.3e+81)
(if (>= b 0.0) (/ (- c) b) (/ b (- a)))
(if (<= b 8.6e-281)
(if (>= b 0.0)
(* (* c 2.0) (/ -1.0 (+ b (sqrt (* c (* a -4.0))))))
(/ (- t_0 b) (* a 2.0)))
(if (<= b 4.4e+92)
(if (>= b 0.0)
(/ (* c 2.0) (- (- b) t_0))
(* b (+ (/ c (pow b 2.0)) (/ -1.0 a))))
(if (>= b 0.0)
(/ (* c 2.0) (* 2.0 (- (* a (/ c b)) b)))
(/ (* b -2.0) (* a 2.0))))))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - (c * (a * 4.0))));
double tmp_1;
if (b <= -2.3e+81) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -c / b;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 8.6e-281) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * 2.0) * (-1.0 / (b + sqrt((c * (a * -4.0)))));
} else {
tmp_3 = (t_0 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b <= 4.4e+92) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (c * 2.0) / (-b - t_0);
} else {
tmp_4 = b * ((c / pow(b, 2.0)) + (-1.0 / a));
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
real(8) :: tmp_4
t_0 = sqrt(((b * b) - (c * (a * 4.0d0))))
if (b <= (-2.3d+81)) then
if (b >= 0.0d0) then
tmp_2 = -c / b
else
tmp_2 = b / -a
end if
tmp_1 = tmp_2
else if (b <= 8.6d-281) then
if (b >= 0.0d0) then
tmp_3 = (c * 2.0d0) * ((-1.0d0) / (b + sqrt((c * (a * (-4.0d0))))))
else
tmp_3 = (t_0 - b) / (a * 2.0d0)
end if
tmp_1 = tmp_3
else if (b <= 4.4d+92) then
if (b >= 0.0d0) then
tmp_4 = (c * 2.0d0) / (-b - t_0)
else
tmp_4 = b * ((c / (b ** 2.0d0)) + ((-1.0d0) / a))
end if
tmp_1 = tmp_4
else if (b >= 0.0d0) then
tmp_1 = (c * 2.0d0) / (2.0d0 * ((a * (c / b)) - b))
else
tmp_1 = (b * (-2.0d0)) / (a * 2.0d0)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - (c * (a * 4.0))));
double tmp_1;
if (b <= -2.3e+81) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -c / b;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 8.6e-281) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * 2.0) * (-1.0 / (b + Math.sqrt((c * (a * -4.0)))));
} else {
tmp_3 = (t_0 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b <= 4.4e+92) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (c * 2.0) / (-b - t_0);
} else {
tmp_4 = b * ((c / Math.pow(b, 2.0)) + (-1.0 / a));
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - (c * (a * 4.0)))) tmp_1 = 0 if b <= -2.3e+81: tmp_2 = 0 if b >= 0.0: tmp_2 = -c / b else: tmp_2 = b / -a tmp_1 = tmp_2 elif b <= 8.6e-281: tmp_3 = 0 if b >= 0.0: tmp_3 = (c * 2.0) * (-1.0 / (b + math.sqrt((c * (a * -4.0))))) else: tmp_3 = (t_0 - b) / (a * 2.0) tmp_1 = tmp_3 elif b <= 4.4e+92: tmp_4 = 0 if b >= 0.0: tmp_4 = (c * 2.0) / (-b - t_0) else: tmp_4 = b * ((c / math.pow(b, 2.0)) + (-1.0 / a)) tmp_1 = tmp_4 elif b >= 0.0: tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)) else: tmp_1 = (b * -2.0) / (a * 2.0) return tmp_1
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) tmp_1 = 0.0 if (b <= -2.3e+81) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(-c) / b); else tmp_2 = Float64(b / Float64(-a)); end tmp_1 = tmp_2; elseif (b <= 8.6e-281) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(c * 2.0) * Float64(-1.0 / Float64(b + sqrt(Float64(c * Float64(a * -4.0)))))); else tmp_3 = Float64(Float64(t_0 - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b <= 4.4e+92) tmp_4 = 0.0 if (b >= 0.0) tmp_4 = Float64(Float64(c * 2.0) / Float64(Float64(-b) - t_0)); else tmp_4 = Float64(b * Float64(Float64(c / (b ^ 2.0)) + Float64(-1.0 / a))); end tmp_1 = tmp_4; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * 2.0) / Float64(2.0 * Float64(Float64(a * Float64(c / b)) - b))); else tmp_1 = Float64(Float64(b * -2.0) / Float64(a * 2.0)); end return tmp_1 end
function tmp_6 = code(a, b, c) t_0 = sqrt(((b * b) - (c * (a * 4.0)))); tmp_2 = 0.0; if (b <= -2.3e+81) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = -c / b; else tmp_3 = b / -a; end tmp_2 = tmp_3; elseif (b <= 8.6e-281) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = (c * 2.0) * (-1.0 / (b + sqrt((c * (a * -4.0))))); else tmp_4 = (t_0 - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b <= 4.4e+92) tmp_5 = 0.0; if (b >= 0.0) tmp_5 = (c * 2.0) / (-b - t_0); else tmp_5 = b * ((c / (b ^ 2.0)) + (-1.0 / a)); end tmp_2 = tmp_5; elseif (b >= 0.0) tmp_2 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)); else tmp_2 = (b * -2.0) / (a * 2.0); end tmp_6 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -2.3e+81], If[GreaterEqual[b, 0.0], N[((-c) / b), $MachinePrecision], N[(b / (-a)), $MachinePrecision]], If[LessEqual[b, 8.6e-281], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] * N[(-1.0 / N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 4.4e+92], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(b * N[(N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[(2.0 * N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
\mathbf{if}\;b \leq -2.3 \cdot 10^{+81}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
\mathbf{elif}\;b \leq 8.6 \cdot 10^{-281}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\left(c \cdot 2\right) \cdot \frac{-1}{b + \sqrt{c \cdot \left(a \cdot -4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \leq 4.4 \cdot 10^{+92}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{2 \cdot \left(a \cdot \frac{c}{b} - b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 2}\\
\end{array}
\end{array}
if b < -2.2999999999999999e81Initial program 55.2%
Simplified55.2%
Taylor expanded in c around 0 55.2%
associate-*r/55.2%
mul-1-neg55.2%
Simplified55.2%
Taylor expanded in b around -inf 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in b around 0 91.6%
associate-*r/91.6%
mul-1-neg91.6%
associate-*r/91.6%
neg-mul-191.6%
Simplified91.6%
if -2.2999999999999999e81 < b < 8.60000000000000047e-281Initial program 81.7%
add-sqr-sqrt81.7%
pow281.7%
pow1/281.7%
sqrt-pow181.7%
fmm-def81.7%
*-commutative81.7%
distribute-rgt-neg-in81.7%
distribute-lft-neg-in81.7%
metadata-eval81.7%
*-commutative81.7%
metadata-eval81.7%
Applied egg-rr81.7%
Taylor expanded in b around 0 81.7%
*-commutative81.7%
*-commutative81.7%
associate-*r*81.7%
*-commutative81.7%
Simplified81.7%
div-inv81.7%
pow-pow81.7%
*-commutative81.7%
metadata-eval81.7%
pow1/281.7%
Applied egg-rr81.7%
if 8.60000000000000047e-281 < b < 4.39999999999999984e92Initial program 85.3%
frac-2neg85.3%
div-inv85.3%
Applied egg-rr85.3%
Taylor expanded in b around -inf 85.3%
if 4.39999999999999984e92 < b Initial program 56.6%
Taylor expanded in b around -inf 56.6%
*-commutative56.6%
Simplified56.6%
Taylor expanded in a around 0 93.5%
distribute-lft-out--93.5%
associate-/l*99.8%
Simplified99.8%
Final simplification89.0%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- c) b))
(t_1 (sqrt (* c (* a -4.0))))
(t_2 (/ (* b -2.0) (* a 2.0))))
(if (<= b -1.05e-82)
(if (>= b 0.0) t_0 (/ b (- a)))
(if (<= b -5e-310)
(if (>= b 0.0) t_0 (/ (- b t_1) (* -2.0 a)))
(if (<= b 2.4e-41)
(if (>= b 0.0) (/ -1.0 (/ (+ b t_1) (* c 2.0))) t_2)
(if (>= b 0.0) (/ (* c 2.0) (* 2.0 (- (* a (/ c b)) b))) t_2))))))
double code(double a, double b, double c) {
double t_0 = -c / b;
double t_1 = sqrt((c * (a * -4.0)));
double t_2 = (b * -2.0) / (a * 2.0);
double tmp_1;
if (b <= -1.05e-82) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= -5e-310) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = t_0;
} else {
tmp_3 = (b - t_1) / (-2.0 * a);
}
tmp_1 = tmp_3;
} else if (b <= 2.4e-41) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = -1.0 / ((b + t_1) / (c * 2.0));
} else {
tmp_4 = t_2;
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = t_2;
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
real(8) :: tmp_4
t_0 = -c / b
t_1 = sqrt((c * (a * (-4.0d0))))
t_2 = (b * (-2.0d0)) / (a * 2.0d0)
if (b <= (-1.05d-82)) then
if (b >= 0.0d0) then
tmp_2 = t_0
else
tmp_2 = b / -a
end if
tmp_1 = tmp_2
else if (b <= (-5d-310)) then
if (b >= 0.0d0) then
tmp_3 = t_0
else
tmp_3 = (b - t_1) / ((-2.0d0) * a)
end if
tmp_1 = tmp_3
else if (b <= 2.4d-41) then
if (b >= 0.0d0) then
tmp_4 = (-1.0d0) / ((b + t_1) / (c * 2.0d0))
else
tmp_4 = t_2
end if
tmp_1 = tmp_4
else if (b >= 0.0d0) then
tmp_1 = (c * 2.0d0) / (2.0d0 * ((a * (c / b)) - b))
else
tmp_1 = t_2
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double t_0 = -c / b;
double t_1 = Math.sqrt((c * (a * -4.0)));
double t_2 = (b * -2.0) / (a * 2.0);
double tmp_1;
if (b <= -1.05e-82) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= -5e-310) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = t_0;
} else {
tmp_3 = (b - t_1) / (-2.0 * a);
}
tmp_1 = tmp_3;
} else if (b <= 2.4e-41) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = -1.0 / ((b + t_1) / (c * 2.0));
} else {
tmp_4 = t_2;
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = t_2;
}
return tmp_1;
}
def code(a, b, c): t_0 = -c / b t_1 = math.sqrt((c * (a * -4.0))) t_2 = (b * -2.0) / (a * 2.0) tmp_1 = 0 if b <= -1.05e-82: tmp_2 = 0 if b >= 0.0: tmp_2 = t_0 else: tmp_2 = b / -a tmp_1 = tmp_2 elif b <= -5e-310: tmp_3 = 0 if b >= 0.0: tmp_3 = t_0 else: tmp_3 = (b - t_1) / (-2.0 * a) tmp_1 = tmp_3 elif b <= 2.4e-41: tmp_4 = 0 if b >= 0.0: tmp_4 = -1.0 / ((b + t_1) / (c * 2.0)) else: tmp_4 = t_2 tmp_1 = tmp_4 elif b >= 0.0: tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)) else: tmp_1 = t_2 return tmp_1
function code(a, b, c) t_0 = Float64(Float64(-c) / b) t_1 = sqrt(Float64(c * Float64(a * -4.0))) t_2 = Float64(Float64(b * -2.0) / Float64(a * 2.0)) tmp_1 = 0.0 if (b <= -1.05e-82) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = t_0; else tmp_2 = Float64(b / Float64(-a)); end tmp_1 = tmp_2; elseif (b <= -5e-310) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = t_0; else tmp_3 = Float64(Float64(b - t_1) / Float64(-2.0 * a)); end tmp_1 = tmp_3; elseif (b <= 2.4e-41) tmp_4 = 0.0 if (b >= 0.0) tmp_4 = Float64(-1.0 / Float64(Float64(b + t_1) / Float64(c * 2.0))); else tmp_4 = t_2; end tmp_1 = tmp_4; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * 2.0) / Float64(2.0 * Float64(Float64(a * Float64(c / b)) - b))); else tmp_1 = t_2; end return tmp_1 end
function tmp_6 = code(a, b, c) t_0 = -c / b; t_1 = sqrt((c * (a * -4.0))); t_2 = (b * -2.0) / (a * 2.0); tmp_2 = 0.0; if (b <= -1.05e-82) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = t_0; else tmp_3 = b / -a; end tmp_2 = tmp_3; elseif (b <= -5e-310) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = t_0; else tmp_4 = (b - t_1) / (-2.0 * a); end tmp_2 = tmp_4; elseif (b <= 2.4e-41) tmp_5 = 0.0; if (b >= 0.0) tmp_5 = -1.0 / ((b + t_1) / (c * 2.0)); else tmp_5 = t_2; end tmp_2 = tmp_5; elseif (b >= 0.0) tmp_2 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)); else tmp_2 = t_2; end tmp_6 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[((-c) / b), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(b * -2.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.05e-82], If[GreaterEqual[b, 0.0], t$95$0, N[(b / (-a)), $MachinePrecision]], If[LessEqual[b, -5e-310], If[GreaterEqual[b, 0.0], t$95$0, N[(N[(b - t$95$1), $MachinePrecision] / N[(-2.0 * a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 2.4e-41], If[GreaterEqual[b, 0.0], N[(-1.0 / N[(N[(b + t$95$1), $MachinePrecision] / N[(c * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[(2.0 * N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-c}{b}\\
t_1 := \sqrt{c \cdot \left(a \cdot -4\right)}\\
t_2 := \frac{b \cdot -2}{a \cdot 2}\\
\mathbf{if}\;b \leq -1.05 \cdot 10^{-82}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
\mathbf{elif}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b - t\_1}{-2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \leq 2.4 \cdot 10^{-41}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-1}{\frac{b + t\_1}{c \cdot 2}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{2 \cdot \left(a \cdot \frac{c}{b} - b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if b < -1.05e-82Initial program 69.0%
Simplified69.0%
Taylor expanded in c around 0 69.0%
associate-*r/69.0%
mul-1-neg69.0%
Simplified69.0%
Taylor expanded in b around -inf 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in b around 0 84.8%
associate-*r/84.8%
mul-1-neg84.8%
associate-*r/84.8%
neg-mul-184.8%
Simplified84.8%
if -1.05e-82 < b < -4.999999999999985e-310Initial program 72.3%
Simplified72.3%
Taylor expanded in c around 0 72.3%
associate-*r/72.3%
mul-1-neg72.3%
Simplified72.3%
Taylor expanded in c around inf 65.0%
*-commutative65.0%
*-commutative65.0%
associate-*r*65.0%
*-commutative65.0%
Simplified65.0%
if -4.999999999999985e-310 < b < 2.40000000000000022e-41Initial program 75.7%
add-sqr-sqrt75.3%
pow275.3%
pow1/275.3%
sqrt-pow175.3%
fmm-def75.3%
*-commutative75.3%
distribute-rgt-neg-in75.3%
distribute-lft-neg-in75.3%
metadata-eval75.3%
*-commutative75.3%
metadata-eval75.3%
Applied egg-rr75.3%
Taylor expanded in b around 0 65.7%
*-commutative65.7%
*-commutative65.7%
associate-*r*65.7%
*-commutative65.7%
Simplified65.7%
clear-num65.7%
inv-pow65.7%
pow-pow66.2%
*-commutative66.2%
metadata-eval66.2%
pow1/266.2%
Applied egg-rr66.2%
unpow-166.2%
Simplified66.2%
Taylor expanded in b around -inf 66.2%
*-commutative75.7%
Simplified66.2%
if 2.40000000000000022e-41 < b Initial program 70.2%
Taylor expanded in b around -inf 70.2%
*-commutative70.2%
Simplified70.2%
Taylor expanded in a around 0 89.0%
distribute-lft-out--89.0%
associate-/l*93.3%
Simplified93.3%
Final simplification81.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (- (* b b) (* c (* a 4.0))))))
(if (<= b -2.5e+79)
(if (>= b 0.0) (/ (- c) b) (/ b (- a)))
(if (<= b 3.5e+92)
(if (>= b 0.0) (/ (* c 2.0) (- (- b) t_0)) (/ (- t_0 b) (* a 2.0)))
(if (>= b 0.0)
(/ (* c 2.0) (* 2.0 (- (* a (/ c b)) b)))
(/ (* b -2.0) (* a 2.0)))))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - (c * (a * 4.0))));
double tmp_1;
if (b <= -2.5e+79) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -c / b;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 3.5e+92) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * 2.0) / (-b - t_0);
} else {
tmp_3 = (t_0 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
t_0 = sqrt(((b * b) - (c * (a * 4.0d0))))
if (b <= (-2.5d+79)) then
if (b >= 0.0d0) then
tmp_2 = -c / b
else
tmp_2 = b / -a
end if
tmp_1 = tmp_2
else if (b <= 3.5d+92) then
if (b >= 0.0d0) then
tmp_3 = (c * 2.0d0) / (-b - t_0)
else
tmp_3 = (t_0 - b) / (a * 2.0d0)
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = (c * 2.0d0) / (2.0d0 * ((a * (c / b)) - b))
else
tmp_1 = (b * (-2.0d0)) / (a * 2.0d0)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - (c * (a * 4.0))));
double tmp_1;
if (b <= -2.5e+79) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -c / b;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 3.5e+92) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * 2.0) / (-b - t_0);
} else {
tmp_3 = (t_0 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - (c * (a * 4.0)))) tmp_1 = 0 if b <= -2.5e+79: tmp_2 = 0 if b >= 0.0: tmp_2 = -c / b else: tmp_2 = b / -a tmp_1 = tmp_2 elif b <= 3.5e+92: tmp_3 = 0 if b >= 0.0: tmp_3 = (c * 2.0) / (-b - t_0) else: tmp_3 = (t_0 - b) / (a * 2.0) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)) else: tmp_1 = (b * -2.0) / (a * 2.0) return tmp_1
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) tmp_1 = 0.0 if (b <= -2.5e+79) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(-c) / b); else tmp_2 = Float64(b / Float64(-a)); end tmp_1 = tmp_2; elseif (b <= 3.5e+92) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(c * 2.0) / Float64(Float64(-b) - t_0)); else tmp_3 = Float64(Float64(t_0 - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * 2.0) / Float64(2.0 * Float64(Float64(a * Float64(c / b)) - b))); else tmp_1 = Float64(Float64(b * -2.0) / Float64(a * 2.0)); end return tmp_1 end
function tmp_5 = code(a, b, c) t_0 = sqrt(((b * b) - (c * (a * 4.0)))); tmp_2 = 0.0; if (b <= -2.5e+79) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = -c / b; else tmp_3 = b / -a; end tmp_2 = tmp_3; elseif (b <= 3.5e+92) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = (c * 2.0) / (-b - t_0); else tmp_4 = (t_0 - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)); else tmp_2 = (b * -2.0) / (a * 2.0); end tmp_5 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -2.5e+79], If[GreaterEqual[b, 0.0], N[((-c) / b), $MachinePrecision], N[(b / (-a)), $MachinePrecision]], If[LessEqual[b, 3.5e+92], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[(2.0 * N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
\mathbf{if}\;b \leq -2.5 \cdot 10^{+79}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
\mathbf{elif}\;b \leq 3.5 \cdot 10^{+92}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{2 \cdot \left(a \cdot \frac{c}{b} - b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 2}\\
\end{array}
\end{array}
if b < -2.5e79Initial program 55.2%
Simplified55.2%
Taylor expanded in c around 0 55.2%
associate-*r/55.2%
mul-1-neg55.2%
Simplified55.2%
Taylor expanded in b around -inf 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in b around 0 91.6%
associate-*r/91.6%
mul-1-neg91.6%
associate-*r/91.6%
neg-mul-191.6%
Simplified91.6%
if -2.5e79 < b < 3.49999999999999986e92Initial program 83.5%
if 3.49999999999999986e92 < b Initial program 56.6%
Taylor expanded in b around -inf 56.6%
*-commutative56.6%
Simplified56.6%
Taylor expanded in a around 0 93.5%
distribute-lft-out--93.5%
associate-/l*99.8%
Simplified99.8%
Final simplification89.0%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))))
(if (<= b -2.3e+81)
(if (>= b 0.0) (/ (- c) b) (/ b (- a)))
(if (<= b 4.2e-41)
(if (>= b 0.0) (/ -1.0 (/ (+ b (sqrt (* c (* a -4.0)))) (* c 2.0))) t_0)
(if (>= b 0.0) (/ (* c 2.0) (* 2.0 (fma a (/ c b) (- b)))) t_0)))))
double code(double a, double b, double c) {
double t_0 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
double tmp_1;
if (b <= -2.3e+81) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -c / b;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 4.2e-41) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = -1.0 / ((b + sqrt((c * (a * -4.0)))) / (c * 2.0));
} else {
tmp_3 = t_0;
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * fma(a, (c / b), -b));
} else {
tmp_1 = t_0;
}
return tmp_1;
}
function code(a, b, c) t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) tmp_1 = 0.0 if (b <= -2.3e+81) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(-c) / b); else tmp_2 = Float64(b / Float64(-a)); end tmp_1 = tmp_2; elseif (b <= 4.2e-41) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(-1.0 / Float64(Float64(b + sqrt(Float64(c * Float64(a * -4.0)))) / Float64(c * 2.0))); else tmp_3 = t_0; end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * 2.0) / Float64(2.0 * fma(a, Float64(c / b), Float64(-b)))); else tmp_1 = t_0; end return tmp_1 end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2.3e+81], If[GreaterEqual[b, 0.0], N[((-c) / b), $MachinePrecision], N[(b / (-a)), $MachinePrecision]], If[LessEqual[b, 4.2e-41], If[GreaterEqual[b, 0.0], N[(-1.0 / N[(N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(c * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[(2.0 * N[(a * N[(c / b), $MachinePrecision] + (-b)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{if}\;b \leq -2.3 \cdot 10^{+81}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{-41}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-1}{\frac{b + \sqrt{c \cdot \left(a \cdot -4\right)}}{c \cdot 2}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -2.2999999999999999e81Initial program 55.2%
Simplified55.2%
Taylor expanded in c around 0 55.2%
associate-*r/55.2%
mul-1-neg55.2%
Simplified55.2%
Taylor expanded in b around -inf 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in b around 0 91.6%
associate-*r/91.6%
mul-1-neg91.6%
associate-*r/91.6%
neg-mul-191.6%
Simplified91.6%
if -2.2999999999999999e81 < b < 4.20000000000000025e-41Initial program 79.6%
add-sqr-sqrt79.4%
pow279.4%
pow1/279.4%
sqrt-pow179.4%
fmm-def79.4%
*-commutative79.4%
distribute-rgt-neg-in79.4%
distribute-lft-neg-in79.4%
metadata-eval79.4%
*-commutative79.4%
metadata-eval79.4%
Applied egg-rr79.4%
Taylor expanded in b around 0 75.2%
*-commutative75.2%
*-commutative75.2%
associate-*r*75.2%
*-commutative75.2%
Simplified75.2%
clear-num75.2%
inv-pow75.2%
pow-pow75.4%
*-commutative75.4%
metadata-eval75.4%
pow1/275.4%
Applied egg-rr75.4%
unpow-175.4%
Simplified75.4%
if 4.20000000000000025e-41 < b Initial program 70.2%
Taylor expanded in a around 0 89.0%
distribute-lft-out--89.0%
associate-/l*93.3%
fmm-def93.3%
Simplified93.3%
Final simplification84.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e+81)
(if (>= b 0.0) (/ (- c) b) (/ b (- a)))
(if (<= b 3.5e-41)
(if (>= b 0.0)
(/ -1.0 (/ (+ b (sqrt (* c (* a -4.0)))) (* c 2.0)))
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)))
(if (>= b 0.0)
(/ (* c 2.0) (* 2.0 (- (* a (/ c b)) b)))
(/ (* b -2.0) (* a 2.0))))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= -2.3e+81) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -c / b;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 3.5e-41) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = -1.0 / ((b + sqrt((c * (a * -4.0)))) / (c * 2.0));
} else {
tmp_3 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
if (b <= (-2.3d+81)) then
if (b >= 0.0d0) then
tmp_2 = -c / b
else
tmp_2 = b / -a
end if
tmp_1 = tmp_2
else if (b <= 3.5d-41) then
if (b >= 0.0d0) then
tmp_3 = (-1.0d0) / ((b + sqrt((c * (a * (-4.0d0))))) / (c * 2.0d0))
else
tmp_3 = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = (c * 2.0d0) / (2.0d0 * ((a * (c / b)) - b))
else
tmp_1 = (b * (-2.0d0)) / (a * 2.0d0)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= -2.3e+81) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -c / b;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 3.5e-41) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = -1.0 / ((b + Math.sqrt((c * (a * -4.0)))) / (c * 2.0));
} else {
tmp_3 = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= -2.3e+81: tmp_2 = 0 if b >= 0.0: tmp_2 = -c / b else: tmp_2 = b / -a tmp_1 = tmp_2 elif b <= 3.5e-41: tmp_3 = 0 if b >= 0.0: tmp_3 = -1.0 / ((b + math.sqrt((c * (a * -4.0)))) / (c * 2.0)) else: tmp_3 = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)) else: tmp_1 = (b * -2.0) / (a * 2.0) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= -2.3e+81) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(-c) / b); else tmp_2 = Float64(b / Float64(-a)); end tmp_1 = tmp_2; elseif (b <= 3.5e-41) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(-1.0 / Float64(Float64(b + sqrt(Float64(c * Float64(a * -4.0)))) / Float64(c * 2.0))); else tmp_3 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * 2.0) / Float64(2.0 * Float64(Float64(a * Float64(c / b)) - b))); else tmp_1 = Float64(Float64(b * -2.0) / Float64(a * 2.0)); end return tmp_1 end
function tmp_5 = code(a, b, c) tmp_2 = 0.0; if (b <= -2.3e+81) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = -c / b; else tmp_3 = b / -a; end tmp_2 = tmp_3; elseif (b <= 3.5e-41) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = -1.0 / ((b + sqrt((c * (a * -4.0)))) / (c * 2.0)); else tmp_4 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)); else tmp_2 = (b * -2.0) / (a * 2.0); end tmp_5 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, -2.3e+81], If[GreaterEqual[b, 0.0], N[((-c) / b), $MachinePrecision], N[(b / (-a)), $MachinePrecision]], If[LessEqual[b, 3.5e-41], If[GreaterEqual[b, 0.0], N[(-1.0 / N[(N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(c * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[(2.0 * N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{+81}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
\mathbf{elif}\;b \leq 3.5 \cdot 10^{-41}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-1}{\frac{b + \sqrt{c \cdot \left(a \cdot -4\right)}}{c \cdot 2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{2 \cdot \left(a \cdot \frac{c}{b} - b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 2}\\
\end{array}
\end{array}
if b < -2.2999999999999999e81Initial program 55.2%
Simplified55.2%
Taylor expanded in c around 0 55.2%
associate-*r/55.2%
mul-1-neg55.2%
Simplified55.2%
Taylor expanded in b around -inf 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in b around 0 91.6%
associate-*r/91.6%
mul-1-neg91.6%
associate-*r/91.6%
neg-mul-191.6%
Simplified91.6%
if -2.2999999999999999e81 < b < 3.5e-41Initial program 79.6%
add-sqr-sqrt79.4%
pow279.4%
pow1/279.4%
sqrt-pow179.4%
fmm-def79.4%
*-commutative79.4%
distribute-rgt-neg-in79.4%
distribute-lft-neg-in79.4%
metadata-eval79.4%
*-commutative79.4%
metadata-eval79.4%
Applied egg-rr79.4%
Taylor expanded in b around 0 75.2%
*-commutative75.2%
*-commutative75.2%
associate-*r*75.2%
*-commutative75.2%
Simplified75.2%
clear-num75.2%
inv-pow75.2%
pow-pow75.4%
*-commutative75.4%
metadata-eval75.4%
pow1/275.4%
Applied egg-rr75.4%
unpow-175.4%
Simplified75.4%
if 3.5e-41 < b Initial program 70.2%
Taylor expanded in b around -inf 70.2%
*-commutative70.2%
Simplified70.2%
Taylor expanded in a around 0 89.0%
distribute-lft-out--89.0%
associate-/l*93.3%
Simplified93.3%
Final simplification84.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e+81)
(if (>= b 0.0) (/ (- c) b) (/ b (- a)))
(if (<= b 2.5e-41)
(if (>= b 0.0)
(/ -1.0 (* (/ 0.5 c) (+ b (sqrt (* c (* a -4.0))))))
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)))
(if (>= b 0.0)
(/ (* c 2.0) (* 2.0 (- (* a (/ c b)) b)))
(/ (* b -2.0) (* a 2.0))))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= -2.3e+81) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -c / b;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 2.5e-41) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = -1.0 / ((0.5 / c) * (b + sqrt((c * (a * -4.0)))));
} else {
tmp_3 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
if (b <= (-2.3d+81)) then
if (b >= 0.0d0) then
tmp_2 = -c / b
else
tmp_2 = b / -a
end if
tmp_1 = tmp_2
else if (b <= 2.5d-41) then
if (b >= 0.0d0) then
tmp_3 = (-1.0d0) / ((0.5d0 / c) * (b + sqrt((c * (a * (-4.0d0))))))
else
tmp_3 = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = (c * 2.0d0) / (2.0d0 * ((a * (c / b)) - b))
else
tmp_1 = (b * (-2.0d0)) / (a * 2.0d0)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= -2.3e+81) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -c / b;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 2.5e-41) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = -1.0 / ((0.5 / c) * (b + Math.sqrt((c * (a * -4.0)))));
} else {
tmp_3 = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= -2.3e+81: tmp_2 = 0 if b >= 0.0: tmp_2 = -c / b else: tmp_2 = b / -a tmp_1 = tmp_2 elif b <= 2.5e-41: tmp_3 = 0 if b >= 0.0: tmp_3 = -1.0 / ((0.5 / c) * (b + math.sqrt((c * (a * -4.0))))) else: tmp_3 = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)) else: tmp_1 = (b * -2.0) / (a * 2.0) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= -2.3e+81) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(-c) / b); else tmp_2 = Float64(b / Float64(-a)); end tmp_1 = tmp_2; elseif (b <= 2.5e-41) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(-1.0 / Float64(Float64(0.5 / c) * Float64(b + sqrt(Float64(c * Float64(a * -4.0)))))); else tmp_3 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * 2.0) / Float64(2.0 * Float64(Float64(a * Float64(c / b)) - b))); else tmp_1 = Float64(Float64(b * -2.0) / Float64(a * 2.0)); end return tmp_1 end
function tmp_5 = code(a, b, c) tmp_2 = 0.0; if (b <= -2.3e+81) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = -c / b; else tmp_3 = b / -a; end tmp_2 = tmp_3; elseif (b <= 2.5e-41) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = -1.0 / ((0.5 / c) * (b + sqrt((c * (a * -4.0))))); else tmp_4 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)); else tmp_2 = (b * -2.0) / (a * 2.0); end tmp_5 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, -2.3e+81], If[GreaterEqual[b, 0.0], N[((-c) / b), $MachinePrecision], N[(b / (-a)), $MachinePrecision]], If[LessEqual[b, 2.5e-41], If[GreaterEqual[b, 0.0], N[(-1.0 / N[(N[(0.5 / c), $MachinePrecision] * N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[(2.0 * N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{+81}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
\mathbf{elif}\;b \leq 2.5 \cdot 10^{-41}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-1}{\frac{0.5}{c} \cdot \left(b + \sqrt{c \cdot \left(a \cdot -4\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{2 \cdot \left(a \cdot \frac{c}{b} - b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 2}\\
\end{array}
\end{array}
if b < -2.2999999999999999e81Initial program 55.2%
Simplified55.2%
Taylor expanded in c around 0 55.2%
associate-*r/55.2%
mul-1-neg55.2%
Simplified55.2%
Taylor expanded in b around -inf 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in b around 0 91.6%
associate-*r/91.6%
mul-1-neg91.6%
associate-*r/91.6%
neg-mul-191.6%
Simplified91.6%
if -2.2999999999999999e81 < b < 2.4999999999999998e-41Initial program 79.6%
add-sqr-sqrt79.4%
pow279.4%
pow1/279.4%
sqrt-pow179.4%
fmm-def79.4%
*-commutative79.4%
distribute-rgt-neg-in79.4%
distribute-lft-neg-in79.4%
metadata-eval79.4%
*-commutative79.4%
metadata-eval79.4%
Applied egg-rr79.4%
Taylor expanded in b around 0 75.2%
*-commutative75.2%
*-commutative75.2%
associate-*r*75.2%
*-commutative75.2%
Simplified75.2%
clear-num75.2%
inv-pow75.2%
pow-pow75.4%
*-commutative75.4%
metadata-eval75.4%
pow1/275.4%
Applied egg-rr75.4%
unpow-175.4%
Simplified75.4%
inv-pow75.4%
Applied egg-rr75.4%
unpow-175.4%
*-rgt-identity75.4%
associate-*r/75.4%
associate-/r*75.4%
metadata-eval75.4%
metadata-eval75.4%
associate-*r/75.4%
*-commutative75.4%
associate-*r/75.4%
metadata-eval75.4%
*-commutative75.4%
Simplified75.4%
if 2.4999999999999998e-41 < b Initial program 70.2%
Taylor expanded in b around -inf 70.2%
*-commutative70.2%
Simplified70.2%
Taylor expanded in a around 0 89.0%
distribute-lft-out--89.0%
associate-/l*93.3%
Simplified93.3%
Final simplification84.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2e+79)
(if (>= b 0.0) (/ (- c) b) (/ b (- a)))
(if (<= b 3.3e-41)
(if (>= b 0.0)
(* (* c 2.0) (/ -1.0 (+ b (sqrt (* c (* a -4.0))))))
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)))
(if (>= b 0.0)
(/ (* c 2.0) (* 2.0 (- (* a (/ c b)) b)))
(/ (* b -2.0) (* a 2.0))))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= -2e+79) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -c / b;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 3.3e-41) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * 2.0) * (-1.0 / (b + sqrt((c * (a * -4.0)))));
} else {
tmp_3 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
if (b <= (-2d+79)) then
if (b >= 0.0d0) then
tmp_2 = -c / b
else
tmp_2 = b / -a
end if
tmp_1 = tmp_2
else if (b <= 3.3d-41) then
if (b >= 0.0d0) then
tmp_3 = (c * 2.0d0) * ((-1.0d0) / (b + sqrt((c * (a * (-4.0d0))))))
else
tmp_3 = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = (c * 2.0d0) / (2.0d0 * ((a * (c / b)) - b))
else
tmp_1 = (b * (-2.0d0)) / (a * 2.0d0)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= -2e+79) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -c / b;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 3.3e-41) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * 2.0) * (-1.0 / (b + Math.sqrt((c * (a * -4.0)))));
} else {
tmp_3 = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= -2e+79: tmp_2 = 0 if b >= 0.0: tmp_2 = -c / b else: tmp_2 = b / -a tmp_1 = tmp_2 elif b <= 3.3e-41: tmp_3 = 0 if b >= 0.0: tmp_3 = (c * 2.0) * (-1.0 / (b + math.sqrt((c * (a * -4.0))))) else: tmp_3 = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)) else: tmp_1 = (b * -2.0) / (a * 2.0) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= -2e+79) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(-c) / b); else tmp_2 = Float64(b / Float64(-a)); end tmp_1 = tmp_2; elseif (b <= 3.3e-41) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(c * 2.0) * Float64(-1.0 / Float64(b + sqrt(Float64(c * Float64(a * -4.0)))))); else tmp_3 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * 2.0) / Float64(2.0 * Float64(Float64(a * Float64(c / b)) - b))); else tmp_1 = Float64(Float64(b * -2.0) / Float64(a * 2.0)); end return tmp_1 end
function tmp_5 = code(a, b, c) tmp_2 = 0.0; if (b <= -2e+79) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = -c / b; else tmp_3 = b / -a; end tmp_2 = tmp_3; elseif (b <= 3.3e-41) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = (c * 2.0) * (-1.0 / (b + sqrt((c * (a * -4.0))))); else tmp_4 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = (c * 2.0) / (2.0 * ((a * (c / b)) - b)); else tmp_2 = (b * -2.0) / (a * 2.0); end tmp_5 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, -2e+79], If[GreaterEqual[b, 0.0], N[((-c) / b), $MachinePrecision], N[(b / (-a)), $MachinePrecision]], If[LessEqual[b, 3.3e-41], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] * N[(-1.0 / N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[(2.0 * N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{+79}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
\mathbf{elif}\;b \leq 3.3 \cdot 10^{-41}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\left(c \cdot 2\right) \cdot \frac{-1}{b + \sqrt{c \cdot \left(a \cdot -4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{2 \cdot \left(a \cdot \frac{c}{b} - b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 2}\\
\end{array}
\end{array}
if b < -1.99999999999999993e79Initial program 55.2%
Simplified55.2%
Taylor expanded in c around 0 55.2%
associate-*r/55.2%
mul-1-neg55.2%
Simplified55.2%
Taylor expanded in b around -inf 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in b around 0 91.6%
associate-*r/91.6%
mul-1-neg91.6%
associate-*r/91.6%
neg-mul-191.6%
Simplified91.6%
if -1.99999999999999993e79 < b < 3.30000000000000024e-41Initial program 79.6%
add-sqr-sqrt79.4%
pow279.4%
pow1/279.4%
sqrt-pow179.4%
fmm-def79.4%
*-commutative79.4%
distribute-rgt-neg-in79.4%
distribute-lft-neg-in79.4%
metadata-eval79.4%
*-commutative79.4%
metadata-eval79.4%
Applied egg-rr79.4%
Taylor expanded in b around 0 75.2%
*-commutative75.2%
*-commutative75.2%
associate-*r*75.2%
*-commutative75.2%
Simplified75.2%
div-inv75.2%
pow-pow75.3%
*-commutative75.3%
metadata-eval75.3%
pow1/275.3%
Applied egg-rr75.3%
if 3.30000000000000024e-41 < b Initial program 70.2%
Taylor expanded in b around -inf 70.2%
*-commutative70.2%
Simplified70.2%
Taylor expanded in a around 0 89.0%
distribute-lft-out--89.0%
associate-/l*93.3%
Simplified93.3%
Final simplification84.9%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- c) b)))
(if (<= b -4.2e-86)
(if (>= b 0.0) t_0 (/ b (- a)))
(if (>= b 0.0) t_0 (/ (- b (sqrt (* c (* a -4.0)))) (* -2.0 a))))))
double code(double a, double b, double c) {
double t_0 = -c / b;
double tmp_1;
if (b <= -4.2e-86) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = t_0;
} else {
tmp_1 = (b - sqrt((c * (a * -4.0)))) / (-2.0 * a);
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
t_0 = -c / b
if (b <= (-4.2d-86)) then
if (b >= 0.0d0) then
tmp_2 = t_0
else
tmp_2 = b / -a
end if
tmp_1 = tmp_2
else if (b >= 0.0d0) then
tmp_1 = t_0
else
tmp_1 = (b - sqrt((c * (a * (-4.0d0))))) / ((-2.0d0) * a)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double t_0 = -c / b;
double tmp_1;
if (b <= -4.2e-86) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = t_0;
} else {
tmp_1 = (b - Math.sqrt((c * (a * -4.0)))) / (-2.0 * a);
}
return tmp_1;
}
def code(a, b, c): t_0 = -c / b tmp_1 = 0 if b <= -4.2e-86: tmp_2 = 0 if b >= 0.0: tmp_2 = t_0 else: tmp_2 = b / -a tmp_1 = tmp_2 elif b >= 0.0: tmp_1 = t_0 else: tmp_1 = (b - math.sqrt((c * (a * -4.0)))) / (-2.0 * a) return tmp_1
function code(a, b, c) t_0 = Float64(Float64(-c) / b) tmp_1 = 0.0 if (b <= -4.2e-86) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = t_0; else tmp_2 = Float64(b / Float64(-a)); end tmp_1 = tmp_2; elseif (b >= 0.0) tmp_1 = t_0; else tmp_1 = Float64(Float64(b - sqrt(Float64(c * Float64(a * -4.0)))) / Float64(-2.0 * a)); end return tmp_1 end
function tmp_4 = code(a, b, c) t_0 = -c / b; tmp_2 = 0.0; if (b <= -4.2e-86) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = t_0; else tmp_3 = b / -a; end tmp_2 = tmp_3; elseif (b >= 0.0) tmp_2 = t_0; else tmp_2 = (b - sqrt((c * (a * -4.0)))) / (-2.0 * a); end tmp_4 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[((-c) / b), $MachinePrecision]}, If[LessEqual[b, -4.2e-86], If[GreaterEqual[b, 0.0], t$95$0, N[(b / (-a)), $MachinePrecision]], If[GreaterEqual[b, 0.0], t$95$0, N[(N[(b - N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(-2.0 * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-c}{b}\\
\mathbf{if}\;b \leq -4.2 \cdot 10^{-86}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \sqrt{c \cdot \left(a \cdot -4\right)}}{-2 \cdot a}\\
\end{array}
\end{array}
if b < -4.2e-86Initial program 69.0%
Simplified69.0%
Taylor expanded in c around 0 69.0%
associate-*r/69.0%
mul-1-neg69.0%
Simplified69.0%
Taylor expanded in b around -inf 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in b around 0 84.8%
associate-*r/84.8%
mul-1-neg84.8%
associate-*r/84.8%
neg-mul-184.8%
Simplified84.8%
if -4.2e-86 < b Initial program 72.3%
Simplified72.2%
Taylor expanded in c around 0 66.6%
associate-*r/66.6%
mul-1-neg66.6%
Simplified66.6%
Taylor expanded in c around inf 65.1%
*-commutative65.1%
*-commutative65.1%
associate-*r*65.1%
*-commutative65.1%
Simplified65.1%
Final simplification71.5%
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ (- c) b) (/ b (- a))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = -c / b;
} else {
tmp = b / -a;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b >= 0.0d0) then
tmp = -c / b
else
tmp = b / -a
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = -c / b;
} else {
tmp = b / -a;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = -c / b else: tmp = b / -a return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(-c) / b); else tmp = Float64(b / Float64(-a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b >= 0.0) tmp = -c / b; else tmp = b / -a; end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[((-c) / b), $MachinePrecision], N[(b / (-a)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}
\end{array}
Initial program 71.2%
Simplified71.1%
Taylor expanded in c around 0 67.4%
associate-*r/67.4%
mul-1-neg67.4%
Simplified67.4%
Taylor expanded in b around -inf 65.2%
*-commutative65.2%
Simplified65.2%
Taylor expanded in b around 0 65.6%
associate-*r/65.6%
mul-1-neg65.6%
associate-*r/65.6%
neg-mul-165.6%
Simplified65.6%
Final simplification65.6%
herbie shell --seed 2024172
(FPCore (a b c)
:name "jeff quadratic root 2"
:precision binary64
(if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))