
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.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) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.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) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma a (* c -4.0) (* b b))) (t_1 (sqrt t_0)))
(if (<= (/ (- (sqrt (- (* b b) (* (* 4.0 a) c))) b) (* a 2.0)) -17.0)
(/ (fma t_1 t_0 (* (- b) (* b b))) (* (* a 2.0) (fma b (+ b t_1) t_0)))
(/
1.0
(/
(fma
c
(fma
c
(*
-2.0
(fma
c
(- (/ (* a (* a a)) (pow b 5.0)))
(* -0.5 (/ (* a a) (* b (* b b))))))
(/ a b))
(- b))
c)))))
double code(double a, double b, double c) {
double t_0 = fma(a, (c * -4.0), (b * b));
double t_1 = sqrt(t_0);
double tmp;
if (((sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -17.0) {
tmp = fma(t_1, t_0, (-b * (b * b))) / ((a * 2.0) * fma(b, (b + t_1), t_0));
} else {
tmp = 1.0 / (fma(c, fma(c, (-2.0 * fma(c, -((a * (a * a)) / pow(b, 5.0)), (-0.5 * ((a * a) / (b * (b * b)))))), (a / b)), -b) / c);
}
return tmp;
}
function code(a, b, c) t_0 = fma(a, Float64(c * -4.0), Float64(b * b)) t_1 = sqrt(t_0) tmp = 0.0 if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) - b) / Float64(a * 2.0)) <= -17.0) tmp = Float64(fma(t_1, t_0, Float64(Float64(-b) * Float64(b * b))) / Float64(Float64(a * 2.0) * fma(b, Float64(b + t_1), t_0))); else tmp = Float64(1.0 / Float64(fma(c, fma(c, Float64(-2.0 * fma(c, Float64(-Float64(Float64(a * Float64(a * a)) / (b ^ 5.0))), Float64(-0.5 * Float64(Float64(a * a) / Float64(b * Float64(b * b)))))), Float64(a / b)), Float64(-b)) / c)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -17.0], N[(N[(t$95$1 * t$95$0 + N[((-b) * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(a * 2.0), $MachinePrecision] * N[(b * N[(b + t$95$1), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(c * N[(c * N[(-2.0 * N[(c * (-N[(N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]) + N[(-0.5 * N[(N[(a * a), $MachinePrecision] / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a / b), $MachinePrecision]), $MachinePrecision] + (-b)), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\\
t_1 := \sqrt{t\_0}\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -17:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, t\_0, \left(-b\right) \cdot \left(b \cdot b\right)\right)}{\left(a \cdot 2\right) \cdot \mathsf{fma}\left(b, b + t\_1, t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(c, \mathsf{fma}\left(c, -2 \cdot \mathsf{fma}\left(c, -\frac{a \cdot \left(a \cdot a\right)}{{b}^{5}}, -0.5 \cdot \frac{a \cdot a}{b \cdot \left(b \cdot b\right)}\right), \frac{a}{b}\right), -b\right)}{c}}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -17Initial program 85.3%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
div-subN/A
lower--.f64N/A
Applied rewrites84.6%
Applied rewrites87.6%
if -17 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) Initial program 51.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval51.8
Applied rewrites51.8%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6451.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.8
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6451.8
Applied rewrites51.8%
Taylor expanded in c around 0
Applied rewrites93.2%
Taylor expanded in b around 0
Applied rewrites93.2%
Final simplification92.5%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma a (* c -4.0) (* b b))) (t_1 (sqrt t_0)) (t_2 (* b (* b b))))
(if (<= (/ (- (sqrt (- (* b b) (* (* 4.0 a) c))) b) (* a 2.0)) -17.0)
(/ (fma t_1 t_0 (* (- b) (* b b))) (* (* a 2.0) (fma b (+ b t_1) t_0)))
(-
(/
(-
(fma
-5.0
(/
(* (* a (* a (* a a))) (* (* c c) (* c c)))
(* a (* b (* (* b b) t_2))))
(/ (* (* c -2.0) (* (* a a) (* c c))) (* b t_2)))
(/ (* a (* c c)) (* b b)))
b)
(/ c b)))))
double code(double a, double b, double c) {
double t_0 = fma(a, (c * -4.0), (b * b));
double t_1 = sqrt(t_0);
double t_2 = b * (b * b);
double tmp;
if (((sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -17.0) {
tmp = fma(t_1, t_0, (-b * (b * b))) / ((a * 2.0) * fma(b, (b + t_1), t_0));
} else {
tmp = ((fma(-5.0, (((a * (a * (a * a))) * ((c * c) * (c * c))) / (a * (b * ((b * b) * t_2)))), (((c * -2.0) * ((a * a) * (c * c))) / (b * t_2))) - ((a * (c * c)) / (b * b))) / b) - (c / b);
}
return tmp;
}
function code(a, b, c) t_0 = fma(a, Float64(c * -4.0), Float64(b * b)) t_1 = sqrt(t_0) t_2 = Float64(b * Float64(b * b)) tmp = 0.0 if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) - b) / Float64(a * 2.0)) <= -17.0) tmp = Float64(fma(t_1, t_0, Float64(Float64(-b) * Float64(b * b))) / Float64(Float64(a * 2.0) * fma(b, Float64(b + t_1), t_0))); else tmp = Float64(Float64(Float64(fma(-5.0, Float64(Float64(Float64(a * Float64(a * Float64(a * a))) * Float64(Float64(c * c) * Float64(c * c))) / Float64(a * Float64(b * Float64(Float64(b * b) * t_2)))), Float64(Float64(Float64(c * -2.0) * Float64(Float64(a * a) * Float64(c * c))) / Float64(b * t_2))) - Float64(Float64(a * Float64(c * c)) / Float64(b * b))) / b) - Float64(c / b)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -17.0], N[(N[(t$95$1 * t$95$0 + N[((-b) * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(a * 2.0), $MachinePrecision] * N[(b * N[(b + t$95$1), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-5.0 * N[(N[(N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b * N[(N[(b * b), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(c * -2.0), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(a * N[(c * c), $MachinePrecision]), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\\
t_1 := \sqrt{t\_0}\\
t_2 := b \cdot \left(b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -17:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, t\_0, \left(-b\right) \cdot \left(b \cdot b\right)\right)}{\left(a \cdot 2\right) \cdot \mathsf{fma}\left(b, b + t\_1, t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-5, \frac{\left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot c\right)\right)}{a \cdot \left(b \cdot \left(\left(b \cdot b\right) \cdot t\_2\right)\right)}, \frac{\left(c \cdot -2\right) \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)}{b \cdot t\_2}\right) - \frac{a \cdot \left(c \cdot c\right)}{b \cdot b}}{b} - \frac{c}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -17Initial program 85.3%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
div-subN/A
lower--.f64N/A
Applied rewrites84.6%
Applied rewrites87.6%
if -17 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) Initial program 51.8%
Taylor expanded in b around inf
Applied rewrites92.9%
Applied rewrites92.9%
Applied rewrites93.0%
Final simplification92.3%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* a (* a (* c c))))
(t_1 (fma a (* c -4.0) (* b b)))
(t_2 (sqrt t_1))
(t_3 (* b (* b b))))
(if (<= (/ (- (sqrt (- (* b b) (* (* 4.0 a) c))) b) (* a 2.0)) -17.0)
(/ (fma t_2 t_1 (* (- b) (* b b))) (* (* a 2.0) (fma b (+ b t_2) t_1)))
(/
(-
(fma
-2.0
(/ (* c t_0) (* b t_3))
(/ (* -0.25 (* t_0 t_0)) (* (* a (* t_3 t_3)) 0.05)))
(fma (* c c) (/ a (* b b)) c))
b))))
double code(double a, double b, double c) {
double t_0 = a * (a * (c * c));
double t_1 = fma(a, (c * -4.0), (b * b));
double t_2 = sqrt(t_1);
double t_3 = b * (b * b);
double tmp;
if (((sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -17.0) {
tmp = fma(t_2, t_1, (-b * (b * b))) / ((a * 2.0) * fma(b, (b + t_2), t_1));
} else {
tmp = (fma(-2.0, ((c * t_0) / (b * t_3)), ((-0.25 * (t_0 * t_0)) / ((a * (t_3 * t_3)) * 0.05))) - fma((c * c), (a / (b * b)), c)) / b;
}
return tmp;
}
function code(a, b, c) t_0 = Float64(a * Float64(a * Float64(c * c))) t_1 = fma(a, Float64(c * -4.0), Float64(b * b)) t_2 = sqrt(t_1) t_3 = Float64(b * Float64(b * b)) tmp = 0.0 if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) - b) / Float64(a * 2.0)) <= -17.0) tmp = Float64(fma(t_2, t_1, Float64(Float64(-b) * Float64(b * b))) / Float64(Float64(a * 2.0) * fma(b, Float64(b + t_2), t_1))); else tmp = Float64(Float64(fma(-2.0, Float64(Float64(c * t_0) / Float64(b * t_3)), Float64(Float64(-0.25 * Float64(t_0 * t_0)) / Float64(Float64(a * Float64(t_3 * t_3)) * 0.05))) - fma(Float64(c * c), Float64(a / Float64(b * b)), c)) / b); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(a * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -17.0], N[(N[(t$95$2 * t$95$1 + N[((-b) * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(a * 2.0), $MachinePrecision] * N[(b * N[(b + t$95$2), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 * N[(N[(c * t$95$0), $MachinePrecision] / N[(b * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.25 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(N[(a * N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision] * 0.05), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(c * c), $MachinePrecision] * N[(a / N[(b * b), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot \left(c \cdot c\right)\right)\\
t_1 := \mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\\
t_2 := \sqrt{t\_1}\\
t_3 := b \cdot \left(b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -17:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_2, t\_1, \left(-b\right) \cdot \left(b \cdot b\right)\right)}{\left(a \cdot 2\right) \cdot \mathsf{fma}\left(b, b + t\_2, t\_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-2, \frac{c \cdot t\_0}{b \cdot t\_3}, \frac{-0.25 \cdot \left(t\_0 \cdot t\_0\right)}{\left(a \cdot \left(t\_3 \cdot t\_3\right)\right) \cdot 0.05}\right) - \mathsf{fma}\left(c \cdot c, \frac{a}{b \cdot b}, c\right)}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -17Initial program 85.3%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
div-subN/A
lower--.f64N/A
Applied rewrites84.6%
Applied rewrites87.6%
if -17 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) Initial program 51.8%
Taylor expanded in b around inf
Applied rewrites92.9%
Applied rewrites92.9%
Final simplification92.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma a (* c -4.0) (* b b))) (t_1 (sqrt t_0)) (t_2 (* b (* b b))))
(if (<= (/ (- (sqrt (- (* b b) (* (* 4.0 a) c))) b) (* a 2.0)) -17.0)
(/ (fma t_1 t_0 (* (- b) (* b b))) (* (* a 2.0) (fma b (+ b t_1) t_0)))
(/
(-
(fma
-5.0
(/
(* (* a (* a (* a a))) (* (* c c) (* c c)))
(* a (* b (* (* b b) t_2))))
(/ (* (* c -2.0) (* (* a a) (* c c))) (* b t_2)))
(fma (* a c) (/ c (* b b)) c))
b))))
double code(double a, double b, double c) {
double t_0 = fma(a, (c * -4.0), (b * b));
double t_1 = sqrt(t_0);
double t_2 = b * (b * b);
double tmp;
if (((sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -17.0) {
tmp = fma(t_1, t_0, (-b * (b * b))) / ((a * 2.0) * fma(b, (b + t_1), t_0));
} else {
tmp = (fma(-5.0, (((a * (a * (a * a))) * ((c * c) * (c * c))) / (a * (b * ((b * b) * t_2)))), (((c * -2.0) * ((a * a) * (c * c))) / (b * t_2))) - fma((a * c), (c / (b * b)), c)) / b;
}
return tmp;
}
function code(a, b, c) t_0 = fma(a, Float64(c * -4.0), Float64(b * b)) t_1 = sqrt(t_0) t_2 = Float64(b * Float64(b * b)) tmp = 0.0 if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) - b) / Float64(a * 2.0)) <= -17.0) tmp = Float64(fma(t_1, t_0, Float64(Float64(-b) * Float64(b * b))) / Float64(Float64(a * 2.0) * fma(b, Float64(b + t_1), t_0))); else tmp = Float64(Float64(fma(-5.0, Float64(Float64(Float64(a * Float64(a * Float64(a * a))) * Float64(Float64(c * c) * Float64(c * c))) / Float64(a * Float64(b * Float64(Float64(b * b) * t_2)))), Float64(Float64(Float64(c * -2.0) * Float64(Float64(a * a) * Float64(c * c))) / Float64(b * t_2))) - fma(Float64(a * c), Float64(c / Float64(b * b)), c)) / b); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -17.0], N[(N[(t$95$1 * t$95$0 + N[((-b) * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(a * 2.0), $MachinePrecision] * N[(b * N[(b + t$95$1), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-5.0 * N[(N[(N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b * N[(N[(b * b), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(c * -2.0), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(a * c), $MachinePrecision] * N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\\
t_1 := \sqrt{t\_0}\\
t_2 := b \cdot \left(b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -17:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, t\_0, \left(-b\right) \cdot \left(b \cdot b\right)\right)}{\left(a \cdot 2\right) \cdot \mathsf{fma}\left(b, b + t\_1, t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-5, \frac{\left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot c\right)\right)}{a \cdot \left(b \cdot \left(\left(b \cdot b\right) \cdot t\_2\right)\right)}, \frac{\left(c \cdot -2\right) \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)}{b \cdot t\_2}\right) - \mathsf{fma}\left(a \cdot c, \frac{c}{b \cdot b}, c\right)}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -17Initial program 85.3%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
div-subN/A
lower--.f64N/A
Applied rewrites84.6%
Applied rewrites87.6%
if -17 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) Initial program 51.8%
Taylor expanded in b around inf
Applied rewrites92.9%
Applied rewrites92.9%
Applied rewrites92.9%
Final simplification92.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma a (* c -4.0) (* b b))) (t_1 (sqrt t_0)))
(if (<= (/ (- (sqrt (- (* b b) (* (* 4.0 a) c))) b) (* a 2.0)) -17.0)
(/ (fma t_1 t_0 (* (- b) (* b b))) (* (* a 2.0) (fma b (+ b t_1) t_0)))
(/
1.0
(/
(fma
c
(fma (* c -2.0) (* -0.5 (/ (* a a) (* b (* b b)))) (/ a b))
(- b))
c)))))
double code(double a, double b, double c) {
double t_0 = fma(a, (c * -4.0), (b * b));
double t_1 = sqrt(t_0);
double tmp;
if (((sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -17.0) {
tmp = fma(t_1, t_0, (-b * (b * b))) / ((a * 2.0) * fma(b, (b + t_1), t_0));
} else {
tmp = 1.0 / (fma(c, fma((c * -2.0), (-0.5 * ((a * a) / (b * (b * b)))), (a / b)), -b) / c);
}
return tmp;
}
function code(a, b, c) t_0 = fma(a, Float64(c * -4.0), Float64(b * b)) t_1 = sqrt(t_0) tmp = 0.0 if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) - b) / Float64(a * 2.0)) <= -17.0) tmp = Float64(fma(t_1, t_0, Float64(Float64(-b) * Float64(b * b))) / Float64(Float64(a * 2.0) * fma(b, Float64(b + t_1), t_0))); else tmp = Float64(1.0 / Float64(fma(c, fma(Float64(c * -2.0), Float64(-0.5 * Float64(Float64(a * a) / Float64(b * Float64(b * b)))), Float64(a / b)), Float64(-b)) / c)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -17.0], N[(N[(t$95$1 * t$95$0 + N[((-b) * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(a * 2.0), $MachinePrecision] * N[(b * N[(b + t$95$1), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(c * N[(N[(c * -2.0), $MachinePrecision] * N[(-0.5 * N[(N[(a * a), $MachinePrecision] / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a / b), $MachinePrecision]), $MachinePrecision] + (-b)), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\\
t_1 := \sqrt{t\_0}\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -17:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, t\_0, \left(-b\right) \cdot \left(b \cdot b\right)\right)}{\left(a \cdot 2\right) \cdot \mathsf{fma}\left(b, b + t\_1, t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(c, \mathsf{fma}\left(c \cdot -2, -0.5 \cdot \frac{a \cdot a}{b \cdot \left(b \cdot b\right)}, \frac{a}{b}\right), -b\right)}{c}}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -17Initial program 85.3%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
div-subN/A
lower--.f64N/A
Applied rewrites84.6%
Applied rewrites87.6%
if -17 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) Initial program 51.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval51.8
Applied rewrites51.8%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6451.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.8
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6451.8
Applied rewrites51.8%
Taylor expanded in c around 0
lower-/.f64N/A
Applied rewrites90.5%
Final simplification90.1%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma c (* a -4.0) (* b b))))
(if (<= (/ (- (sqrt (- (* b b) (* (* 4.0 a) c))) b) (* a 2.0)) -17.0)
(/ (* (/ 0.5 a) (- t_0 (* b b))) (+ b (sqrt t_0)))
(/
1.0
(/
(fma
c
(fma (* c -2.0) (* -0.5 (/ (* a a) (* b (* b b)))) (/ a b))
(- b))
c)))))
double code(double a, double b, double c) {
double t_0 = fma(c, (a * -4.0), (b * b));
double tmp;
if (((sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -17.0) {
tmp = ((0.5 / a) * (t_0 - (b * b))) / (b + sqrt(t_0));
} else {
tmp = 1.0 / (fma(c, fma((c * -2.0), (-0.5 * ((a * a) / (b * (b * b)))), (a / b)), -b) / c);
}
return tmp;
}
function code(a, b, c) t_0 = fma(c, Float64(a * -4.0), Float64(b * b)) tmp = 0.0 if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) - b) / Float64(a * 2.0)) <= -17.0) tmp = Float64(Float64(Float64(0.5 / a) * Float64(t_0 - Float64(b * b))) / Float64(b + sqrt(t_0))); else tmp = Float64(1.0 / Float64(fma(c, fma(Float64(c * -2.0), Float64(-0.5 * Float64(Float64(a * a) / Float64(b * Float64(b * b)))), Float64(a / b)), Float64(-b)) / c)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -17.0], N[(N[(N[(0.5 / a), $MachinePrecision] * N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(c * N[(N[(c * -2.0), $MachinePrecision] * N[(-0.5 * N[(N[(a * a), $MachinePrecision] / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a / b), $MachinePrecision]), $MachinePrecision] + (-b)), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -17:\\
\;\;\;\;\frac{\frac{0.5}{a} \cdot \left(t\_0 - b \cdot b\right)}{b + \sqrt{t\_0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(c, \mathsf{fma}\left(c \cdot -2, -0.5 \cdot \frac{a \cdot a}{b \cdot \left(b \cdot b\right)}, \frac{a}{b}\right), -b\right)}{c}}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -17Initial program 85.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval85.3
Applied rewrites85.3%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6485.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.4
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6485.4
Applied rewrites85.4%
Applied rewrites87.2%
if -17 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) Initial program 51.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval51.8
Applied rewrites51.8%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6451.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.8
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6451.8
Applied rewrites51.8%
Taylor expanded in c around 0
lower-/.f64N/A
Applied rewrites90.5%
Final simplification90.1%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma c (* a -4.0) (* b b))))
(if (<= (/ (- (sqrt (- (* b b) (* (* 4.0 a) c))) b) (* a 2.0)) -17.0)
(/ (* (/ 0.5 a) (- t_0 (* b b))) (+ b (sqrt t_0)))
(/
1.0
(fma
a
(fma (* a -2.0) (* -0.5 (/ c (* b (* b b)))) (/ 1.0 b))
(/ b (- c)))))))
double code(double a, double b, double c) {
double t_0 = fma(c, (a * -4.0), (b * b));
double tmp;
if (((sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -17.0) {
tmp = ((0.5 / a) * (t_0 - (b * b))) / (b + sqrt(t_0));
} else {
tmp = 1.0 / fma(a, fma((a * -2.0), (-0.5 * (c / (b * (b * b)))), (1.0 / b)), (b / -c));
}
return tmp;
}
function code(a, b, c) t_0 = fma(c, Float64(a * -4.0), Float64(b * b)) tmp = 0.0 if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) - b) / Float64(a * 2.0)) <= -17.0) tmp = Float64(Float64(Float64(0.5 / a) * Float64(t_0 - Float64(b * b))) / Float64(b + sqrt(t_0))); else tmp = Float64(1.0 / fma(a, fma(Float64(a * -2.0), Float64(-0.5 * Float64(c / Float64(b * Float64(b * b)))), Float64(1.0 / b)), Float64(b / Float64(-c)))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -17.0], N[(N[(N[(0.5 / a), $MachinePrecision] * N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(a * N[(N[(a * -2.0), $MachinePrecision] * N[(-0.5 * N[(c / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / b), $MachinePrecision]), $MachinePrecision] + N[(b / (-c)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -17:\\
\;\;\;\;\frac{\frac{0.5}{a} \cdot \left(t\_0 - b \cdot b\right)}{b + \sqrt{t\_0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot -2, -0.5 \cdot \frac{c}{b \cdot \left(b \cdot b\right)}, \frac{1}{b}\right), \frac{b}{-c}\right)}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -17Initial program 85.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval85.3
Applied rewrites85.3%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6485.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.4
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6485.4
Applied rewrites85.4%
Applied rewrites87.2%
if -17 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) Initial program 51.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval51.8
Applied rewrites51.8%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6451.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.8
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6451.8
Applied rewrites51.8%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites90.5%
Final simplification90.0%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma c (* a -4.0) (* b b))))
(if (<= (/ (- (sqrt (- (* b b) (* (* 4.0 a) c))) b) (* a 2.0)) -17.0)
(/ (- t_0 (* b b)) (* (* a 2.0) (+ b (sqrt t_0))))
(/
1.0
(fma
a
(fma (* a -2.0) (* -0.5 (/ c (* b (* b b)))) (/ 1.0 b))
(/ b (- c)))))))
double code(double a, double b, double c) {
double t_0 = fma(c, (a * -4.0), (b * b));
double tmp;
if (((sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -17.0) {
tmp = (t_0 - (b * b)) / ((a * 2.0) * (b + sqrt(t_0)));
} else {
tmp = 1.0 / fma(a, fma((a * -2.0), (-0.5 * (c / (b * (b * b)))), (1.0 / b)), (b / -c));
}
return tmp;
}
function code(a, b, c) t_0 = fma(c, Float64(a * -4.0), Float64(b * b)) tmp = 0.0 if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) - b) / Float64(a * 2.0)) <= -17.0) tmp = Float64(Float64(t_0 - Float64(b * b)) / Float64(Float64(a * 2.0) * Float64(b + sqrt(t_0)))); else tmp = Float64(1.0 / fma(a, fma(Float64(a * -2.0), Float64(-0.5 * Float64(c / Float64(b * Float64(b * b)))), Float64(1.0 / b)), Float64(b / Float64(-c)))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -17.0], N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(N[(a * 2.0), $MachinePrecision] * N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(a * N[(N[(a * -2.0), $MachinePrecision] * N[(-0.5 * N[(c / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / b), $MachinePrecision]), $MachinePrecision] + N[(b / (-c)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -17:\\
\;\;\;\;\frac{t\_0 - b \cdot b}{\left(a \cdot 2\right) \cdot \left(b + \sqrt{t\_0}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot -2, -0.5 \cdot \frac{c}{b \cdot \left(b \cdot b\right)}, \frac{1}{b}\right), \frac{b}{-c}\right)}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -17Initial program 85.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval85.3
Applied rewrites85.3%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6485.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.4
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6485.4
Applied rewrites85.4%
Applied rewrites87.1%
if -17 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) Initial program 51.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval51.8
Applied rewrites51.8%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6451.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.8
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6451.8
Applied rewrites51.8%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites90.5%
Final simplification90.0%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma c (* a -4.0) (* b b))))
(if (<= b 210.0)
(/ (- t_0 (* b b)) (* (* a 2.0) (+ b (sqrt t_0))))
(*
c
(fma
c
(/ (fma (* a a) (* -2.0 (/ c (* b b))) (- a)) (* b (* b b)))
(/ -1.0 b))))))
double code(double a, double b, double c) {
double t_0 = fma(c, (a * -4.0), (b * b));
double tmp;
if (b <= 210.0) {
tmp = (t_0 - (b * b)) / ((a * 2.0) * (b + sqrt(t_0)));
} else {
tmp = c * fma(c, (fma((a * a), (-2.0 * (c / (b * b))), -a) / (b * (b * b))), (-1.0 / b));
}
return tmp;
}
function code(a, b, c) t_0 = fma(c, Float64(a * -4.0), Float64(b * b)) tmp = 0.0 if (b <= 210.0) tmp = Float64(Float64(t_0 - Float64(b * b)) / Float64(Float64(a * 2.0) * Float64(b + sqrt(t_0)))); else tmp = Float64(c * fma(c, Float64(fma(Float64(a * a), Float64(-2.0 * Float64(c / Float64(b * b))), Float64(-a)) / Float64(b * Float64(b * b))), Float64(-1.0 / b))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 210.0], N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(N[(a * 2.0), $MachinePrecision] * N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(c * N[(N[(N[(a * a), $MachinePrecision] * N[(-2.0 * N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-a)), $MachinePrecision] / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\\
\mathbf{if}\;b \leq 210:\\
\;\;\;\;\frac{t\_0 - b \cdot b}{\left(a \cdot 2\right) \cdot \left(b + \sqrt{t\_0}\right)}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \mathsf{fma}\left(c, \frac{\mathsf{fma}\left(a \cdot a, -2 \cdot \frac{c}{b \cdot b}, -a\right)}{b \cdot \left(b \cdot b\right)}, \frac{-1}{b}\right)\\
\end{array}
\end{array}
if b < 210Initial program 79.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval79.3
Applied rewrites79.3%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6479.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.2
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6479.2
Applied rewrites79.2%
Applied rewrites80.6%
if 210 < b Initial program 42.9%
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
distribute-neg-fracN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites95.0%
Taylor expanded in b around inf
Applied rewrites95.0%
Final simplification89.7%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma c (* a -4.0) (* b b))))
(if (<= b 210.0)
(/ (- t_0 (* b b)) (* (* a 2.0) (+ b (sqrt t_0))))
(/ 1.0 (/ (- (/ (* a c) b) b) c)))))
double code(double a, double b, double c) {
double t_0 = fma(c, (a * -4.0), (b * b));
double tmp;
if (b <= 210.0) {
tmp = (t_0 - (b * b)) / ((a * 2.0) * (b + sqrt(t_0)));
} else {
tmp = 1.0 / ((((a * c) / b) - b) / c);
}
return tmp;
}
function code(a, b, c) t_0 = fma(c, Float64(a * -4.0), Float64(b * b)) tmp = 0.0 if (b <= 210.0) tmp = Float64(Float64(t_0 - Float64(b * b)) / Float64(Float64(a * 2.0) * Float64(b + sqrt(t_0)))); else tmp = Float64(1.0 / Float64(Float64(Float64(Float64(a * c) / b) - b) / c)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 210.0], N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(N[(a * 2.0), $MachinePrecision] * N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(N[(a * c), $MachinePrecision] / b), $MachinePrecision] - b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\\
\mathbf{if}\;b \leq 210:\\
\;\;\;\;\frac{t\_0 - b \cdot b}{\left(a \cdot 2\right) \cdot \left(b + \sqrt{t\_0}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\frac{a \cdot c}{b} - b}{c}}\\
\end{array}
\end{array}
if b < 210Initial program 79.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval79.3
Applied rewrites79.3%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6479.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.2
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6479.2
Applied rewrites79.2%
Applied rewrites80.6%
if 210 < b Initial program 42.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval42.9
Applied rewrites42.9%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6442.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6442.9
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6442.9
Applied rewrites42.9%
Taylor expanded in c around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.7
Applied rewrites91.7%
Final simplification87.7%
(FPCore (a b c) :precision binary64 (if (<= b 255.0) (/ (- (sqrt (fma b b (* a (* c -4.0)))) b) (* a 2.0)) (/ 1.0 (/ (- (/ (* a c) b) b) c))))
double code(double a, double b, double c) {
double tmp;
if (b <= 255.0) {
tmp = (sqrt(fma(b, b, (a * (c * -4.0)))) - b) / (a * 2.0);
} else {
tmp = 1.0 / ((((a * c) / b) - b) / c);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 255.0) tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(c * -4.0)))) - b) / Float64(a * 2.0)); else tmp = Float64(1.0 / Float64(Float64(Float64(Float64(a * c) / b) - b) / c)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 255.0], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(N[(a * c), $MachinePrecision] / b), $MachinePrecision] - b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 255:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\frac{a \cdot c}{b} - b}{c}}\\
\end{array}
\end{array}
if b < 255Initial program 79.2%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval79.5
Applied rewrites79.5%
if 255 < b Initial program 42.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval42.7
Applied rewrites42.7%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6442.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6442.7
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6442.7
Applied rewrites42.7%
Taylor expanded in c around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.8
Applied rewrites91.8%
Final simplification87.2%
(FPCore (a b c) :precision binary64 (if (<= b 255.0) (/ (- (sqrt (fma c (* a -4.0) (* b b))) b) (* a 2.0)) (/ 1.0 (/ (- (/ (* a c) b) b) c))))
double code(double a, double b, double c) {
double tmp;
if (b <= 255.0) {
tmp = (sqrt(fma(c, (a * -4.0), (b * b))) - b) / (a * 2.0);
} else {
tmp = 1.0 / ((((a * c) / b) - b) / c);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 255.0) tmp = Float64(Float64(sqrt(fma(c, Float64(a * -4.0), Float64(b * b))) - b) / Float64(a * 2.0)); else tmp = Float64(1.0 / Float64(Float64(Float64(Float64(a * c) / b) - b) / c)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 255.0], N[(N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(N[(a * c), $MachinePrecision] / b), $MachinePrecision] - b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 255:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\frac{a \cdot c}{b} - b}{c}}\\
\end{array}
\end{array}
if b < 255Initial program 79.2%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6479.2
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-eval79.2
Applied rewrites79.2%
if 255 < b Initial program 42.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval42.7
Applied rewrites42.7%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6442.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6442.7
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6442.7
Applied rewrites42.7%
Taylor expanded in c around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.8
Applied rewrites91.8%
Final simplification87.1%
(FPCore (a b c) :precision binary64 (if (<= b 255.0) (* (/ -0.5 a) (- b (sqrt (fma c (* a -4.0) (* b b))))) (/ 1.0 (/ (- (/ (* a c) b) b) c))))
double code(double a, double b, double c) {
double tmp;
if (b <= 255.0) {
tmp = (-0.5 / a) * (b - sqrt(fma(c, (a * -4.0), (b * b))));
} else {
tmp = 1.0 / ((((a * c) / b) - b) / c);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 255.0) tmp = Float64(Float64(-0.5 / a) * Float64(b - sqrt(fma(c, Float64(a * -4.0), Float64(b * b))))); else tmp = Float64(1.0 / Float64(Float64(Float64(Float64(a * c) / b) - b) / c)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 255.0], N[(N[(-0.5 / a), $MachinePrecision] * N[(b - N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(N[(a * c), $MachinePrecision] / b), $MachinePrecision] - b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 255:\\
\;\;\;\;\frac{-0.5}{a} \cdot \left(b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\frac{a \cdot c}{b} - b}{c}}\\
\end{array}
\end{array}
if b < 255Initial program 79.2%
Applied rewrites79.2%
if 255 < b Initial program 42.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval42.7
Applied rewrites42.7%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6442.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6442.7
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6442.7
Applied rewrites42.7%
Taylor expanded in c around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.8
Applied rewrites91.8%
Final simplification87.1%
(FPCore (a b c) :precision binary64 (/ 1.0 (/ (- (/ (* a c) b) b) c)))
double code(double a, double b, double c) {
return 1.0 / ((((a * c) / b) - b) / c);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = 1.0d0 / ((((a * c) / b) - b) / c)
end function
public static double code(double a, double b, double c) {
return 1.0 / ((((a * c) / b) - b) / c);
}
def code(a, b, c): return 1.0 / ((((a * c) / b) - b) / c)
function code(a, b, c) return Float64(1.0 / Float64(Float64(Float64(Float64(a * c) / b) - b) / c)) end
function tmp = code(a, b, c) tmp = 1.0 / ((((a * c) / b) - b) / c); end
code[a_, b_, c_] := N[(1.0 / N[(N[(N[(N[(a * c), $MachinePrecision] / b), $MachinePrecision] - b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{\frac{a \cdot c}{b} - b}{c}}
\end{array}
Initial program 56.2%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval56.2
Applied rewrites56.2%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6456.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.2
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6456.2
Applied rewrites56.2%
Taylor expanded in c around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.1
Applied rewrites81.1%
Final simplification81.1%
(FPCore (a b c) :precision binary64 (/ 1.0 (- (/ a b) (/ b c))))
double code(double a, double b, double c) {
return 1.0 / ((a / b) - (b / c));
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = 1.0d0 / ((a / b) - (b / c))
end function
public static double code(double a, double b, double c) {
return 1.0 / ((a / b) - (b / c));
}
def code(a, b, c): return 1.0 / ((a / b) - (b / c))
function code(a, b, c) return Float64(1.0 / Float64(Float64(a / b) - Float64(b / c))) end
function tmp = code(a, b, c) tmp = 1.0 / ((a / b) - (b / c)); end
code[a_, b_, c_] := N[(1.0 / N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{a}{b} - \frac{b}{c}}
\end{array}
Initial program 56.2%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval56.2
Applied rewrites56.2%
lift-/.f64N/A
clear-numN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
lower-/.f6456.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.2
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6456.2
Applied rewrites56.2%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6481.1
Applied rewrites81.1%
(FPCore (a b c) :precision binary64 (/ c (- b)))
double code(double a, double b, double c) {
return c / -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 / -b
end function
public static double code(double a, double b, double c) {
return c / -b;
}
def code(a, b, c): return c / -b
function code(a, b, c) return Float64(c / Float64(-b)) end
function tmp = code(a, b, c) tmp = c / -b; end
code[a_, b_, c_] := N[(c / (-b)), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{-b}
\end{array}
Initial program 56.2%
Taylor expanded in b around inf
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-neg.f6463.5
Applied rewrites63.5%
herbie shell --seed 2024232
(FPCore (a b c)
:name "Quadratic roots, narrow range"
:precision binary64
:pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))