
(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 16 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 (* (pow (pow (pow (exp 10.0) 0.5) (+ x x)) x) (cos x)))
double code(double x) {
return pow(pow(pow(exp(10.0), 0.5), (x + x)), x) * cos(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (((exp(10.0d0) ** 0.5d0) ** (x + x)) ** x) * cos(x)
end function
public static double code(double x) {
return Math.pow(Math.pow(Math.pow(Math.exp(10.0), 0.5), (x + x)), x) * Math.cos(x);
}
def code(x): return math.pow(math.pow(math.pow(math.exp(10.0), 0.5), (x + x)), x) * math.cos(x)
function code(x) return Float64((((exp(10.0) ^ 0.5) ^ Float64(x + x)) ^ x) * cos(x)) end
function tmp = code(x) tmp = (((exp(10.0) ^ 0.5) ^ (x + x)) ^ x) * cos(x); end
code[x_] := N[(N[Power[N[Power[N[Power[N[Exp[10.0], $MachinePrecision], 0.5], $MachinePrecision], N[(x + x), $MachinePrecision]], $MachinePrecision], x], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left({\left({\left(e^{10}\right)}^{0.5}\right)}^{\left(x + x\right)}\right)}^{x} \cdot \cos x
\end{array}
Initial program 94.4%
associate-*r*N/A
*-commutativeN/A
exp-prodN/A
*-commutativeN/A
unpow1N/A
metadata-evalN/A
sqr-powN/A
associate-*l*N/A
pow-unpowN/A
lower-pow.f64N/A
pow-expN/A
lower-exp.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr93.2%
lift-cos.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
rem-log-expN/A
lift-exp.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
exp-prodN/A
pow-to-expN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6493.2
Applied egg-rr93.3%
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
*-commutativeN/A
pow-unpowN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f6493.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.4
Applied egg-rr93.4%
lift-sqrt.f64N/A
rem-log-expN/A
lift-exp.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-exp.f64N/A
rem-log-expN/A
pow-expN/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
exp-prodN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
*-rgt-identityN/A
metadata-evalN/A
distribute-lft-outN/A
distribute-rgt-outN/A
pow-unpowN/A
lower-pow.f64N/A
Applied egg-rr98.4%
(FPCore (x) :precision binary64 (* (cos x) (pow (pow (exp 5.0) x) (+ x x))))
double code(double x) {
return cos(x) * pow(pow(exp(5.0), x), (x + x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * ((exp(5.0d0) ** x) ** (x + x))
end function
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.pow(Math.exp(5.0), x), (x + x));
}
def code(x): return math.cos(x) * math.pow(math.pow(math.exp(5.0), x), (x + x))
function code(x) return Float64(cos(x) * ((exp(5.0) ^ x) ^ Float64(x + x))) end
function tmp = code(x) tmp = cos(x) * ((exp(5.0) ^ x) ^ (x + x)); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Power[N[Exp[5.0], $MachinePrecision], x], $MachinePrecision], N[(x + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left({\left(e^{5}\right)}^{x}\right)}^{\left(x + x\right)}
\end{array}
Initial program 94.4%
associate-*r*N/A
exp-prodN/A
pow-expN/A
sqr-powN/A
unpow-prod-downN/A
pow-prod-upN/A
lower-pow.f64N/A
pow-to-expN/A
lower-exp.f64N/A
rem-log-expN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
metadata-evalN/A
lower-+.f6494.9
Applied egg-rr94.9%
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6498.3
Applied egg-rr98.3%
(FPCore (x) :precision binary64 (* (cos x) (pow (pow (exp 10.0) x) x)))
double code(double x) {
return cos(x) * pow(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.pow(Math.exp(10.0), x), x);
}
def code(x): return math.cos(x) * math.pow(math.pow(math.exp(10.0), x), x)
function code(x) return Float64(cos(x) * ((exp(10.0) ^ 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[Power[N[Exp[10.0], $MachinePrecision], x], $MachinePrecision], x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left({\left(e^{10}\right)}^{x}\right)}^{x}
\end{array}
Initial program 94.4%
associate-*r*N/A
*-commutativeN/A
exp-prodN/A
*-commutativeN/A
unpow1N/A
metadata-evalN/A
sqr-powN/A
associate-*l*N/A
pow-unpowN/A
lower-pow.f64N/A
pow-expN/A
lower-exp.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr93.2%
lift-cos.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
rem-log-expN/A
lift-exp.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
exp-prodN/A
pow-to-expN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6493.2
Applied egg-rr93.3%
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
*-commutativeN/A
pow-unpowN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f6493.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.4
Applied egg-rr93.4%
lift-sqrt.f64N/A
rem-log-expN/A
lift-exp.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-exp.f64N/A
rem-log-expN/A
pow-expN/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
exp-prodN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lower-pow.f64N/A
lower-exp.f6497.9
Applied egg-rr97.9%
Final simplification97.9%
(FPCore (x) :precision binary64 (* (cos x) (pow (pow (exp x) x) 10.0)))
double code(double x) {
return cos(x) * pow(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.pow(Math.exp(x), x), 10.0);
}
def code(x): return math.cos(x) * math.pow(math.pow(math.exp(x), x), 10.0)
function code(x) return Float64(cos(x) * ((exp(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[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision], 10.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left({\left(e^{x}\right)}^{x}\right)}^{10}
\end{array}
Initial program 94.4%
Applied egg-rr95.2%
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6496.7
Applied egg-rr96.7%
(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.4%
Applied egg-rr95.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.4%
lift-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6495.2
Applied egg-rr95.2%
(FPCore (x) :precision binary64 (* (cos x) (exp (fma (* x x) 5.0 (* x (* x 5.0))))))
double code(double x) {
return cos(x) * exp(fma((x * x), 5.0, (x * (x * 5.0))));
}
function code(x) return Float64(cos(x) * exp(fma(Float64(x * x), 5.0, Float64(x * Float64(x * 5.0))))) end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(N[(x * x), $MachinePrecision] * 5.0 + N[(x * N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot e^{\mathsf{fma}\left(x \cdot x, 5, x \cdot \left(x \cdot 5\right)\right)}
\end{array}
Initial program 94.4%
associate-*r*N/A
*-commutativeN/A
exp-prodN/A
*-commutativeN/A
unpow1N/A
metadata-evalN/A
sqr-powN/A
associate-*l*N/A
pow-unpowN/A
lower-pow.f64N/A
pow-expN/A
lower-exp.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr93.2%
lift-cos.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
rem-log-expN/A
lift-exp.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
exp-prodN/A
pow-to-expN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6493.2
Applied egg-rr93.3%
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6493.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.3
Applied egg-rr93.3%
Applied egg-rr94.5%
Final simplification94.5%
(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.4%
(FPCore (x) :precision binary64 (* (exp (* (sqrt x) (* x (* 10.0 (sqrt x))))) (fma (* x x) (fma (* x x) (fma (* x x) -0.001388888888888889 0.041666666666666664) -0.5) 1.0)))
double code(double x) {
return exp((sqrt(x) * (x * (10.0 * sqrt(x))))) * fma((x * x), fma((x * x), fma((x * x), -0.001388888888888889, 0.041666666666666664), -0.5), 1.0);
}
function code(x) return Float64(exp(Float64(sqrt(x) * Float64(x * Float64(10.0 * sqrt(x))))) * fma(Float64(x * x), fma(Float64(x * x), fma(Float64(x * x), -0.001388888888888889, 0.041666666666666664), -0.5), 1.0)) end
code[x_] := N[(N[Exp[N[(N[Sqrt[x], $MachinePrecision] * N[(x * N[(10.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(x * x), $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^{\sqrt{x} \cdot \left(x \cdot \left(10 \cdot \sqrt{x}\right)\right)} \cdot \mathsf{fma}\left(x \cdot x, \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.4%
associate-*r*N/A
*-commutativeN/A
exp-prodN/A
*-commutativeN/A
unpow1N/A
metadata-evalN/A
sqr-powN/A
associate-*l*N/A
pow-unpowN/A
lower-pow.f64N/A
pow-expN/A
lower-exp.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr93.2%
lift-cos.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
rem-log-expN/A
lift-exp.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
exp-prodN/A
pow-to-expN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6493.2
Applied egg-rr93.3%
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
Simplified27.5%
(FPCore (x) :precision binary64 (* (exp (* 10.0 (* x x))) (fma (* x x) (fma (* x x) (fma (* x x) -0.001388888888888889 0.041666666666666664) -0.5) 1.0)))
double code(double x) {
return exp((10.0 * (x * x))) * fma((x * x), fma((x * x), fma((x * x), -0.001388888888888889, 0.041666666666666664), -0.5), 1.0);
}
function code(x) return Float64(exp(Float64(10.0 * Float64(x * x))) * fma(Float64(x * x), fma(Float64(x * x), fma(Float64(x * x), -0.001388888888888889, 0.041666666666666664), -0.5), 1.0)) end
code[x_] := N[(N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(x * x), $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^{10 \cdot \left(x \cdot x\right)} \cdot \mathsf{fma}\left(x \cdot x, \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.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
Simplified27.5%
Final simplification27.5%
(FPCore (x) :precision binary64 (* (fma (* x x) (fma (* x x) (fma (* x x) -0.001388888888888889 0.041666666666666664) -0.5) 1.0) (exp (* x (* 10.0 x)))))
double code(double x) {
return fma((x * x), fma((x * x), fma((x * x), -0.001388888888888889, 0.041666666666666664), -0.5), 1.0) * exp((x * (10.0 * x)));
}
function code(x) return Float64(fma(Float64(x * x), fma(Float64(x * x), fma(Float64(x * x), -0.001388888888888889, 0.041666666666666664), -0.5), 1.0) * exp(Float64(x * Float64(10.0 * x)))) end
code[x_] := N[(N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * -0.001388888888888889 + 0.041666666666666664), $MachinePrecision] + -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(x * N[(10.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, -0.001388888888888889, 0.041666666666666664\right), -0.5\right), 1\right) \cdot e^{x \cdot \left(10 \cdot x\right)}
\end{array}
Initial program 94.4%
Taylor expanded in x around inf
*-commutativeN/A
*-lft-identityN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-lft-identityN/A
lower-cos.f6494.4
Simplified94.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
Simplified27.5%
Final simplification27.5%
(FPCore (x) :precision binary64 (* (exp (* x (* 10.0 x))) (fma (* x x) (fma x (* x 0.041666666666666664) -0.5) 1.0)))
double code(double x) {
return exp((x * (10.0 * x))) * fma((x * x), fma(x, (x * 0.041666666666666664), -0.5), 1.0);
}
function code(x) return Float64(exp(Float64(x * Float64(10.0 * x))) * fma(Float64(x * x), fma(x, Float64(x * 0.041666666666666664), -0.5), 1.0)) end
code[x_] := N[(N[Exp[N[(x * N[(10.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.041666666666666664), $MachinePrecision] + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{x \cdot \left(10 \cdot x\right)} \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.041666666666666664, -0.5\right), 1\right)
\end{array}
Initial program 94.4%
Taylor expanded in x around inf
*-commutativeN/A
*-lft-identityN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-lft-identityN/A
lower-cos.f6494.4
Simplified94.4%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/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
Simplified21.3%
Final simplification21.3%
(FPCore (x) :precision binary64 (* (exp (* x (* 10.0 x))) (fma x (* x -0.5) 1.0)))
double code(double x) {
return exp((x * (10.0 * x))) * fma(x, (x * -0.5), 1.0);
}
function code(x) return Float64(exp(Float64(x * Float64(10.0 * x))) * fma(x, Float64(x * -0.5), 1.0)) end
code[x_] := N[(N[Exp[N[(x * N[(10.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(x * N[(x * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{x \cdot \left(10 \cdot x\right)} \cdot \mathsf{fma}\left(x, x \cdot -0.5, 1\right)
\end{array}
Initial program 94.4%
Taylor expanded in x around inf
*-commutativeN/A
*-lft-identityN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-lft-identityN/A
lower-cos.f6494.4
Simplified94.4%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6418.2
Simplified18.2%
Final simplification18.2%
(FPCore (x) :precision binary64 (* (cos x) (fma x (* 10.0 x) 1.0)))
double code(double x) {
return cos(x) * fma(x, (10.0 * x), 1.0);
}
function code(x) return Float64(cos(x) * fma(x, Float64(10.0 * x), 1.0)) end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[(x * N[(10.0 * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \mathsf{fma}\left(x, 10 \cdot x, 1\right)
\end{array}
Initial program 94.4%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f649.8
Simplified9.8%
Final simplification9.8%
(FPCore (x) :precision binary64 (* (* x x) -0.5))
double code(double x) {
return (x * x) * -0.5;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x * x) * (-0.5d0)
end function
public static double code(double x) {
return (x * x) * -0.5;
}
def code(x): return (x * x) * -0.5
function code(x) return Float64(Float64(x * x) * -0.5) end
function tmp = code(x) tmp = (x * x) * -0.5; end
code[x_] := N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot x\right) \cdot -0.5
\end{array}
Initial program 94.4%
Taylor expanded in x around 0
Simplified9.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
Simplified9.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f649.7
Simplified9.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.4%
Taylor expanded in x around 0
Simplified1.5%
herbie shell --seed 2024207
(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)))))