
(FPCore (x) :precision binary64 (* (cos x) (exp (* 10.0 (* x x)))))
double code(double x) {
return cos(x) * exp((10.0 * (x * x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * exp((10.0d0 * (x * x)))
end function
public static double code(double x) {
return Math.cos(x) * Math.exp((10.0 * (x * x)));
}
def code(x): return math.cos(x) * math.exp((10.0 * (x * x)))
function code(x) return Float64(cos(x) * exp(Float64(10.0 * Float64(x * x)))) end
function tmp = code(x) tmp = cos(x) * exp((10.0 * (x * x))); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (* (cos x) (exp (* 10.0 (* x x)))))
double code(double x) {
return cos(x) * exp((10.0 * (x * x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * exp((10.0d0 * (x * x)))
end function
public static double code(double x) {
return Math.cos(x) * Math.exp((10.0 * (x * x)));
}
def code(x): return math.cos(x) * math.exp((10.0 * (x * x)))
function code(x) return Float64(cos(x) * exp(Float64(10.0 * Float64(x * x)))) end
function tmp = code(x) tmp = cos(x) * exp((10.0 * (x * x))); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}
\end{array}
(FPCore (x) :precision binary64 (* (cos x) (pow (pow (exp 20.0) (* x 0.5)) (exp (log x)))))
double code(double x) {
return cos(x) * pow(pow(exp(20.0), (x * 0.5)), exp(log(x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * ((exp(20.0d0) ** (x * 0.5d0)) ** exp(log(x)))
end function
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.pow(Math.exp(20.0), (x * 0.5)), Math.exp(Math.log(x)));
}
def code(x): return math.cos(x) * math.pow(math.pow(math.exp(20.0), (x * 0.5)), math.exp(math.log(x)))
function code(x) return Float64(cos(x) * ((exp(20.0) ^ Float64(x * 0.5)) ^ exp(log(x)))) end
function tmp = code(x) tmp = cos(x) * ((exp(20.0) ^ (x * 0.5)) ^ exp(log(x))); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Power[N[Exp[20.0], $MachinePrecision], N[(x * 0.5), $MachinePrecision]], $MachinePrecision], N[Exp[N[Log[x], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left({\left(e^{20}\right)}^{\left(x \cdot 0.5\right)}\right)}^{\left(e^{\log x}\right)}
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6495.2
Applied rewrites95.2%
lift-pow.f64N/A
lift-*.f64N/A
pow2N/A
pow-to-expN/A
exp-lft-sqrN/A
pow-unpowN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-log.f64N/A
lower-exp.f64N/A
lower-log.f6498.0
Applied rewrites98.0%
lift-pow.f64N/A
lift-exp.f64N/A
lift-log.f64N/A
rem-exp-logN/A
sqr-powN/A
pow-prod-downN/A
lift-exp.f64N/A
lift-exp.f64N/A
prod-expN/A
metadata-evalN/A
lift-exp.f64N/A
lower-pow.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f6499.3
Applied rewrites99.3%
(FPCore (x) :precision binary64 (* (cos x) (pow (pow (exp 10.0) (exp (log x))) x)))
double code(double x) {
return cos(x) * pow(pow(exp(10.0), exp(log(x))), x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * ((exp(10.0d0) ** exp(log(x))) ** x)
end function
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.pow(Math.exp(10.0), Math.exp(Math.log(x))), x);
}
def code(x): return math.cos(x) * math.pow(math.pow(math.exp(10.0), math.exp(math.log(x))), x)
function code(x) return Float64(cos(x) * ((exp(10.0) ^ exp(log(x))) ^ x)) end
function tmp = code(x) tmp = cos(x) * ((exp(10.0) ^ exp(log(x))) ^ x); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Power[N[Exp[10.0], $MachinePrecision], N[Exp[N[Log[x], $MachinePrecision]], $MachinePrecision]], $MachinePrecision], x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left({\left(e^{10}\right)}^{\left(e^{\log x}\right)}\right)}^{x}
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6495.2
Applied rewrites95.2%
lift-pow.f64N/A
lift-*.f64N/A
pow2N/A
pow-to-expN/A
exp-lft-sqrN/A
pow-unpowN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-log.f64N/A
lower-exp.f64N/A
lower-log.f6498.0
Applied rewrites98.0%
lift-exp.f64N/A
lift-log.f64N/A
rem-exp-log98.0
Applied rewrites98.0%
(FPCore (x) :precision binary64 (* (cos x) (pow (pow (exp (+ x x)) 5.0) x)))
double code(double x) {
return cos(x) * pow(pow(exp((x + x)), 5.0), x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * ((exp((x + x)) ** 5.0d0) ** x)
end function
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.pow(Math.exp((x + x)), 5.0), x);
}
def code(x): return math.cos(x) * math.pow(math.pow(math.exp((x + x)), 5.0), x)
function code(x) return Float64(cos(x) * ((exp(Float64(x + x)) ^ 5.0) ^ x)) end
function tmp = code(x) tmp = cos(x) * ((exp((x + x)) ^ 5.0) ^ x); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Power[N[Exp[N[(x + x), $MachinePrecision]], $MachinePrecision], 5.0], $MachinePrecision], x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left({\left(e^{x + x}\right)}^{5}\right)}^{x}
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6495.2
Applied rewrites95.2%
lift-pow.f64N/A
lift-exp.f64N/A
pow-expN/A
*-commutativeN/A
pow-expN/A
lift-*.f64N/A
sqr-powN/A
pow-prod-downN/A
exp-prodN/A
lift-exp.f64N/A
exp-prodN/A
lift-exp.f64N/A
pow-prod-downN/A
pow-unpowN/A
*-commutativeN/A
pow-unpowN/A
lower-pow.f64N/A
Applied rewrites97.6%
(FPCore (x) :precision binary64 (* (cos x) (pow (exp (* x x)) 10.0)))
double code(double x) {
return cos(x) * pow(exp((x * x)), 10.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * (exp((x * x)) ** 10.0d0)
end function
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.exp((x * x)), 10.0);
}
def code(x): return math.cos(x) * math.pow(math.exp((x * x)), 10.0)
function code(x) return Float64(cos(x) * (exp(Float64(x * x)) ^ 10.0)) end
function tmp = code(x) tmp = cos(x) * (exp((x * x)) ^ 10.0); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision], 10.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left(e^{x \cdot x}\right)}^{10}
\end{array}
Initial program 94.5%
Applied rewrites95.2%
(FPCore (x) :precision binary64 (* (cos x) (pow (exp 10.0) (* x x))))
double code(double x) {
return cos(x) * pow(exp(10.0), (x * x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * (exp(10.0d0) ** (x * x))
end function
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.exp(10.0), (x * x));
}
def code(x): return math.cos(x) * math.pow(math.exp(10.0), (x * x))
function code(x) return Float64(cos(x) * (exp(10.0) ^ Float64(x * x))) end
function tmp = code(x) tmp = cos(x) * (exp(10.0) ^ (x * x)); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Exp[10.0], $MachinePrecision], N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left(e^{10}\right)}^{\left(x \cdot x\right)}
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6495.2
Applied rewrites95.2%
(FPCore (x) :precision binary64 (* (cos x) (sqrt (exp (* 20.0 (* x x))))))
double code(double x) {
return cos(x) * sqrt(exp((20.0 * (x * x))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * sqrt(exp((20.0d0 * (x * x))))
end function
public static double code(double x) {
return Math.cos(x) * Math.sqrt(Math.exp((20.0 * (x * x))));
}
def code(x): return math.cos(x) * math.sqrt(math.exp((20.0 * (x * x))))
function code(x) return Float64(cos(x) * sqrt(exp(Float64(20.0 * Float64(x * x))))) end
function tmp = code(x) tmp = cos(x) * sqrt(exp((20.0 * (x * x)))); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Sqrt[N[Exp[N[(20.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \sqrt{e^{20 \cdot \left(x \cdot x\right)}}
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6495.2
Applied rewrites95.2%
lift-pow.f64N/A
lift-*.f64N/A
pow2N/A
pow-to-expN/A
exp-lft-sqrN/A
pow-unpowN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-log.f64N/A
lower-exp.f64N/A
lower-log.f6498.0
Applied rewrites98.0%
Applied rewrites94.6%
Final simplification94.6%
(FPCore (x) :precision binary64 (* (cos x) (exp (* 10.0 (* x x)))))
double code(double x) {
return cos(x) * exp((10.0 * (x * x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * exp((10.0d0 * (x * x)))
end function
public static double code(double x) {
return Math.cos(x) * Math.exp((10.0 * (x * x)));
}
def code(x): return math.cos(x) * math.exp((10.0 * (x * x)))
function code(x) return Float64(cos(x) * exp(Float64(10.0 * Float64(x * x)))) end
function tmp = code(x) tmp = cos(x) * exp((10.0 * (x * x))); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}
\end{array}
Initial program 94.5%
(FPCore (x)
:precision binary64
(let* ((t_0 (* x (* x (* x x)))))
(*
(+
1.0
(*
(* x (* x t_0))
(+
-0.001388888888888889
(+ (/ 0.041666666666666664 (* x x)) (/ -0.5 t_0)))))
(exp (* x (* x 10.0))))))
double code(double x) {
double t_0 = x * (x * (x * x));
return (1.0 + ((x * (x * t_0)) * (-0.001388888888888889 + ((0.041666666666666664 / (x * x)) + (-0.5 / t_0))))) * exp((x * (x * 10.0)));
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
t_0 = x * (x * (x * x))
code = (1.0d0 + ((x * (x * t_0)) * ((-0.001388888888888889d0) + ((0.041666666666666664d0 / (x * x)) + ((-0.5d0) / t_0))))) * exp((x * (x * 10.0d0)))
end function
public static double code(double x) {
double t_0 = x * (x * (x * x));
return (1.0 + ((x * (x * t_0)) * (-0.001388888888888889 + ((0.041666666666666664 / (x * x)) + (-0.5 / t_0))))) * Math.exp((x * (x * 10.0)));
}
def code(x): t_0 = x * (x * (x * x)) return (1.0 + ((x * (x * t_0)) * (-0.001388888888888889 + ((0.041666666666666664 / (x * x)) + (-0.5 / t_0))))) * math.exp((x * (x * 10.0)))
function code(x) t_0 = Float64(x * Float64(x * Float64(x * x))) return Float64(Float64(1.0 + Float64(Float64(x * Float64(x * t_0)) * Float64(-0.001388888888888889 + Float64(Float64(0.041666666666666664 / Float64(x * x)) + Float64(-0.5 / t_0))))) * exp(Float64(x * Float64(x * 10.0)))) end
function tmp = code(x) t_0 = x * (x * (x * x)); tmp = (1.0 + ((x * (x * t_0)) * (-0.001388888888888889 + ((0.041666666666666664 / (x * x)) + (-0.5 / t_0))))) * exp((x * (x * 10.0))); end
code[x_] := Block[{t$95$0 = N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 + N[(N[(x * N[(x * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(-0.001388888888888889 + N[(N[(0.041666666666666664 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(x * 10.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \left(x \cdot x\right)\right)\\
\left(1 + \left(x \cdot \left(x \cdot t\_0\right)\right) \cdot \left(-0.001388888888888889 + \left(\frac{0.041666666666666664}{x \cdot x} + \frac{-0.5}{t\_0}\right)\right)\right) \cdot e^{x \cdot \left(x \cdot 10\right)}
\end{array}
\end{array}
Initial program 94.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6494.4
Applied rewrites94.4%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.5
Applied rewrites27.5%
Taylor expanded in x around inf
Applied rewrites27.5%
Final simplification27.5%
(FPCore (x) :precision binary64 (* (exp (* x (* x 10.0))) (fma (* (sqrt x) (* x (sqrt x))) (fma (* x x) (fma (* x x) -0.001388888888888889 0.041666666666666664) -0.5) 1.0)))
double code(double x) {
return exp((x * (x * 10.0))) * fma((sqrt(x) * (x * sqrt(x))), fma((x * x), fma((x * x), -0.001388888888888889, 0.041666666666666664), -0.5), 1.0);
}
function code(x) return Float64(exp(Float64(x * Float64(x * 10.0))) * fma(Float64(sqrt(x) * Float64(x * sqrt(x))), fma(Float64(x * x), fma(Float64(x * x), -0.001388888888888889, 0.041666666666666664), -0.5), 1.0)) end
code[x_] := N[(N[Exp[N[(x * N[(x * 10.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[x], $MachinePrecision] * N[(x * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * -0.001388888888888889 + 0.041666666666666664), $MachinePrecision] + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{x \cdot \left(x \cdot 10\right)} \cdot \mathsf{fma}\left(\sqrt{x} \cdot \left(x \cdot \sqrt{x}\right), \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, -0.001388888888888889, 0.041666666666666664\right), -0.5\right), 1\right)
\end{array}
Initial program 94.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6494.4
Applied rewrites94.4%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.5
Applied rewrites27.5%
Applied rewrites27.5%
Final simplification27.5%
(FPCore (x) :precision binary64 (* (exp (* x (* x 10.0))) (fma (* x x) (fma (* x x) (fma x (* x -0.001388888888888889) 0.041666666666666664) -0.5) 1.0)))
double code(double x) {
return exp((x * (x * 10.0))) * fma((x * x), fma((x * x), fma(x, (x * -0.001388888888888889), 0.041666666666666664), -0.5), 1.0);
}
function code(x) return Float64(exp(Float64(x * Float64(x * 10.0))) * fma(Float64(x * x), fma(Float64(x * x), fma(x, Float64(x * -0.001388888888888889), 0.041666666666666664), -0.5), 1.0)) end
code[x_] := N[(N[Exp[N[(x * N[(x * 10.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * -0.001388888888888889), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{x \cdot \left(x \cdot 10\right)} \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot -0.001388888888888889, 0.041666666666666664\right), -0.5\right), 1\right)
\end{array}
Initial program 94.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6494.4
Applied rewrites94.4%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.5
Applied rewrites27.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6427.5
Applied rewrites27.5%
Final simplification27.5%
(FPCore (x) :precision binary64 (* (exp (* x (* x 10.0))) (fma x (* x (fma x (* x 0.041666666666666664) -0.5)) 1.0)))
double code(double x) {
return exp((x * (x * 10.0))) * fma(x, (x * fma(x, (x * 0.041666666666666664), -0.5)), 1.0);
}
function code(x) return Float64(exp(Float64(x * Float64(x * 10.0))) * fma(x, Float64(x * fma(x, Float64(x * 0.041666666666666664), -0.5)), 1.0)) end
code[x_] := N[(N[Exp[N[(x * N[(x * 10.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(x * N[(x * N[(x * N[(x * 0.041666666666666664), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{x \cdot \left(x \cdot 10\right)} \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, x \cdot 0.041666666666666664, -0.5\right), 1\right)
\end{array}
Initial program 94.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6494.4
Applied rewrites94.4%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Final simplification21.3%
(FPCore (x) :precision binary64 (* (exp (* 10.0 (* x x))) (fma x (* x -0.5) 1.0)))
double code(double x) {
return exp((10.0 * (x * x))) * fma(x, (x * -0.5), 1.0);
}
function code(x) return Float64(exp(Float64(10.0 * Float64(x * x))) * fma(x, Float64(x * -0.5), 1.0)) end
code[x_] := N[(N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(x * N[(x * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{10 \cdot \left(x \cdot x\right)} \cdot \mathsf{fma}\left(x, x \cdot -0.5, 1\right)
\end{array}
Initial program 94.5%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6418.2
Applied rewrites18.2%
Final simplification18.2%
(FPCore (x) :precision binary64 (* (fma x (* x -0.5) 1.0) (fma (* x x) (fma x (* x (fma x (* x 166.66666666666666) 50.0)) 10.0) 1.0)))
double code(double x) {
return fma(x, (x * -0.5), 1.0) * fma((x * x), fma(x, (x * fma(x, (x * 166.66666666666666), 50.0)), 10.0), 1.0);
}
function code(x) return Float64(fma(x, Float64(x * -0.5), 1.0) * fma(Float64(x * x), fma(x, Float64(x * fma(x, Float64(x * 166.66666666666666), 50.0)), 10.0), 1.0)) end
code[x_] := N[(N[(x * N[(x * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(x * N[(x * 166.66666666666666), $MachinePrecision] + 50.0), $MachinePrecision]), $MachinePrecision] + 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, x \cdot -0.5, 1\right) \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, x \cdot 166.66666666666666, 50\right), 10\right), 1\right)
\end{array}
Initial program 94.5%
Applied rewrites95.2%
Taylor expanded in x around 0
Applied rewrites9.6%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f649.7
Applied rewrites9.7%
Taylor expanded in x around 0
Applied rewrites10.3%
(FPCore (x) :precision binary64 (* (fma x (* x -0.5) 1.0) (fma (* x x) (fma x (* x 50.0) 10.0) 1.0)))
double code(double x) {
return fma(x, (x * -0.5), 1.0) * fma((x * x), fma(x, (x * 50.0), 10.0), 1.0);
}
function code(x) return Float64(fma(x, Float64(x * -0.5), 1.0) * fma(Float64(x * x), fma(x, Float64(x * 50.0), 10.0), 1.0)) end
code[x_] := N[(N[(x * N[(x * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 50.0), $MachinePrecision] + 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, x \cdot -0.5, 1\right) \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 50, 10\right), 1\right)
\end{array}
Initial program 94.5%
Applied rewrites95.2%
Taylor expanded in x around 0
Applied rewrites9.6%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f649.7
Applied rewrites9.7%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6410.1
Applied rewrites10.1%
(FPCore (x) :precision binary64 (* (fma x (* x -0.5) 1.0) (fma x (* x 10.0) 1.0)))
double code(double x) {
return fma(x, (x * -0.5), 1.0) * fma(x, (x * 10.0), 1.0);
}
function code(x) return Float64(fma(x, Float64(x * -0.5), 1.0) * fma(x, Float64(x * 10.0), 1.0)) end
code[x_] := N[(N[(x * N[(x * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x * N[(x * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, x \cdot -0.5, 1\right) \cdot \mathsf{fma}\left(x, x \cdot 10, 1\right)
\end{array}
Initial program 94.5%
Applied rewrites95.2%
Taylor expanded in x around 0
Applied rewrites9.6%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f649.7
Applied rewrites9.7%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f649.9
Applied rewrites9.9%
(FPCore (x) :precision binary64 (* (* x (* x -0.5)) 1.0))
double code(double x) {
return (x * (x * -0.5)) * 1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x * (x * (-0.5d0))) * 1.0d0
end function
public static double code(double x) {
return (x * (x * -0.5)) * 1.0;
}
def code(x): return (x * (x * -0.5)) * 1.0
function code(x) return Float64(Float64(x * Float64(x * -0.5)) * 1.0) end
function tmp = code(x) tmp = (x * (x * -0.5)) * 1.0; end
code[x_] := N[(N[(x * N[(x * -0.5), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(x \cdot -0.5\right)\right) \cdot 1
\end{array}
Initial program 94.5%
Applied rewrites95.2%
Taylor expanded in x around 0
Applied rewrites9.6%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f649.7
Applied rewrites9.7%
Taylor expanded in x around inf
Applied rewrites9.7%
(FPCore (x) :precision binary64 1.0)
double code(double x) {
return 1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0
end function
public static double code(double x) {
return 1.0;
}
def code(x): return 1.0
function code(x) return 1.0 end
function tmp = code(x) tmp = 1.0; end
code[x_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 94.5%
Taylor expanded in x around 0
Applied rewrites1.5%
herbie shell --seed 2024219
(FPCore (x)
:name "ENA, Section 1.4, Exercise 1"
:precision binary64
:pre (and (<= 1.99 x) (<= x 2.01))
(* (cos x) (exp (* 10.0 (* x x)))))