
(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 (if (>= b 0.0) (/ (- c) b) (/ b (- a)))) (t_1 (* a (* c -4.0))))
(if (<= b -1.4e+163)
t_0
(if (<= b -5e-136)
(if (>= b 0.0)
(* c (/ 2.0 (* b -2.0)))
(/ (- (sqrt (fma b b t_1)) b) (* a 2.0)))
(if (<= b 1.72e+72)
(if (>= b 0.0)
(/ (* c 2.0) (- (- b) (sqrt (- (* b b) (* c (* a 4.0))))))
(/ (- (hypot b (sqrt t_1)) b) (* a 2.0)))
t_0)))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = -c / b;
} else {
tmp = b / -a;
}
double t_0 = tmp;
double t_1 = a * (c * -4.0);
double tmp_1;
if (b <= -1.4e+163) {
tmp_1 = t_0;
} else if (b <= -5e-136) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = c * (2.0 / (b * -2.0));
} else {
tmp_2 = (sqrt(fma(b, b, t_1)) - b) / (a * 2.0);
}
tmp_1 = tmp_2;
} else if (b <= 1.72e+72) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * 2.0) / (-b - sqrt(((b * b) - (c * (a * 4.0)))));
} else {
tmp_3 = (hypot(b, sqrt(t_1)) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else {
tmp_1 = t_0;
}
return tmp_1;
}
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(-c) / b); else tmp = Float64(b / Float64(-a)); end t_0 = tmp t_1 = Float64(a * Float64(c * -4.0)) tmp_1 = 0.0 if (b <= -1.4e+163) tmp_1 = t_0; elseif (b <= -5e-136) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(c * Float64(2.0 / Float64(b * -2.0))); else tmp_2 = Float64(Float64(sqrt(fma(b, b, t_1)) - b) / Float64(a * 2.0)); end tmp_1 = tmp_2; elseif (b <= 1.72e+72) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(c * 2.0) / Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))))); else tmp_3 = Float64(Float64(hypot(b, sqrt(t_1)) - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; else tmp_1 = t_0; end return tmp_1 end
code[a_, b_, c_] := Block[{t$95$0 = If[GreaterEqual[b, 0.0], N[((-c) / b), $MachinePrecision], N[(b / (-a)), $MachinePrecision]]}, Block[{t$95$1 = N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.4e+163], t$95$0, If[LessEqual[b, -5e-136], If[GreaterEqual[b, 0.0], N[(c * N[(2.0 / N[(b * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(b * b + t$95$1), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 1.72e+72], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[b ^ 2 + N[Sqrt[t$95$1], $MachinePrecision] ^ 2], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
t_1 := a \cdot \left(c \cdot -4\right)\\
\mathbf{if}\;b \leq -1.4 \cdot 10^{+163}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b \leq -5 \cdot 10^{-136}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{2}{b \cdot -2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, t_1\right)} - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.72 \cdot 10^{+72}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{hypot}\left(b, \sqrt{t_1}\right) - b}{a \cdot 2}\\
\end{array}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- c) b))
(t_1 (sqrt (- (* b b) (* c (* a 4.0)))))
(t_2 (/ (* c 2.0) (- (- b) t_1))))
(if (<= b -1.25e+49)
(if (>= b 0.0) t_0 (* -0.5 (+ (* -2.0 (/ c b)) (* 2.0 (/ b a)))))
(if (<= b -2e-117)
(if (>= b 0.0) t_2 (/ (- t_1 b) (* a 2.0)))
(if (<= b 1.66e+72)
(if (>= b 0.0)
t_2
(/ (- (hypot b (sqrt (* a (* c -4.0)))) b) (* a 2.0)))
(if (>= b 0.0) t_0 (/ b (- a))))))))
double code(double a, double b, double c) {
double t_0 = -c / b;
double t_1 = sqrt(((b * b) - (c * (a * 4.0))));
double t_2 = (c * 2.0) / (-b - t_1);
double tmp_1;
if (b <= -1.25e+49) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a)));
}
tmp_1 = tmp_2;
} else if (b <= -2e-117) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = t_2;
} else {
tmp_3 = (t_1 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b <= 1.66e+72) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = t_2;
} else {
tmp_4 = (hypot(b, sqrt((a * (c * -4.0)))) - b) / (a * 2.0);
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = t_0;
} else {
tmp_1 = b / -a;
}
return tmp_1;
}
public static double code(double a, double b, double c) {
double t_0 = -c / b;
double t_1 = Math.sqrt(((b * b) - (c * (a * 4.0))));
double t_2 = (c * 2.0) / (-b - t_1);
double tmp_1;
if (b <= -1.25e+49) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a)));
}
tmp_1 = tmp_2;
} else if (b <= -2e-117) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = t_2;
} else {
tmp_3 = (t_1 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b <= 1.66e+72) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = t_2;
} else {
tmp_4 = (Math.hypot(b, Math.sqrt((a * (c * -4.0)))) - b) / (a * 2.0);
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = t_0;
} else {
tmp_1 = b / -a;
}
return tmp_1;
}
def code(a, b, c): t_0 = -c / b t_1 = math.sqrt(((b * b) - (c * (a * 4.0)))) t_2 = (c * 2.0) / (-b - t_1) tmp_1 = 0 if b <= -1.25e+49: tmp_2 = 0 if b >= 0.0: tmp_2 = t_0 else: tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a))) tmp_1 = tmp_2 elif b <= -2e-117: tmp_3 = 0 if b >= 0.0: tmp_3 = t_2 else: tmp_3 = (t_1 - b) / (a * 2.0) tmp_1 = tmp_3 elif b <= 1.66e+72: tmp_4 = 0 if b >= 0.0: tmp_4 = t_2 else: tmp_4 = (math.hypot(b, math.sqrt((a * (c * -4.0)))) - b) / (a * 2.0) tmp_1 = tmp_4 elif b >= 0.0: tmp_1 = t_0 else: tmp_1 = b / -a return tmp_1
function code(a, b, c) t_0 = Float64(Float64(-c) / b) t_1 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) t_2 = Float64(Float64(c * 2.0) / Float64(Float64(-b) - t_1)) tmp_1 = 0.0 if (b <= -1.25e+49) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = t_0; else tmp_2 = Float64(-0.5 * Float64(Float64(-2.0 * Float64(c / b)) + Float64(2.0 * Float64(b / a)))); end tmp_1 = tmp_2; elseif (b <= -2e-117) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = t_2; else tmp_3 = Float64(Float64(t_1 - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b <= 1.66e+72) tmp_4 = 0.0 if (b >= 0.0) tmp_4 = t_2; else tmp_4 = Float64(Float64(hypot(b, sqrt(Float64(a * Float64(c * -4.0)))) - b) / Float64(a * 2.0)); end tmp_1 = tmp_4; elseif (b >= 0.0) tmp_1 = t_0; else tmp_1 = Float64(b / Float64(-a)); end return tmp_1 end
function tmp_6 = code(a, b, c) t_0 = -c / b; t_1 = sqrt(((b * b) - (c * (a * 4.0)))); t_2 = (c * 2.0) / (-b - t_1); tmp_2 = 0.0; if (b <= -1.25e+49) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = t_0; else tmp_3 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a))); end tmp_2 = tmp_3; elseif (b <= -2e-117) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = t_2; else tmp_4 = (t_1 - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b <= 1.66e+72) tmp_5 = 0.0; if (b >= 0.0) tmp_5 = t_2; else tmp_5 = (hypot(b, sqrt((a * (c * -4.0)))) - b) / (a * 2.0); end tmp_2 = tmp_5; elseif (b >= 0.0) tmp_2 = t_0; else tmp_2 = b / -a; 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[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * 2.0), $MachinePrecision] / N[((-b) - t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.25e+49], If[GreaterEqual[b, 0.0], t$95$0, N[(-0.5 * N[(N[(-2.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, -2e-117], If[GreaterEqual[b, 0.0], t$95$2, N[(N[(t$95$1 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 1.66e+72], If[GreaterEqual[b, 0.0], t$95$2, N[(N[(N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], t$95$0, N[(b / (-a)), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-c}{b}\\
t_1 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
t_2 := \frac{c \cdot 2}{\left(-b\right) - t_1}\\
\mathbf{if}\;b \leq -1.25 \cdot 10^{+49}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(-2 \cdot \frac{c}{b} + 2 \cdot \frac{b}{a}\right)\\
\end{array}\\
\mathbf{elif}\;b \leq -2 \cdot 10^{-117}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1 - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.66 \cdot 10^{+72}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right) - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- c) b)) (t_1 (sqrt (- (* b b) (* c (* a 4.0))))))
(if (<= b -1.15e+49)
(if (>= b 0.0) t_0 (* -0.5 (+ (* -2.0 (/ c b)) (* 2.0 (/ b a)))))
(if (<= b 1.72e+72)
(if (>= b 0.0) (/ (* c 2.0) (- (- b) t_1)) (/ (- t_1 b) (* a 2.0)))
(if (>= b 0.0) t_0 (/ b (- a)))))))
double code(double a, double b, double c) {
double t_0 = -c / b;
double t_1 = sqrt(((b * b) - (c * (a * 4.0))));
double tmp_1;
if (b <= -1.15e+49) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a)));
}
tmp_1 = tmp_2;
} else if (b <= 1.72e+72) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * 2.0) / (-b - t_1);
} else {
tmp_3 = (t_1 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = t_0;
} else {
tmp_1 = b / -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) :: t_1
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
t_0 = -c / b
t_1 = sqrt(((b * b) - (c * (a * 4.0d0))))
if (b <= (-1.15d+49)) then
if (b >= 0.0d0) then
tmp_2 = t_0
else
tmp_2 = (-0.5d0) * (((-2.0d0) * (c / b)) + (2.0d0 * (b / a)))
end if
tmp_1 = tmp_2
else if (b <= 1.72d+72) then
if (b >= 0.0d0) then
tmp_3 = (c * 2.0d0) / (-b - t_1)
else
tmp_3 = (t_1 - b) / (a * 2.0d0)
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = t_0
else
tmp_1 = b / -a
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(((b * b) - (c * (a * 4.0))));
double tmp_1;
if (b <= -1.15e+49) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a)));
}
tmp_1 = tmp_2;
} else if (b <= 1.72e+72) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * 2.0) / (-b - t_1);
} else {
tmp_3 = (t_1 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = t_0;
} else {
tmp_1 = b / -a;
}
return tmp_1;
}
def code(a, b, c): t_0 = -c / b t_1 = math.sqrt(((b * b) - (c * (a * 4.0)))) tmp_1 = 0 if b <= -1.15e+49: tmp_2 = 0 if b >= 0.0: tmp_2 = t_0 else: tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a))) tmp_1 = tmp_2 elif b <= 1.72e+72: tmp_3 = 0 if b >= 0.0: tmp_3 = (c * 2.0) / (-b - t_1) else: tmp_3 = (t_1 - b) / (a * 2.0) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = t_0 else: tmp_1 = b / -a return tmp_1
function code(a, b, c) t_0 = Float64(Float64(-c) / b) t_1 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) tmp_1 = 0.0 if (b <= -1.15e+49) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = t_0; else tmp_2 = Float64(-0.5 * Float64(Float64(-2.0 * Float64(c / b)) + Float64(2.0 * Float64(b / a)))); end tmp_1 = tmp_2; elseif (b <= 1.72e+72) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(c * 2.0) / Float64(Float64(-b) - t_1)); else tmp_3 = Float64(Float64(t_1 - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = t_0; else tmp_1 = Float64(b / Float64(-a)); end return tmp_1 end
function tmp_5 = code(a, b, c) t_0 = -c / b; t_1 = sqrt(((b * b) - (c * (a * 4.0)))); tmp_2 = 0.0; if (b <= -1.15e+49) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = t_0; else tmp_3 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a))); end tmp_2 = tmp_3; elseif (b <= 1.72e+72) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = (c * 2.0) / (-b - t_1); else tmp_4 = (t_1 - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = t_0; else tmp_2 = b / -a; end tmp_5 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[((-c) / b), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -1.15e+49], If[GreaterEqual[b, 0.0], t$95$0, N[(-0.5 * N[(N[(-2.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 1.72e+72], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[((-b) - t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], t$95$0, N[(b / (-a)), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-c}{b}\\
t_1 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
\mathbf{if}\;b \leq -1.15 \cdot 10^{+49}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(-2 \cdot \frac{c}{b} + 2 \cdot \frac{b}{a}\right)\\
\end{array}\\
\mathbf{elif}\;b \leq 1.72 \cdot 10^{+72}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{\left(-b\right) - t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1 - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- c) b)) (t_1 (sqrt (* -4.0 (* c a)))))
(if (<= b -5.6e-73)
(if (>= b 0.0) t_0 (* -0.5 (+ (* -2.0 (/ c b)) (* 2.0 (/ b a)))))
(if (<= b 2.8e-279)
(if (>= b 0.0) t_0 (* -0.5 (/ (- b t_1) a)))
(if (<= b 2.1e-56)
(if (>= b 0.0) (* c (/ -2.0 (+ b t_1))) (* -0.5 (/ (+ b b) a)))
(if (>= b 0.0) t_0 (/ b (- a))))))))
double code(double a, double b, double c) {
double t_0 = -c / b;
double t_1 = sqrt((-4.0 * (c * a)));
double tmp_1;
if (b <= -5.6e-73) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a)));
}
tmp_1 = tmp_2;
} else if (b <= 2.8e-279) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = t_0;
} else {
tmp_3 = -0.5 * ((b - t_1) / a);
}
tmp_1 = tmp_3;
} else if (b <= 2.1e-56) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = c * (-2.0 / (b + t_1));
} else {
tmp_4 = -0.5 * ((b + b) / a);
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = t_0;
} else {
tmp_1 = b / -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) :: t_1
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(((-4.0d0) * (c * a)))
if (b <= (-5.6d-73)) then
if (b >= 0.0d0) then
tmp_2 = t_0
else
tmp_2 = (-0.5d0) * (((-2.0d0) * (c / b)) + (2.0d0 * (b / a)))
end if
tmp_1 = tmp_2
else if (b <= 2.8d-279) then
if (b >= 0.0d0) then
tmp_3 = t_0
else
tmp_3 = (-0.5d0) * ((b - t_1) / a)
end if
tmp_1 = tmp_3
else if (b <= 2.1d-56) then
if (b >= 0.0d0) then
tmp_4 = c * ((-2.0d0) / (b + t_1))
else
tmp_4 = (-0.5d0) * ((b + b) / a)
end if
tmp_1 = tmp_4
else if (b >= 0.0d0) then
tmp_1 = t_0
else
tmp_1 = b / -a
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((-4.0 * (c * a)));
double tmp_1;
if (b <= -5.6e-73) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a)));
}
tmp_1 = tmp_2;
} else if (b <= 2.8e-279) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = t_0;
} else {
tmp_3 = -0.5 * ((b - t_1) / a);
}
tmp_1 = tmp_3;
} else if (b <= 2.1e-56) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = c * (-2.0 / (b + t_1));
} else {
tmp_4 = -0.5 * ((b + b) / a);
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = t_0;
} else {
tmp_1 = b / -a;
}
return tmp_1;
}
def code(a, b, c): t_0 = -c / b t_1 = math.sqrt((-4.0 * (c * a))) tmp_1 = 0 if b <= -5.6e-73: tmp_2 = 0 if b >= 0.0: tmp_2 = t_0 else: tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a))) tmp_1 = tmp_2 elif b <= 2.8e-279: tmp_3 = 0 if b >= 0.0: tmp_3 = t_0 else: tmp_3 = -0.5 * ((b - t_1) / a) tmp_1 = tmp_3 elif b <= 2.1e-56: tmp_4 = 0 if b >= 0.0: tmp_4 = c * (-2.0 / (b + t_1)) else: tmp_4 = -0.5 * ((b + b) / a) tmp_1 = tmp_4 elif b >= 0.0: tmp_1 = t_0 else: tmp_1 = b / -a return tmp_1
function code(a, b, c) t_0 = Float64(Float64(-c) / b) t_1 = sqrt(Float64(-4.0 * Float64(c * a))) tmp_1 = 0.0 if (b <= -5.6e-73) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = t_0; else tmp_2 = Float64(-0.5 * Float64(Float64(-2.0 * Float64(c / b)) + Float64(2.0 * Float64(b / a)))); end tmp_1 = tmp_2; elseif (b <= 2.8e-279) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = t_0; else tmp_3 = Float64(-0.5 * Float64(Float64(b - t_1) / a)); end tmp_1 = tmp_3; elseif (b <= 2.1e-56) tmp_4 = 0.0 if (b >= 0.0) tmp_4 = Float64(c * Float64(-2.0 / Float64(b + t_1))); else tmp_4 = Float64(-0.5 * Float64(Float64(b + b) / a)); end tmp_1 = tmp_4; elseif (b >= 0.0) tmp_1 = t_0; else tmp_1 = Float64(b / Float64(-a)); end return tmp_1 end
function tmp_6 = code(a, b, c) t_0 = -c / b; t_1 = sqrt((-4.0 * (c * a))); tmp_2 = 0.0; if (b <= -5.6e-73) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = t_0; else tmp_3 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a))); end tmp_2 = tmp_3; elseif (b <= 2.8e-279) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = t_0; else tmp_4 = -0.5 * ((b - t_1) / a); end tmp_2 = tmp_4; elseif (b <= 2.1e-56) tmp_5 = 0.0; if (b >= 0.0) tmp_5 = c * (-2.0 / (b + t_1)); else tmp_5 = -0.5 * ((b + b) / a); end tmp_2 = tmp_5; elseif (b >= 0.0) tmp_2 = t_0; else tmp_2 = b / -a; 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[(-4.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -5.6e-73], If[GreaterEqual[b, 0.0], t$95$0, N[(-0.5 * N[(N[(-2.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 2.8e-279], If[GreaterEqual[b, 0.0], t$95$0, N[(-0.5 * N[(N[(b - t$95$1), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 2.1e-56], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], t$95$0, N[(b / (-a)), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-c}{b}\\
t_1 := \sqrt{-4 \cdot \left(c \cdot a\right)}\\
\mathbf{if}\;b \leq -5.6 \cdot 10^{-73}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(-2 \cdot \frac{c}{b} + 2 \cdot \frac{b}{a}\right)\\
\end{array}\\
\mathbf{elif}\;b \leq 2.8 \cdot 10^{-279}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b - t_1}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 2.1 \cdot 10^{-56}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + t_1}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b + b}{a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- c) b)))
(if (<= b -1.1e-72)
(if (>= b 0.0) t_0 (* -0.5 (+ (* -2.0 (/ c b)) (* 2.0 (/ b a)))))
(if (<= b 2.8e-279)
(if (>= b 0.0) t_0 (* -0.5 (/ (- b (sqrt (* -4.0 (* c a)))) a)))
(if (<= b 3e-56)
(if (>= b 0.0)
(/ (* c -2.0) (+ b (sqrt (* a (* c -4.0)))))
(* -0.5 (/ (+ b b) a)))
(if (>= b 0.0) t_0 (/ b (- a))))))))
double code(double a, double b, double c) {
double t_0 = -c / b;
double tmp_1;
if (b <= -1.1e-72) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a)));
}
tmp_1 = tmp_2;
} else if (b <= 2.8e-279) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = t_0;
} else {
tmp_3 = -0.5 * ((b - sqrt((-4.0 * (c * a)))) / a);
}
tmp_1 = tmp_3;
} else if (b <= 3e-56) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (c * -2.0) / (b + sqrt((a * (c * -4.0))));
} else {
tmp_4 = -0.5 * ((b + b) / a);
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = t_0;
} else {
tmp_1 = b / -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
real(8) :: tmp_3
real(8) :: tmp_4
t_0 = -c / b
if (b <= (-1.1d-72)) then
if (b >= 0.0d0) then
tmp_2 = t_0
else
tmp_2 = (-0.5d0) * (((-2.0d0) * (c / b)) + (2.0d0 * (b / a)))
end if
tmp_1 = tmp_2
else if (b <= 2.8d-279) then
if (b >= 0.0d0) then
tmp_3 = t_0
else
tmp_3 = (-0.5d0) * ((b - sqrt(((-4.0d0) * (c * a)))) / a)
end if
tmp_1 = tmp_3
else if (b <= 3d-56) then
if (b >= 0.0d0) then
tmp_4 = (c * (-2.0d0)) / (b + sqrt((a * (c * (-4.0d0)))))
else
tmp_4 = (-0.5d0) * ((b + b) / a)
end if
tmp_1 = tmp_4
else if (b >= 0.0d0) then
tmp_1 = t_0
else
tmp_1 = b / -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 <= -1.1e-72) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a)));
}
tmp_1 = tmp_2;
} else if (b <= 2.8e-279) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = t_0;
} else {
tmp_3 = -0.5 * ((b - Math.sqrt((-4.0 * (c * a)))) / a);
}
tmp_1 = tmp_3;
} else if (b <= 3e-56) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (c * -2.0) / (b + Math.sqrt((a * (c * -4.0))));
} else {
tmp_4 = -0.5 * ((b + b) / a);
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = t_0;
} else {
tmp_1 = b / -a;
}
return tmp_1;
}
def code(a, b, c): t_0 = -c / b tmp_1 = 0 if b <= -1.1e-72: tmp_2 = 0 if b >= 0.0: tmp_2 = t_0 else: tmp_2 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a))) tmp_1 = tmp_2 elif b <= 2.8e-279: tmp_3 = 0 if b >= 0.0: tmp_3 = t_0 else: tmp_3 = -0.5 * ((b - math.sqrt((-4.0 * (c * a)))) / a) tmp_1 = tmp_3 elif b <= 3e-56: tmp_4 = 0 if b >= 0.0: tmp_4 = (c * -2.0) / (b + math.sqrt((a * (c * -4.0)))) else: tmp_4 = -0.5 * ((b + b) / a) tmp_1 = tmp_4 elif b >= 0.0: tmp_1 = t_0 else: tmp_1 = b / -a return tmp_1
function code(a, b, c) t_0 = Float64(Float64(-c) / b) tmp_1 = 0.0 if (b <= -1.1e-72) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = t_0; else tmp_2 = Float64(-0.5 * Float64(Float64(-2.0 * Float64(c / b)) + Float64(2.0 * Float64(b / a)))); end tmp_1 = tmp_2; elseif (b <= 2.8e-279) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = t_0; else tmp_3 = Float64(-0.5 * Float64(Float64(b - sqrt(Float64(-4.0 * Float64(c * a)))) / a)); end tmp_1 = tmp_3; elseif (b <= 3e-56) tmp_4 = 0.0 if (b >= 0.0) tmp_4 = Float64(Float64(c * -2.0) / Float64(b + sqrt(Float64(a * Float64(c * -4.0))))); else tmp_4 = Float64(-0.5 * Float64(Float64(b + b) / a)); end tmp_1 = tmp_4; elseif (b >= 0.0) tmp_1 = t_0; else tmp_1 = Float64(b / Float64(-a)); end return tmp_1 end
function tmp_6 = code(a, b, c) t_0 = -c / b; tmp_2 = 0.0; if (b <= -1.1e-72) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = t_0; else tmp_3 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a))); end tmp_2 = tmp_3; elseif (b <= 2.8e-279) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = t_0; else tmp_4 = -0.5 * ((b - sqrt((-4.0 * (c * a)))) / a); end tmp_2 = tmp_4; elseif (b <= 3e-56) tmp_5 = 0.0; if (b >= 0.0) tmp_5 = (c * -2.0) / (b + sqrt((a * (c * -4.0)))); else tmp_5 = -0.5 * ((b + b) / a); end tmp_2 = tmp_5; elseif (b >= 0.0) tmp_2 = t_0; else tmp_2 = b / -a; end tmp_6 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[((-c) / b), $MachinePrecision]}, If[LessEqual[b, -1.1e-72], If[GreaterEqual[b, 0.0], t$95$0, N[(-0.5 * N[(N[(-2.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 2.8e-279], If[GreaterEqual[b, 0.0], t$95$0, N[(-0.5 * N[(N[(b - N[Sqrt[N[(-4.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 3e-56], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], t$95$0, N[(b / (-a)), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-c}{b}\\
\mathbf{if}\;b \leq -1.1 \cdot 10^{-72}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(-2 \cdot \frac{c}{b} + 2 \cdot \frac{b}{a}\right)\\
\end{array}\\
\mathbf{elif}\;b \leq 2.8 \cdot 10^{-279}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b - \sqrt{-4 \cdot \left(c \cdot a\right)}}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 3 \cdot 10^{-56}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \sqrt{a \cdot \left(c \cdot -4\right)}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b + b}{a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b 2.25e-57)
(if (>= b 0.0)
(* c (/ -2.0 (+ b (sqrt (* -4.0 (* c a))))))
(* -0.5 (/ (+ b b) a)))
(if (>= b 0.0) (/ (- c) b) (/ b (- a)))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= 2.25e-57) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = c * (-2.0 / (b + sqrt((-4.0 * (c * a)))));
} else {
tmp_2 = -0.5 * ((b + b) / a);
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = -c / b;
} else {
tmp_1 = b / -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) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
if (b <= 2.25d-57) then
if (b >= 0.0d0) then
tmp_2 = c * ((-2.0d0) / (b + sqrt(((-4.0d0) * (c * a)))))
else
tmp_2 = (-0.5d0) * ((b + b) / a)
end if
tmp_1 = tmp_2
else if (b >= 0.0d0) then
tmp_1 = -c / b
else
tmp_1 = b / -a
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= 2.25e-57) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = c * (-2.0 / (b + Math.sqrt((-4.0 * (c * a)))));
} else {
tmp_2 = -0.5 * ((b + b) / a);
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = -c / b;
} else {
tmp_1 = b / -a;
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= 2.25e-57: tmp_2 = 0 if b >= 0.0: tmp_2 = c * (-2.0 / (b + math.sqrt((-4.0 * (c * a))))) else: tmp_2 = -0.5 * ((b + b) / a) tmp_1 = tmp_2 elif b >= 0.0: tmp_1 = -c / b else: tmp_1 = b / -a return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= 2.25e-57) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(c * Float64(-2.0 / Float64(b + sqrt(Float64(-4.0 * Float64(c * a)))))); else tmp_2 = Float64(-0.5 * Float64(Float64(b + b) / a)); end tmp_1 = tmp_2; elseif (b >= 0.0) tmp_1 = Float64(Float64(-c) / b); else tmp_1 = Float64(b / Float64(-a)); end return tmp_1 end
function tmp_4 = code(a, b, c) tmp_2 = 0.0; if (b <= 2.25e-57) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = c * (-2.0 / (b + sqrt((-4.0 * (c * a))))); else tmp_3 = -0.5 * ((b + b) / a); end tmp_2 = tmp_3; elseif (b >= 0.0) tmp_2 = -c / b; else tmp_2 = b / -a; end tmp_4 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, 2.25e-57], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + N[Sqrt[N[(-4.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[((-c) / b), $MachinePrecision], N[(b / (-a)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.25 \cdot 10^{-57}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + \sqrt{-4 \cdot \left(c \cdot a\right)}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b + b}{a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}
\end{array}
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (* c (/ -2.0 (+ b (+ b (* -2.0 (/ a (/ b c))))))) (* -0.5 (/ (+ b b) a))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = c * (-2.0 / (b + (b + (-2.0 * (a / (b / c))))));
} else {
tmp = -0.5 * ((b + 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 * ((-2.0d0) / (b + (b + ((-2.0d0) * (a / (b / c))))))
else
tmp = (-0.5d0) * ((b + 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 * (-2.0 / (b + (b + (-2.0 * (a / (b / c))))));
} else {
tmp = -0.5 * ((b + b) / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = c * (-2.0 / (b + (b + (-2.0 * (a / (b / c)))))) else: tmp = -0.5 * ((b + b) / a) return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(c * Float64(-2.0 / Float64(b + Float64(b + Float64(-2.0 * Float64(a / Float64(b / c))))))); else tmp = Float64(-0.5 * Float64(Float64(b + b) / a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b >= 0.0) tmp = c * (-2.0 / (b + (b + (-2.0 * (a / (b / c)))))); else tmp = -0.5 * ((b + b) / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + N[(b + N[(-2.0 * N[(a / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + \left(b + -2 \cdot \frac{a}{\frac{b}{c}}\right)}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b + b}{a}\\
\end{array}
\end{array}
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (* c (/ -2.0 (+ (* -2.0 (* c (/ a b))) (* b 2.0)))) (* -0.5 (/ (+ b b) a))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = c * (-2.0 / ((-2.0 * (c * (a / b))) + (b * 2.0)));
} else {
tmp = -0.5 * ((b + 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 * ((-2.0d0) / (((-2.0d0) * (c * (a / b))) + (b * 2.0d0)))
else
tmp = (-0.5d0) * ((b + 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 * (-2.0 / ((-2.0 * (c * (a / b))) + (b * 2.0)));
} else {
tmp = -0.5 * ((b + b) / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = c * (-2.0 / ((-2.0 * (c * (a / b))) + (b * 2.0))) else: tmp = -0.5 * ((b + b) / a) return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(c * Float64(-2.0 / Float64(Float64(-2.0 * Float64(c * Float64(a / b))) + Float64(b * 2.0)))); else tmp = Float64(-0.5 * Float64(Float64(b + b) / a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b >= 0.0) tmp = c * (-2.0 / ((-2.0 * (c * (a / b))) + (b * 2.0))); else tmp = -0.5 * ((b + b) / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(N[(-2.0 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{-2 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b + b}{a}\\
\end{array}
\end{array}
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ (- c) b) (* -0.5 (+ (* -2.0 (/ c b)) (* 2.0 (/ b a))))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = -c / b;
} else {
tmp = -0.5 * ((-2.0 * (c / b)) + (2.0 * (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 = (-0.5d0) * (((-2.0d0) * (c / b)) + (2.0d0 * (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 = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a)));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = -c / b else: tmp = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a))) return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(-c) / b); else tmp = Float64(-0.5 * Float64(Float64(-2.0 * Float64(c / b)) + Float64(2.0 * Float64(b / a)))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b >= 0.0) tmp = -c / b; else tmp = -0.5 * ((-2.0 * (c / b)) + (2.0 * (b / a))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[((-c) / b), $MachinePrecision], N[(-0.5 * N[(N[(-2.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(-2 \cdot \frac{c}{b} + 2 \cdot \frac{b}{a}\right)\\
\end{array}
\end{array}
(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}
herbie shell --seed 2024008
(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))))