
(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 11 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
(fma
a
(fma
a
(fma
(/ (* (/ (pow c 4.0) (pow b 6.0)) (* a 6.328125)) b)
-0.16666666666666666
(/ (* (* c (* c c)) -0.5625) (pow b 5.0)))
(/ (* (* c c) -0.375) (* b (* b b))))
(/ (* c -0.5) b)))
double code(double a, double b, double c) {
return fma(a, fma(a, fma((((pow(c, 4.0) / pow(b, 6.0)) * (a * 6.328125)) / b), -0.16666666666666666, (((c * (c * c)) * -0.5625) / pow(b, 5.0))), (((c * c) * -0.375) / (b * (b * b)))), ((c * -0.5) / b));
}
function code(a, b, c) return fma(a, fma(a, fma(Float64(Float64(Float64((c ^ 4.0) / (b ^ 6.0)) * Float64(a * 6.328125)) / b), -0.16666666666666666, Float64(Float64(Float64(c * Float64(c * c)) * -0.5625) / (b ^ 5.0))), Float64(Float64(Float64(c * c) * -0.375) / Float64(b * Float64(b * b)))), Float64(Float64(c * -0.5) / b)) end
code[a_, b_, c_] := N[(a * N[(a * N[(N[(N[(N[(N[Power[c, 4.0], $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision] * N[(a * 6.328125), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision] * -0.16666666666666666 + N[(N[(N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision] * -0.5625), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(c * c), $MachinePrecision] * -0.375), $MachinePrecision] / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(\frac{\frac{{c}^{4}}{{b}^{6}} \cdot \left(a \cdot 6.328125\right)}{b}, -0.16666666666666666, \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot -0.5625}{{b}^{5}}\right), \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot \left(b \cdot b\right)}\right), \frac{c \cdot -0.5}{b}\right)
\end{array}
Initial program 20.0%
Taylor expanded in a around 0
Simplified97.9%
Final simplification97.9%
(FPCore (a b c)
:precision binary64
(*
c
(fma
c
(fma
c
(fma
-0.5625
(/ (* a a) (pow b 5.0))
(/ (* -1.0546875 (* a (* a (* a c)))) (pow b 7.0)))
(/ (* a -0.375) (* b (* b b))))
(/ -0.5 b))))
double code(double a, double b, double c) {
return c * fma(c, fma(c, fma(-0.5625, ((a * a) / pow(b, 5.0)), ((-1.0546875 * (a * (a * (a * c)))) / pow(b, 7.0))), ((a * -0.375) / (b * (b * b)))), (-0.5 / b));
}
function code(a, b, c) return Float64(c * fma(c, fma(c, fma(-0.5625, Float64(Float64(a * a) / (b ^ 5.0)), Float64(Float64(-1.0546875 * Float64(a * Float64(a * Float64(a * c)))) / (b ^ 7.0))), Float64(Float64(a * -0.375) / Float64(b * Float64(b * b)))), Float64(-0.5 / b))) end
code[a_, b_, c_] := N[(c * N[(c * N[(c * N[(-0.5625 * N[(N[(a * a), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0546875 * N[(a * N[(a * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * -0.375), $MachinePrecision] / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \mathsf{fma}\left(c, \mathsf{fma}\left(c, \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}}, \frac{-1.0546875 \cdot \left(a \cdot \left(a \cdot \left(a \cdot c\right)\right)\right)}{{b}^{7}}\right), \frac{a \cdot -0.375}{b \cdot \left(b \cdot b\right)}\right), \frac{-0.5}{b}\right)
\end{array}
Initial program 20.0%
Taylor expanded in c around 0
Simplified97.5%
Taylor expanded in c around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6497.5
Simplified97.5%
(FPCore (a b c) :precision binary64 (fma a (fma a (/ (* (* c (* c c)) -0.5625) (pow b 5.0)) (/ (* (* c c) -0.375) (* b (* b b)))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
return fma(a, fma(a, (((c * (c * c)) * -0.5625) / pow(b, 5.0)), (((c * c) * -0.375) / (b * (b * b)))), ((c * -0.5) / b));
}
function code(a, b, c) return fma(a, fma(a, Float64(Float64(Float64(c * Float64(c * c)) * -0.5625) / (b ^ 5.0)), Float64(Float64(Float64(c * c) * -0.375) / Float64(b * Float64(b * b)))), Float64(Float64(c * -0.5) / b)) end
code[a_, b_, c_] := N[(a * N[(a * N[(N[(N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision] * -0.5625), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(c * c), $MachinePrecision] * -0.375), $MachinePrecision] / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, \mathsf{fma}\left(a, \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot -0.5625}{{b}^{5}}, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot \left(b \cdot b\right)}\right), \frac{c \cdot -0.5}{b}\right)
\end{array}
Initial program 20.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
Simplified97.0%
(FPCore (a b c) :precision binary64 (fma (/ c b) (fma c (/ (* a -0.375) (* b b)) -0.5) (/ (* -0.5625 (* a (* a (* c (* c c))))) (pow b 5.0))))
double code(double a, double b, double c) {
return fma((c / b), fma(c, ((a * -0.375) / (b * b)), -0.5), ((-0.5625 * (a * (a * (c * (c * c))))) / pow(b, 5.0)));
}
function code(a, b, c) return fma(Float64(c / b), fma(c, Float64(Float64(a * -0.375) / Float64(b * b)), -0.5), Float64(Float64(-0.5625 * Float64(a * Float64(a * Float64(c * Float64(c * c))))) / (b ^ 5.0))) end
code[a_, b_, c_] := N[(N[(c / b), $MachinePrecision] * N[(c * N[(N[(a * -0.375), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision] + N[(N[(-0.5625 * N[(a * N[(a * N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{c}{b}, \mathsf{fma}\left(c, \frac{a \cdot -0.375}{b \cdot b}, -0.5\right), \frac{-0.5625 \cdot \left(a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)\right)}{{b}^{5}}\right)
\end{array}
Initial program 20.0%
Taylor expanded in a around inf
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6420.0
Simplified20.0%
Taylor expanded in c around 0
lower-*.f64N/A
sub-negN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
Simplified96.6%
Taylor expanded in a around 0
Simplified96.9%
(FPCore (a b c) :precision binary64 (/ (fma c (fma c (/ (* a -0.375) (* b b)) -0.5) (/ (* -0.5625 (* a (* a (* c (* c c))))) (pow b 4.0))) b))
double code(double a, double b, double c) {
return fma(c, fma(c, ((a * -0.375) / (b * b)), -0.5), ((-0.5625 * (a * (a * (c * (c * c))))) / pow(b, 4.0))) / b;
}
function code(a, b, c) return Float64(fma(c, fma(c, Float64(Float64(a * -0.375) / Float64(b * b)), -0.5), Float64(Float64(-0.5625 * Float64(a * Float64(a * Float64(c * Float64(c * c))))) / (b ^ 4.0))) / b) end
code[a_, b_, c_] := N[(N[(c * N[(c * N[(N[(a * -0.375), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision] + N[(N[(-0.5625 * N[(a * N[(a * N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(c, \mathsf{fma}\left(c, \frac{a \cdot -0.375}{b \cdot b}, -0.5\right), \frac{-0.5625 \cdot \left(a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)\right)}{{b}^{4}}\right)}{b}
\end{array}
Initial program 20.0%
Taylor expanded in a around inf
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6420.0
Simplified20.0%
Taylor expanded in c around 0
lower-*.f64N/A
sub-negN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
Simplified96.6%
Taylor expanded in b around inf
Simplified96.9%
(FPCore (a b c) :precision binary64 (* c (fma c (fma c (/ (* -0.5625 (* a a)) (pow b 5.0)) (/ (* a -0.375) (* b (* b b)))) (/ -0.5 b))))
double code(double a, double b, double c) {
return c * fma(c, fma(c, ((-0.5625 * (a * a)) / pow(b, 5.0)), ((a * -0.375) / (b * (b * b)))), (-0.5 / b));
}
function code(a, b, c) return Float64(c * fma(c, fma(c, Float64(Float64(-0.5625 * Float64(a * a)) / (b ^ 5.0)), Float64(Float64(a * -0.375) / Float64(b * Float64(b * b)))), Float64(-0.5 / b))) end
code[a_, b_, c_] := N[(c * N[(c * N[(c * N[(N[(-0.5625 * N[(a * a), $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] + N[(N[(a * -0.375), $MachinePrecision] / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \mathsf{fma}\left(c, \mathsf{fma}\left(c, \frac{-0.5625 \cdot \left(a \cdot a\right)}{{b}^{5}}, \frac{a \cdot -0.375}{b \cdot \left(b \cdot b\right)}\right), \frac{-0.5}{b}\right)
\end{array}
Initial program 20.0%
Taylor expanded in c around 0
lower-*.f64N/A
sub-negN/A
+-commutativeN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
lower-fma.f64N/A
Simplified96.6%
Final simplification96.6%
(FPCore (a b c) :precision binary64 (/ (fma (* b b) (* c (fma a (* c -0.375) (* (* b b) -0.5))) (* -0.5625 (* a (* a (* c (* c c)))))) (pow b 5.0)))
double code(double a, double b, double c) {
return fma((b * b), (c * fma(a, (c * -0.375), ((b * b) * -0.5))), (-0.5625 * (a * (a * (c * (c * c)))))) / pow(b, 5.0);
}
function code(a, b, c) return Float64(fma(Float64(b * b), Float64(c * fma(a, Float64(c * -0.375), Float64(Float64(b * b) * -0.5))), Float64(-0.5625 * Float64(a * Float64(a * Float64(c * Float64(c * c)))))) / (b ^ 5.0)) end
code[a_, b_, c_] := N[(N[(N[(b * b), $MachinePrecision] * N[(c * N[(a * N[(c * -0.375), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5625 * N[(a * N[(a * N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(b \cdot b, c \cdot \mathsf{fma}\left(a, c \cdot -0.375, \left(b \cdot b\right) \cdot -0.5\right), -0.5625 \cdot \left(a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)\right)\right)}{{b}^{5}}
\end{array}
Initial program 20.0%
Taylor expanded in a around inf
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6420.0
Simplified20.0%
Taylor expanded in c around 0
lower-*.f64N/A
sub-negN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
Simplified96.6%
Taylor expanded in b around 0
lower-/.f64N/A
Simplified96.1%
Final simplification96.1%
(FPCore (a b c) :precision binary64 (fma a (/ (* (* c c) -0.375) (* b (* b b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
return fma(a, (((c * c) * -0.375) / (b * (b * b))), ((c * -0.5) / b));
}
function code(a, b, c) return fma(a, Float64(Float64(Float64(c * c) * -0.375) / Float64(b * Float64(b * b))), Float64(Float64(c * -0.5) / b)) end
code[a_, b_, c_] := N[(a * N[(N[(N[(c * c), $MachinePrecision] * -0.375), $MachinePrecision] / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot \left(b \cdot b\right)}, \frac{c \cdot -0.5}{b}\right)
\end{array}
Initial program 20.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6494.8
Simplified94.8%
(FPCore (a b c) :precision binary64 (/ (fma a (* -0.375 (* c (/ c (* b b)))) (* c -0.5)) b))
double code(double a, double b, double c) {
return fma(a, (-0.375 * (c * (c / (b * b)))), (c * -0.5)) / b;
}
function code(a, b, c) return Float64(fma(a, Float64(-0.375 * Float64(c * Float64(c / Float64(b * b)))), Float64(c * -0.5)) / b) end
code[a_, b_, c_] := N[(N[(a * N[(-0.375 * N[(c * N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * -0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(a, -0.375 \cdot \left(c \cdot \frac{c}{b \cdot b}\right), c \cdot -0.5\right)}{b}
\end{array}
Initial program 20.0%
Taylor expanded in b around inf
lower-/.f64N/A
Simplified94.8%
(FPCore (a b c) :precision binary64 (* (/ c b) (fma c (/ (* a -0.375) (* b b)) -0.5)))
double code(double a, double b, double c) {
return (c / b) * fma(c, ((a * -0.375) / (b * b)), -0.5);
}
function code(a, b, c) return Float64(Float64(c / b) * fma(c, Float64(Float64(a * -0.375) / Float64(b * b)), -0.5)) end
code[a_, b_, c_] := N[(N[(c / b), $MachinePrecision] * N[(c * N[(N[(a * -0.375), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{b} \cdot \mathsf{fma}\left(c, \frac{a \cdot -0.375}{b \cdot b}, -0.5\right)
\end{array}
Initial program 20.0%
Taylor expanded in c around 0
sub-negN/A
distribute-rgt-inN/A
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
distribute-rgt-inN/A
lower-*.f64N/A
associate-*r/N/A
associate-*l/N/A
associate-*r*N/A
associate-*r/N/A
*-commutativeN/A
Simplified94.4%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6494.4
Simplified94.4%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6494.4
Simplified94.4%
Taylor expanded in c around 0
sub-negN/A
distribute-rgt-inN/A
associate-*r/N/A
associate-*l/N/A
unpow3N/A
unpow2N/A
times-fracN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*l/N/A
associate-*r/N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-/.f64N/A
Simplified94.8%
(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(Float64(c * -0.5) / b) end
function tmp = code(a, b, c) tmp = (c * -0.5) / b; end
code[a_, b_, c_] := N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{c \cdot -0.5}{b}
\end{array}
Initial program 20.0%
Taylor expanded in b around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6488.7
Simplified88.7%
herbie shell --seed 2024215
(FPCore (a b c)
:name "Cubic critical, wide range"
:precision binary64
:pre (and (and (and (< 4.930380657631324e-32 a) (< a 2.028240960365167e+31)) (and (< 4.930380657631324e-32 b) (< b 2.028240960365167e+31))) (and (< 4.930380657631324e-32 c) (< c 2.028240960365167e+31)))
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))