
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * 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 + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * 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 + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -5.5e+152)
(fma 0.5 (/ c b) (/ -0.6666666666666666 (/ a b)))
(if (<= b 1e-92)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.5e+152) {
tmp = fma(0.5, (c / b), (-0.6666666666666666 / (a / b)));
} else if (b <= 1e-92) {
tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -5.5e+152) tmp = fma(0.5, Float64(c / b), Float64(-0.6666666666666666 / Float64(a / b))); elseif (b <= 1e-92) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -5.5e+152], N[(0.5 * N[(c / b), $MachinePrecision] + N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1e-92], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.5 \cdot 10^{+152}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\
\mathbf{elif}\;b \leq 10^{-92}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.4999999999999999e152Initial program 26.4%
/-rgt-identity26.4%
metadata-eval26.4%
associate-/l*26.4%
associate-*r/26.4%
*-commutative26.4%
associate-*l/26.4%
associate-*r/26.4%
metadata-eval26.4%
metadata-eval26.4%
times-frac26.4%
neg-mul-126.4%
distribute-rgt-neg-in26.4%
times-frac26.4%
metadata-eval26.4%
neg-mul-126.4%
Simplified26.4%
fma-udef26.4%
Applied egg-rr26.4%
Taylor expanded in b around -inf 97.1%
+-commutative97.1%
fma-def97.1%
associate-*r/97.3%
associate-/l*97.2%
Simplified97.2%
if -5.4999999999999999e152 < b < 9.99999999999999988e-93Initial program 83.9%
if 9.99999999999999988e-93 < b Initial program 15.4%
neg-sub015.4%
associate-+l-15.4%
sub0-neg15.4%
neg-mul-115.4%
associate-*r/15.4%
*-commutative15.4%
metadata-eval15.4%
metadata-eval15.4%
times-frac15.4%
*-commutative15.4%
times-frac15.4%
Simplified15.4%
Taylor expanded in b around inf 91.3%
associate-*r/91.3%
Applied egg-rr91.3%
Final simplification88.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2e+119)
(fma 0.5 (/ c b) (/ -0.6666666666666666 (/ a b)))
(if (<= b 2e-96)
(* -0.3333333333333333 (/ (- b (sqrt (+ (* b b) (* a (* c -3.0))))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e+119) {
tmp = fma(0.5, (c / b), (-0.6666666666666666 / (a / b)));
} else if (b <= 2e-96) {
tmp = -0.3333333333333333 * ((b - sqrt(((b * b) + (a * (c * -3.0))))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2e+119) tmp = fma(0.5, Float64(c / b), Float64(-0.6666666666666666 / Float64(a / b))); elseif (b <= 2e-96) tmp = Float64(-0.3333333333333333 * Float64(Float64(b - sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -3.0))))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2e+119], N[(0.5 * N[(c / b), $MachinePrecision] + N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e-96], N[(-0.3333333333333333 * N[(N[(b - N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{+119}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\
\mathbf{elif}\;b \leq 2 \cdot 10^{-96}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.99999999999999989e119Initial program 38.6%
/-rgt-identity38.6%
metadata-eval38.6%
associate-/l*38.6%
associate-*r/38.6%
*-commutative38.6%
associate-*l/38.6%
associate-*r/38.6%
metadata-eval38.6%
metadata-eval38.6%
times-frac38.6%
neg-mul-138.6%
distribute-rgt-neg-in38.6%
times-frac38.6%
metadata-eval38.6%
neg-mul-138.6%
Simplified38.6%
fma-udef38.6%
Applied egg-rr38.6%
Taylor expanded in b around -inf 97.5%
+-commutative97.5%
fma-def97.5%
associate-*r/97.7%
associate-/l*97.7%
Simplified97.7%
if -1.99999999999999989e119 < b < 1.9999999999999998e-96Initial program 82.8%
/-rgt-identity82.8%
metadata-eval82.8%
associate-/l*82.8%
associate-*r/82.6%
*-commutative82.6%
associate-*l/82.8%
associate-*r/82.8%
metadata-eval82.8%
metadata-eval82.8%
times-frac82.8%
neg-mul-182.8%
distribute-rgt-neg-in82.8%
times-frac82.6%
metadata-eval82.6%
neg-mul-182.6%
Simplified82.5%
fma-udef82.5%
Applied egg-rr82.5%
if 1.9999999999999998e-96 < b Initial program 15.4%
neg-sub015.4%
associate-+l-15.4%
sub0-neg15.4%
neg-mul-115.4%
associate-*r/15.4%
*-commutative15.4%
metadata-eval15.4%
metadata-eval15.4%
times-frac15.4%
*-commutative15.4%
times-frac15.4%
Simplified15.4%
Taylor expanded in b around inf 91.3%
associate-*r/91.3%
Applied egg-rr91.3%
Final simplification88.7%
(FPCore (a b c)
:precision binary64
(if (<= b -3.5e+148)
(fma 0.5 (/ c b) (/ -0.6666666666666666 (/ a b)))
(if (<= b 1.2e-92)
(/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.5e+148) {
tmp = fma(0.5, (c / b), (-0.6666666666666666 / (a / b)));
} else if (b <= 1.2e-92) {
tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -3.5e+148) tmp = fma(0.5, Float64(c / b), Float64(-0.6666666666666666 / Float64(a / b))); elseif (b <= 1.2e-92) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -3.5e+148], N[(0.5 * N[(c / b), $MachinePrecision] + N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.2e-92], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.5 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-92}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.4999999999999999e148Initial program 26.4%
/-rgt-identity26.4%
metadata-eval26.4%
associate-/l*26.4%
associate-*r/26.4%
*-commutative26.4%
associate-*l/26.4%
associate-*r/26.4%
metadata-eval26.4%
metadata-eval26.4%
times-frac26.4%
neg-mul-126.4%
distribute-rgt-neg-in26.4%
times-frac26.4%
metadata-eval26.4%
neg-mul-126.4%
Simplified26.4%
fma-udef26.4%
Applied egg-rr26.4%
Taylor expanded in b around -inf 97.1%
+-commutative97.1%
fma-def97.1%
associate-*r/97.3%
associate-/l*97.2%
Simplified97.2%
if -3.4999999999999999e148 < b < 1.2000000000000001e-92Initial program 83.9%
neg-sub083.9%
associate-+l-83.9%
sub0-neg83.9%
neg-mul-183.9%
associate-*r/83.9%
metadata-eval83.9%
metadata-eval83.9%
times-frac83.9%
*-commutative83.9%
times-frac83.8%
associate-*l/83.9%
Simplified83.9%
if 1.2000000000000001e-92 < b Initial program 15.4%
neg-sub015.4%
associate-+l-15.4%
sub0-neg15.4%
neg-mul-115.4%
associate-*r/15.4%
*-commutative15.4%
metadata-eval15.4%
metadata-eval15.4%
times-frac15.4%
*-commutative15.4%
times-frac15.4%
Simplified15.4%
Taylor expanded in b around inf 91.3%
associate-*r/91.3%
Applied egg-rr91.3%
Final simplification88.8%
(FPCore (a b c)
:precision binary64
(if (<= b -3e-56)
(fma 0.5 (/ c b) (/ -0.6666666666666666 (/ a b)))
(if (<= b 1.55e-96)
(* -0.3333333333333333 (/ (- b (sqrt (* c (* a -3.0)))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3e-56) {
tmp = fma(0.5, (c / b), (-0.6666666666666666 / (a / b)));
} else if (b <= 1.55e-96) {
tmp = -0.3333333333333333 * ((b - sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -3e-56) tmp = fma(0.5, Float64(c / b), Float64(-0.6666666666666666 / Float64(a / b))); elseif (b <= 1.55e-96) tmp = Float64(-0.3333333333333333 * Float64(Float64(b - sqrt(Float64(c * Float64(a * -3.0)))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -3e-56], N[(0.5 * N[(c / b), $MachinePrecision] + N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.55e-96], N[(-0.3333333333333333 * N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3 \cdot 10^{-56}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\
\mathbf{elif}\;b \leq 1.55 \cdot 10^{-96}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.99999999999999989e-56Initial program 64.0%
/-rgt-identity64.0%
metadata-eval64.0%
associate-/l*64.0%
associate-*r/63.9%
*-commutative63.9%
associate-*l/64.0%
associate-*r/64.0%
metadata-eval64.0%
metadata-eval64.0%
times-frac64.0%
neg-mul-164.0%
distribute-rgt-neg-in64.0%
times-frac64.0%
metadata-eval64.0%
neg-mul-164.0%
Simplified64.0%
fma-udef64.0%
Applied egg-rr64.0%
Taylor expanded in b around -inf 91.5%
+-commutative91.5%
fma-def91.5%
associate-*r/91.6%
associate-/l*91.5%
Simplified91.5%
if -2.99999999999999989e-56 < b < 1.55e-96Initial program 75.6%
/-rgt-identity75.6%
metadata-eval75.6%
associate-/l*75.6%
associate-*r/75.5%
*-commutative75.5%
associate-*l/75.6%
associate-*r/75.6%
metadata-eval75.6%
metadata-eval75.6%
times-frac75.6%
neg-mul-175.6%
distribute-rgt-neg-in75.6%
times-frac75.3%
metadata-eval75.3%
neg-mul-175.3%
Simplified75.3%
Taylor expanded in b around 0 73.7%
*-commutative73.7%
associate-*r*73.8%
metadata-eval73.8%
distribute-lft-neg-in73.8%
*-commutative73.8%
*-commutative73.8%
distribute-rgt-neg-in73.8%
metadata-eval73.8%
Simplified73.8%
if 1.55e-96 < b Initial program 15.4%
neg-sub015.4%
associate-+l-15.4%
sub0-neg15.4%
neg-mul-115.4%
associate-*r/15.4%
*-commutative15.4%
metadata-eval15.4%
metadata-eval15.4%
times-frac15.4%
*-commutative15.4%
times-frac15.4%
Simplified15.4%
Taylor expanded in b around inf 91.3%
associate-*r/91.3%
Applied egg-rr91.3%
Final simplification86.4%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 68.0%
neg-sub068.0%
associate-+l-68.0%
sub0-neg68.0%
neg-mul-168.0%
associate-*r/68.0%
*-commutative68.0%
metadata-eval68.0%
metadata-eval68.0%
times-frac68.0%
*-commutative68.0%
times-frac67.9%
Simplified67.8%
Taylor expanded in b around -inf 65.1%
fma-def65.2%
Simplified65.2%
if -1.999999999999994e-310 < b Initial program 30.3%
neg-sub030.3%
associate-+l-30.3%
sub0-neg30.3%
neg-mul-130.3%
associate-*r/30.3%
*-commutative30.3%
metadata-eval30.3%
metadata-eval30.3%
times-frac30.3%
*-commutative30.3%
times-frac30.3%
Simplified30.3%
Taylor expanded in b around inf 73.1%
associate-*r/73.1%
Applied egg-rr73.1%
Final simplification69.2%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (fma 0.5 (/ c b) (/ -0.6666666666666666 (/ a b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = fma(0.5, (c / b), (-0.6666666666666666 / (a / b)));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = fma(0.5, Float64(c / b), Float64(-0.6666666666666666 / Float64(a / b))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(0.5 * N[(c / b), $MachinePrecision] + N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 68.0%
/-rgt-identity68.0%
metadata-eval68.0%
associate-/l*68.0%
associate-*r/67.9%
*-commutative67.9%
associate-*l/68.0%
associate-*r/68.0%
metadata-eval68.0%
metadata-eval68.0%
times-frac68.0%
neg-mul-168.0%
distribute-rgt-neg-in68.0%
times-frac67.9%
metadata-eval67.9%
neg-mul-167.9%
Simplified67.8%
fma-udef67.8%
Applied egg-rr67.8%
Taylor expanded in b around -inf 65.1%
+-commutative65.1%
fma-def65.1%
associate-*r/65.2%
associate-/l*65.2%
Simplified65.2%
if -1.999999999999994e-310 < b Initial program 30.3%
neg-sub030.3%
associate-+l-30.3%
sub0-neg30.3%
neg-mul-130.3%
associate-*r/30.3%
*-commutative30.3%
metadata-eval30.3%
metadata-eval30.3%
times-frac30.3%
*-commutative30.3%
times-frac30.3%
Simplified30.3%
Taylor expanded in b around inf 73.1%
associate-*r/73.1%
Applied egg-rr73.1%
Final simplification69.2%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (* -0.3333333333333333 (+ (* (/ c b) -1.5) (* (/ b a) 2.0))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = -0.3333333333333333 * (((c / b) * -1.5) + ((b / a) * 2.0));
} else {
tmp = (c * -0.5) / 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.3333333333333333d0) * (((c / b) * (-1.5d0)) + ((b / a) * 2.0d0))
else
tmp = (c * (-0.5d0)) / 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.3333333333333333 * (((c / b) * -1.5) + ((b / a) * 2.0));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = -0.3333333333333333 * (((c / b) * -1.5) + ((b / a) * 2.0)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = Float64(-0.3333333333333333 * Float64(Float64(Float64(c / b) * -1.5) + Float64(Float64(b / a) * 2.0))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e-310) tmp = -0.3333333333333333 * (((c / b) * -1.5) + ((b / a) * 2.0)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(-0.3333333333333333 * N[(N[(N[(c / b), $MachinePrecision] * -1.5), $MachinePrecision] + N[(N[(b / a), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(\frac{c}{b} \cdot -1.5 + \frac{b}{a} \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 68.0%
/-rgt-identity68.0%
metadata-eval68.0%
associate-/l*68.0%
associate-*r/67.9%
*-commutative67.9%
associate-*l/68.0%
associate-*r/68.0%
metadata-eval68.0%
metadata-eval68.0%
times-frac68.0%
neg-mul-168.0%
distribute-rgt-neg-in68.0%
times-frac67.9%
metadata-eval67.9%
neg-mul-167.9%
Simplified67.8%
Taylor expanded in b around -inf 65.1%
if -1.999999999999994e-310 < b Initial program 30.3%
neg-sub030.3%
associate-+l-30.3%
sub0-neg30.3%
neg-mul-130.3%
associate-*r/30.3%
*-commutative30.3%
metadata-eval30.3%
metadata-eval30.3%
times-frac30.3%
*-commutative30.3%
times-frac30.3%
Simplified30.3%
Taylor expanded in b around inf 73.1%
associate-*r/73.1%
Applied egg-rr73.1%
Final simplification69.2%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (+ (* 0.5 (/ c b)) (* -0.6666666666666666 (/ b a))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else {
tmp = (c * -0.5) / 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.5d0 * (c / b)) + ((-0.6666666666666666d0) * (b / a))
else
tmp = (c * (-0.5d0)) / 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.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = Float64(Float64(0.5 * Float64(c / b)) + Float64(-0.6666666666666666 * Float64(b / a))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e-310) tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 68.0%
neg-sub068.0%
associate-+l-68.0%
sub0-neg68.0%
neg-mul-168.0%
associate-*r/68.0%
*-commutative68.0%
metadata-eval68.0%
metadata-eval68.0%
times-frac68.0%
*-commutative68.0%
times-frac67.9%
Simplified67.8%
Taylor expanded in b around -inf 65.1%
if -1.999999999999994e-310 < b Initial program 30.3%
neg-sub030.3%
associate-+l-30.3%
sub0-neg30.3%
neg-mul-130.3%
associate-*r/30.3%
*-commutative30.3%
metadata-eval30.3%
metadata-eval30.3%
times-frac30.3%
*-commutative30.3%
times-frac30.3%
Simplified30.3%
Taylor expanded in b around inf 73.1%
associate-*r/73.1%
Applied egg-rr73.1%
Final simplification69.2%
(FPCore (a b c) :precision binary64 (if (<= b 7e-289) (/ -1.0 (* (/ a b) 1.5)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 7e-289) {
tmp = -1.0 / ((a / b) * 1.5);
} else {
tmp = (c * -0.5) / 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 <= 7d-289) then
tmp = (-1.0d0) / ((a / b) * 1.5d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 7e-289) {
tmp = -1.0 / ((a / b) * 1.5);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 7e-289: tmp = -1.0 / ((a / b) * 1.5) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 7e-289) tmp = Float64(-1.0 / Float64(Float64(a / b) * 1.5)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 7e-289) tmp = -1.0 / ((a / b) * 1.5); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 7e-289], N[(-1.0 / N[(N[(a / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7 \cdot 10^{-289}:\\
\;\;\;\;\frac{-1}{\frac{a}{b} \cdot 1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 6.9999999999999999e-289Initial program 67.7%
/-rgt-identity67.7%
metadata-eval67.7%
associate-/l*67.7%
associate-*r/67.6%
*-commutative67.6%
associate-*l/67.7%
associate-*r/67.7%
metadata-eval67.7%
metadata-eval67.7%
times-frac67.7%
neg-mul-167.7%
distribute-rgt-neg-in67.7%
times-frac67.6%
metadata-eval67.6%
neg-mul-167.6%
Simplified67.6%
div-sub67.6%
fma-udef67.6%
add-sqr-sqrt51.4%
hypot-def62.2%
Applied egg-rr62.2%
Taylor expanded in b around -inf 63.6%
*-commutative63.6%
associate-*l/63.6%
associate-*r/63.6%
Simplified63.6%
associate-*r/63.6%
metadata-eval63.6%
associate-*l*63.6%
clear-num63.6%
frac-2neg63.6%
metadata-eval63.6%
associate-*l*63.6%
metadata-eval63.6%
Applied egg-rr63.6%
distribute-neg-frac63.6%
neg-mul-163.6%
*-commutative63.6%
times-frac63.6%
metadata-eval63.6%
Simplified63.6%
if 6.9999999999999999e-289 < b Initial program 30.0%
neg-sub030.0%
associate-+l-30.0%
sub0-neg30.0%
neg-mul-130.0%
associate-*r/30.0%
*-commutative30.0%
metadata-eval30.0%
metadata-eval30.0%
times-frac30.0%
*-commutative30.0%
times-frac30.0%
Simplified29.9%
Taylor expanded in b around inf 74.1%
associate-*r/74.2%
Applied egg-rr74.2%
Final simplification68.9%
(FPCore (a b c) :precision binary64 (if (<= b 3.15e-279) (* b (/ -0.6666666666666666 a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.15e-279) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * -0.5;
}
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 <= 3.15d-279) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 3.15e-279) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.15e-279: tmp = b * (-0.6666666666666666 / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.15e-279) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 3.15e-279) tmp = b * (-0.6666666666666666 / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.15e-279], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.15 \cdot 10^{-279}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 3.1499999999999999e-279Initial program 67.7%
/-rgt-identity67.7%
metadata-eval67.7%
associate-/l*67.7%
associate-*r/67.6%
*-commutative67.6%
associate-*l/67.7%
associate-*r/67.7%
metadata-eval67.7%
metadata-eval67.7%
times-frac67.7%
neg-mul-167.7%
distribute-rgt-neg-in67.7%
times-frac67.6%
metadata-eval67.6%
neg-mul-167.6%
Simplified67.6%
div-sub67.6%
fma-udef67.6%
add-sqr-sqrt51.4%
hypot-def62.2%
Applied egg-rr62.2%
Taylor expanded in b around -inf 63.6%
*-commutative63.6%
associate-*l/63.6%
associate-*r/63.6%
Simplified63.6%
if 3.1499999999999999e-279 < b Initial program 30.0%
neg-sub030.0%
associate-+l-30.0%
sub0-neg30.0%
neg-mul-130.0%
associate-*r/30.0%
*-commutative30.0%
metadata-eval30.0%
metadata-eval30.0%
times-frac30.0%
*-commutative30.0%
times-frac30.0%
Simplified29.9%
Taylor expanded in b around inf 74.1%
Final simplification68.9%
(FPCore (a b c) :precision binary64 (if (<= b 7e-289) (/ -0.6666666666666666 (/ a b)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 7e-289) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = (c / b) * -0.5;
}
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 <= 7d-289) then
tmp = (-0.6666666666666666d0) / (a / b)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 7e-289) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 7e-289: tmp = -0.6666666666666666 / (a / b) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 7e-289) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 7e-289) tmp = -0.6666666666666666 / (a / b); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 7e-289], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7 \cdot 10^{-289}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 6.9999999999999999e-289Initial program 67.7%
/-rgt-identity67.7%
metadata-eval67.7%
associate-/l*67.7%
associate-*r/67.6%
*-commutative67.6%
associate-*l/67.7%
associate-*r/67.7%
metadata-eval67.7%
metadata-eval67.7%
times-frac67.7%
neg-mul-167.7%
distribute-rgt-neg-in67.7%
times-frac67.6%
metadata-eval67.6%
neg-mul-167.6%
Simplified67.6%
fma-udef67.6%
Applied egg-rr67.6%
Taylor expanded in b around -inf 63.6%
associate-*r/63.6%
associate-/l*63.6%
Simplified63.6%
if 6.9999999999999999e-289 < b Initial program 30.0%
neg-sub030.0%
associate-+l-30.0%
sub0-neg30.0%
neg-mul-130.0%
associate-*r/30.0%
*-commutative30.0%
metadata-eval30.0%
metadata-eval30.0%
times-frac30.0%
*-commutative30.0%
times-frac30.0%
Simplified29.9%
Taylor expanded in b around inf 74.1%
Final simplification68.9%
(FPCore (a b c) :precision binary64 (if (<= b 7e-289) (/ b (/ a -0.6666666666666666)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 7e-289) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = (c / b) * -0.5;
}
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 <= 7d-289) then
tmp = b / (a / (-0.6666666666666666d0))
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 7e-289) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 7e-289: tmp = b / (a / -0.6666666666666666) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 7e-289) tmp = Float64(b / Float64(a / -0.6666666666666666)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 7e-289) tmp = b / (a / -0.6666666666666666); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 7e-289], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7 \cdot 10^{-289}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 6.9999999999999999e-289Initial program 67.7%
/-rgt-identity67.7%
metadata-eval67.7%
associate-/l*67.7%
associate-*r/67.6%
*-commutative67.6%
associate-*l/67.7%
associate-*r/67.7%
metadata-eval67.7%
metadata-eval67.7%
times-frac67.7%
neg-mul-167.7%
distribute-rgt-neg-in67.7%
times-frac67.6%
metadata-eval67.6%
neg-mul-167.6%
Simplified67.6%
div-sub67.6%
fma-udef67.6%
add-sqr-sqrt51.4%
hypot-def62.2%
Applied egg-rr62.2%
Taylor expanded in b around -inf 63.6%
*-commutative63.6%
associate-*l/63.6%
associate-*r/63.6%
Simplified63.6%
Taylor expanded in b around 0 63.6%
associate-*r/63.6%
*-commutative63.6%
associate-/l*63.6%
Simplified63.6%
if 6.9999999999999999e-289 < b Initial program 30.0%
neg-sub030.0%
associate-+l-30.0%
sub0-neg30.0%
neg-mul-130.0%
associate-*r/30.0%
*-commutative30.0%
metadata-eval30.0%
metadata-eval30.0%
times-frac30.0%
*-commutative30.0%
times-frac30.0%
Simplified29.9%
Taylor expanded in b around inf 74.1%
Final simplification68.9%
(FPCore (a b c) :precision binary64 (if (<= b 7e-289) (/ b (/ a -0.6666666666666666)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 7e-289) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = (c * -0.5) / 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 <= 7d-289) then
tmp = b / (a / (-0.6666666666666666d0))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 7e-289) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 7e-289: tmp = b / (a / -0.6666666666666666) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 7e-289) tmp = Float64(b / Float64(a / -0.6666666666666666)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 7e-289) tmp = b / (a / -0.6666666666666666); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 7e-289], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7 \cdot 10^{-289}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 6.9999999999999999e-289Initial program 67.7%
/-rgt-identity67.7%
metadata-eval67.7%
associate-/l*67.7%
associate-*r/67.6%
*-commutative67.6%
associate-*l/67.7%
associate-*r/67.7%
metadata-eval67.7%
metadata-eval67.7%
times-frac67.7%
neg-mul-167.7%
distribute-rgt-neg-in67.7%
times-frac67.6%
metadata-eval67.6%
neg-mul-167.6%
Simplified67.6%
div-sub67.6%
fma-udef67.6%
add-sqr-sqrt51.4%
hypot-def62.2%
Applied egg-rr62.2%
Taylor expanded in b around -inf 63.6%
*-commutative63.6%
associate-*l/63.6%
associate-*r/63.6%
Simplified63.6%
Taylor expanded in b around 0 63.6%
associate-*r/63.6%
*-commutative63.6%
associate-/l*63.6%
Simplified63.6%
if 6.9999999999999999e-289 < b Initial program 30.0%
neg-sub030.0%
associate-+l-30.0%
sub0-neg30.0%
neg-mul-130.0%
associate-*r/30.0%
*-commutative30.0%
metadata-eval30.0%
metadata-eval30.0%
times-frac30.0%
*-commutative30.0%
times-frac30.0%
Simplified29.9%
Taylor expanded in b around inf 74.1%
associate-*r/74.2%
Applied egg-rr74.2%
Final simplification68.9%
(FPCore (a b c) :precision binary64 (if (<= b 7e-289) (/ (* b -0.6666666666666666) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 7e-289) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / 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 <= 7d-289) then
tmp = (b * (-0.6666666666666666d0)) / a
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 7e-289) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 7e-289: tmp = (b * -0.6666666666666666) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 7e-289) tmp = Float64(Float64(b * -0.6666666666666666) / a); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 7e-289) tmp = (b * -0.6666666666666666) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 7e-289], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7 \cdot 10^{-289}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 6.9999999999999999e-289Initial program 67.7%
neg-sub067.7%
associate-+l-67.7%
sub0-neg67.7%
neg-mul-167.7%
associate-*r/67.7%
*-commutative67.7%
metadata-eval67.7%
metadata-eval67.7%
times-frac67.7%
*-commutative67.7%
times-frac67.6%
Simplified67.5%
Taylor expanded in b around -inf 63.6%
*-commutative63.6%
Simplified63.6%
associate-*r/63.6%
Applied egg-rr63.6%
Taylor expanded in b around 0 63.6%
*-commutative63.6%
Simplified63.6%
if 6.9999999999999999e-289 < b Initial program 30.0%
neg-sub030.0%
associate-+l-30.0%
sub0-neg30.0%
neg-mul-130.0%
associate-*r/30.0%
*-commutative30.0%
metadata-eval30.0%
metadata-eval30.0%
times-frac30.0%
*-commutative30.0%
times-frac30.0%
Simplified29.9%
Taylor expanded in b around inf 74.1%
associate-*r/74.2%
Applied egg-rr74.2%
Final simplification68.9%
(FPCore (a b c) :precision binary64 (* (/ c b) -0.5))
double code(double a, double b, double c) {
return (c / b) * -0.5;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (c / b) * (-0.5d0)
end function
public static double code(double a, double b, double c) {
return (c / b) * -0.5;
}
def code(a, b, c): return (c / b) * -0.5
function code(a, b, c) return Float64(Float64(c / b) * -0.5) end
function tmp = code(a, b, c) tmp = (c / b) * -0.5; end
code[a_, b_, c_] := N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{b} \cdot -0.5
\end{array}
Initial program 48.7%
neg-sub048.7%
associate-+l-48.7%
sub0-neg48.7%
neg-mul-148.7%
associate-*r/48.7%
*-commutative48.7%
metadata-eval48.7%
metadata-eval48.7%
times-frac48.7%
*-commutative48.7%
times-frac48.6%
Simplified48.6%
Taylor expanded in b around inf 38.5%
Final simplification38.5%
herbie shell --seed 2023229
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))