
(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 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) (/ (* 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
(if (<= b -1e+154)
(if (>= b 0.0) (/ (* c -2.0) (* b 2.0)) (- (/ c b) (/ b a)))
(if (<= b 1.85e-258)
(/ (* 0.5 (- (sqrt (+ (* b b) (* a (* c -4.0)))) b)) a)
(if (<= b 8.6e+120)
(if (>= b 0.0)
(* c (/ -2.0 (+ b (sqrt (+ (* b b) (* c (* a -4.0)))))))
(* (/ 0.5 a) (+ b (sqrt (+ (* b b) (* -4.0 (* c a)))))))
(if (>= b 0.0)
(/ (* c -2.0) (+ b (+ b (* a (/ (* c -2.0) b)))))
(* c (- (/ b (* c (- 0.0 a))) (/ -1.0 b))))))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= -1e+154) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b * 2.0);
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 1.85e-258) {
tmp_1 = (0.5 * (sqrt(((b * b) + (a * (c * -4.0)))) - b)) / a;
} else if (b <= 8.6e+120) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = c * (-2.0 / (b + sqrt(((b * b) + (c * (a * -4.0))))));
} else {
tmp_3 = (0.5 / a) * (b + sqrt(((b * b) + (-4.0 * (c * a)))));
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b))));
} else {
tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b));
}
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 <= (-1d+154)) then
if (b >= 0.0d0) then
tmp_2 = (c * (-2.0d0)) / (b * 2.0d0)
else
tmp_2 = (c / b) - (b / a)
end if
tmp_1 = tmp_2
else if (b <= 1.85d-258) then
tmp_1 = (0.5d0 * (sqrt(((b * b) + (a * (c * (-4.0d0))))) - b)) / a
else if (b <= 8.6d+120) then
if (b >= 0.0d0) then
tmp_3 = c * ((-2.0d0) / (b + sqrt(((b * b) + (c * (a * (-4.0d0)))))))
else
tmp_3 = (0.5d0 / a) * (b + sqrt(((b * b) + ((-4.0d0) * (c * a)))))
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + (b + (a * ((c * (-2.0d0)) / b))))
else
tmp_1 = c * ((b / (c * (0.0d0 - a))) - ((-1.0d0) / b))
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= -1e+154) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b * 2.0);
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 1.85e-258) {
tmp_1 = (0.5 * (Math.sqrt(((b * b) + (a * (c * -4.0)))) - b)) / a;
} else if (b <= 8.6e+120) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = c * (-2.0 / (b + Math.sqrt(((b * b) + (c * (a * -4.0))))));
} else {
tmp_3 = (0.5 / a) * (b + Math.sqrt(((b * b) + (-4.0 * (c * a)))));
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b))));
} else {
tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b));
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= -1e+154: tmp_2 = 0 if b >= 0.0: tmp_2 = (c * -2.0) / (b * 2.0) else: tmp_2 = (c / b) - (b / a) tmp_1 = tmp_2 elif b <= 1.85e-258: tmp_1 = (0.5 * (math.sqrt(((b * b) + (a * (c * -4.0)))) - b)) / a elif b <= 8.6e+120: tmp_3 = 0 if b >= 0.0: tmp_3 = c * (-2.0 / (b + math.sqrt(((b * b) + (c * (a * -4.0)))))) else: tmp_3 = (0.5 / a) * (b + math.sqrt(((b * b) + (-4.0 * (c * a))))) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b)))) else: tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b)) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= -1e+154) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(c * -2.0) / Float64(b * 2.0)); else tmp_2 = Float64(Float64(c / b) - Float64(b / a)); end tmp_1 = tmp_2; elseif (b <= 1.85e-258) tmp_1 = Float64(Float64(0.5 * Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -4.0)))) - b)) / a); elseif (b <= 8.6e+120) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(c * Float64(-2.0 / Float64(b + sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0))))))); else tmp_3 = Float64(Float64(0.5 / a) * Float64(b + sqrt(Float64(Float64(b * b) + Float64(-4.0 * Float64(c * a)))))); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + Float64(b + Float64(a * Float64(Float64(c * -2.0) / b))))); else tmp_1 = Float64(c * Float64(Float64(b / Float64(c * Float64(0.0 - a))) - Float64(-1.0 / b))); end return tmp_1 end
function tmp_5 = code(a, b, c) tmp_2 = 0.0; if (b <= -1e+154) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = (c * -2.0) / (b * 2.0); else tmp_3 = (c / b) - (b / a); end tmp_2 = tmp_3; elseif (b <= 1.85e-258) tmp_2 = (0.5 * (sqrt(((b * b) + (a * (c * -4.0)))) - b)) / a; elseif (b <= 8.6e+120) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = c * (-2.0 / (b + sqrt(((b * b) + (c * (a * -4.0)))))); else tmp_4 = (0.5 / a) * (b + sqrt(((b * b) + (-4.0 * (c * a))))); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b)))); else tmp_2 = c * ((b / (c * (0.0 - a))) - (-1.0 / b)); end tmp_5 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, -1e+154], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 1.85e-258], N[(N[(0.5 * N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 8.6e+120], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / a), $MachinePrecision] * N[(b + N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(-4.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(b + N[(a * N[(N[(c * -2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(b / N[(c * N[(0.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+154}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.85 \cdot 10^{-258}:\\
\;\;\;\;\frac{0.5 \cdot \left(\sqrt{b \cdot b + a \cdot \left(c \cdot -4\right)} - b\right)}{a}\\
\mathbf{elif}\;b \leq 8.6 \cdot 10^{+120}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{a} \cdot \left(b + \sqrt{b \cdot b + -4 \cdot \left(c \cdot a\right)}\right)\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \left(b + a \cdot \frac{c \cdot -2}{b}\right)}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(\frac{b}{c \cdot \left(0 - a\right)} - \frac{-1}{b}\right)\\
\end{array}
\end{array}
if b < -1.00000000000000004e154Initial program 32.5%
Simplified32.5%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6432.5%
Simplified32.5%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6497.5%
Simplified97.5%
Taylor expanded in a around inf
+-commutativeN/A
neg-mul-1N/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6498.8%
Simplified98.8%
Taylor expanded in b around inf
*-commutativeN/A
*-lowering-*.f6498.8%
Simplified98.8%
if -1.00000000000000004e154 < b < 1.85e-258Initial program 90.2%
Simplified90.2%
associate-/l*N/A
*-commutativeN/A
flip-+N/A
associate-/r/N/A
associate-*l*N/A
*-lowering-*.f64N/A
Applied egg-rr89.2%
Taylor expanded in b around -inf
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
Simplified90.3%
if 1.85e-258 < b < 8.6000000000000003e120Initial program 85.8%
Simplified85.8%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6485.7%
Applied egg-rr85.7%
Applied egg-rr85.7%
if 8.6000000000000003e120 < b Initial program 44.4%
Simplified44.4%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6498.3%
Simplified98.3%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6498.3%
Simplified98.3%
Taylor expanded in c around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6498.3%
Simplified98.3%
Final simplification92.4%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (+ (* b b) (* -4.0 (* c a))))))
(if (<= b -1e+154)
(if (>= b 0.0) (/ (* c -2.0) (* b 2.0)) (- (/ c b) (/ b a)))
(if (<= b 2e+118)
(if (>= b 0.0) (/ (* c -2.0) (+ b t_0)) (/ (- t_0 b) (* 2.0 a)))
(if (>= b 0.0)
(/ (* c -2.0) (+ b (+ b (* a (/ (* c -2.0) b)))))
(* c (- (/ b (* c (- 0.0 a))) (/ -1.0 b))))))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) + (-4.0 * (c * a))));
double tmp_1;
if (b <= -1e+154) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b * 2.0);
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 2e+118) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * -2.0) / (b + t_0);
} else {
tmp_3 = (t_0 - b) / (2.0 * a);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b))));
} else {
tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b));
}
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) + ((-4.0d0) * (c * a))))
if (b <= (-1d+154)) then
if (b >= 0.0d0) then
tmp_2 = (c * (-2.0d0)) / (b * 2.0d0)
else
tmp_2 = (c / b) - (b / a)
end if
tmp_1 = tmp_2
else if (b <= 2d+118) then
if (b >= 0.0d0) then
tmp_3 = (c * (-2.0d0)) / (b + t_0)
else
tmp_3 = (t_0 - b) / (2.0d0 * a)
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + (b + (a * ((c * (-2.0d0)) / b))))
else
tmp_1 = c * ((b / (c * (0.0d0 - a))) - ((-1.0d0) / b))
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) + (-4.0 * (c * a))));
double tmp_1;
if (b <= -1e+154) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b * 2.0);
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 2e+118) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * -2.0) / (b + t_0);
} else {
tmp_3 = (t_0 - b) / (2.0 * a);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b))));
} else {
tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b));
}
return tmp_1;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) + (-4.0 * (c * a)))) tmp_1 = 0 if b <= -1e+154: tmp_2 = 0 if b >= 0.0: tmp_2 = (c * -2.0) / (b * 2.0) else: tmp_2 = (c / b) - (b / a) tmp_1 = tmp_2 elif b <= 2e+118: tmp_3 = 0 if b >= 0.0: tmp_3 = (c * -2.0) / (b + t_0) else: tmp_3 = (t_0 - b) / (2.0 * a) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b)))) else: tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b)) return tmp_1
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) + Float64(-4.0 * Float64(c * a)))) tmp_1 = 0.0 if (b <= -1e+154) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(c * -2.0) / Float64(b * 2.0)); else tmp_2 = Float64(Float64(c / b) - Float64(b / a)); end tmp_1 = tmp_2; elseif (b <= 2e+118) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(c * -2.0) / Float64(b + t_0)); else tmp_3 = Float64(Float64(t_0 - b) / Float64(2.0 * a)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + Float64(b + Float64(a * Float64(Float64(c * -2.0) / b))))); else tmp_1 = Float64(c * Float64(Float64(b / Float64(c * Float64(0.0 - a))) - Float64(-1.0 / b))); end return tmp_1 end
function tmp_5 = code(a, b, c) t_0 = sqrt(((b * b) + (-4.0 * (c * a)))); tmp_2 = 0.0; if (b <= -1e+154) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = (c * -2.0) / (b * 2.0); else tmp_3 = (c / b) - (b / a); end tmp_2 = tmp_3; elseif (b <= 2e+118) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = (c * -2.0) / (b + t_0); else tmp_4 = (t_0 - b) / (2.0 * a); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b)))); else tmp_2 = c * ((b / (c * (0.0 - a))) - (-1.0 / b)); end tmp_5 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(-4.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -1e+154], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 2e+118], 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[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(b + N[(a * N[(N[(c * -2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(b / N[(c * N[(0.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b + -4 \cdot \left(c \cdot a\right)}\\
\mathbf{if}\;b \leq -1 \cdot 10^{+154}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 2 \cdot 10^{+118}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \left(b + a \cdot \frac{c \cdot -2}{b}\right)}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(\frac{b}{c \cdot \left(0 - a\right)} - \frac{-1}{b}\right)\\
\end{array}
\end{array}
if b < -1.00000000000000004e154Initial program 32.5%
Simplified32.5%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6432.5%
Simplified32.5%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6497.5%
Simplified97.5%
Taylor expanded in a around inf
+-commutativeN/A
neg-mul-1N/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6498.8%
Simplified98.8%
Taylor expanded in b around inf
*-commutativeN/A
*-lowering-*.f6498.8%
Simplified98.8%
if -1.00000000000000004e154 < b < 1.99999999999999993e118Initial program 88.4%
Simplified88.4%
if 1.99999999999999993e118 < b Initial program 44.4%
Simplified44.4%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6498.3%
Simplified98.3%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6498.3%
Simplified98.3%
Taylor expanded in c around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6498.3%
Simplified98.3%
Final simplification92.4%
(FPCore (a b c)
:precision binary64
(if (<= b -2e+147)
(if (>= b 0.0) (/ (* c -2.0) (* b 2.0)) (- (/ c b) (/ b a)))
(if (<= b 5.9e+119)
(if (>= b 0.0)
(* c (/ -2.0 (+ b (sqrt (+ (* b b) (* c (* a -4.0)))))))
(/ (- (sqrt (+ (* b b) (* -4.0 (* c a)))) b) (* 2.0 a)))
(if (>= b 0.0)
(/ (* c -2.0) (+ b (+ b (* a (/ (* c -2.0) b)))))
(* c (- (/ b (* c (- 0.0 a))) (/ -1.0 b)))))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= -2e+147) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b * 2.0);
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 5.9e+119) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = c * (-2.0 / (b + sqrt(((b * b) + (c * (a * -4.0))))));
} else {
tmp_3 = (sqrt(((b * b) + (-4.0 * (c * a)))) - b) / (2.0 * a);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b))));
} else {
tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b));
}
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+147)) then
if (b >= 0.0d0) then
tmp_2 = (c * (-2.0d0)) / (b * 2.0d0)
else
tmp_2 = (c / b) - (b / a)
end if
tmp_1 = tmp_2
else if (b <= 5.9d+119) then
if (b >= 0.0d0) then
tmp_3 = c * ((-2.0d0) / (b + sqrt(((b * b) + (c * (a * (-4.0d0)))))))
else
tmp_3 = (sqrt(((b * b) + ((-4.0d0) * (c * a)))) - b) / (2.0d0 * a)
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + (b + (a * ((c * (-2.0d0)) / b))))
else
tmp_1 = c * ((b / (c * (0.0d0 - a))) - ((-1.0d0) / b))
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= -2e+147) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b * 2.0);
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 5.9e+119) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = c * (-2.0 / (b + Math.sqrt(((b * b) + (c * (a * -4.0))))));
} else {
tmp_3 = (Math.sqrt(((b * b) + (-4.0 * (c * a)))) - b) / (2.0 * a);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b))));
} else {
tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b));
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= -2e+147: tmp_2 = 0 if b >= 0.0: tmp_2 = (c * -2.0) / (b * 2.0) else: tmp_2 = (c / b) - (b / a) tmp_1 = tmp_2 elif b <= 5.9e+119: tmp_3 = 0 if b >= 0.0: tmp_3 = c * (-2.0 / (b + math.sqrt(((b * b) + (c * (a * -4.0)))))) else: tmp_3 = (math.sqrt(((b * b) + (-4.0 * (c * a)))) - b) / (2.0 * a) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b)))) else: tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b)) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= -2e+147) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(c * -2.0) / Float64(b * 2.0)); else tmp_2 = Float64(Float64(c / b) - Float64(b / a)); end tmp_1 = tmp_2; elseif (b <= 5.9e+119) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(c * Float64(-2.0 / Float64(b + sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0))))))); else tmp_3 = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(-4.0 * Float64(c * a)))) - b) / Float64(2.0 * a)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + Float64(b + Float64(a * Float64(Float64(c * -2.0) / b))))); else tmp_1 = Float64(c * Float64(Float64(b / Float64(c * Float64(0.0 - a))) - Float64(-1.0 / b))); end return tmp_1 end
function tmp_5 = code(a, b, c) tmp_2 = 0.0; if (b <= -2e+147) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = (c * -2.0) / (b * 2.0); else tmp_3 = (c / b) - (b / a); end tmp_2 = tmp_3; elseif (b <= 5.9e+119) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = c * (-2.0 / (b + sqrt(((b * b) + (c * (a * -4.0)))))); else tmp_4 = (sqrt(((b * b) + (-4.0 * (c * a)))) - b) / (2.0 * a); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b)))); else tmp_2 = c * ((b / (c * (0.0 - a))) - (-1.0 / b)); end tmp_5 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, -2e+147], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 5.9e+119], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(-4.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(b + N[(a * N[(N[(c * -2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(b / N[(c * N[(0.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{+147}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 5.9 \cdot 10^{+119}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + -4 \cdot \left(c \cdot a\right)} - b}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \left(b + a \cdot \frac{c \cdot -2}{b}\right)}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(\frac{b}{c \cdot \left(0 - a\right)} - \frac{-1}{b}\right)\\
\end{array}
\end{array}
if b < -2e147Initial program 32.5%
Simplified32.5%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6432.5%
Simplified32.5%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6497.5%
Simplified97.5%
Taylor expanded in a around inf
+-commutativeN/A
neg-mul-1N/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6498.8%
Simplified98.8%
Taylor expanded in b around inf
*-commutativeN/A
*-lowering-*.f6498.8%
Simplified98.8%
if -2e147 < b < 5.9000000000000001e119Initial program 88.4%
Simplified88.4%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6488.4%
Applied egg-rr88.4%
if 5.9000000000000001e119 < b Initial program 44.4%
Simplified44.4%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6498.3%
Simplified98.3%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6498.3%
Simplified98.3%
Taylor expanded in c around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6498.3%
Simplified98.3%
Final simplification92.4%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (+ (* b b) (* c (* a -4.0))))))
(if (<= b -4.2e+57)
(if (>= b 0.0) (/ (* c -2.0) (* b 2.0)) (- (/ c b) (/ b a)))
(if (<= b 7.2e+120)
(if (>= b 0.0) (* c (/ -2.0 (+ b t_0))) (* (/ 0.5 a) (- t_0 b)))
(if (>= b 0.0)
(/ (* c -2.0) (+ b (+ b (* a (/ (* c -2.0) b)))))
(* c (- (/ b (* c (- 0.0 a))) (/ -1.0 b))))))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) + (c * (a * -4.0))));
double tmp_1;
if (b <= -4.2e+57) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b * 2.0);
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 7.2e+120) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = c * (-2.0 / (b + t_0));
} else {
tmp_3 = (0.5 / a) * (t_0 - b);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b))));
} else {
tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b));
}
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 <= (-4.2d+57)) then
if (b >= 0.0d0) then
tmp_2 = (c * (-2.0d0)) / (b * 2.0d0)
else
tmp_2 = (c / b) - (b / a)
end if
tmp_1 = tmp_2
else if (b <= 7.2d+120) then
if (b >= 0.0d0) then
tmp_3 = c * ((-2.0d0) / (b + t_0))
else
tmp_3 = (0.5d0 / a) * (t_0 - b)
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + (b + (a * ((c * (-2.0d0)) / b))))
else
tmp_1 = c * ((b / (c * (0.0d0 - a))) - ((-1.0d0) / b))
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 <= -4.2e+57) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b * 2.0);
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 7.2e+120) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = c * (-2.0 / (b + t_0));
} else {
tmp_3 = (0.5 / a) * (t_0 - b);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b))));
} else {
tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b));
}
return tmp_1;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) + (c * (a * -4.0)))) tmp_1 = 0 if b <= -4.2e+57: tmp_2 = 0 if b >= 0.0: tmp_2 = (c * -2.0) / (b * 2.0) else: tmp_2 = (c / b) - (b / a) tmp_1 = tmp_2 elif b <= 7.2e+120: tmp_3 = 0 if b >= 0.0: tmp_3 = c * (-2.0 / (b + t_0)) else: tmp_3 = (0.5 / a) * (t_0 - b) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b)))) else: tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b)) 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 <= -4.2e+57) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(c * -2.0) / Float64(b * 2.0)); else tmp_2 = Float64(Float64(c / b) - Float64(b / a)); end tmp_1 = tmp_2; elseif (b <= 7.2e+120) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(c * Float64(-2.0 / Float64(b + t_0))); else tmp_3 = Float64(Float64(0.5 / a) * Float64(t_0 - b)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + Float64(b + Float64(a * Float64(Float64(c * -2.0) / b))))); else tmp_1 = Float64(c * Float64(Float64(b / Float64(c * Float64(0.0 - a))) - Float64(-1.0 / b))); 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 <= -4.2e+57) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = (c * -2.0) / (b * 2.0); else tmp_3 = (c / b) - (b / a); end tmp_2 = tmp_3; elseif (b <= 7.2e+120) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = c * (-2.0 / (b + t_0)); else tmp_4 = (0.5 / a) * (t_0 - b); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b)))); else tmp_2 = c * ((b / (c * (0.0 - a))) - (-1.0 / b)); 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, -4.2e+57], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 7.2e+120], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / a), $MachinePrecision] * N[(t$95$0 - b), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(b + N[(a * N[(N[(c * -2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(b / N[(c * N[(0.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-1.0 / b), $MachinePrecision]), $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 -4.2 \cdot 10^{+57}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{+120}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{a} \cdot \left(t\_0 - b\right)\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \left(b + a \cdot \frac{c \cdot -2}{b}\right)}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(\frac{b}{c \cdot \left(0 - a\right)} - \frac{-1}{b}\right)\\
\end{array}
\end{array}
if b < -4.19999999999999982e57Initial program 50.8%
Simplified50.8%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6450.8%
Simplified50.8%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6498.1%
Simplified98.1%
Taylor expanded in a around inf
+-commutativeN/A
neg-mul-1N/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6499.1%
Simplified99.1%
Taylor expanded in b around inf
*-commutativeN/A
*-lowering-*.f6499.1%
Simplified99.1%
if -4.19999999999999982e57 < b < 7.20000000000000031e120Initial program 86.8%
Simplified86.8%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6486.8%
Applied egg-rr86.8%
Applied egg-rr68.9%
Applied egg-rr86.7%
if 7.20000000000000031e120 < b Initial program 44.4%
Simplified44.4%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6498.3%
Simplified98.3%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6498.3%
Simplified98.3%
Taylor expanded in c around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6498.3%
Simplified98.3%
Final simplification92.3%
(FPCore (a b c)
:precision binary64
(if (<= b -1e+148)
(if (>= b 0.0) (/ (* c -2.0) (* b 2.0)) (- (/ c b) (/ b a)))
(if (<= b 5e-14)
(/ (* 0.5 (- (sqrt (+ (* b b) (* a (* c -4.0)))) b)) a)
(if (>= b 0.0)
(/ (* c -2.0) (+ b (+ b (* a (/ (* c -2.0) b)))))
(* c (- (/ b (* c (- 0.0 a))) (/ -1.0 b)))))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= -1e+148) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b * 2.0);
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 5e-14) {
tmp_1 = (0.5 * (sqrt(((b * b) + (a * (c * -4.0)))) - b)) / a;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b))));
} else {
tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b));
}
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 <= (-1d+148)) then
if (b >= 0.0d0) then
tmp_2 = (c * (-2.0d0)) / (b * 2.0d0)
else
tmp_2 = (c / b) - (b / a)
end if
tmp_1 = tmp_2
else if (b <= 5d-14) then
tmp_1 = (0.5d0 * (sqrt(((b * b) + (a * (c * (-4.0d0))))) - b)) / a
else if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + (b + (a * ((c * (-2.0d0)) / b))))
else
tmp_1 = c * ((b / (c * (0.0d0 - a))) - ((-1.0d0) / b))
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= -1e+148) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b * 2.0);
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 5e-14) {
tmp_1 = (0.5 * (Math.sqrt(((b * b) + (a * (c * -4.0)))) - b)) / a;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b))));
} else {
tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b));
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= -1e+148: tmp_2 = 0 if b >= 0.0: tmp_2 = (c * -2.0) / (b * 2.0) else: tmp_2 = (c / b) - (b / a) tmp_1 = tmp_2 elif b <= 5e-14: tmp_1 = (0.5 * (math.sqrt(((b * b) + (a * (c * -4.0)))) - b)) / a elif b >= 0.0: tmp_1 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b)))) else: tmp_1 = c * ((b / (c * (0.0 - a))) - (-1.0 / b)) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= -1e+148) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(c * -2.0) / Float64(b * 2.0)); else tmp_2 = Float64(Float64(c / b) - Float64(b / a)); end tmp_1 = tmp_2; elseif (b <= 5e-14) tmp_1 = Float64(Float64(0.5 * Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -4.0)))) - b)) / a); elseif (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + Float64(b + Float64(a * Float64(Float64(c * -2.0) / b))))); else tmp_1 = Float64(c * Float64(Float64(b / Float64(c * Float64(0.0 - a))) - Float64(-1.0 / b))); end return tmp_1 end
function tmp_4 = code(a, b, c) tmp_2 = 0.0; if (b <= -1e+148) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = (c * -2.0) / (b * 2.0); else tmp_3 = (c / b) - (b / a); end tmp_2 = tmp_3; elseif (b <= 5e-14) tmp_2 = (0.5 * (sqrt(((b * b) + (a * (c * -4.0)))) - b)) / a; elseif (b >= 0.0) tmp_2 = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b)))); else tmp_2 = c * ((b / (c * (0.0 - a))) - (-1.0 / b)); end tmp_4 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, -1e+148], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 5e-14], N[(N[(0.5 * N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(b + N[(a * N[(N[(c * -2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(b / N[(c * N[(0.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+148}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 5 \cdot 10^{-14}:\\
\;\;\;\;\frac{0.5 \cdot \left(\sqrt{b \cdot b + a \cdot \left(c \cdot -4\right)} - b\right)}{a}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \left(b + a \cdot \frac{c \cdot -2}{b}\right)}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(\frac{b}{c \cdot \left(0 - a\right)} - \frac{-1}{b}\right)\\
\end{array}
\end{array}
if b < -1e148Initial program 32.5%
Simplified32.5%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6432.5%
Simplified32.5%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6497.5%
Simplified97.5%
Taylor expanded in a around inf
+-commutativeN/A
neg-mul-1N/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6498.8%
Simplified98.8%
Taylor expanded in b around inf
*-commutativeN/A
*-lowering-*.f6498.8%
Simplified98.8%
if -1e148 < b < 5.0000000000000002e-14Initial program 87.2%
Simplified87.2%
associate-/l*N/A
*-commutativeN/A
flip-+N/A
associate-/r/N/A
associate-*l*N/A
*-lowering-*.f64N/A
Applied egg-rr78.7%
Taylor expanded in b around -inf
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
Simplified80.7%
if 5.0000000000000002e-14 < b Initial program 60.5%
Simplified60.5%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6495.7%
Simplified95.7%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6495.7%
Simplified95.7%
Taylor expanded in c around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6495.7%
Simplified95.7%
Final simplification88.6%
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ (* c -2.0) (+ b (+ b (* a (/ (* c -2.0) b))))) (- (/ c b) (/ b a))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b))));
} else {
tmp = (c / 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 + (a * ((c * (-2.0d0)) / b))))
else
tmp = (c / 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 + (a * ((c * -2.0) / b))));
} else {
tmp = (c / b) - (b / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = (c * -2.0) / (b + (b + (a * ((c * -2.0) / b)))) else: tmp = (c / b) - (b / a) return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(c * -2.0) / Float64(b + Float64(b + Float64(a * Float64(Float64(c * -2.0) / b))))); else tmp = Float64(Float64(c / b) - Float64(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 + (a * ((c * -2.0) / b)))); else tmp = (c / b) - (b / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(b + N[(a * N[(N[(c * -2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \left(b + a \cdot \frac{c \cdot -2}{b}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}
\end{array}
Initial program 68.7%
Simplified68.7%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6466.9%
Simplified66.9%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6468.0%
Simplified68.0%
Taylor expanded in a around inf
+-commutativeN/A
neg-mul-1N/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6470.3%
Simplified70.3%
Final simplification70.3%
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ (* c -2.0) (* b 2.0)) (- (/ c b) (/ b a))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = (c * -2.0) / (b * 2.0);
} else {
tmp = (c / 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 * 2.0d0)
else
tmp = (c / 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 * 2.0);
} else {
tmp = (c / b) - (b / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = (c * -2.0) / (b * 2.0) else: tmp = (c / b) - (b / a) return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(c * -2.0) / Float64(b * 2.0)); else tmp = Float64(Float64(c / b) - Float64(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 * 2.0); else tmp = (c / b) - (b / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}
\end{array}
Initial program 68.7%
Simplified68.7%
Taylor expanded in c around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6466.9%
Simplified66.9%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6468.0%
Simplified68.0%
Taylor expanded in a around inf
+-commutativeN/A
neg-mul-1N/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6470.3%
Simplified70.3%
Taylor expanded in b around inf
*-commutativeN/A
*-lowering-*.f6470.2%
Simplified70.2%
(FPCore (a b c) :precision binary64 (if (<= b -8.5e-308) (/ (- 0.0 b) a) 0.0))
double code(double a, double b, double c) {
double tmp;
if (b <= -8.5e-308) {
tmp = (0.0 - b) / a;
} else {
tmp = 0.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 <= (-8.5d-308)) then
tmp = (0.0d0 - b) / a
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -8.5e-308) {
tmp = (0.0 - b) / a;
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -8.5e-308: tmp = (0.0 - b) / a else: tmp = 0.0 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -8.5e-308) tmp = Float64(Float64(0.0 - b) / a); else tmp = 0.0; end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -8.5e-308) tmp = (0.0 - b) / a; else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -8.5e-308], N[(N[(0.0 - b), $MachinePrecision] / a), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.5 \cdot 10^{-308}:\\
\;\;\;\;\frac{0 - b}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b < -8.49999999999999972e-308Initial program 68.1%
Simplified68.1%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6473.5%
Simplified73.5%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6473.5%
Simplified73.5%
associate--l-N/A
sub0-negN/A
count-2N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/A
frac-2negN/A
*-commutativeN/A
times-fracN/A
metadata-evalN/A
neg-mul-1N/A
sub0-negN/A
if-sameN/A
sub0-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6473.5%
Applied egg-rr73.5%
if -8.49999999999999972e-308 < b Initial program 69.4%
Simplified69.4%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6469.4%
Simplified69.4%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f642.8%
Simplified2.8%
Applied egg-rr3.5%
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
mul0-rgtN/A
+-lft-identityN/A
mul0-lftN/A
+-commutativeN/A
+-lft-identityN/A
mul0-lftN/A
mul0-rgtN/A
+-lft-identityN/A
mul0-lftN/A
+-commutativeN/A
+-lft-identityN/A
mul0-lftN/A
+-inversesN/A
metadata-evalN/A
mul0-rgtN/A
Applied egg-rr19.2%
Final simplification47.4%
(FPCore (a b c) :precision binary64 0.0)
double code(double a, double b, double c) {
return 0.0;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = 0.0d0
end function
public static double code(double a, double b, double c) {
return 0.0;
}
def code(a, b, c): return 0.0
function code(a, b, c) return 0.0 end
function tmp = code(a, b, c) tmp = 0.0; end
code[a_, b_, c_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 68.7%
Simplified68.7%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6471.5%
Simplified71.5%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6439.5%
Simplified39.5%
Applied egg-rr2.5%
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
mul0-rgtN/A
+-lft-identityN/A
mul0-lftN/A
+-commutativeN/A
+-lft-identityN/A
mul0-lftN/A
mul0-rgtN/A
+-lft-identityN/A
mul0-lftN/A
+-commutativeN/A
+-lft-identityN/A
mul0-lftN/A
+-inversesN/A
metadata-evalN/A
mul0-rgtN/A
Applied egg-rr10.7%
herbie shell --seed 2024138
(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))))