
(FPCore (a b c) :precision binary64 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c))))) (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (+ (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((b * b) - ((4.0d0 * a) * c)))
if (b >= 0.0d0) then
tmp = (2.0d0 * c) / (-b - t_0)
else
tmp = (-b + t_0) / (2.0d0 * a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - ((4.0 * a) * c))) tmp = 0 if b >= 0.0: tmp = (2.0 * c) / (-b - t_0) else: tmp = (-b + t_0) / (2.0 * a) return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0)); else tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt(((b * b) - ((4.0 * a) * c))); tmp = 0.0; if (b >= 0.0) tmp = (2.0 * c) / (-b - t_0); else tmp = (-b + t_0) / (2.0 * a); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c))))) (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (+ (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((b * b) - ((4.0d0 * a) * c)))
if (b >= 0.0d0) then
tmp = (2.0d0 * c) / (-b - t_0)
else
tmp = (-b + t_0) / (2.0d0 * a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - ((4.0 * a) * c))) tmp = 0 if b >= 0.0: tmp = (2.0 * c) / (-b - t_0) else: tmp = (-b + t_0) / (2.0 * a) return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0)); else tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt(((b * b) - ((4.0 * a) * c))); tmp = 0.0; if (b >= 0.0) tmp = (2.0 * c) / (-b - t_0); else tmp = (-b + t_0) / (2.0 * a); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (+ (* b b) (* (* a c) -4.0))))
(t_1 (/ (- t_0 b) (* a 2.0))))
(if (<= b -2e+126)
(if (>= b 0.0) (/ b a) (- (/ c b) (/ b a)))
(if (<= b 5.4e+126)
(if (>= b 0.0) (/ (* c -2.0) (+ b t_0)) t_1)
(if (>= b 0.0) (/ (* c -2.0) (+ b b)) t_1)))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) + ((a * c) * -4.0)));
double t_1 = (t_0 - b) / (a * 2.0);
double tmp_1;
if (b <= -2e+126) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 5.4e+126) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * -2.0) / (b + t_0);
} else {
tmp_3 = t_1;
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + b);
} else {
tmp_1 = t_1;
}
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 = sqrt(((b * b) + ((a * c) * (-4.0d0))))
t_1 = (t_0 - b) / (a * 2.0d0)
if (b <= (-2d+126)) then
if (b >= 0.0d0) then
tmp_2 = b / a
else
tmp_2 = (c / b) - (b / a)
end if
tmp_1 = tmp_2
else if (b <= 5.4d+126) then
if (b >= 0.0d0) then
tmp_3 = (c * (-2.0d0)) / (b + t_0)
else
tmp_3 = t_1
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + b)
else
tmp_1 = t_1
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) + ((a * c) * -4.0)));
double t_1 = (t_0 - b) / (a * 2.0);
double tmp_1;
if (b <= -2e+126) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 5.4e+126) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * -2.0) / (b + t_0);
} else {
tmp_3 = t_1;
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + b);
} else {
tmp_1 = t_1;
}
return tmp_1;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) + ((a * c) * -4.0))) t_1 = (t_0 - b) / (a * 2.0) tmp_1 = 0 if b <= -2e+126: tmp_2 = 0 if b >= 0.0: tmp_2 = b / a else: tmp_2 = (c / b) - (b / a) tmp_1 = tmp_2 elif b <= 5.4e+126: tmp_3 = 0 if b >= 0.0: tmp_3 = (c * -2.0) / (b + t_0) else: tmp_3 = t_1 tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = (c * -2.0) / (b + b) else: tmp_1 = t_1 return tmp_1
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) + Float64(Float64(a * c) * -4.0))) t_1 = Float64(Float64(t_0 - b) / Float64(a * 2.0)) tmp_1 = 0.0 if (b <= -2e+126) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(b / a); else tmp_2 = Float64(Float64(c / b) - Float64(b / a)); end tmp_1 = tmp_2; elseif (b <= 5.4e+126) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(c * -2.0) / Float64(b + t_0)); else tmp_3 = t_1; end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + b)); else tmp_1 = t_1; end return tmp_1 end
function tmp_5 = code(a, b, c) t_0 = sqrt(((b * b) + ((a * c) * -4.0))); t_1 = (t_0 - b) / (a * 2.0); tmp_2 = 0.0; if (b <= -2e+126) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = b / a; else tmp_3 = (c / b) - (b / a); end tmp_2 = tmp_3; elseif (b <= 5.4e+126) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = (c * -2.0) / (b + t_0); else tmp_4 = t_1; end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = (c * -2.0) / (b + b); else tmp_2 = t_1; end tmp_5 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2e+126], If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 5.4e+126], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b + \left(a \cdot c\right) \cdot -4}\\
t_1 := \frac{t\_0 - b}{a \cdot 2}\\
\mathbf{if}\;b \leq -2 \cdot 10^{+126}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{+126}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.99999999999999985e126Initial program 40.1%
Simplified40.1%
Taylor expanded in b around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6440.1%
Simplified40.1%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.4%
Simplified84.4%
Taylor expanded in c around inf
/-lowering-/.f6484.4%
Simplified84.4%
Taylor expanded in c around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6492.7%
Simplified92.7%
if -1.99999999999999985e126 < b < 5.40000000000000005e126Initial program 84.7%
Simplified84.7%
if 5.40000000000000005e126 < b Initial program 45.7%
Simplified45.7%
Taylor expanded in b around inf
Simplified96.2%
Final simplification88.1%
(FPCore (a b c)
:precision binary64
(if (<= b -4.5e-78)
(if (>= b 0.0) (/ b a) (- (/ c b) (/ b a)))
(if (<= b 1.5e-274)
(if (>= b 0.0)
(/ (* c -2.0) (+ b (/ 1.0 (/ 1.0 b))))
(/ (- (pow (/ -0.25 (* a c)) -0.5) b) (* a 2.0)))
(if (<= b 2.4e-75)
(if (>= b 0.0)
(/ (* c -2.0) (+ b (sqrt (* (* a c) -4.0))))
(- (/ c b) (* 0.5 (/ (+ b b) a))))
(if (>= b 0.0)
(/
(* c -2.0)
(+ b (* b (+ 1.0 (* -2.0 (* c (* a (/ 1.0 (* b b)))))))))
(/ (* b (- (- 0.0 2.0) (/ (* -2.0 (* a c)) (* b b)))) (* a 2.0)))))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= -4.5e-78) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 1.5e-274) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * -2.0) / (b + (1.0 / (1.0 / b)));
} else {
tmp_3 = (pow((-0.25 / (a * c)), -0.5) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b <= 2.4e-75) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (c * -2.0) / (b + sqrt(((a * c) * -4.0)));
} else {
tmp_4 = (c / b) - (0.5 * ((b + b) / a));
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b))))))));
} else {
tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0);
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
real(8) :: tmp_4
if (b <= (-4.5d-78)) then
if (b >= 0.0d0) then
tmp_2 = b / a
else
tmp_2 = (c / b) - (b / a)
end if
tmp_1 = tmp_2
else if (b <= 1.5d-274) then
if (b >= 0.0d0) then
tmp_3 = (c * (-2.0d0)) / (b + (1.0d0 / (1.0d0 / b)))
else
tmp_3 = ((((-0.25d0) / (a * c)) ** (-0.5d0)) - b) / (a * 2.0d0)
end if
tmp_1 = tmp_3
else if (b <= 2.4d-75) then
if (b >= 0.0d0) then
tmp_4 = (c * (-2.0d0)) / (b + sqrt(((a * c) * (-4.0d0))))
else
tmp_4 = (c / b) - (0.5d0 * ((b + b) / a))
end if
tmp_1 = tmp_4
else if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + (b * (1.0d0 + ((-2.0d0) * (c * (a * (1.0d0 / (b * b))))))))
else
tmp_1 = (b * ((0.0d0 - 2.0d0) - (((-2.0d0) * (a * c)) / (b * b)))) / (a * 2.0d0)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= -4.5e-78) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 1.5e-274) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * -2.0) / (b + (1.0 / (1.0 / b)));
} else {
tmp_3 = (Math.pow((-0.25 / (a * c)), -0.5) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b <= 2.4e-75) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (c * -2.0) / (b + Math.sqrt(((a * c) * -4.0)));
} else {
tmp_4 = (c / b) - (0.5 * ((b + b) / a));
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b))))))));
} else {
tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0);
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= -4.5e-78: tmp_2 = 0 if b >= 0.0: tmp_2 = b / a else: tmp_2 = (c / b) - (b / a) tmp_1 = tmp_2 elif b <= 1.5e-274: tmp_3 = 0 if b >= 0.0: tmp_3 = (c * -2.0) / (b + (1.0 / (1.0 / b))) else: tmp_3 = (math.pow((-0.25 / (a * c)), -0.5) - b) / (a * 2.0) tmp_1 = tmp_3 elif b <= 2.4e-75: tmp_4 = 0 if b >= 0.0: tmp_4 = (c * -2.0) / (b + math.sqrt(((a * c) * -4.0))) else: tmp_4 = (c / b) - (0.5 * ((b + b) / a)) tmp_1 = tmp_4 elif b >= 0.0: tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b)))))))) else: tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= -4.5e-78) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(b / a); else tmp_2 = Float64(Float64(c / b) - Float64(b / a)); end tmp_1 = tmp_2; elseif (b <= 1.5e-274) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(c * -2.0) / Float64(b + Float64(1.0 / Float64(1.0 / b)))); else tmp_3 = Float64(Float64((Float64(-0.25 / Float64(a * c)) ^ -0.5) - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b <= 2.4e-75) tmp_4 = 0.0 if (b >= 0.0) tmp_4 = Float64(Float64(c * -2.0) / Float64(b + sqrt(Float64(Float64(a * c) * -4.0)))); else tmp_4 = Float64(Float64(c / b) - Float64(0.5 * Float64(Float64(b + b) / a))); end tmp_1 = tmp_4; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + Float64(b * Float64(1.0 + Float64(-2.0 * Float64(c * Float64(a * Float64(1.0 / Float64(b * b))))))))); else tmp_1 = Float64(Float64(b * Float64(Float64(0.0 - 2.0) - Float64(Float64(-2.0 * Float64(a * c)) / Float64(b * b)))) / Float64(a * 2.0)); end return tmp_1 end
function tmp_6 = code(a, b, c) tmp_2 = 0.0; if (b <= -4.5e-78) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = b / a; else tmp_3 = (c / b) - (b / a); end tmp_2 = tmp_3; elseif (b <= 1.5e-274) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = (c * -2.0) / (b + (1.0 / (1.0 / b))); else tmp_4 = (((-0.25 / (a * c)) ^ -0.5) - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b <= 2.4e-75) tmp_5 = 0.0; if (b >= 0.0) tmp_5 = (c * -2.0) / (b + sqrt(((a * c) * -4.0))); else tmp_5 = (c / b) - (0.5 * ((b + b) / a)); end tmp_2 = tmp_5; elseif (b >= 0.0) tmp_2 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b)))))))); else tmp_2 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0); end tmp_6 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, -4.5e-78], If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 1.5e-274], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(1.0 / N[(1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(-0.25 / N[(a * c), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 2.4e-75], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[Sqrt[N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(b * N[(1.0 + N[(-2.0 * N[(c * N[(a * N[(1.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(N[(0.0 - 2.0), $MachinePrecision] - N[(N[(-2.0 * N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{-78}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-274}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \frac{1}{\frac{1}{b}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{-0.25}{a \cdot c}\right)}^{-0.5} - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \leq 2.4 \cdot 10^{-75}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \sqrt{\left(a \cdot c\right) \cdot -4}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - 0.5 \cdot \frac{b + b}{a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b \cdot \left(1 + -2 \cdot \left(c \cdot \left(a \cdot \frac{1}{b \cdot b}\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot \left(\left(0 - 2\right) - \frac{-2 \cdot \left(a \cdot c\right)}{b \cdot b}\right)}{a \cdot 2}\\
\end{array}
\end{array}
if b < -4.5e-78Initial program 66.8%
Simplified66.8%
Taylor expanded in b around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6466.8%
Simplified66.8%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6478.8%
Simplified78.8%
Taylor expanded in c around inf
/-lowering-/.f6478.8%
Simplified78.8%
Taylor expanded in c around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6482.5%
Simplified82.5%
if -4.5e-78 < b < 1.49999999999999989e-274Initial program 83.6%
Simplified83.6%
flip-+N/A
fmm-defN/A
*-commutativeN/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
Applied egg-rr83.6%
Taylor expanded in b around inf
/-lowering-/.f6483.6%
Simplified83.6%
pow1/2N/A
*-commutativeN/A
metadata-evalN/A
pow-powN/A
inv-powN/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6483.7%
Applied egg-rr83.7%
Taylor expanded in b around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6473.7%
Simplified73.7%
if 1.49999999999999989e-274 < b < 2.40000000000000019e-75Initial program 83.6%
Simplified83.6%
Taylor expanded in b around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f6483.6%
Simplified83.6%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6483.6%
Simplified83.6%
Taylor expanded in b around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.9%
Simplified75.9%
if 2.40000000000000019e-75 < b Initial program 63.7%
Simplified63.7%
Taylor expanded in b around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6484.0%
Simplified84.0%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.0%
Simplified84.0%
*-commutativeN/A
div-invN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6484.1%
Applied egg-rr84.1%
Final simplification80.8%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (* (* a c) -4.0))))
(if (<= b -1.6e-80)
(if (>= b 0.0) (/ b a) (- (/ c b) (/ b a)))
(if (<= b 1.5e-274)
(if (>= b 0.0)
(/ (* c -2.0) (+ b (/ 1.0 (/ 1.0 b))))
(/ (- t_0 b) (* a 2.0)))
(if (<= b 7.6e-75)
(if (>= b 0.0)
(/ (* c -2.0) (+ b t_0))
(- (/ c b) (* 0.5 (/ (+ b b) a))))
(if (>= b 0.0)
(/
(* c -2.0)
(+ b (* b (+ 1.0 (* -2.0 (* c (* a (/ 1.0 (* b b)))))))))
(/
(* b (- (- 0.0 2.0) (/ (* -2.0 (* a c)) (* b b))))
(* a 2.0))))))))
double code(double a, double b, double c) {
double t_0 = sqrt(((a * c) * -4.0));
double tmp_1;
if (b <= -1.6e-80) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 1.5e-274) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * -2.0) / (b + (1.0 / (1.0 / b)));
} else {
tmp_3 = (t_0 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b <= 7.6e-75) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (c * -2.0) / (b + t_0);
} else {
tmp_4 = (c / b) - (0.5 * ((b + b) / a));
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b))))))));
} else {
tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0);
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
real(8) :: tmp_4
t_0 = sqrt(((a * c) * (-4.0d0)))
if (b <= (-1.6d-80)) then
if (b >= 0.0d0) then
tmp_2 = b / a
else
tmp_2 = (c / b) - (b / a)
end if
tmp_1 = tmp_2
else if (b <= 1.5d-274) then
if (b >= 0.0d0) then
tmp_3 = (c * (-2.0d0)) / (b + (1.0d0 / (1.0d0 / b)))
else
tmp_3 = (t_0 - b) / (a * 2.0d0)
end if
tmp_1 = tmp_3
else if (b <= 7.6d-75) then
if (b >= 0.0d0) then
tmp_4 = (c * (-2.0d0)) / (b + t_0)
else
tmp_4 = (c / b) - (0.5d0 * ((b + b) / a))
end if
tmp_1 = tmp_4
else if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + (b * (1.0d0 + ((-2.0d0) * (c * (a * (1.0d0 / (b * b))))))))
else
tmp_1 = (b * ((0.0d0 - 2.0d0) - (((-2.0d0) * (a * c)) / (b * b)))) / (a * 2.0d0)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((a * c) * -4.0));
double tmp_1;
if (b <= -1.6e-80) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 1.5e-274) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (c * -2.0) / (b + (1.0 / (1.0 / b)));
} else {
tmp_3 = (t_0 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b <= 7.6e-75) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (c * -2.0) / (b + t_0);
} else {
tmp_4 = (c / b) - (0.5 * ((b + b) / a));
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b))))))));
} else {
tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0);
}
return tmp_1;
}
def code(a, b, c): t_0 = math.sqrt(((a * c) * -4.0)) tmp_1 = 0 if b <= -1.6e-80: tmp_2 = 0 if b >= 0.0: tmp_2 = b / a else: tmp_2 = (c / b) - (b / a) tmp_1 = tmp_2 elif b <= 1.5e-274: tmp_3 = 0 if b >= 0.0: tmp_3 = (c * -2.0) / (b + (1.0 / (1.0 / b))) else: tmp_3 = (t_0 - b) / (a * 2.0) tmp_1 = tmp_3 elif b <= 7.6e-75: tmp_4 = 0 if b >= 0.0: tmp_4 = (c * -2.0) / (b + t_0) else: tmp_4 = (c / b) - (0.5 * ((b + b) / a)) tmp_1 = tmp_4 elif b >= 0.0: tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b)))))))) else: tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0) return tmp_1
function code(a, b, c) t_0 = sqrt(Float64(Float64(a * c) * -4.0)) tmp_1 = 0.0 if (b <= -1.6e-80) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(b / a); else tmp_2 = Float64(Float64(c / b) - Float64(b / a)); end tmp_1 = tmp_2; elseif (b <= 1.5e-274) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(c * -2.0) / Float64(b + Float64(1.0 / Float64(1.0 / b)))); else tmp_3 = Float64(Float64(t_0 - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b <= 7.6e-75) tmp_4 = 0.0 if (b >= 0.0) tmp_4 = Float64(Float64(c * -2.0) / Float64(b + t_0)); else tmp_4 = Float64(Float64(c / b) - Float64(0.5 * Float64(Float64(b + b) / a))); end tmp_1 = tmp_4; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + Float64(b * Float64(1.0 + Float64(-2.0 * Float64(c * Float64(a * Float64(1.0 / Float64(b * b))))))))); else tmp_1 = Float64(Float64(b * Float64(Float64(0.0 - 2.0) - Float64(Float64(-2.0 * Float64(a * c)) / Float64(b * b)))) / Float64(a * 2.0)); end return tmp_1 end
function tmp_6 = code(a, b, c) t_0 = sqrt(((a * c) * -4.0)); tmp_2 = 0.0; if (b <= -1.6e-80) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = b / a; else tmp_3 = (c / b) - (b / a); end tmp_2 = tmp_3; elseif (b <= 1.5e-274) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = (c * -2.0) / (b + (1.0 / (1.0 / b))); else tmp_4 = (t_0 - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b <= 7.6e-75) tmp_5 = 0.0; if (b >= 0.0) tmp_5 = (c * -2.0) / (b + t_0); else tmp_5 = (c / b) - (0.5 * ((b + b) / a)); end tmp_2 = tmp_5; elseif (b >= 0.0) tmp_2 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b)))))))); else tmp_2 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0); end tmp_6 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -1.6e-80], If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 1.5e-274], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(1.0 / N[(1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 7.6e-75], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(b * N[(1.0 + N[(-2.0 * N[(c * N[(a * N[(1.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(N[(0.0 - 2.0), $MachinePrecision] - N[(N[(-2.0 * N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\left(a \cdot c\right) \cdot -4}\\
\mathbf{if}\;b \leq -1.6 \cdot 10^{-80}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-274}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \frac{1}{\frac{1}{b}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \leq 7.6 \cdot 10^{-75}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - 0.5 \cdot \frac{b + b}{a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b \cdot \left(1 + -2 \cdot \left(c \cdot \left(a \cdot \frac{1}{b \cdot b}\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot \left(\left(0 - 2\right) - \frac{-2 \cdot \left(a \cdot c\right)}{b \cdot b}\right)}{a \cdot 2}\\
\end{array}
\end{array}
if b < -1.5999999999999999e-80Initial program 66.8%
Simplified66.8%
Taylor expanded in b around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6466.8%
Simplified66.8%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6478.8%
Simplified78.8%
Taylor expanded in c around inf
/-lowering-/.f6478.8%
Simplified78.8%
Taylor expanded in c around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6482.5%
Simplified82.5%
if -1.5999999999999999e-80 < b < 1.49999999999999989e-274Initial program 83.6%
Simplified83.6%
flip-+N/A
fmm-defN/A
*-commutativeN/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
Applied egg-rr83.6%
Taylor expanded in b around inf
/-lowering-/.f6483.6%
Simplified83.6%
Taylor expanded in b around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6473.7%
Simplified73.7%
if 1.49999999999999989e-274 < b < 7.59999999999999987e-75Initial program 83.6%
Simplified83.6%
Taylor expanded in b around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f6483.6%
Simplified83.6%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6483.6%
Simplified83.6%
Taylor expanded in b around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.9%
Simplified75.9%
if 7.59999999999999987e-75 < b Initial program 63.7%
Simplified63.7%
Taylor expanded in b around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6484.0%
Simplified84.0%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.0%
Simplified84.0%
*-commutativeN/A
div-invN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6484.1%
Applied egg-rr84.1%
Final simplification80.8%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- (sqrt (+ (* b b) (* (* a c) -4.0))) b) (* a 2.0))))
(if (<= b -2e+128)
(if (>= b 0.0) (/ b a) (- (/ c b) (/ b a)))
(if (<= b 5e+126)
(if (>= b 0.0)
(* c (/ -2.0 (+ b (sqrt (+ (* b b) (* c (* a -4.0)))))))
t_0)
(if (>= b 0.0) (/ (* c -2.0) (+ b b)) t_0)))))
double code(double a, double b, double c) {
double t_0 = (sqrt(((b * b) + ((a * c) * -4.0))) - b) / (a * 2.0);
double tmp_1;
if (b <= -2e+128) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 5e+126) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = c * (-2.0 / (b + sqrt(((b * b) + (c * (a * -4.0))))));
} else {
tmp_3 = t_0;
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + b);
} else {
tmp_1 = t_0;
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
t_0 = (sqrt(((b * b) + ((a * c) * (-4.0d0)))) - b) / (a * 2.0d0)
if (b <= (-2d+128)) then
if (b >= 0.0d0) then
tmp_2 = b / a
else
tmp_2 = (c / b) - (b / a)
end if
tmp_1 = tmp_2
else if (b <= 5d+126) then
if (b >= 0.0d0) then
tmp_3 = c * ((-2.0d0) / (b + sqrt(((b * b) + (c * (a * (-4.0d0)))))))
else
tmp_3 = t_0
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + b)
else
tmp_1 = t_0
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double t_0 = (Math.sqrt(((b * b) + ((a * c) * -4.0))) - b) / (a * 2.0);
double tmp_1;
if (b <= -2e+128) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 5e+126) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = c * (-2.0 / (b + Math.sqrt(((b * b) + (c * (a * -4.0))))));
} else {
tmp_3 = t_0;
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + b);
} else {
tmp_1 = t_0;
}
return tmp_1;
}
def code(a, b, c): t_0 = (math.sqrt(((b * b) + ((a * c) * -4.0))) - b) / (a * 2.0) tmp_1 = 0 if b <= -2e+128: tmp_2 = 0 if b >= 0.0: tmp_2 = b / a else: tmp_2 = (c / b) - (b / a) tmp_1 = tmp_2 elif b <= 5e+126: tmp_3 = 0 if b >= 0.0: tmp_3 = c * (-2.0 / (b + math.sqrt(((b * b) + (c * (a * -4.0)))))) else: tmp_3 = t_0 tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = (c * -2.0) / (b + b) else: tmp_1 = t_0 return tmp_1
function code(a, b, c) t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(Float64(a * c) * -4.0))) - b) / Float64(a * 2.0)) tmp_1 = 0.0 if (b <= -2e+128) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(b / a); else tmp_2 = Float64(Float64(c / b) - Float64(b / a)); end tmp_1 = tmp_2; elseif (b <= 5e+126) 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 = t_0; end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + b)); else tmp_1 = t_0; end return tmp_1 end
function tmp_5 = code(a, b, c) t_0 = (sqrt(((b * b) + ((a * c) * -4.0))) - b) / (a * 2.0); tmp_2 = 0.0; if (b <= -2e+128) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = b / a; else tmp_3 = (c / b) - (b / a); end tmp_2 = tmp_3; elseif (b <= 5e+126) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = c * (-2.0 / (b + sqrt(((b * b) + (c * (a * -4.0)))))); else tmp_4 = t_0; end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = (c * -2.0) / (b + b); else tmp_2 = t_0; end tmp_5 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2e+128], If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 5e+126], 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], t$95$0], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + b), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b + \left(a \cdot c\right) \cdot -4} - b}{a \cdot 2}\\
\mathbf{if}\;b \leq -2 \cdot 10^{+128}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 5 \cdot 10^{+126}:\\
\;\;\;\;\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}:\\
\;\;\;\;t\_0\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -2.0000000000000002e128Initial program 40.1%
Simplified40.1%
Taylor expanded in b around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6440.1%
Simplified40.1%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.4%
Simplified84.4%
Taylor expanded in c around inf
/-lowering-/.f6484.4%
Simplified84.4%
Taylor expanded in c around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6492.7%
Simplified92.7%
if -2.0000000000000002e128 < b < 4.99999999999999977e126Initial program 84.7%
Simplified84.7%
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-*.f6484.6%
Applied egg-rr84.6%
if 4.99999999999999977e126 < b Initial program 45.7%
Simplified45.7%
Taylor expanded in b around inf
Simplified96.2%
Final simplification88.0%
(FPCore (a b c)
:precision binary64
(if (<= b -3.7e+128)
(if (>= b 0.0) (/ b a) (- (/ c b) (/ b a)))
(if (<= b 5.5e+126)
(if (>= b 0.0)
(* c (/ -2.0 (+ b (sqrt (+ (* b b) (* c (* a -4.0)))))))
(/ (- (sqrt (+ (* b b) (* (* a c) -4.0))) b) (* a 2.0)))
(if (>= b 0.0) (- 0.0 (/ c b)) (- 0.0 (/ b a))))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= -3.7e+128) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 5.5e+126) {
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) + ((a * c) * -4.0))) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = 0.0 - (c / b);
} else {
tmp_1 = 0.0 - (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
real(8) :: tmp_3
if (b <= (-3.7d+128)) then
if (b >= 0.0d0) then
tmp_2 = b / a
else
tmp_2 = (c / b) - (b / a)
end if
tmp_1 = tmp_2
else if (b <= 5.5d+126) 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) + ((a * c) * (-4.0d0)))) - b) / (a * 2.0d0)
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = 0.0d0 - (c / b)
else
tmp_1 = 0.0d0 - (b / a)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= -3.7e+128) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = (c / b) - (b / a);
}
tmp_1 = tmp_2;
} else if (b <= 5.5e+126) {
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) + ((a * c) * -4.0))) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = 0.0 - (c / b);
} else {
tmp_1 = 0.0 - (b / a);
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= -3.7e+128: tmp_2 = 0 if b >= 0.0: tmp_2 = b / a else: tmp_2 = (c / b) - (b / a) tmp_1 = tmp_2 elif b <= 5.5e+126: 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) + ((a * c) * -4.0))) - b) / (a * 2.0) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = 0.0 - (c / b) else: tmp_1 = 0.0 - (b / a) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= -3.7e+128) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(b / a); else tmp_2 = Float64(Float64(c / b) - Float64(b / a)); end tmp_1 = tmp_2; elseif (b <= 5.5e+126) 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(Float64(a * c) * -4.0))) - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(0.0 - Float64(c / b)); else tmp_1 = Float64(0.0 - Float64(b / a)); end return tmp_1 end
function tmp_5 = code(a, b, c) tmp_2 = 0.0; if (b <= -3.7e+128) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = b / a; else tmp_3 = (c / b) - (b / a); end tmp_2 = tmp_3; elseif (b <= 5.5e+126) 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) + ((a * c) * -4.0))) - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = 0.0 - (c / b); else tmp_2 = 0.0 - (b / a); end tmp_5 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, -3.7e+128], If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 5.5e+126], 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[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(0.0 - N[(c / b), $MachinePrecision]), $MachinePrecision], N[(0.0 - N[(b / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.7 \cdot 10^{+128}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 5.5 \cdot 10^{+126}:\\
\;\;\;\;\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 + \left(a \cdot c\right) \cdot -4} - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;0 - \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;0 - \frac{b}{a}\\
\end{array}
\end{array}
if b < -3.7000000000000001e128Initial program 40.1%
Simplified40.1%
Taylor expanded in b around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6440.1%
Simplified40.1%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.4%
Simplified84.4%
Taylor expanded in c around inf
/-lowering-/.f6484.4%
Simplified84.4%
Taylor expanded in c around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6492.7%
Simplified92.7%
if -3.7000000000000001e128 < b < 5.5000000000000004e126Initial program 84.7%
Simplified84.7%
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-*.f6484.6%
Applied egg-rr84.6%
if 5.5000000000000004e126 < b Initial program 45.7%
Simplified45.7%
flip-+N/A
fmm-defN/A
*-commutativeN/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
Applied egg-rr45.7%
Taylor expanded in b around inf
/-lowering-/.f6496.1%
Simplified96.1%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6496.1%
Simplified96.1%
Taylor expanded in b around 0
>=-lowering->=.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6496.2%
Simplified96.2%
Final simplification88.0%
(FPCore (a b c)
:precision binary64
(if (<= b 8.4e-75)
(if (>= b 0.0)
(/ (* c -2.0) (+ b (sqrt (* (* a c) -4.0))))
(- (/ c b) (* 0.5 (/ (+ b b) a))))
(if (>= b 0.0)
(/ (* c -2.0) (+ b (* b (+ 1.0 (* -2.0 (* c (* a (/ 1.0 (* b b)))))))))
(/ (* b (- (- 0.0 2.0) (/ (* -2.0 (* a c)) (* b b)))) (* a 2.0)))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= 8.4e-75) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b + sqrt(((a * c) * -4.0)));
} else {
tmp_2 = (c / b) - (0.5 * ((b + b) / a));
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b))))))));
} else {
tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0);
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
if (b <= 8.4d-75) then
if (b >= 0.0d0) then
tmp_2 = (c * (-2.0d0)) / (b + sqrt(((a * c) * (-4.0d0))))
else
tmp_2 = (c / b) - (0.5d0 * ((b + b) / a))
end if
tmp_1 = tmp_2
else if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + (b * (1.0d0 + ((-2.0d0) * (c * (a * (1.0d0 / (b * b))))))))
else
tmp_1 = (b * ((0.0d0 - 2.0d0) - (((-2.0d0) * (a * c)) / (b * b)))) / (a * 2.0d0)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= 8.4e-75) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (c * -2.0) / (b + Math.sqrt(((a * c) * -4.0)));
} else {
tmp_2 = (c / b) - (0.5 * ((b + b) / a));
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b))))))));
} else {
tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0);
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= 8.4e-75: tmp_2 = 0 if b >= 0.0: tmp_2 = (c * -2.0) / (b + math.sqrt(((a * c) * -4.0))) else: tmp_2 = (c / b) - (0.5 * ((b + b) / a)) tmp_1 = tmp_2 elif b >= 0.0: tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b)))))))) else: tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= 8.4e-75) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(c * -2.0) / Float64(b + sqrt(Float64(Float64(a * c) * -4.0)))); else tmp_2 = Float64(Float64(c / b) - Float64(0.5 * Float64(Float64(b + b) / a))); end tmp_1 = tmp_2; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + Float64(b * Float64(1.0 + Float64(-2.0 * Float64(c * Float64(a * Float64(1.0 / Float64(b * b))))))))); else tmp_1 = Float64(Float64(b * Float64(Float64(0.0 - 2.0) - Float64(Float64(-2.0 * Float64(a * c)) / Float64(b * b)))) / Float64(a * 2.0)); end return tmp_1 end
function tmp_4 = code(a, b, c) tmp_2 = 0.0; if (b <= 8.4e-75) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = (c * -2.0) / (b + sqrt(((a * c) * -4.0))); else tmp_3 = (c / b) - (0.5 * ((b + b) / a)); end tmp_2 = tmp_3; elseif (b >= 0.0) tmp_2 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b)))))))); else tmp_2 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0); end tmp_4 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, 8.4e-75], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[Sqrt[N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(b * N[(1.0 + N[(-2.0 * N[(c * N[(a * N[(1.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(N[(0.0 - 2.0), $MachinePrecision] - N[(N[(-2.0 * N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.4 \cdot 10^{-75}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \sqrt{\left(a \cdot c\right) \cdot -4}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - 0.5 \cdot \frac{b + b}{a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b \cdot \left(1 + -2 \cdot \left(c \cdot \left(a \cdot \frac{1}{b \cdot b}\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot \left(\left(0 - 2\right) - \frac{-2 \cdot \left(a \cdot c\right)}{b \cdot b}\right)}{a \cdot 2}\\
\end{array}
\end{array}
if b < 8.4000000000000004e-75Initial program 74.5%
Simplified74.5%
Taylor expanded in b around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f6466.0%
Simplified66.0%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6466.7%
Simplified66.7%
Taylor expanded in b around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6465.1%
Simplified65.1%
if 8.4000000000000004e-75 < b Initial program 63.7%
Simplified63.7%
Taylor expanded in b around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6484.0%
Simplified84.0%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.0%
Simplified84.0%
*-commutativeN/A
div-invN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6484.1%
Applied egg-rr84.1%
Final simplification71.9%
(FPCore (a b c)
:precision binary64
(if (<= b 8.7e-75)
(if (>= b 0.0)
(* c (/ -2.0 (+ b (sqrt (* c (* a -4.0))))))
(- (/ c b) (* 0.5 (/ (+ b b) a))))
(if (>= b 0.0)
(/ (* c -2.0) (+ b (* b (+ 1.0 (* -2.0 (* c (* a (/ 1.0 (* b b)))))))))
(/ (* b (- (- 0.0 2.0) (/ (* -2.0 (* a c)) (* b b)))) (* a 2.0)))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= 8.7e-75) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = c * (-2.0 / (b + sqrt((c * (a * -4.0)))));
} else {
tmp_2 = (c / b) - (0.5 * ((b + b) / a));
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b))))))));
} else {
tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0);
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
if (b <= 8.7d-75) then
if (b >= 0.0d0) then
tmp_2 = c * ((-2.0d0) / (b + sqrt((c * (a * (-4.0d0))))))
else
tmp_2 = (c / b) - (0.5d0 * ((b + b) / a))
end if
tmp_1 = tmp_2
else if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + (b * (1.0d0 + ((-2.0d0) * (c * (a * (1.0d0 / (b * b))))))))
else
tmp_1 = (b * ((0.0d0 - 2.0d0) - (((-2.0d0) * (a * c)) / (b * b)))) / (a * 2.0d0)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= 8.7e-75) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = c * (-2.0 / (b + Math.sqrt((c * (a * -4.0)))));
} else {
tmp_2 = (c / b) - (0.5 * ((b + b) / a));
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b))))))));
} else {
tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0);
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= 8.7e-75: tmp_2 = 0 if b >= 0.0: tmp_2 = c * (-2.0 / (b + math.sqrt((c * (a * -4.0))))) else: tmp_2 = (c / b) - (0.5 * ((b + b) / a)) tmp_1 = tmp_2 elif b >= 0.0: tmp_1 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b)))))))) else: tmp_1 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= 8.7e-75) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(c * Float64(-2.0 / Float64(b + sqrt(Float64(c * Float64(a * -4.0)))))); else tmp_2 = Float64(Float64(c / b) - Float64(0.5 * Float64(Float64(b + b) / a))); end tmp_1 = tmp_2; elseif (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + Float64(b * Float64(1.0 + Float64(-2.0 * Float64(c * Float64(a * Float64(1.0 / Float64(b * b))))))))); else tmp_1 = Float64(Float64(b * Float64(Float64(0.0 - 2.0) - Float64(Float64(-2.0 * Float64(a * c)) / Float64(b * b)))) / Float64(a * 2.0)); end return tmp_1 end
function tmp_4 = code(a, b, c) tmp_2 = 0.0; if (b <= 8.7e-75) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = c * (-2.0 / (b + sqrt((c * (a * -4.0))))); else tmp_3 = (c / b) - (0.5 * ((b + b) / a)); end tmp_2 = tmp_3; elseif (b >= 0.0) tmp_2 = (c * -2.0) / (b + (b * (1.0 + (-2.0 * (c * (a * (1.0 / (b * b)))))))); else tmp_2 = (b * ((0.0 - 2.0) - ((-2.0 * (a * c)) / (b * b)))) / (a * 2.0); end tmp_4 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, 8.7e-75], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[(b * N[(1.0 + N[(-2.0 * N[(c * N[(a * N[(1.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(N[(0.0 - 2.0), $MachinePrecision] - N[(N[(-2.0 * N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.7 \cdot 10^{-75}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + \sqrt{c \cdot \left(a \cdot -4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - 0.5 \cdot \frac{b + b}{a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b \cdot \left(1 + -2 \cdot \left(c \cdot \left(a \cdot \frac{1}{b \cdot b}\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot \left(\left(0 - 2\right) - \frac{-2 \cdot \left(a \cdot c\right)}{b \cdot b}\right)}{a \cdot 2}\\
\end{array}
\end{array}
if b < 8.6999999999999995e-75Initial program 74.5%
Simplified74.5%
Taylor expanded in b around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f6466.0%
Simplified66.0%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6466.7%
Simplified66.7%
Taylor expanded in b around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6465.1%
Simplified65.1%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6465.1%
Applied egg-rr65.1%
if 8.6999999999999995e-75 < b Initial program 63.7%
Simplified63.7%
Taylor expanded in b around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6484.0%
Simplified84.0%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.0%
Simplified84.0%
*-commutativeN/A
div-invN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6484.1%
Applied egg-rr84.1%
Final simplification71.9%
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ (* c -2.0) (+ b b)) (- (/ c b) (* 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);
} else {
tmp = (c / b) - (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)
else
tmp = (c / b) - (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);
} else {
tmp = (c / b) - (0.5 * ((b + b) / a));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = (c * -2.0) / (b + b) else: tmp = (c / b) - (0.5 * ((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 + b)); else tmp = Float64(Float64(c / b) - 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); else tmp = (c / b) - (0.5 * ((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 + b), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - 0.5 \cdot \frac{b + b}{a}\\
\end{array}
\end{array}
Initial program 70.6%
Simplified70.6%
Taylor expanded in b around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f6465.1%
Simplified65.1%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6465.6%
Simplified65.6%
Taylor expanded in b around inf
Simplified64.0%
Final simplification64.0%
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (- 0.0 (/ c b)) (- 0.0 (/ b a))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = 0.0 - (c / b);
} else {
tmp = 0.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 = 0.0d0 - (c / b)
else
tmp = 0.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 = 0.0 - (c / b);
} else {
tmp = 0.0 - (b / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = 0.0 - (c / b) else: tmp = 0.0 - (b / a) return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(0.0 - Float64(c / b)); else tmp = Float64(0.0 - Float64(b / a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b >= 0.0) tmp = 0.0 - (c / b); else tmp = 0.0 - (b / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(0.0 - N[(c / b), $MachinePrecision]), $MachinePrecision], N[(0.0 - N[(b / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;0 - \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;0 - \frac{b}{a}\\
\end{array}
\end{array}
Initial program 70.6%
Simplified70.6%
flip-+N/A
fmm-defN/A
*-commutativeN/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
Applied egg-rr70.6%
Taylor expanded in b around inf
/-lowering-/.f6469.0%
Simplified69.0%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6464.0%
Simplified64.0%
Taylor expanded in b around 0
>=-lowering->=.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6464.0%
Simplified64.0%
Final simplification64.0%
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ b a) (/ c b)))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = b / a;
} else {
tmp = c / b;
}
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 = b / a
else
tmp = c / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = b / a;
} else {
tmp = c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = b / a else: tmp = c / b return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(b / a); else tmp = Float64(c / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b >= 0.0) tmp = b / a; else tmp = c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], N[(c / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b}\\
\end{array}
\end{array}
Initial program 70.6%
Simplified70.6%
Taylor expanded in b around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6468.1%
Simplified68.1%
Taylor expanded in b around -inf
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6461.4%
Simplified61.4%
Taylor expanded in c around inf
/-lowering-/.f6431.6%
Simplified31.6%
Taylor expanded in b around 0
/-lowering-/.f643.6%
Simplified3.6%
herbie shell --seed 2024145
(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))))