
(FPCore (a b c) :precision binary64 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c))))) (if (>= b 0.0) (/ (- (- b) t_0) (* 2.0 a)) (/ (* 2.0 c) (+ (- b) t_0)))))
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 = (-b - t_0) / (2.0 * a);
} else {
tmp = (2.0 * c) / (-b + t_0);
}
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 = (-b - t_0) / (2.0d0 * a)
else
tmp = (2.0d0 * c) / (-b + t_0)
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 = (-b - t_0) / (2.0 * a);
} else {
tmp = (2.0 * c) / (-b + t_0);
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - ((4.0 * a) * c))) tmp = 0 if b >= 0.0: tmp = (-b - t_0) / (2.0 * a) else: tmp = (2.0 * c) / (-b + t_0) 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(Float64(-b) - t_0) / Float64(2.0 * a)); else tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) + t_0)); 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 = (-b - t_0) / (2.0 * a); else tmp = (2.0 * c) / (-b + t_0); 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[((-b) - t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) + t$95$0), $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{\left(-b\right) - t\_0}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + t\_0}\\
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c))))) (if (>= b 0.0) (/ (- (- b) t_0) (* 2.0 a)) (/ (* 2.0 c) (+ (- b) t_0)))))
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 = (-b - t_0) / (2.0 * a);
} else {
tmp = (2.0 * c) / (-b + t_0);
}
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 = (-b - t_0) / (2.0d0 * a)
else
tmp = (2.0d0 * c) / (-b + t_0)
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 = (-b - t_0) / (2.0 * a);
} else {
tmp = (2.0 * c) / (-b + t_0);
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - ((4.0 * a) * c))) tmp = 0 if b >= 0.0: tmp = (-b - t_0) / (2.0 * a) else: tmp = (2.0 * c) / (-b + t_0) 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(Float64(-b) - t_0) / Float64(2.0 * a)); else tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) + t_0)); 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 = (-b - t_0) / (2.0 * a); else tmp = (2.0 * c) / (-b + t_0); 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[((-b) - t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) + t$95$0), $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{\left(-b\right) - t\_0}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + t\_0}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (fma -4.0 (* c a) (* b b)))) (t_1 (/ c (- b))))
(if (<= b -1.22e+156)
t_1
(if (<= b -1.2e-281)
(/ (+ c c) (- t_0 b))
(if (<= b 5e+121)
(* (/ (+ t_0 b) a) -0.5)
(if (<= b 3.1e+279)
(if (>= b 0.0)
(fma (/ b a) -1.0 (/ c b))
(/ (+ c c) (- (fma -2.0 (/ (* c a) b) b) b)))
(if (<= b 1.45e+300) (* c (/ (- b) (* c a))) t_1)))))))
double code(double a, double b, double c) {
double t_0 = sqrt(fma(-4.0, (c * a), (b * b)));
double t_1 = c / -b;
double tmp;
if (b <= -1.22e+156) {
tmp = t_1;
} else if (b <= -1.2e-281) {
tmp = (c + c) / (t_0 - b);
} else if (b <= 5e+121) {
tmp = ((t_0 + b) / a) * -0.5;
} else if (b <= 3.1e+279) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = fma((b / a), -1.0, (c / b));
} else {
tmp_1 = (c + c) / (fma(-2.0, ((c * a) / b), b) - b);
}
tmp = tmp_1;
} else if (b <= 1.45e+300) {
tmp = c * (-b / (c * a));
} else {
tmp = t_1;
}
return tmp;
}
function code(a, b, c) t_0 = sqrt(fma(-4.0, Float64(c * a), Float64(b * b))) t_1 = Float64(c / Float64(-b)) tmp = 0.0 if (b <= -1.22e+156) tmp = t_1; elseif (b <= -1.2e-281) tmp = Float64(Float64(c + c) / Float64(t_0 - b)); elseif (b <= 5e+121) tmp = Float64(Float64(Float64(t_0 + b) / a) * -0.5); elseif (b <= 3.1e+279) tmp_1 = 0.0 if (b >= 0.0) tmp_1 = fma(Float64(b / a), -1.0, Float64(c / b)); else tmp_1 = Float64(Float64(c + c) / Float64(fma(-2.0, Float64(Float64(c * a) / b), b) - b)); end tmp = tmp_1; elseif (b <= 1.45e+300) tmp = Float64(c * Float64(Float64(-b) / Float64(c * a))); else tmp = t_1; end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(-4.0 * N[(c * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(c / (-b)), $MachinePrecision]}, If[LessEqual[b, -1.22e+156], t$95$1, If[LessEqual[b, -1.2e-281], N[(N[(c + c), $MachinePrecision] / N[(t$95$0 - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5e+121], N[(N[(N[(t$95$0 + b), $MachinePrecision] / a), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[b, 3.1e+279], If[GreaterEqual[b, 0.0], N[(N[(b / a), $MachinePrecision] * -1.0 + N[(c / b), $MachinePrecision]), $MachinePrecision], N[(N[(c + c), $MachinePrecision] / N[(N[(-2.0 * N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision] + b), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 1.45e+300], N[(c * N[((-b) / N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{fma}\left(-4, c \cdot a, b \cdot b\right)}\\
t_1 := \frac{c}{-b}\\
\mathbf{if}\;b \leq -1.22 \cdot 10^{+156}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -1.2 \cdot 10^{-281}:\\
\;\;\;\;\frac{c + c}{t\_0 - b}\\
\mathbf{elif}\;b \leq 5 \cdot 10^{+121}:\\
\;\;\;\;\frac{t\_0 + b}{a} \cdot -0.5\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{+279}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{b}{a}, -1, \frac{c}{b}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c + c}{\mathsf{fma}\left(-2, \frac{c \cdot a}{b}, b\right) - b}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.45 \cdot 10^{+300}:\\
\;\;\;\;c \cdot \frac{-b}{c \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.21999999999999991e156 or 1.44999999999999993e300 < b Initial program 40.8%
Applied rewrites38.4%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites38.5%
Taylor expanded in a around -inf
Applied rewrites0.0%
Taylor expanded in b around -inf
Applied rewrites91.2%
if -1.21999999999999991e156 < b < -1.2e-281Initial program 89.8%
Applied rewrites89.8%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites89.8%
Applied rewrites89.8%
if -1.2e-281 < b < 5.00000000000000007e121Initial program 80.4%
Applied rewrites80.4%
Taylor expanded in b around inf
+-commutativeN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
if-sameN/A
*-commutativeN/A
Applied rewrites80.4%
if 5.00000000000000007e121 < b < 3.09999999999999984e279Initial program 44.5%
Taylor expanded in a around 0
Applied rewrites44.5%
Taylor expanded in c around 0
Applied rewrites97.5%
Applied rewrites97.5%
Taylor expanded in a around 0
Applied rewrites97.5%
if 3.09999999999999984e279 < b < 1.44999999999999993e300Initial program 44.2%
Applied rewrites0.0%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites1.9%
Applied rewrites1.9%
Taylor expanded in a around 0
Applied rewrites100.0%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ c (- b))) (t_1 (* c (/ (fma (/ b a) -1.0 (/ c b)) c))))
(if (<= b -1.22e+156)
t_0
(if (<= b 3.6e-235)
(/ (+ c c) (- (sqrt (fma -4.0 (* c a) (* b b))) b))
(if (<= b 7e-159)
t_1
(if (<= b 1.8e+148)
(if (>= b 0.0)
(/ (+ b (sqrt (* b b))) (* 2.0 (- a)))
(/ (* 2.0 c) (+ (- b) (- b))))
(if (<= b 1.25e+308) t_1 t_0)))))))
double code(double a, double b, double c) {
double t_0 = c / -b;
double t_1 = c * (fma((b / a), -1.0, (c / b)) / c);
double tmp;
if (b <= -1.22e+156) {
tmp = t_0;
} else if (b <= 3.6e-235) {
tmp = (c + c) / (sqrt(fma(-4.0, (c * a), (b * b))) - b);
} else if (b <= 7e-159) {
tmp = t_1;
} else if (b <= 1.8e+148) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (b + sqrt((b * b))) / (2.0 * -a);
} else {
tmp_1 = (2.0 * c) / (-b + -b);
}
tmp = tmp_1;
} else if (b <= 1.25e+308) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b, c) t_0 = Float64(c / Float64(-b)) t_1 = Float64(c * Float64(fma(Float64(b / a), -1.0, Float64(c / b)) / c)) tmp = 0.0 if (b <= -1.22e+156) tmp = t_0; elseif (b <= 3.6e-235) tmp = Float64(Float64(c + c) / Float64(sqrt(fma(-4.0, Float64(c * a), Float64(b * b))) - b)); elseif (b <= 7e-159) tmp = t_1; elseif (b <= 1.8e+148) tmp_1 = 0.0 if (b >= 0.0) tmp_1 = Float64(Float64(b + sqrt(Float64(b * b))) / Float64(2.0 * Float64(-a))); else tmp_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) + Float64(-b))); end tmp = tmp_1; elseif (b <= 1.25e+308) tmp = t_1; else tmp = t_0; end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(c / (-b)), $MachinePrecision]}, Block[{t$95$1 = N[(c * N[(N[(N[(b / a), $MachinePrecision] * -1.0 + N[(c / b), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.22e+156], t$95$0, If[LessEqual[b, 3.6e-235], N[(N[(c + c), $MachinePrecision] / N[(N[Sqrt[N[(-4.0 * N[(c * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-159], t$95$1, If[LessEqual[b, 1.8e+148], If[GreaterEqual[b, 0.0], N[(N[(b + N[Sqrt[N[(b * b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * (-a)), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) + (-b)), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 1.25e+308], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c}{-b}\\
t_1 := c \cdot \frac{\mathsf{fma}\left(\frac{b}{a}, -1, \frac{c}{b}\right)}{c}\\
\mathbf{if}\;b \leq -1.22 \cdot 10^{+156}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{-235}:\\
\;\;\;\;\frac{c + c}{\sqrt{\mathsf{fma}\left(-4, c \cdot a, b \cdot b\right)} - b}\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{+148}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b + \sqrt{b \cdot b}}{2 \cdot \left(-a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \left(-b\right)}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.25 \cdot 10^{+308}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -1.21999999999999991e156 or 1.25e308 < b Initial program 41.7%
Applied rewrites39.3%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites39.3%
Taylor expanded in a around -inf
Applied rewrites0.0%
Taylor expanded in b around -inf
Applied rewrites93.4%
if -1.21999999999999991e156 < b < 3.59999999999999999e-235Initial program 88.6%
Applied rewrites88.6%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites88.7%
Applied rewrites88.7%
if 3.59999999999999999e-235 < b < 7.00000000000000005e-159 or 1.80000000000000003e148 < b < 1.25e308Initial program 36.4%
Applied rewrites9.4%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites13.2%
Applied rewrites13.2%
Taylor expanded in c around 0
Applied rewrites76.3%
if 7.00000000000000005e-159 < b < 1.80000000000000003e148Initial program 86.7%
Taylor expanded in b around -inf
mul-1-negN/A
lower-neg.f6486.7
Applied rewrites86.7%
Taylor expanded in a around 0
unpow2N/A
lower-*.f6463.2
Applied rewrites63.2%
Final simplification81.4%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (fma -4.0 (* c a) (* b b)))))
(if (<= b -1.22e+156)
(/ c (- b))
(if (<= b 3.6e-235)
(/ (+ c c) (- t_0 b))
(if (or (<= b 1.8e-167) (not (<= b 8.5e+149)))
(* c (/ (fma (/ b a) -1.0 (/ c b)) c))
(* (/ (+ t_0 b) a) -0.5))))))
double code(double a, double b, double c) {
double t_0 = sqrt(fma(-4.0, (c * a), (b * b)));
double tmp;
if (b <= -1.22e+156) {
tmp = c / -b;
} else if (b <= 3.6e-235) {
tmp = (c + c) / (t_0 - b);
} else if ((b <= 1.8e-167) || !(b <= 8.5e+149)) {
tmp = c * (fma((b / a), -1.0, (c / b)) / c);
} else {
tmp = ((t_0 + b) / a) * -0.5;
}
return tmp;
}
function code(a, b, c) t_0 = sqrt(fma(-4.0, Float64(c * a), Float64(b * b))) tmp = 0.0 if (b <= -1.22e+156) tmp = Float64(c / Float64(-b)); elseif (b <= 3.6e-235) tmp = Float64(Float64(c + c) / Float64(t_0 - b)); elseif ((b <= 1.8e-167) || !(b <= 8.5e+149)) tmp = Float64(c * Float64(fma(Float64(b / a), -1.0, Float64(c / b)) / c)); else tmp = Float64(Float64(Float64(t_0 + b) / a) * -0.5); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(-4.0 * N[(c * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -1.22e+156], N[(c / (-b)), $MachinePrecision], If[LessEqual[b, 3.6e-235], N[(N[(c + c), $MachinePrecision] / N[(t$95$0 - b), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1.8e-167], N[Not[LessEqual[b, 8.5e+149]], $MachinePrecision]], N[(c * N[(N[(N[(b / a), $MachinePrecision] * -1.0 + N[(c / b), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 + b), $MachinePrecision] / a), $MachinePrecision] * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{fma}\left(-4, c \cdot a, b \cdot b\right)}\\
\mathbf{if}\;b \leq -1.22 \cdot 10^{+156}:\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{-235}:\\
\;\;\;\;\frac{c + c}{t\_0 - b}\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{-167} \lor \neg \left(b \leq 8.5 \cdot 10^{+149}\right):\\
\;\;\;\;c \cdot \frac{\mathsf{fma}\left(\frac{b}{a}, -1, \frac{c}{b}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 + b}{a} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.21999999999999991e156Initial program 40.2%
Applied rewrites40.2%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites40.2%
Taylor expanded in a around -inf
Applied rewrites0.0%
Taylor expanded in b around -inf
Applied rewrites95.6%
if -1.21999999999999991e156 < b < 3.59999999999999999e-235Initial program 88.6%
Applied rewrites88.6%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites88.7%
Applied rewrites88.7%
if 3.59999999999999999e-235 < b < 1.8e-167 or 8.49999999999999956e149 < b Initial program 36.4%
Applied rewrites9.3%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites13.2%
Applied rewrites13.3%
Taylor expanded in c around 0
Applied rewrites76.3%
if 1.8e-167 < b < 8.49999999999999956e149Initial program 86.9%
Applied rewrites86.9%
Taylor expanded in b around inf
+-commutativeN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
if-sameN/A
*-commutativeN/A
Applied rewrites86.9%
Final simplification87.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ c (- b))))
(if (<= b -1.22e+156)
t_0
(if (<= b 3.8e-147)
(/ (+ c c) (- (sqrt (fma -4.0 (* c a) (* b b))) b))
(if (<= b 1.8e+148)
(if (>= b 0.0)
(/ (+ b (sqrt (* b b))) (* 2.0 (- a)))
(/ (* 2.0 c) (+ (- b) (- b))))
(if (<= b 1.45e+300) (* c (/ (- b) (* c a))) t_0))))))
double code(double a, double b, double c) {
double t_0 = c / -b;
double tmp;
if (b <= -1.22e+156) {
tmp = t_0;
} else if (b <= 3.8e-147) {
tmp = (c + c) / (sqrt(fma(-4.0, (c * a), (b * b))) - b);
} else if (b <= 1.8e+148) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (b + sqrt((b * b))) / (2.0 * -a);
} else {
tmp_1 = (2.0 * c) / (-b + -b);
}
tmp = tmp_1;
} else if (b <= 1.45e+300) {
tmp = c * (-b / (c * a));
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b, c) t_0 = Float64(c / Float64(-b)) tmp = 0.0 if (b <= -1.22e+156) tmp = t_0; elseif (b <= 3.8e-147) tmp = Float64(Float64(c + c) / Float64(sqrt(fma(-4.0, Float64(c * a), Float64(b * b))) - b)); elseif (b <= 1.8e+148) tmp_1 = 0.0 if (b >= 0.0) tmp_1 = Float64(Float64(b + sqrt(Float64(b * b))) / Float64(2.0 * Float64(-a))); else tmp_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) + Float64(-b))); end tmp = tmp_1; elseif (b <= 1.45e+300) tmp = Float64(c * Float64(Float64(-b) / Float64(c * a))); else tmp = t_0; end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(c / (-b)), $MachinePrecision]}, If[LessEqual[b, -1.22e+156], t$95$0, If[LessEqual[b, 3.8e-147], N[(N[(c + c), $MachinePrecision] / N[(N[Sqrt[N[(-4.0 * N[(c * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.8e+148], If[GreaterEqual[b, 0.0], N[(N[(b + N[Sqrt[N[(b * b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * (-a)), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) + (-b)), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 1.45e+300], N[(c * N[((-b) / N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c}{-b}\\
\mathbf{if}\;b \leq -1.22 \cdot 10^{+156}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-147}:\\
\;\;\;\;\frac{c + c}{\sqrt{\mathsf{fma}\left(-4, c \cdot a, b \cdot b\right)} - b}\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{+148}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b + \sqrt{b \cdot b}}{2 \cdot \left(-a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \left(-b\right)}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.45 \cdot 10^{+300}:\\
\;\;\;\;c \cdot \frac{-b}{c \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -1.21999999999999991e156 or 1.44999999999999993e300 < b Initial program 40.8%
Applied rewrites38.4%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites38.5%
Taylor expanded in a around -inf
Applied rewrites0.0%
Taylor expanded in b around -inf
Applied rewrites91.2%
if -1.21999999999999991e156 < b < 3.80000000000000028e-147Initial program 85.3%
Applied rewrites84.7%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites84.8%
Applied rewrites84.8%
if 3.80000000000000028e-147 < b < 1.80000000000000003e148Initial program 86.4%
Taylor expanded in b around -inf
mul-1-negN/A
lower-neg.f6486.4
Applied rewrites86.4%
Taylor expanded in a around 0
unpow2N/A
lower-*.f6464.2
Applied rewrites64.2%
if 1.80000000000000003e148 < b < 1.44999999999999993e300Initial program 35.9%
Applied rewrites3.1%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites7.6%
Applied rewrites7.7%
Taylor expanded in a around 0
Applied rewrites71.9%
Final simplification79.5%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ c (- b))))
(if (<= b -4e-135)
t_0
(if (<= b 7.4e-181)
(- (sqrt (* (/ c a) -1.0)))
(if (<= b 1.8e+148)
(if (>= b 0.0)
(/ (+ b (sqrt (* b b))) (* 2.0 (- a)))
(/ (* 2.0 c) (+ (- b) (- b))))
(if (<= b 1.45e+300) (* c (/ (- b) (* c a))) t_0))))))
double code(double a, double b, double c) {
double t_0 = c / -b;
double tmp;
if (b <= -4e-135) {
tmp = t_0;
} else if (b <= 7.4e-181) {
tmp = -sqrt(((c / a) * -1.0));
} else if (b <= 1.8e+148) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (b + sqrt((b * b))) / (2.0 * -a);
} else {
tmp_1 = (2.0 * c) / (-b + -b);
}
tmp = tmp_1;
} else if (b <= 1.45e+300) {
tmp = c * (-b / (c * a));
} else {
tmp = t_0;
}
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
real(8) :: tmp_1
t_0 = c / -b
if (b <= (-4d-135)) then
tmp = t_0
else if (b <= 7.4d-181) then
tmp = -sqrt(((c / a) * (-1.0d0)))
else if (b <= 1.8d+148) then
if (b >= 0.0d0) then
tmp_1 = (b + sqrt((b * b))) / (2.0d0 * -a)
else
tmp_1 = (2.0d0 * c) / (-b + -b)
end if
tmp = tmp_1
else if (b <= 1.45d+300) then
tmp = c * (-b / (c * a))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = c / -b;
double tmp;
if (b <= -4e-135) {
tmp = t_0;
} else if (b <= 7.4e-181) {
tmp = -Math.sqrt(((c / a) * -1.0));
} else if (b <= 1.8e+148) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (b + Math.sqrt((b * b))) / (2.0 * -a);
} else {
tmp_1 = (2.0 * c) / (-b + -b);
}
tmp = tmp_1;
} else if (b <= 1.45e+300) {
tmp = c * (-b / (c * a));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c): t_0 = c / -b tmp = 0 if b <= -4e-135: tmp = t_0 elif b <= 7.4e-181: tmp = -math.sqrt(((c / a) * -1.0)) elif b <= 1.8e+148: tmp_1 = 0 if b >= 0.0: tmp_1 = (b + math.sqrt((b * b))) / (2.0 * -a) else: tmp_1 = (2.0 * c) / (-b + -b) tmp = tmp_1 elif b <= 1.45e+300: tmp = c * (-b / (c * a)) else: tmp = t_0 return tmp
function code(a, b, c) t_0 = Float64(c / Float64(-b)) tmp = 0.0 if (b <= -4e-135) tmp = t_0; elseif (b <= 7.4e-181) tmp = Float64(-sqrt(Float64(Float64(c / a) * -1.0))); elseif (b <= 1.8e+148) tmp_1 = 0.0 if (b >= 0.0) tmp_1 = Float64(Float64(b + sqrt(Float64(b * b))) / Float64(2.0 * Float64(-a))); else tmp_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) + Float64(-b))); end tmp = tmp_1; elseif (b <= 1.45e+300) tmp = Float64(c * Float64(Float64(-b) / Float64(c * a))); else tmp = t_0; end return tmp end
function tmp_3 = code(a, b, c) t_0 = c / -b; tmp = 0.0; if (b <= -4e-135) tmp = t_0; elseif (b <= 7.4e-181) tmp = -sqrt(((c / a) * -1.0)); elseif (b <= 1.8e+148) tmp_2 = 0.0; if (b >= 0.0) tmp_2 = (b + sqrt((b * b))) / (2.0 * -a); else tmp_2 = (2.0 * c) / (-b + -b); end tmp = tmp_2; elseif (b <= 1.45e+300) tmp = c * (-b / (c * a)); else tmp = t_0; end tmp_3 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(c / (-b)), $MachinePrecision]}, If[LessEqual[b, -4e-135], t$95$0, If[LessEqual[b, 7.4e-181], (-N[Sqrt[N[(N[(c / a), $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision]), If[LessEqual[b, 1.8e+148], If[GreaterEqual[b, 0.0], N[(N[(b + N[Sqrt[N[(b * b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * (-a)), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) + (-b)), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 1.45e+300], N[(c * N[((-b) / N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c}{-b}\\
\mathbf{if}\;b \leq -4 \cdot 10^{-135}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 7.4 \cdot 10^{-181}:\\
\;\;\;\;-\sqrt{\frac{c}{a} \cdot -1}\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{+148}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b + \sqrt{b \cdot b}}{2 \cdot \left(-a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \left(-b\right)}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.45 \cdot 10^{+300}:\\
\;\;\;\;c \cdot \frac{-b}{c \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -4.0000000000000002e-135 or 1.44999999999999993e300 < b Initial program 73.6%
Applied rewrites72.7%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites72.7%
Taylor expanded in a around -inf
Applied rewrites0.0%
Taylor expanded in b around -inf
Applied rewrites79.1%
if -4.0000000000000002e-135 < b < 7.39999999999999968e-181Initial program 76.6%
Applied rewrites75.7%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites75.9%
Taylor expanded in a around -inf
Applied rewrites0.0%
Applied rewrites46.9%
if 7.39999999999999968e-181 < b < 1.80000000000000003e148Initial program 83.4%
Taylor expanded in b around -inf
mul-1-negN/A
lower-neg.f6483.4
Applied rewrites83.4%
Taylor expanded in a around 0
unpow2N/A
lower-*.f6459.9
Applied rewrites59.9%
if 1.80000000000000003e148 < b < 1.44999999999999993e300Initial program 35.9%
Applied rewrites3.1%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites7.6%
Applied rewrites7.7%
Taylor expanded in a around 0
Applied rewrites71.9%
Final simplification67.9%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ c (- b))))
(if (<= b -4e-135)
t_0
(if (<= b 7.4e-181)
(- (sqrt (* (/ c a) -1.0)))
(if (<= b 2.1e+292) (* c (/ (- b) (* c a))) t_0)))))
double code(double a, double b, double c) {
double t_0 = c / -b;
double tmp;
if (b <= -4e-135) {
tmp = t_0;
} else if (b <= 7.4e-181) {
tmp = -sqrt(((c / a) * -1.0));
} else if (b <= 2.1e+292) {
tmp = c * (-b / (c * a));
} else {
tmp = t_0;
}
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 = c / -b
if (b <= (-4d-135)) then
tmp = t_0
else if (b <= 7.4d-181) then
tmp = -sqrt(((c / a) * (-1.0d0)))
else if (b <= 2.1d+292) then
tmp = c * (-b / (c * a))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = c / -b;
double tmp;
if (b <= -4e-135) {
tmp = t_0;
} else if (b <= 7.4e-181) {
tmp = -Math.sqrt(((c / a) * -1.0));
} else if (b <= 2.1e+292) {
tmp = c * (-b / (c * a));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c): t_0 = c / -b tmp = 0 if b <= -4e-135: tmp = t_0 elif b <= 7.4e-181: tmp = -math.sqrt(((c / a) * -1.0)) elif b <= 2.1e+292: tmp = c * (-b / (c * a)) else: tmp = t_0 return tmp
function code(a, b, c) t_0 = Float64(c / Float64(-b)) tmp = 0.0 if (b <= -4e-135) tmp = t_0; elseif (b <= 7.4e-181) tmp = Float64(-sqrt(Float64(Float64(c / a) * -1.0))); elseif (b <= 2.1e+292) tmp = Float64(c * Float64(Float64(-b) / Float64(c * a))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, c) t_0 = c / -b; tmp = 0.0; if (b <= -4e-135) tmp = t_0; elseif (b <= 7.4e-181) tmp = -sqrt(((c / a) * -1.0)); elseif (b <= 2.1e+292) tmp = c * (-b / (c * a)); else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(c / (-b)), $MachinePrecision]}, If[LessEqual[b, -4e-135], t$95$0, If[LessEqual[b, 7.4e-181], (-N[Sqrt[N[(N[(c / a), $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision]), If[LessEqual[b, 2.1e+292], N[(c * N[((-b) / N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c}{-b}\\
\mathbf{if}\;b \leq -4 \cdot 10^{-135}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 7.4 \cdot 10^{-181}:\\
\;\;\;\;-\sqrt{\frac{c}{a} \cdot -1}\\
\mathbf{elif}\;b \leq 2.1 \cdot 10^{+292}:\\
\;\;\;\;c \cdot \frac{-b}{c \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -4.0000000000000002e-135 or 2.1000000000000002e292 < b Initial program 73.3%
Applied rewrites71.4%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites71.5%
Taylor expanded in a around -inf
Applied rewrites0.0%
Taylor expanded in b around -inf
Applied rewrites77.8%
if -4.0000000000000002e-135 < b < 7.39999999999999968e-181Initial program 76.6%
Applied rewrites75.7%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites75.9%
Taylor expanded in a around -inf
Applied rewrites0.0%
Applied rewrites46.9%
if 7.39999999999999968e-181 < b < 2.1000000000000002e292Initial program 67.0%
Applied rewrites21.3%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites22.1%
Applied rewrites22.1%
Taylor expanded in a around 0
Applied rewrites51.3%
(FPCore (a b c) :precision binary64 (if (or (<= b -1.1e-308) (not (<= b 2.1e+292))) (/ c (- b)) (* c (/ (- b) (* c a)))))
double code(double a, double b, double c) {
double tmp;
if ((b <= -1.1e-308) || !(b <= 2.1e+292)) {
tmp = c / -b;
} else {
tmp = c * (-b / (c * 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 <= (-1.1d-308)) .or. (.not. (b <= 2.1d+292))) then
tmp = c / -b
else
tmp = c * (-b / (c * a))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if ((b <= -1.1e-308) || !(b <= 2.1e+292)) {
tmp = c / -b;
} else {
tmp = c * (-b / (c * a));
}
return tmp;
}
def code(a, b, c): tmp = 0 if (b <= -1.1e-308) or not (b <= 2.1e+292): tmp = c / -b else: tmp = c * (-b / (c * a)) return tmp
function code(a, b, c) tmp = 0.0 if ((b <= -1.1e-308) || !(b <= 2.1e+292)) tmp = Float64(c / Float64(-b)); else tmp = Float64(c * Float64(Float64(-b) / Float64(c * a))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if ((b <= -1.1e-308) || ~((b <= 2.1e+292))) tmp = c / -b; else tmp = c * (-b / (c * a)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[Or[LessEqual[b, -1.1e-308], N[Not[LessEqual[b, 2.1e+292]], $MachinePrecision]], N[(c / (-b)), $MachinePrecision], N[(c * N[((-b) / N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1 \cdot 10^{-308} \lor \neg \left(b \leq 2.1 \cdot 10^{+292}\right):\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-b}{c \cdot a}\\
\end{array}
\end{array}
if b < -1.1000000000000001e-308 or 2.1000000000000002e292 < b Initial program 74.1%
Applied rewrites72.6%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites72.7%
Taylor expanded in a around -inf
Applied rewrites0.0%
Taylor expanded in b around -inf
Applied rewrites65.1%
if -1.1000000000000001e-308 < b < 2.1000000000000002e292Initial program 68.2%
Applied rewrites29.4%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites30.1%
Applied rewrites30.1%
Taylor expanded in a around 0
Applied rewrites43.7%
Final simplification55.7%
(FPCore (a b c) :precision binary64 (if (or (<= b -3e-264) (not (<= b 7.6e+212))) (/ c (- b)) (* (/ (* c b) 0.0) 4.0)))
double code(double a, double b, double c) {
double tmp;
if ((b <= -3e-264) || !(b <= 7.6e+212)) {
tmp = c / -b;
} else {
tmp = ((c * b) / 0.0) * 4.0;
}
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 <= (-3d-264)) .or. (.not. (b <= 7.6d+212))) then
tmp = c / -b
else
tmp = ((c * b) / 0.0d0) * 4.0d0
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if ((b <= -3e-264) || !(b <= 7.6e+212)) {
tmp = c / -b;
} else {
tmp = ((c * b) / 0.0) * 4.0;
}
return tmp;
}
def code(a, b, c): tmp = 0 if (b <= -3e-264) or not (b <= 7.6e+212): tmp = c / -b else: tmp = ((c * b) / 0.0) * 4.0 return tmp
function code(a, b, c) tmp = 0.0 if ((b <= -3e-264) || !(b <= 7.6e+212)) tmp = Float64(c / Float64(-b)); else tmp = Float64(Float64(Float64(c * b) / 0.0) * 4.0); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if ((b <= -3e-264) || ~((b <= 7.6e+212))) tmp = c / -b; else tmp = ((c * b) / 0.0) * 4.0; end tmp_2 = tmp; end
code[a_, b_, c_] := If[Or[LessEqual[b, -3e-264], N[Not[LessEqual[b, 7.6e+212]], $MachinePrecision]], N[(c / (-b)), $MachinePrecision], N[(N[(N[(c * b), $MachinePrecision] / 0.0), $MachinePrecision] * 4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3 \cdot 10^{-264} \lor \neg \left(b \leq 7.6 \cdot 10^{+212}\right):\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot b}{0} \cdot 4\\
\end{array}
\end{array}
if b < -3e-264 or 7.59999999999999976e212 < b Initial program 68.6%
Applied rewrites63.6%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites63.9%
Taylor expanded in a around -inf
Applied rewrites0.0%
Taylor expanded in b around -inf
Applied rewrites59.5%
if -3e-264 < b < 7.59999999999999976e212Initial program 76.2%
Applied rewrites37.6%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites38.1%
Applied rewrites34.8%
Taylor expanded in a around 0
Applied rewrites6.2%
Final simplification38.9%
(FPCore (a b c) :precision binary64 (/ c (- b)))
double code(double a, double b, double c) {
return c / -b;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c / -b
end function
public static double code(double a, double b, double c) {
return c / -b;
}
def code(a, b, c): return c / -b
function code(a, b, c) return Float64(c / Float64(-b)) end
function tmp = code(a, b, c) tmp = c / -b; end
code[a_, b_, c_] := N[(c / (-b)), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{-b}
\end{array}
Initial program 71.5%
Applied rewrites53.5%
Taylor expanded in b around -inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
if-sameN/A
associate-*r/N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites53.9%
Taylor expanded in a around -inf
Applied rewrites0.0%
Taylor expanded in b around -inf
Applied rewrites37.3%
herbie shell --seed 2024338
(FPCore (a b c)
:name "jeff quadratic root 1"
:precision binary64
(if (>= b 0.0) (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) (/ (* 2.0 c) (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))))))