
(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
(let* ((t_0 (sqrt (+ (* b b) (* (* a c) -4.0)))))
(if (<= b -6e+126)
(- 0.0 (/ b a))
(if (<= b 3.1e+105)
(if (>= b 0.0) (/ (* c -2.0) (+ b t_0)) (/ (- t_0 b) (* a 2.0)))
(/ c (- 0.0 b))))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) + ((a * c) * -4.0)));
double tmp;
if (b <= -6e+126) {
tmp = 0.0 - (b / a);
} else if (b <= 3.1e+105) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + t_0);
} else {
tmp_1 = (t_0 - b) / (a * 2.0);
}
tmp = tmp_1;
} else {
tmp = c / (0.0 - 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) :: t_0
real(8) :: tmp
real(8) :: tmp_1
t_0 = sqrt(((b * b) + ((a * c) * (-4.0d0))))
if (b <= (-6d+126)) then
tmp = 0.0d0 - (b / a)
else if (b <= 3.1d+105) then
if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + t_0)
else
tmp_1 = (t_0 - b) / (a * 2.0d0)
end if
tmp = tmp_1
else
tmp = c / (0.0d0 - b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) + ((a * c) * -4.0)));
double tmp;
if (b <= -6e+126) {
tmp = 0.0 - (b / a);
} else if (b <= 3.1e+105) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + t_0);
} else {
tmp_1 = (t_0 - b) / (a * 2.0);
}
tmp = tmp_1;
} else {
tmp = c / (0.0 - b);
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) + ((a * c) * -4.0))) tmp = 0 if b <= -6e+126: tmp = 0.0 - (b / a) elif b <= 3.1e+105: tmp_1 = 0 if b >= 0.0: tmp_1 = (c * -2.0) / (b + t_0) else: tmp_1 = (t_0 - b) / (a * 2.0) tmp = tmp_1 else: tmp = c / (0.0 - b) return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) + Float64(Float64(a * c) * -4.0))) tmp = 0.0 if (b <= -6e+126) tmp = Float64(0.0 - Float64(b / a)); elseif (b <= 3.1e+105) tmp_1 = 0.0 if (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + t_0)); else tmp_1 = Float64(Float64(t_0 - b) / Float64(a * 2.0)); end tmp = tmp_1; else tmp = Float64(c / Float64(0.0 - b)); end return tmp end
function tmp_3 = code(a, b, c) t_0 = sqrt(((b * b) + ((a * c) * -4.0))); tmp = 0.0; if (b <= -6e+126) tmp = 0.0 - (b / a); elseif (b <= 3.1e+105) tmp_2 = 0.0; if (b >= 0.0) tmp_2 = (c * -2.0) / (b + t_0); else tmp_2 = (t_0 - b) / (a * 2.0); end tmp = tmp_2; else tmp = c / (0.0 - b); end tmp_3 = tmp; 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]}, If[LessEqual[b, -6e+126], N[(0.0 - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.1e+105], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], N[(c / N[(0.0 - b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b + \left(a \cdot c\right) \cdot -4}\\
\mathbf{if}\;b \leq -6 \cdot 10^{+126}:\\
\;\;\;\;0 - \frac{b}{a}\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{+105}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{a \cdot 2}\\
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{0 - b}\\
\end{array}
\end{array}
if b < -6.0000000000000005e126Initial program 45.3%
Simplified45.3%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr0.0%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f642.0%
Simplified2.0%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6491.3%
Simplified91.3%
sub0-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6491.3%
Applied egg-rr91.3%
if -6.0000000000000005e126 < b < 3.10000000000000004e105Initial program 91.8%
Simplified91.8%
if 3.10000000000000004e105 < b Initial program 43.9%
Simplified43.9%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr43.9%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6443.9%
Simplified43.9%
Taylor expanded in c around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6491.1%
Simplified91.1%
Final simplification91.6%
(FPCore (a b c)
:precision binary64
(if (<= b -2.5e+109)
(- 0.0 (/ b a))
(if (<= b 2.9e+106)
(if (>= b 0.0)
(/ (* c -2.0) (+ b (sqrt (+ (* b b) (* (* a c) -4.0)))))
(/ 0.5 (/ a (- (sqrt (+ (* b b) (* c (* a -4.0)))) b))))
(/ c (- 0.0 b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.5e+109) {
tmp = 0.0 - (b / a);
} else if (b <= 2.9e+106) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + sqrt(((b * b) + ((a * c) * -4.0))));
} else {
tmp_1 = 0.5 / (a / (sqrt(((b * b) + (c * (a * -4.0)))) - b));
}
tmp = tmp_1;
} else {
tmp = c / (0.0 - 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
real(8) :: tmp_1
if (b <= (-2.5d+109)) then
tmp = 0.0d0 - (b / a)
else if (b <= 2.9d+106) then
if (b >= 0.0d0) then
tmp_1 = (c * (-2.0d0)) / (b + sqrt(((b * b) + ((a * c) * (-4.0d0)))))
else
tmp_1 = 0.5d0 / (a / (sqrt(((b * b) + (c * (a * (-4.0d0))))) - b))
end if
tmp = tmp_1
else
tmp = c / (0.0d0 - b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.5e+109) {
tmp = 0.0 - (b / a);
} else if (b <= 2.9e+106) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (c * -2.0) / (b + Math.sqrt(((b * b) + ((a * c) * -4.0))));
} else {
tmp_1 = 0.5 / (a / (Math.sqrt(((b * b) + (c * (a * -4.0)))) - b));
}
tmp = tmp_1;
} else {
tmp = c / (0.0 - b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.5e+109: tmp = 0.0 - (b / a) elif b <= 2.9e+106: tmp_1 = 0 if b >= 0.0: tmp_1 = (c * -2.0) / (b + math.sqrt(((b * b) + ((a * c) * -4.0)))) else: tmp_1 = 0.5 / (a / (math.sqrt(((b * b) + (c * (a * -4.0)))) - b)) tmp = tmp_1 else: tmp = c / (0.0 - b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.5e+109) tmp = Float64(0.0 - Float64(b / a)); elseif (b <= 2.9e+106) tmp_1 = 0.0 if (b >= 0.0) tmp_1 = Float64(Float64(c * -2.0) / Float64(b + sqrt(Float64(Float64(b * b) + Float64(Float64(a * c) * -4.0))))); else tmp_1 = Float64(0.5 / Float64(a / Float64(sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0)))) - b))); end tmp = tmp_1; else tmp = Float64(c / Float64(0.0 - b)); end return tmp end
function tmp_3 = code(a, b, c) tmp = 0.0; if (b <= -2.5e+109) tmp = 0.0 - (b / a); elseif (b <= 2.9e+106) tmp_2 = 0.0; if (b >= 0.0) tmp_2 = (c * -2.0) / (b + sqrt(((b * b) + ((a * c) * -4.0)))); else tmp_2 = 0.5 / (a / (sqrt(((b * b) + (c * (a * -4.0)))) - b)); end tmp = tmp_2; else tmp = c / (0.0 - b); end tmp_3 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.5e+109], N[(0.0 - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.9e+106], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(a / N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], N[(c / N[(0.0 - b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.5 \cdot 10^{+109}:\\
\;\;\;\;0 - \frac{b}{a}\\
\mathbf{elif}\;b \leq 2.9 \cdot 10^{+106}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \sqrt{b \cdot b + \left(a \cdot c\right) \cdot -4}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{a}{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} - b}}\\
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{0 - b}\\
\end{array}
\end{array}
if b < -2.5000000000000001e109Initial program 52.1%
Simplified52.1%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr0.0%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f644.0%
Simplified4.0%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6492.4%
Simplified92.4%
sub0-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6492.4%
Applied egg-rr92.4%
if -2.5000000000000001e109 < b < 2.9000000000000002e106Initial program 91.5%
Simplified91.5%
clear-numN/A
associate-/r/N/A
associate-/r*N/A
metadata-evalN/A
flip3--N/A
clear-numN/A
frac-timesN/A
metadata-evalN/A
Applied egg-rr91.3%
if 2.9000000000000002e106 < b Initial program 43.9%
Simplified43.9%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr43.9%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6443.9%
Simplified43.9%
Taylor expanded in c around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6491.1%
Simplified91.1%
Final simplification91.5%
(FPCore (a b c)
:precision binary64
(if (<= b -5e+136)
(- 0.0 (/ b a))
(if (<= b 1.55e+106)
(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)))
(/ c (- 0.0 b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e+136) {
tmp = 0.0 - (b / a);
} else if (b <= 1.55e+106) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = c * (-2.0 / (b + sqrt(((b * b) + (c * (a * -4.0))))));
} else {
tmp_1 = (sqrt(((b * b) + ((a * c) * -4.0))) - b) / (a * 2.0);
}
tmp = tmp_1;
} else {
tmp = c / (0.0 - 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
real(8) :: tmp_1
if (b <= (-5d+136)) then
tmp = 0.0d0 - (b / a)
else if (b <= 1.55d+106) then
if (b >= 0.0d0) then
tmp_1 = c * ((-2.0d0) / (b + sqrt(((b * b) + (c * (a * (-4.0d0)))))))
else
tmp_1 = (sqrt(((b * b) + ((a * c) * (-4.0d0)))) - b) / (a * 2.0d0)
end if
tmp = tmp_1
else
tmp = c / (0.0d0 - b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e+136) {
tmp = 0.0 - (b / a);
} else if (b <= 1.55e+106) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = c * (-2.0 / (b + Math.sqrt(((b * b) + (c * (a * -4.0))))));
} else {
tmp_1 = (Math.sqrt(((b * b) + ((a * c) * -4.0))) - b) / (a * 2.0);
}
tmp = tmp_1;
} else {
tmp = c / (0.0 - b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e+136: tmp = 0.0 - (b / a) elif b <= 1.55e+106: tmp_1 = 0 if b >= 0.0: tmp_1 = c * (-2.0 / (b + math.sqrt(((b * b) + (c * (a * -4.0)))))) else: tmp_1 = (math.sqrt(((b * b) + ((a * c) * -4.0))) - b) / (a * 2.0) tmp = tmp_1 else: tmp = c / (0.0 - b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e+136) tmp = Float64(0.0 - Float64(b / a)); elseif (b <= 1.55e+106) tmp_1 = 0.0 if (b >= 0.0) tmp_1 = Float64(c * Float64(-2.0 / Float64(b + sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0))))))); else tmp_1 = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(Float64(a * c) * -4.0))) - b) / Float64(a * 2.0)); end tmp = tmp_1; else tmp = Float64(c / Float64(0.0 - b)); end return tmp end
function tmp_3 = code(a, b, c) tmp = 0.0; if (b <= -5e+136) tmp = 0.0 - (b / a); elseif (b <= 1.55e+106) tmp_2 = 0.0; if (b >= 0.0) tmp_2 = c * (-2.0 / (b + sqrt(((b * b) + (c * (a * -4.0)))))); else tmp_2 = (sqrt(((b * b) + ((a * c) * -4.0))) - b) / (a * 2.0); end tmp = tmp_2; else tmp = c / (0.0 - b); end tmp_3 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e+136], N[(0.0 - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.55e+106], 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]], N[(c / N[(0.0 - b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{+136}:\\
\;\;\;\;0 - \frac{b}{a}\\
\mathbf{elif}\;b \leq 1.55 \cdot 10^{+106}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\frac{c}{0 - b}\\
\end{array}
\end{array}
if b < -5.0000000000000002e136Initial program 45.3%
Simplified45.3%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr0.0%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f642.0%
Simplified2.0%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6491.3%
Simplified91.3%
sub0-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6491.3%
Applied egg-rr91.3%
if -5.0000000000000002e136 < b < 1.55e106Initial program 91.8%
Simplified91.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-*.f6491.6%
Applied egg-rr91.6%
if 1.55e106 < b Initial program 43.9%
Simplified43.9%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr43.9%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6443.9%
Simplified43.9%
Taylor expanded in c around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6491.1%
Simplified91.1%
Final simplification91.5%
(FPCore (a b c)
:precision binary64
(if (<= b -7.8e-35)
(* b (+ (/ c (* b b)) (/ -1.0 a)))
(if (<= b 4e+105)
(/ (* c -2.0) (+ b (sqrt (+ (* b b) (* (* a c) -4.0)))))
(/ c (- 0.0 b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.8e-35) {
tmp = b * ((c / (b * b)) + (-1.0 / a));
} else if (b <= 4e+105) {
tmp = (c * -2.0) / (b + sqrt(((b * b) + ((a * c) * -4.0))));
} else {
tmp = c / (0.0 - 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 <= (-7.8d-35)) then
tmp = b * ((c / (b * b)) + ((-1.0d0) / a))
else if (b <= 4d+105) then
tmp = (c * (-2.0d0)) / (b + sqrt(((b * b) + ((a * c) * (-4.0d0)))))
else
tmp = c / (0.0d0 - b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -7.8e-35) {
tmp = b * ((c / (b * b)) + (-1.0 / a));
} else if (b <= 4e+105) {
tmp = (c * -2.0) / (b + Math.sqrt(((b * b) + ((a * c) * -4.0))));
} else {
tmp = c / (0.0 - b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7.8e-35: tmp = b * ((c / (b * b)) + (-1.0 / a)) elif b <= 4e+105: tmp = (c * -2.0) / (b + math.sqrt(((b * b) + ((a * c) * -4.0)))) else: tmp = c / (0.0 - b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7.8e-35) tmp = Float64(b * Float64(Float64(c / Float64(b * b)) + Float64(-1.0 / a))); elseif (b <= 4e+105) tmp = Float64(Float64(c * -2.0) / Float64(b + sqrt(Float64(Float64(b * b) + Float64(Float64(a * c) * -4.0))))); else tmp = Float64(c / Float64(0.0 - b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7.8e-35) tmp = b * ((c / (b * b)) + (-1.0 / a)); elseif (b <= 4e+105) tmp = (c * -2.0) / (b + sqrt(((b * b) + ((a * c) * -4.0)))); else tmp = c / (0.0 - b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7.8e-35], N[(b * N[(N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e+105], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c / N[(0.0 - b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.8 \cdot 10^{-35}:\\
\;\;\;\;b \cdot \left(\frac{c}{b \cdot b} + \frac{-1}{a}\right)\\
\mathbf{elif}\;b \leq 4 \cdot 10^{+105}:\\
\;\;\;\;\frac{c \cdot -2}{b + \sqrt{b \cdot b + \left(a \cdot c\right) \cdot -4}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{0 - b}\\
\end{array}
\end{array}
if b < -7.79999999999999961e-35Initial program 71.4%
Simplified71.4%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr8.6%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6412.3%
Simplified12.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-*.f6487.1%
Simplified87.1%
if -7.79999999999999961e-35 < b < 3.9999999999999998e105Initial program 89.8%
Simplified89.8%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr83.9%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6484.3%
Simplified84.3%
if 3.9999999999999998e105 < b Initial program 43.9%
Simplified43.9%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr43.9%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6443.9%
Simplified43.9%
Taylor expanded in c around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6491.1%
Simplified91.1%
Final simplification86.4%
(FPCore (a b c)
:precision binary64
(if (<= b -8e-39)
(* b (+ (/ c (* b b)) (/ -1.0 a)))
(if (<= b 8e+105)
(* c (/ -2.0 (+ b (sqrt (+ (* b b) (* c (* a -4.0)))))))
(/ c (- 0.0 b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8e-39) {
tmp = b * ((c / (b * b)) + (-1.0 / a));
} else if (b <= 8e+105) {
tmp = c * (-2.0 / (b + sqrt(((b * b) + (c * (a * -4.0))))));
} else {
tmp = c / (0.0 - 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 <= (-8d-39)) then
tmp = b * ((c / (b * b)) + ((-1.0d0) / a))
else if (b <= 8d+105) then
tmp = c * ((-2.0d0) / (b + sqrt(((b * b) + (c * (a * (-4.0d0)))))))
else
tmp = c / (0.0d0 - b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -8e-39) {
tmp = b * ((c / (b * b)) + (-1.0 / a));
} else if (b <= 8e+105) {
tmp = c * (-2.0 / (b + Math.sqrt(((b * b) + (c * (a * -4.0))))));
} else {
tmp = c / (0.0 - b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -8e-39: tmp = b * ((c / (b * b)) + (-1.0 / a)) elif b <= 8e+105: tmp = c * (-2.0 / (b + math.sqrt(((b * b) + (c * (a * -4.0)))))) else: tmp = c / (0.0 - b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -8e-39) tmp = Float64(b * Float64(Float64(c / Float64(b * b)) + Float64(-1.0 / a))); elseif (b <= 8e+105) tmp = Float64(c * Float64(-2.0 / Float64(b + sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0))))))); else tmp = Float64(c / Float64(0.0 - b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -8e-39) tmp = b * ((c / (b * b)) + (-1.0 / a)); elseif (b <= 8e+105) tmp = c * (-2.0 / (b + sqrt(((b * b) + (c * (a * -4.0)))))); else tmp = c / (0.0 - b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -8e-39], N[(b * N[(N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8e+105], 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[(c / N[(0.0 - b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8 \cdot 10^{-39}:\\
\;\;\;\;b \cdot \left(\frac{c}{b \cdot b} + \frac{-1}{a}\right)\\
\mathbf{elif}\;b \leq 8 \cdot 10^{+105}:\\
\;\;\;\;c \cdot \frac{-2}{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{0 - b}\\
\end{array}
\end{array}
if b < -7.99999999999999943e-39Initial program 71.4%
Simplified71.4%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr8.6%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6412.3%
Simplified12.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-*.f6487.1%
Simplified87.1%
if -7.99999999999999943e-39 < b < 7.9999999999999995e105Initial program 89.8%
Simplified89.8%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr83.9%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6484.3%
Simplified84.3%
pow1/2N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-flipN/A
associate-*l/N/A
*-lowering-*.f64N/A
Applied egg-rr84.0%
if 7.9999999999999995e105 < b Initial program 43.9%
Simplified43.9%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr43.9%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6443.9%
Simplified43.9%
Taylor expanded in c around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6491.1%
Simplified91.1%
Final simplification86.2%
(FPCore (a b c)
:precision binary64
(if (<= b -2.5e-103)
(* b (+ (/ c (* b b)) (/ -1.0 a)))
(if (<= b 1.65e-61)
(/ (* c -2.0) (+ b (sqrt (* (* a c) -4.0))))
(/ c (- 0.0 b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.5e-103) {
tmp = b * ((c / (b * b)) + (-1.0 / a));
} else if (b <= 1.65e-61) {
tmp = (c * -2.0) / (b + sqrt(((a * c) * -4.0)));
} else {
tmp = c / (0.0 - 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 <= (-2.5d-103)) then
tmp = b * ((c / (b * b)) + ((-1.0d0) / a))
else if (b <= 1.65d-61) then
tmp = (c * (-2.0d0)) / (b + sqrt(((a * c) * (-4.0d0))))
else
tmp = c / (0.0d0 - b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.5e-103) {
tmp = b * ((c / (b * b)) + (-1.0 / a));
} else if (b <= 1.65e-61) {
tmp = (c * -2.0) / (b + Math.sqrt(((a * c) * -4.0)));
} else {
tmp = c / (0.0 - b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.5e-103: tmp = b * ((c / (b * b)) + (-1.0 / a)) elif b <= 1.65e-61: tmp = (c * -2.0) / (b + math.sqrt(((a * c) * -4.0))) else: tmp = c / (0.0 - b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.5e-103) tmp = Float64(b * Float64(Float64(c / Float64(b * b)) + Float64(-1.0 / a))); elseif (b <= 1.65e-61) tmp = Float64(Float64(c * -2.0) / Float64(b + sqrt(Float64(Float64(a * c) * -4.0)))); else tmp = Float64(c / Float64(0.0 - b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.5e-103) tmp = b * ((c / (b * b)) + (-1.0 / a)); elseif (b <= 1.65e-61) tmp = (c * -2.0) / (b + sqrt(((a * c) * -4.0))); else tmp = c / (0.0 - b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.5e-103], N[(b * N[(N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.65e-61], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[Sqrt[N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c / N[(0.0 - b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.5 \cdot 10^{-103}:\\
\;\;\;\;b \cdot \left(\frac{c}{b \cdot b} + \frac{-1}{a}\right)\\
\mathbf{elif}\;b \leq 1.65 \cdot 10^{-61}:\\
\;\;\;\;\frac{c \cdot -2}{b + \sqrt{\left(a \cdot c\right) \cdot -4}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{0 - b}\\
\end{array}
\end{array}
if b < -2.49999999999999983e-103Initial program 74.5%
Simplified74.5%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr13.4%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6416.8%
Simplified16.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-*.f6483.4%
Simplified83.4%
if -2.49999999999999983e-103 < b < 1.64999999999999998e-61Initial program 84.5%
Simplified84.5%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr79.8%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6480.4%
Simplified80.4%
Taylor expanded in b around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6477.1%
Simplified77.1%
if 1.64999999999999998e-61 < b Initial program 71.6%
Simplified71.6%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr71.6%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6471.6%
Simplified71.6%
Taylor expanded in c around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6482.0%
Simplified82.0%
Final simplification81.3%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (- 0.0 (/ b a)) (/ c (- 0.0 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = 0.0 - (b / a);
} else {
tmp = c / (0.0 - 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 <= (-2d-310)) then
tmp = 0.0d0 - (b / a)
else
tmp = c / (0.0d0 - b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = 0.0 - (b / a);
} else {
tmp = c / (0.0 - b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = 0.0 - (b / a) else: tmp = c / (0.0 - b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = Float64(0.0 - Float64(b / a)); else tmp = Float64(c / Float64(0.0 - b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e-310) tmp = 0.0 - (b / a); else tmp = c / (0.0 - b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(0.0 - N[(b / a), $MachinePrecision]), $MachinePrecision], N[(c / N[(0.0 - b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;0 - \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{0 - b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 78.0%
Simplified78.0%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr31.6%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6434.3%
Simplified34.3%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6465.2%
Simplified65.2%
sub0-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6465.2%
Applied egg-rr65.2%
if -1.999999999999994e-310 < b Initial program 73.7%
Simplified73.7%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr73.7%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6473.7%
Simplified73.7%
Taylor expanded in c around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6467.2%
Simplified67.2%
Final simplification66.2%
(FPCore (a b c) :precision binary64 (- 0.0 (/ b a)))
double code(double a, double b, double c) {
return 0.0 - (b / a);
}
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 - (b / a)
end function
public static double code(double a, double b, double c) {
return 0.0 - (b / a);
}
def code(a, b, c): return 0.0 - (b / a)
function code(a, b, c) return Float64(0.0 - Float64(b / a)) end
function tmp = code(a, b, c) tmp = 0.0 - (b / a); end
code[a_, b_, c_] := N[(0.0 - N[(b / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0 - \frac{b}{a}
\end{array}
Initial program 75.9%
Simplified75.9%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr52.3%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6453.7%
Simplified53.7%
Taylor expanded in b around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6434.4%
Simplified34.4%
sub0-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6434.4%
Applied egg-rr34.4%
Final simplification34.4%
(FPCore (a b c) :precision binary64 (/ b a))
double code(double a, double b, double c) {
return b / a;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = b / a
end function
public static double code(double a, double b, double c) {
return b / a;
}
def code(a, b, c): return b / a
function code(a, b, c) return Float64(b / a) end
function tmp = code(a, b, c) tmp = b / a; end
code[a_, b_, c_] := N[(b / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{a}
\end{array}
Initial program 75.9%
Simplified75.9%
div-invN/A
flip--N/A
+-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr52.3%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
unpow2N/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6453.7%
Simplified53.7%
Taylor expanded in c around 0
metadata-evalN/A
cancel-sign-sub-invN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6433.9%
Simplified33.9%
Taylor expanded in c around inf
/-lowering-/.f642.7%
Simplified2.7%
herbie shell --seed 2024139
(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))))