
(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 9 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 -1.12e+132)
(/ (/ b -1.5) a)
(if (<= b 2.7e-39)
(/ (- (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 <= -1.12e+132) {
tmp = (b / -1.5) / a;
} else if (b <= 2.7e-39) {
tmp = (sqrt(((b * b) + (c * (a * -3.0)))) - b) / (a * 3.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 <= (-1.12d+132)) then
tmp = (b / (-1.5d0)) / a
else if (b <= 2.7d-39) then
tmp = (sqrt(((b * b) + (c * (a * (-3.0d0))))) - b) / (a * 3.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 <= -1.12e+132) {
tmp = (b / -1.5) / a;
} else if (b <= 2.7e-39) {
tmp = (Math.sqrt(((b * b) + (c * (a * -3.0)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.12e+132: tmp = (b / -1.5) / a elif b <= 2.7e-39: tmp = (math.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 <= -1.12e+132) tmp = Float64(Float64(b / -1.5) / a); elseif (b <= 2.7e-39) 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
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.12e+132) tmp = (b / -1.5) / a; elseif (b <= 2.7e-39) tmp = (sqrt(((b * b) + (c * (a * -3.0)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.12e+132], N[(N[(b / -1.5), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 2.7e-39], 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 -1.12 \cdot 10^{+132}:\\
\;\;\;\;\frac{\frac{b}{-1.5}}{a}\\
\mathbf{elif}\;b \leq 2.7 \cdot 10^{-39}:\\
\;\;\;\;\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 < -1.12e132Initial program 50.6%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6450.6%
Simplified50.6%
Taylor expanded in b around -inf
*-commutativeN/A
*-lowering-*.f6492.4%
Simplified92.4%
associate-/r*N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6492.5%
Applied egg-rr92.5%
if -1.12e132 < b < 2.7000000000000001e-39Initial program 79.3%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6479.3%
Simplified79.3%
if 2.7000000000000001e-39 < b Initial program 18.5%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6418.5%
Simplified18.5%
Taylor expanded in b around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6485.2%
Simplified85.2%
Final simplification84.3%
(FPCore (a b c)
:precision binary64
(if (<= b -8e+129)
(/ (/ b -1.5) a)
(if (<= b 2.8e-37)
(* (- (sqrt (+ (* b b) (* c (* a -3.0)))) b) (/ 0.3333333333333333 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8e+129) {
tmp = (b / -1.5) / a;
} else if (b <= 2.8e-37) {
tmp = (sqrt(((b * b) + (c * (a * -3.0)))) - b) * (0.3333333333333333 / 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 <= (-8d+129)) then
tmp = (b / (-1.5d0)) / a
else if (b <= 2.8d-37) then
tmp = (sqrt(((b * b) + (c * (a * (-3.0d0))))) - b) * (0.3333333333333333d0 / 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 <= -8e+129) {
tmp = (b / -1.5) / a;
} else if (b <= 2.8e-37) {
tmp = (Math.sqrt(((b * b) + (c * (a * -3.0)))) - b) * (0.3333333333333333 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -8e+129: tmp = (b / -1.5) / a elif b <= 2.8e-37: tmp = (math.sqrt(((b * b) + (c * (a * -3.0)))) - b) * (0.3333333333333333 / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -8e+129) tmp = Float64(Float64(b / -1.5) / a); elseif (b <= 2.8e-37) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -3.0)))) - b) * Float64(0.3333333333333333 / 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 <= -8e+129) tmp = (b / -1.5) / a; elseif (b <= 2.8e-37) tmp = (sqrt(((b * b) + (c * (a * -3.0)))) - b) * (0.3333333333333333 / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -8e+129], N[(N[(b / -1.5), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 2.8e-37], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8 \cdot 10^{+129}:\\
\;\;\;\;\frac{\frac{b}{-1.5}}{a}\\
\mathbf{elif}\;b \leq 2.8 \cdot 10^{-37}:\\
\;\;\;\;\left(\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -8e129Initial program 50.6%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6450.6%
Simplified50.6%
Taylor expanded in b around -inf
*-commutativeN/A
*-lowering-*.f6492.4%
Simplified92.4%
associate-/r*N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6492.5%
Applied egg-rr92.5%
if -8e129 < b < 2.8000000000000001e-37Initial program 79.3%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6479.3%
Simplified79.3%
remove-double-negN/A
sub-divN/A
remove-double-negN/A
div-subN/A
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-evalN/A
--lowering--.f64N/A
Applied egg-rr79.3%
if 2.8000000000000001e-37 < b Initial program 18.5%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6418.5%
Simplified18.5%
Taylor expanded in b around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6485.2%
Simplified85.2%
Final simplification84.2%
(FPCore (a b c)
:precision binary64
(if (<= b -1.5e-50)
(/ (/ b -1.5) a)
(if (<= b 2.3e-36)
(* (/ 0.3333333333333333 a) (- (sqrt (* c (* a -3.0))) b))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.5e-50) {
tmp = (b / -1.5) / a;
} else if (b <= 2.3e-36) {
tmp = (0.3333333333333333 / a) * (sqrt((c * (a * -3.0))) - b);
} 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 <= (-1.5d-50)) then
tmp = (b / (-1.5d0)) / a
else if (b <= 2.3d-36) then
tmp = (0.3333333333333333d0 / a) * (sqrt((c * (a * (-3.0d0)))) - b)
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 <= -1.5e-50) {
tmp = (b / -1.5) / a;
} else if (b <= 2.3e-36) {
tmp = (0.3333333333333333 / a) * (Math.sqrt((c * (a * -3.0))) - b);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.5e-50: tmp = (b / -1.5) / a elif b <= 2.3e-36: tmp = (0.3333333333333333 / a) * (math.sqrt((c * (a * -3.0))) - b) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.5e-50) tmp = Float64(Float64(b / -1.5) / a); elseif (b <= 2.3e-36) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(sqrt(Float64(c * Float64(a * -3.0))) - b)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.5e-50) tmp = (b / -1.5) / a; elseif (b <= 2.3e-36) tmp = (0.3333333333333333 / a) * (sqrt((c * (a * -3.0))) - b); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.5e-50], N[(N[(b / -1.5), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 2.3e-36], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.5 \cdot 10^{-50}:\\
\;\;\;\;\frac{\frac{b}{-1.5}}{a}\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{-36}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.49999999999999995e-50Initial program 62.4%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6462.4%
Simplified62.4%
Taylor expanded in b around -inf
*-commutativeN/A
*-lowering-*.f6486.2%
Simplified86.2%
associate-/r*N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6486.3%
Applied egg-rr86.3%
if -1.49999999999999995e-50 < b < 2.29999999999999996e-36Initial program 77.7%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6477.7%
Simplified77.7%
remove-double-negN/A
sub-divN/A
remove-double-negN/A
div-subN/A
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-evalN/A
--lowering--.f64N/A
Applied egg-rr77.7%
Taylor expanded in b around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6470.1%
Simplified70.1%
if 2.29999999999999996e-36 < b Initial program 18.5%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6418.5%
Simplified18.5%
Taylor expanded in b around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6485.2%
Simplified85.2%
(FPCore (a b c) :precision binary64 (if (<= b 1.45e-272) (/ (/ b -1.5) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.45e-272) {
tmp = (b / -1.5) / 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 <= 1.45d-272) then
tmp = (b / (-1.5d0)) / 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 <= 1.45e-272) {
tmp = (b / -1.5) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.45e-272: tmp = (b / -1.5) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.45e-272) tmp = Float64(Float64(b / -1.5) / 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 <= 1.45e-272) tmp = (b / -1.5) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.45e-272], N[(N[(b / -1.5), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.45 \cdot 10^{-272}:\\
\;\;\;\;\frac{\frac{b}{-1.5}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.44999999999999997e-272Initial program 69.9%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6469.9%
Simplified69.9%
Taylor expanded in b around -inf
*-commutativeN/A
*-lowering-*.f6463.7%
Simplified63.7%
associate-/r*N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6463.7%
Applied egg-rr63.7%
if 1.44999999999999997e-272 < b Initial program 33.3%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6433.3%
Simplified33.3%
Taylor expanded in b around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6465.3%
Simplified65.3%
(FPCore (a b c) :precision binary64 (if (<= b 1.45e-272) (/ b (* -1.5 a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.45e-272) {
tmp = b / (-1.5 * 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 <= 1.45d-272) then
tmp = b / ((-1.5d0) * 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 <= 1.45e-272) {
tmp = b / (-1.5 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.45e-272: tmp = b / (-1.5 * a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.45e-272) tmp = Float64(b / Float64(-1.5 * 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 <= 1.45e-272) tmp = b / (-1.5 * a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.45e-272], N[(b / N[(-1.5 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.45 \cdot 10^{-272}:\\
\;\;\;\;\frac{b}{-1.5 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.44999999999999997e-272Initial program 69.9%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6469.9%
Simplified69.9%
Taylor expanded in b around -inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6463.7%
Simplified63.7%
clear-numN/A
inv-powN/A
div-invN/A
unpow-prod-downN/A
inv-powN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-eval63.5%
Applied egg-rr63.5%
unpow-1N/A
/-lowering-/.f64N/A
/-lowering-/.f6463.5%
Applied egg-rr63.5%
associate-/r/N/A
clear-numN/A
clear-numN/A
associate-/l/N/A
/-lowering-/.f64N/A
*-lowering-*.f6463.7%
Applied egg-rr63.7%
if 1.44999999999999997e-272 < b Initial program 33.3%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6433.3%
Simplified33.3%
Taylor expanded in b around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6465.3%
Simplified65.3%
Final simplification64.4%
(FPCore (a b c) :precision binary64 (if (<= b 1.45e-272) (/ b (* -1.5 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.45e-272) {
tmp = b / (-1.5 * 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 <= 1.45d-272) then
tmp = b / ((-1.5d0) * 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 <= 1.45e-272) {
tmp = b / (-1.5 * a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.45e-272: tmp = b / (-1.5 * a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.45e-272) tmp = Float64(b / Float64(-1.5 * a)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.45e-272) tmp = b / (-1.5 * a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.45e-272], N[(b / N[(-1.5 * a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.45 \cdot 10^{-272}:\\
\;\;\;\;\frac{b}{-1.5 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.44999999999999997e-272Initial program 69.9%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6469.9%
Simplified69.9%
Taylor expanded in b around -inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6463.7%
Simplified63.7%
clear-numN/A
inv-powN/A
div-invN/A
unpow-prod-downN/A
inv-powN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-eval63.5%
Applied egg-rr63.5%
unpow-1N/A
/-lowering-/.f64N/A
/-lowering-/.f6463.5%
Applied egg-rr63.5%
associate-/r/N/A
clear-numN/A
clear-numN/A
associate-/l/N/A
/-lowering-/.f64N/A
*-lowering-*.f6463.7%
Applied egg-rr63.7%
if 1.44999999999999997e-272 < b Initial program 33.3%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6433.3%
Simplified33.3%
Taylor expanded in c around 0
sub-negN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
associate-*r/N/A
associate-*l/N/A
associate-*r*N/A
/-lowering-/.f64N/A
Simplified59.6%
Taylor expanded in b around inf
/-lowering-/.f6465.0%
Simplified65.0%
Final simplification64.2%
(FPCore (a b c) :precision binary64 (if (<= b 1.45e-272) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.45e-272) {
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 <= 1.45d-272) 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 <= 1.45e-272) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.45e-272: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.45e-272) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.45e-272) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.45e-272], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.45 \cdot 10^{-272}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.44999999999999997e-272Initial program 69.9%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6469.9%
Simplified69.9%
Taylor expanded in b around -inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6463.7%
Simplified63.7%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6463.7%
Applied egg-rr63.7%
if 1.44999999999999997e-272 < b Initial program 33.3%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6433.3%
Simplified33.3%
Taylor expanded in c around 0
sub-negN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
associate-*r/N/A
associate-*l/N/A
associate-*r*N/A
/-lowering-/.f64N/A
Simplified59.6%
Taylor expanded in b around inf
/-lowering-/.f6465.0%
Simplified65.0%
Final simplification64.2%
(FPCore (a b c) :precision binary64 (* c (/ -0.5 b)))
double code(double a, double b, double c) {
return c * (-0.5 / b);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c * ((-0.5d0) / b)
end function
public static double code(double a, double b, double c) {
return c * (-0.5 / b);
}
def code(a, b, c): return c * (-0.5 / b)
function code(a, b, c) return Float64(c * Float64(-0.5 / b)) end
function tmp = code(a, b, c) tmp = c * (-0.5 / b); end
code[a_, b_, c_] := N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \frac{-0.5}{b}
\end{array}
Initial program 54.3%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6454.3%
Simplified54.3%
Taylor expanded in c around 0
sub-negN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
associate-*r/N/A
associate-*l/N/A
associate-*r*N/A
/-lowering-/.f64N/A
Simplified26.8%
Taylor expanded in b around inf
/-lowering-/.f6428.8%
Simplified28.8%
(FPCore (a b c) :precision binary64 0.0)
double code(double a, double b, double c) {
return 0.0;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = 0.0d0
end function
public static double code(double a, double b, double c) {
return 0.0;
}
def code(a, b, c): return 0.0
function code(a, b, c) return 0.0 end
function tmp = code(a, b, c) tmp = 0.0; end
code[a_, b_, c_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 54.3%
/-lowering-/.f64N/A
+-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6454.3%
Simplified54.3%
Taylor expanded in b around inf
Simplified10.0%
div-subN/A
+-inverses10.0%
Applied egg-rr10.0%
herbie shell --seed 2024159
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))