
(FPCore (a b_2 c) :precision binary64 (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
double code(double a, double b_2, double c) {
return (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
code = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a
end function
public static double code(double a, double b_2, double c) {
return (-b_2 + Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
def code(a, b_2, c): return (-b_2 + math.sqrt(((b_2 * b_2) - (a * c)))) / a
function code(a, b_2, c) return Float64(Float64(Float64(-b_2) + sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a) end
function tmp = code(a, b_2, c) tmp = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a; end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) + N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b_2 c) :precision binary64 (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
double code(double a, double b_2, double c) {
return (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
code = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a
end function
public static double code(double a, double b_2, double c) {
return (-b_2 + Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
def code(a, b_2, c): return (-b_2 + math.sqrt(((b_2 * b_2) - (a * c)))) / a
function code(a, b_2, c) return Float64(Float64(Float64(-b_2) + sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a) end
function tmp = code(a, b_2, c) tmp = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a; end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) + N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\end{array}
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -1e+154)
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
(if (<= b_2 2.3e-40)
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
(/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1e+154) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 2.3e-40) {
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-1d+154)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 2.3d-40) then
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1e+154) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 2.3e-40) {
tmp = (Math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -1e+154: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 2.3e-40: tmp = (math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -1e+154) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 2.3e-40) tmp = Float64(Float64(sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c))) - b_2) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -1e+154) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 2.3e-40) tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -1e+154], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 2.3e-40], N[(N[(N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b$95$2), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -1 \cdot 10^{+154}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 2.3 \cdot 10^{-40}:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -1.00000000000000004e154Initial program 42.0%
+-commutative42.0%
unsub-neg42.0%
Simplified42.0%
Taylor expanded in b_2 around -inf 98.1%
if -1.00000000000000004e154 < b_2 < 2.3e-40Initial program 81.2%
+-commutative81.2%
unsub-neg81.2%
Simplified81.2%
if 2.3e-40 < b_2 Initial program 11.8%
+-commutative11.8%
unsub-neg11.8%
Simplified11.8%
prod-diff11.6%
*-commutative11.6%
fma-def11.6%
associate-+l+11.6%
distribute-rgt-neg-in11.6%
fma-def11.7%
*-commutative11.7%
fma-udef11.6%
distribute-lft-neg-in11.6%
*-commutative11.6%
distribute-rgt-neg-in11.6%
fma-def11.7%
Applied egg-rr11.7%
Taylor expanded in a around 0 91.0%
associate-*r/91.0%
distribute-rgt1-in91.0%
metadata-eval91.0%
associate-*r*91.0%
metadata-eval91.0%
associate-*r/91.0%
*-commutative91.0%
associate-*l/91.0%
Simplified91.0%
Final simplification87.8%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -1.6e-123) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (if (<= b_2 1.9e-40) (/ (- (sqrt (* a (- c))) b_2) a) (/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1.6e-123) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 1.9e-40) {
tmp = (sqrt((a * -c)) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-1.6d-123)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 1.9d-40) then
tmp = (sqrt((a * -c)) - b_2) / a
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1.6e-123) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 1.9e-40) {
tmp = (Math.sqrt((a * -c)) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -1.6e-123: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 1.9e-40: tmp = (math.sqrt((a * -c)) - b_2) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -1.6e-123) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 1.9e-40) tmp = Float64(Float64(sqrt(Float64(a * Float64(-c))) - b_2) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -1.6e-123) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 1.9e-40) tmp = (sqrt((a * -c)) - b_2) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -1.6e-123], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 1.9e-40], N[(N[(N[Sqrt[N[(a * (-c)), $MachinePrecision]], $MachinePrecision] - b$95$2), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -1.6 \cdot 10^{-123}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 1.9 \cdot 10^{-40}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(-c\right)} - b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -1.59999999999999989e-123Initial program 65.3%
+-commutative65.3%
unsub-neg65.3%
Simplified65.3%
Taylor expanded in b_2 around -inf 85.5%
if -1.59999999999999989e-123 < b_2 < 1.8999999999999999e-40Initial program 76.2%
+-commutative76.2%
unsub-neg76.2%
Simplified76.2%
Taylor expanded in b_2 around 0 74.0%
mul-1-neg74.0%
distribute-rgt-neg-out74.0%
Simplified74.0%
if 1.8999999999999999e-40 < b_2 Initial program 11.8%
+-commutative11.8%
unsub-neg11.8%
Simplified11.8%
prod-diff11.6%
*-commutative11.6%
fma-def11.6%
associate-+l+11.6%
distribute-rgt-neg-in11.6%
fma-def11.7%
*-commutative11.7%
fma-udef11.6%
distribute-lft-neg-in11.6%
*-commutative11.6%
distribute-rgt-neg-in11.6%
fma-def11.7%
Applied egg-rr11.7%
Taylor expanded in a around 0 91.0%
associate-*r/91.0%
distribute-rgt1-in91.0%
metadata-eval91.0%
associate-*r*91.0%
metadata-eval91.0%
associate-*r/91.0%
*-commutative91.0%
associate-*l/91.0%
Simplified91.0%
Final simplification84.3%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -1.6e-123) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (if (<= b_2 3.7e-41) (/ (sqrt (* a (- c))) a) (/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1.6e-123) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 3.7e-41) {
tmp = sqrt((a * -c)) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-1.6d-123)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 3.7d-41) then
tmp = sqrt((a * -c)) / a
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1.6e-123) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 3.7e-41) {
tmp = Math.sqrt((a * -c)) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -1.6e-123: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 3.7e-41: tmp = math.sqrt((a * -c)) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -1.6e-123) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 3.7e-41) tmp = Float64(sqrt(Float64(a * Float64(-c))) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -1.6e-123) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 3.7e-41) tmp = sqrt((a * -c)) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -1.6e-123], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 3.7e-41], N[(N[Sqrt[N[(a * (-c)), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -1.6 \cdot 10^{-123}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 3.7 \cdot 10^{-41}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(-c\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -1.59999999999999989e-123Initial program 65.3%
+-commutative65.3%
unsub-neg65.3%
Simplified65.3%
Taylor expanded in b_2 around -inf 85.5%
if -1.59999999999999989e-123 < b_2 < 3.7000000000000002e-41Initial program 76.2%
+-commutative76.2%
unsub-neg76.2%
Simplified76.2%
prod-diff75.9%
*-commutative75.9%
fma-def75.9%
associate-+l+75.9%
distribute-rgt-neg-in75.9%
fma-def76.0%
*-commutative76.0%
fma-udef75.9%
distribute-lft-neg-in75.9%
*-commutative75.9%
distribute-rgt-neg-in75.9%
fma-def76.0%
Applied egg-rr76.0%
Taylor expanded in b_2 around 0 73.3%
associate-*l/73.5%
*-lft-identity73.5%
distribute-rgt1-in73.7%
metadata-eval73.7%
mul-1-neg73.7%
*-commutative73.7%
distribute-rgt-neg-out73.7%
Simplified73.7%
if 3.7000000000000002e-41 < b_2 Initial program 11.8%
+-commutative11.8%
unsub-neg11.8%
Simplified11.8%
prod-diff11.6%
*-commutative11.6%
fma-def11.6%
associate-+l+11.6%
distribute-rgt-neg-in11.6%
fma-def11.7%
*-commutative11.7%
fma-udef11.6%
distribute-lft-neg-in11.6%
*-commutative11.6%
distribute-rgt-neg-in11.6%
fma-def11.7%
Applied egg-rr11.7%
Taylor expanded in a around 0 91.0%
associate-*r/91.0%
distribute-rgt1-in91.0%
metadata-eval91.0%
associate-*r*91.0%
metadata-eval91.0%
associate-*r/91.0%
*-commutative91.0%
associate-*l/91.0%
Simplified91.0%
Final simplification84.2%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-310) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-5d-310)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-310: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-310) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -5e-310) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-310], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -4.999999999999985e-310Initial program 69.9%
+-commutative69.9%
unsub-neg69.9%
Simplified69.9%
Taylor expanded in b_2 around -inf 68.6%
if -4.999999999999985e-310 < b_2 Initial program 31.0%
+-commutative31.0%
unsub-neg31.0%
Simplified31.0%
prod-diff30.8%
*-commutative30.8%
fma-def30.8%
associate-+l+30.8%
distribute-rgt-neg-in30.8%
fma-def30.8%
*-commutative30.8%
fma-udef30.8%
distribute-lft-neg-in30.8%
*-commutative30.8%
distribute-rgt-neg-in30.8%
fma-def30.8%
Applied egg-rr30.8%
Taylor expanded in a around 0 69.7%
associate-*r/69.7%
distribute-rgt1-in69.7%
metadata-eval69.7%
associate-*r*69.7%
metadata-eval69.7%
associate-*r/69.7%
*-commutative69.7%
associate-*l/69.7%
Simplified69.7%
Final simplification69.2%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 1.15e-216) (* -2.0 (/ b_2 a)) 0.0))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1.15e-216) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= 1.15d-216) then
tmp = (-2.0d0) * (b_2 / a)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1.15e-216) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 1.15e-216: tmp = -2.0 * (b_2 / a) else: tmp = 0.0 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 1.15e-216) tmp = Float64(-2.0 * Float64(b_2 / a)); else tmp = 0.0; end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 1.15e-216) tmp = -2.0 * (b_2 / a); else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 1.15e-216], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 1.15 \cdot 10^{-216}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b_2 < 1.14999999999999998e-216Initial program 70.9%
+-commutative70.9%
unsub-neg70.9%
Simplified70.9%
Taylor expanded in b_2 around -inf 60.0%
if 1.14999999999999998e-216 < b_2 Initial program 24.5%
+-commutative24.5%
unsub-neg24.5%
Simplified24.5%
add-sqr-sqrt23.2%
pow223.2%
pow1/223.2%
sqrt-pow123.3%
fma-neg23.3%
*-commutative23.3%
distribute-rgt-neg-in23.3%
metadata-eval23.3%
Applied egg-rr23.3%
Taylor expanded in b_2 around inf 15.7%
distribute-rgt1-in15.7%
metadata-eval15.7%
mul0-lft19.6%
Simplified19.6%
Final simplification40.9%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 2e-249) (* -2.0 (/ b_2 a)) (* (/ c b_2) -0.5)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 2e-249) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= 2d-249) then
tmp = (-2.0d0) * (b_2 / a)
else
tmp = (c / b_2) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 2e-249) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 2e-249: tmp = -2.0 * (b_2 / a) else: tmp = (c / b_2) * -0.5 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 2e-249) tmp = Float64(-2.0 * Float64(b_2 / a)); else tmp = Float64(Float64(c / b_2) * -0.5); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 2e-249) tmp = -2.0 * (b_2 / a); else tmp = (c / b_2) * -0.5; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 2e-249], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 2 \cdot 10^{-249}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < 2.00000000000000011e-249Initial program 71.6%
+-commutative71.6%
unsub-neg71.6%
Simplified71.6%
Taylor expanded in b_2 around -inf 64.4%
if 2.00000000000000011e-249 < b_2 Initial program 27.3%
+-commutative27.3%
unsub-neg27.3%
Simplified27.3%
Taylor expanded in b_2 around inf 73.2%
Final simplification68.9%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 2e-249) (* -2.0 (/ b_2 a)) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 2e-249) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= 2d-249) then
tmp = (-2.0d0) * (b_2 / a)
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 2e-249) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 2e-249: tmp = -2.0 * (b_2 / a) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 2e-249) tmp = Float64(-2.0 * Float64(b_2 / a)); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 2e-249) tmp = -2.0 * (b_2 / a); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 2e-249], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 2 \cdot 10^{-249}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < 2.00000000000000011e-249Initial program 71.6%
+-commutative71.6%
unsub-neg71.6%
Simplified71.6%
Taylor expanded in b_2 around -inf 64.4%
if 2.00000000000000011e-249 < b_2 Initial program 27.3%
+-commutative27.3%
unsub-neg27.3%
Simplified27.3%
prod-diff27.1%
*-commutative27.1%
fma-def27.1%
associate-+l+27.1%
distribute-rgt-neg-in27.1%
fma-def27.1%
*-commutative27.1%
fma-udef27.1%
distribute-lft-neg-in27.1%
*-commutative27.1%
distribute-rgt-neg-in27.1%
fma-def27.1%
Applied egg-rr27.1%
Taylor expanded in a around 0 73.2%
associate-*r/73.2%
distribute-rgt1-in73.2%
metadata-eval73.2%
associate-*r*73.2%
metadata-eval73.2%
associate-*r/73.2%
*-commutative73.2%
associate-*l/73.2%
Simplified73.2%
Final simplification68.9%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 1.15e-216) (/ (- b_2) a) 0.0))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1.15e-216) {
tmp = -b_2 / a;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= 1.15d-216) then
tmp = -b_2 / a
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1.15e-216) {
tmp = -b_2 / a;
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 1.15e-216: tmp = -b_2 / a else: tmp = 0.0 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 1.15e-216) tmp = Float64(Float64(-b_2) / a); else tmp = 0.0; end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 1.15e-216) tmp = -b_2 / a; else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 1.15e-216], N[((-b$95$2) / a), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 1.15 \cdot 10^{-216}:\\
\;\;\;\;\frac{-b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b_2 < 1.14999999999999998e-216Initial program 70.9%
+-commutative70.9%
unsub-neg70.9%
Simplified70.9%
add-sqr-sqrt70.7%
pow270.7%
pow1/270.7%
sqrt-pow170.8%
fma-neg70.8%
*-commutative70.8%
distribute-rgt-neg-in70.8%
metadata-eval70.8%
Applied egg-rr70.8%
Taylor expanded in b_2 around inf 25.6%
associate-*r/25.6%
mul-1-neg25.6%
Simplified25.6%
if 1.14999999999999998e-216 < b_2 Initial program 24.5%
+-commutative24.5%
unsub-neg24.5%
Simplified24.5%
add-sqr-sqrt23.2%
pow223.2%
pow1/223.2%
sqrt-pow123.3%
fma-neg23.3%
*-commutative23.3%
distribute-rgt-neg-in23.3%
metadata-eval23.3%
Applied egg-rr23.3%
Taylor expanded in b_2 around inf 15.7%
distribute-rgt1-in15.7%
metadata-eval15.7%
mul0-lft19.6%
Simplified19.6%
Final simplification22.8%
(FPCore (a b_2 c) :precision binary64 0.0)
double code(double a, double b_2, double c) {
return 0.0;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
code = 0.0d0
end function
public static double code(double a, double b_2, double c) {
return 0.0;
}
def code(a, b_2, c): return 0.0
function code(a, b_2, c) return 0.0 end
function tmp = code(a, b_2, c) tmp = 0.0; end
code[a_, b$95$2_, c_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 48.9%
+-commutative48.9%
unsub-neg48.9%
Simplified48.9%
add-sqr-sqrt48.2%
pow248.2%
pow1/248.2%
sqrt-pow148.3%
fma-neg48.4%
*-commutative48.4%
distribute-rgt-neg-in48.4%
metadata-eval48.4%
Applied egg-rr48.4%
Taylor expanded in b_2 around inf 8.8%
distribute-rgt1-in8.8%
metadata-eval8.8%
mul0-lft10.7%
Simplified10.7%
Final simplification10.7%
herbie shell --seed 2023252
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))