
(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 18 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 (exp 20.0) x) (* 0.5 x)) (cos x)))
double code(double x) {
return pow(pow(exp(20.0), x), (0.5 * x)) * cos(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((exp(20.0d0) ** x) ** (0.5d0 * x)) * cos(x)
end function
public static double code(double x) {
return Math.pow(Math.pow(Math.exp(20.0), x), (0.5 * x)) * Math.cos(x);
}
def code(x): return math.pow(math.pow(math.exp(20.0), x), (0.5 * x)) * math.cos(x)
function code(x) return Float64(((exp(20.0) ^ x) ^ Float64(0.5 * x)) * cos(x)) end
function tmp = code(x) tmp = ((exp(20.0) ^ x) ^ (0.5 * x)) * cos(x); end
code[x_] := N[(N[Power[N[Power[N[Exp[20.0], $MachinePrecision], x], $MachinePrecision], N[(0.5 * x), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left({\left(e^{20}\right)}^{x}\right)}^{\left(0.5 \cdot x\right)} \cdot \cos x
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
pow-unpowN/A
sqr-powN/A
unpow-prod-downN/A
pow-prod-upN/A
lower-pow.f64N/A
pow-to-expN/A
rem-log-expN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
pow-expN/A
lower-pow.f64N/A
lower-exp.f64N/A
metadata-evalN/A
count-2N/A
lower-*.f6496.7
Applied rewrites96.7%
lift-pow.f64N/A
lift-pow.f64N/A
pow-powN/A
lift-exp.f64N/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
rem-log-expN/A
pow-expN/A
lift-exp.f64N/A
lift-pow.f64N/A
pow-expN/A
*-commutativeN/A
pow-to-expN/A
sqr-powN/A
*-rgt-identityN/A
lift-*.f64N/A
lift-/.f64N/A
*-rgt-identityN/A
lift-*.f64N/A
lift-/.f64N/A
pow-prod-downN/A
Applied rewrites99.4%
Final simplification99.4%
(FPCore (x) :precision binary64 (* (pow (pow (exp 5.0) x) (* 2.0 x)) (cos x)))
double code(double x) {
return pow(pow(exp(5.0), x), (2.0 * x)) * cos(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((exp(5.0d0) ** x) ** (2.0d0 * x)) * cos(x)
end function
public static double code(double x) {
return Math.pow(Math.pow(Math.exp(5.0), x), (2.0 * x)) * Math.cos(x);
}
def code(x): return math.pow(math.pow(math.exp(5.0), x), (2.0 * x)) * math.cos(x)
function code(x) return Float64(((exp(5.0) ^ x) ^ Float64(2.0 * x)) * cos(x)) end
function tmp = code(x) tmp = ((exp(5.0) ^ x) ^ (2.0 * x)) * cos(x); end
code[x_] := N[(N[Power[N[Power[N[Exp[5.0], $MachinePrecision], x], $MachinePrecision], N[(2.0 * x), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left({\left(e^{5}\right)}^{x}\right)}^{\left(2 \cdot x\right)} \cdot \cos x
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
pow-unpowN/A
sqr-powN/A
unpow-prod-downN/A
pow-prod-upN/A
lower-pow.f64N/A
pow-to-expN/A
rem-log-expN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
pow-expN/A
lower-pow.f64N/A
lower-exp.f64N/A
metadata-evalN/A
count-2N/A
lower-*.f6496.7
Applied rewrites96.7%
lift-pow.f64N/A
lift-exp.f64N/A
pow-expN/A
*-commutativeN/A
exp-prodN/A
metadata-evalN/A
pow-expN/A
lift-exp.f64N/A
lower-pow.f64N/A
lift-exp.f64N/A
pow-expN/A
metadata-evalN/A
lower-exp.f6498.2
Applied rewrites98.2%
Final simplification98.2%
(FPCore (x) :precision binary64 (* (pow (pow (exp 10.0) x) x) (cos x)))
double code(double x) {
return pow(pow(exp(10.0), x), x) * cos(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((exp(10.0d0) ** x) ** x) * cos(x)
end function
public static double code(double x) {
return Math.pow(Math.pow(Math.exp(10.0), x), x) * Math.cos(x);
}
def code(x): return math.pow(math.pow(math.exp(10.0), x), x) * math.cos(x)
function code(x) return Float64(((exp(10.0) ^ x) ^ x) * cos(x)) end
function tmp = code(x) tmp = ((exp(10.0) ^ x) ^ x) * cos(x); end
code[x_] := N[(N[Power[N[Power[N[Exp[10.0], $MachinePrecision], x], $MachinePrecision], x], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left({\left(e^{10}\right)}^{x}\right)}^{x} \cdot \cos x
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
pow-unpowN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f6497.9
Applied rewrites97.9%
Final simplification97.9%
(FPCore (x) :precision binary64 (* (pow (pow (exp x) 10.0) x) (cos x)))
double code(double x) {
return pow(pow(exp(x), 10.0), x) * cos(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((exp(x) ** 10.0d0) ** x) * cos(x)
end function
public static double code(double x) {
return Math.pow(Math.pow(Math.exp(x), 10.0), x) * Math.cos(x);
}
def code(x): return math.pow(math.pow(math.exp(x), 10.0), x) * math.cos(x)
function code(x) return Float64(((exp(x) ^ 10.0) ^ x) * cos(x)) end
function tmp = code(x) tmp = ((exp(x) ^ 10.0) ^ x) * cos(x); end
code[x_] := N[(N[Power[N[Power[N[Exp[x], $MachinePrecision], 10.0], $MachinePrecision], x], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left({\left(e^{x}\right)}^{10}\right)}^{x} \cdot \cos x
\end{array}
Initial program 94.5%
Taylor expanded in x around inf
unpow2N/A
associate-*r*N/A
exp-prodN/A
lower-pow.f64N/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6496.8
Applied rewrites96.8%
Final simplification96.8%
(FPCore (x) :precision binary64 (* (pow (exp (* 20.0 x)) (* 0.5 x)) (cos x)))
double code(double x) {
return pow(exp((20.0 * x)), (0.5 * x)) * cos(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (exp((20.0d0 * x)) ** (0.5d0 * x)) * cos(x)
end function
public static double code(double x) {
return Math.pow(Math.exp((20.0 * x)), (0.5 * x)) * Math.cos(x);
}
def code(x): return math.pow(math.exp((20.0 * x)), (0.5 * x)) * math.cos(x)
function code(x) return Float64((exp(Float64(20.0 * x)) ^ Float64(0.5 * x)) * cos(x)) end
function tmp = code(x) tmp = (exp((20.0 * x)) ^ (0.5 * x)) * cos(x); end
code[x_] := N[(N[Power[N[Exp[N[(20.0 * x), $MachinePrecision]], $MachinePrecision], N[(0.5 * x), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(e^{20 \cdot x}\right)}^{\left(0.5 \cdot x\right)} \cdot \cos x
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
pow-unpowN/A
sqr-powN/A
unpow-prod-downN/A
pow-prod-upN/A
lower-pow.f64N/A
pow-to-expN/A
rem-log-expN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
pow-expN/A
lower-pow.f64N/A
lower-exp.f64N/A
metadata-evalN/A
count-2N/A
lower-*.f6496.7
Applied rewrites96.7%
lift-pow.f64N/A
lift-pow.f64N/A
pow-powN/A
lift-exp.f64N/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
rem-log-expN/A
pow-expN/A
lift-exp.f64N/A
lift-pow.f64N/A
pow-expN/A
*-commutativeN/A
pow-to-expN/A
sqr-powN/A
*-rgt-identityN/A
lift-*.f64N/A
lift-/.f64N/A
*-rgt-identityN/A
lift-*.f64N/A
lift-/.f64N/A
pow-prod-downN/A
Applied rewrites99.4%
lift-pow.f64N/A
pow-to-expN/A
rem-log-expN/A
pow-to-expN/A
lift-pow.f64N/A
lower-exp.f64N/A
lift-pow.f64N/A
pow-to-expN/A
rem-log-expN/A
lower-*.f64N/A
lift-exp.f64N/A
rem-log-exp95.3
Applied rewrites95.3%
Final simplification95.3%
(FPCore (x) :precision binary64 (* (pow (exp 20.0) (* (* x x) 0.5)) (cos x)))
double code(double x) {
return pow(exp(20.0), ((x * x) * 0.5)) * cos(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (exp(20.0d0) ** ((x * x) * 0.5d0)) * cos(x)
end function
public static double code(double x) {
return Math.pow(Math.exp(20.0), ((x * x) * 0.5)) * Math.cos(x);
}
def code(x): return math.pow(math.exp(20.0), ((x * x) * 0.5)) * math.cos(x)
function code(x) return Float64((exp(20.0) ^ Float64(Float64(x * x) * 0.5)) * cos(x)) end
function tmp = code(x) tmp = (exp(20.0) ^ ((x * x) * 0.5)) * cos(x); end
code[x_] := N[(N[Power[N[Exp[20.0], $MachinePrecision], N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(e^{20}\right)}^{\left(\left(x \cdot x\right) \cdot 0.5\right)} \cdot \cos x
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
pow-unpowN/A
sqr-powN/A
unpow-prod-downN/A
pow-prod-upN/A
lower-pow.f64N/A
pow-to-expN/A
rem-log-expN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
pow-expN/A
lower-pow.f64N/A
lower-exp.f64N/A
metadata-evalN/A
count-2N/A
lower-*.f6496.7
Applied rewrites96.7%
lift-pow.f64N/A
lift-pow.f64N/A
pow-powN/A
lift-exp.f64N/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
rem-log-expN/A
pow-expN/A
lift-exp.f64N/A
lift-pow.f64N/A
pow-expN/A
*-commutativeN/A
pow-to-expN/A
lift-pow.f64N/A
pow-powN/A
sqr-powN/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
Applied rewrites95.2%
Final simplification95.2%
(FPCore (x) :precision binary64 (* (pow (exp 5.0) (* (* 2.0 x) x)) (cos x)))
double code(double x) {
return pow(exp(5.0), ((2.0 * x) * x)) * cos(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (exp(5.0d0) ** ((2.0d0 * x) * x)) * cos(x)
end function
public static double code(double x) {
return Math.pow(Math.exp(5.0), ((2.0 * x) * x)) * Math.cos(x);
}
def code(x): return math.pow(math.exp(5.0), ((2.0 * x) * x)) * math.cos(x)
function code(x) return Float64((exp(5.0) ^ Float64(Float64(2.0 * x) * x)) * cos(x)) end
function tmp = code(x) tmp = (exp(5.0) ^ ((2.0 * x) * x)) * cos(x); end
code[x_] := N[(N[Power[N[Exp[5.0], $MachinePrecision], N[(N[(2.0 * x), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(e^{5}\right)}^{\left(\left(2 \cdot x\right) \cdot x\right)} \cdot \cos x
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
pow-unpowN/A
sqr-powN/A
unpow-prod-downN/A
pow-prod-upN/A
lower-pow.f64N/A
pow-to-expN/A
rem-log-expN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
pow-expN/A
lower-pow.f64N/A
lower-exp.f64N/A
metadata-evalN/A
count-2N/A
lower-*.f6496.7
Applied rewrites96.7%
lift-pow.f64N/A
lift-pow.f64N/A
pow-powN/A
lift-exp.f64N/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
rem-log-expN/A
pow-expN/A
lift-exp.f64N/A
lift-pow.f64N/A
pow-expN/A
*-commutativeN/A
pow-to-expN/A
sqr-powN/A
*-rgt-identityN/A
lift-*.f64N/A
lift-/.f64N/A
*-rgt-identityN/A
lift-*.f64N/A
lift-/.f64N/A
pow-prod-downN/A
Applied rewrites99.4%
lift-pow.f64N/A
lift-pow.f64N/A
pow-powN/A
pow-to-expN/A
pow-expN/A
lift-exp.f64N/A
rem-log-expN/A
metadata-evalN/A
prod-expN/A
lift-exp.f64N/A
lift-exp.f64N/A
pow-prod-downN/A
pow-prod-upN/A
distribute-lft-outN/A
pow-powN/A
lift-exp.f64N/A
pow-expN/A
lift-*.f64N/A
pow-expN/A
distribute-lft-outN/A
prod-expN/A
exp-lft-sqrN/A
Applied rewrites95.2%
Final simplification95.2%
(FPCore (x) :precision binary64 (* (pow (exp 10.0) (* x x)) (cos x)))
double code(double x) {
return pow(exp(10.0), (x * x)) * cos(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (exp(10.0d0) ** (x * x)) * cos(x)
end function
public static double code(double x) {
return Math.pow(Math.exp(10.0), (x * x)) * Math.cos(x);
}
def code(x): return math.pow(math.exp(10.0), (x * x)) * math.cos(x)
function code(x) return Float64((exp(10.0) ^ Float64(x * x)) * cos(x)) end
function tmp = code(x) tmp = (exp(10.0) ^ (x * x)) * cos(x); end
code[x_] := N[(N[Power[N[Exp[10.0], $MachinePrecision], N[(x * x), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(e^{10}\right)}^{\left(x \cdot x\right)} \cdot \cos 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%
Final simplification95.2%
(FPCore (x) :precision binary64 (* (exp (fma (* 2.5 x) x (fma (* x x) 5.0 (* (* 2.5 x) x)))) (cos x)))
double code(double x) {
return exp(fma((2.5 * x), x, fma((x * x), 5.0, ((2.5 * x) * x)))) * cos(x);
}
function code(x) return Float64(exp(fma(Float64(2.5 * x), x, fma(Float64(x * x), 5.0, Float64(Float64(2.5 * x) * x)))) * cos(x)) end
code[x_] := N[(N[Exp[N[(N[(2.5 * x), $MachinePrecision] * x + N[(N[(x * x), $MachinePrecision] * 5.0 + N[(N[(2.5 * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\mathsf{fma}\left(2.5 \cdot x, x, \mathsf{fma}\left(x \cdot x, 5, \left(2.5 \cdot x\right) \cdot x\right)\right)} \cdot \cos x
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
pow-unpowN/A
sqr-powN/A
unpow-prod-downN/A
pow-prod-upN/A
lower-pow.f64N/A
pow-to-expN/A
rem-log-expN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
pow-expN/A
lower-pow.f64N/A
lower-exp.f64N/A
metadata-evalN/A
count-2N/A
lower-*.f6496.7
Applied rewrites96.7%
Applied rewrites94.6%
Final simplification94.6%
(FPCore (x) :precision binary64 (* (exp (* (* x x) 10.0)) (cos x)))
double code(double x) {
return exp(((x * x) * 10.0)) * cos(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = exp(((x * x) * 10.0d0)) * cos(x)
end function
public static double code(double x) {
return Math.exp(((x * x) * 10.0)) * Math.cos(x);
}
def code(x): return math.exp(((x * x) * 10.0)) * math.cos(x)
function code(x) return Float64(exp(Float64(Float64(x * x) * 10.0)) * cos(x)) end
function tmp = code(x) tmp = exp(((x * x) * 10.0)) * cos(x); end
code[x_] := N[(N[Exp[N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\left(x \cdot x\right) \cdot 10} \cdot \cos x
\end{array}
Initial program 94.5%
Final simplification94.5%
(FPCore (x) :precision binary64 (* (fma (fma (fma -0.001388888888888889 (* x x) 0.041666666666666664) (* x x) -0.5) (* x x) 1.0) (exp (* (* x x) 10.0))))
double code(double x) {
return fma(fma(fma(-0.001388888888888889, (x * x), 0.041666666666666664), (x * x), -0.5), (x * x), 1.0) * exp(((x * x) * 10.0));
}
function code(x) return Float64(fma(fma(fma(-0.001388888888888889, Float64(x * x), 0.041666666666666664), Float64(x * x), -0.5), Float64(x * x), 1.0) * exp(Float64(Float64(x * x) * 10.0))) end
code[x_] := N[(N[(N[(N[(-0.001388888888888889 * N[(x * x), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] * N[(x * x), $MachinePrecision] + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, x \cdot x, 0.041666666666666664\right), x \cdot x, -0.5\right), x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10}
\end{array}
Initial program 94.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6427.6
Applied rewrites27.6%
Final simplification27.6%
(FPCore (x) :precision binary64 (* (fma (fma 0.041666666666666664 (* x x) -0.5) (* x x) 1.0) (exp (* (* x x) 10.0))))
double code(double x) {
return fma(fma(0.041666666666666664, (x * x), -0.5), (x * x), 1.0) * exp(((x * x) * 10.0));
}
function code(x) return Float64(fma(fma(0.041666666666666664, Float64(x * x), -0.5), Float64(x * x), 1.0) * exp(Float64(Float64(x * x) * 10.0))) end
code[x_] := N[(N[(N[(0.041666666666666664 * N[(x * x), $MachinePrecision] + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x \cdot x, -0.5\right), x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10}
\end{array}
Initial program 94.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6421.3
Applied rewrites21.3%
Final simplification21.3%
(FPCore (x) :precision binary64 (* (fma -0.5 (* x x) 1.0) (exp (* (* x x) 10.0))))
double code(double x) {
return fma(-0.5, (x * x), 1.0) * exp(((x * x) * 10.0));
}
function code(x) return Float64(fma(-0.5, Float64(x * x), 1.0) * exp(Float64(Float64(x * x) * 10.0))) end
code[x_] := N[(N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot e^{\left(x \cdot x\right) \cdot 10}
\end{array}
Initial program 94.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6418.2
Applied rewrites18.2%
Final simplification18.2%
(FPCore (x) :precision binary64 (* (fma (* (fma (fma 166.66666666666666 (* x x) 50.0) (* x x) 10.0) x) x 1.0) (fma -0.5 (* x x) 1.0)))
double code(double x) {
return fma((fma(fma(166.66666666666666, (x * x), 50.0), (x * x), 10.0) * x), x, 1.0) * fma(-0.5, (x * x), 1.0);
}
function code(x) return Float64(fma(Float64(fma(fma(166.66666666666666, Float64(x * x), 50.0), Float64(x * x), 10.0) * x), x, 1.0) * fma(-0.5, Float64(x * x), 1.0)) end
code[x_] := N[(N[(N[(N[(N[(166.66666666666666 * N[(x * x), $MachinePrecision] + 50.0), $MachinePrecision] * N[(x * x), $MachinePrecision] + 10.0), $MachinePrecision] * x), $MachinePrecision] * x + 1.0), $MachinePrecision] * N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(166.66666666666666, x \cdot x, 50\right), x \cdot x, 10\right) \cdot x, x, 1\right) \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right)
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
pow-unpowN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f6497.9
Applied rewrites97.9%
Taylor expanded in x around 0
Applied rewrites9.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f649.7
Applied rewrites9.7%
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
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6410.3
Applied rewrites10.3%
Final simplification10.3%
(FPCore (x) :precision binary64 (* (fma (fma 50.0 (* x x) 10.0) (* x x) 1.0) (fma -0.5 (* x x) 1.0)))
double code(double x) {
return fma(fma(50.0, (x * x), 10.0), (x * x), 1.0) * fma(-0.5, (x * x), 1.0);
}
function code(x) return Float64(fma(fma(50.0, Float64(x * x), 10.0), Float64(x * x), 1.0) * fma(-0.5, Float64(x * x), 1.0)) end
code[x_] := N[(N[(N[(50.0 * N[(x * x), $MachinePrecision] + 10.0), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(50, x \cdot x, 10\right), x \cdot x, 1\right) \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right)
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
pow-unpowN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f6497.9
Applied rewrites97.9%
Taylor expanded in x around 0
Applied rewrites9.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f649.7
Applied rewrites9.7%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6410.1
Applied rewrites10.1%
Final simplification10.1%
(FPCore (x) :precision binary64 (* (fma 10.0 (* x x) 1.0) (fma -0.5 (* x x) 1.0)))
double code(double x) {
return fma(10.0, (x * x), 1.0) * fma(-0.5, (x * x), 1.0);
}
function code(x) return Float64(fma(10.0, Float64(x * x), 1.0) * fma(-0.5, Float64(x * x), 1.0)) end
code[x_] := N[(N[(10.0 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(10, x \cdot x, 1\right) \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right)
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
pow-unpowN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f6497.9
Applied rewrites97.9%
Taylor expanded in x around 0
Applied rewrites9.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f649.7
Applied rewrites9.7%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f649.9
Applied rewrites9.9%
Final simplification9.9%
(FPCore (x) :precision binary64 (* 1.0 (* -0.5 (* x x))))
double code(double x) {
return 1.0 * (-0.5 * (x * x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 * ((-0.5d0) * (x * x))
end function
public static double code(double x) {
return 1.0 * (-0.5 * (x * x));
}
def code(x): return 1.0 * (-0.5 * (x * x))
function code(x) return Float64(1.0 * Float64(-0.5 * Float64(x * x))) end
function tmp = code(x) tmp = 1.0 * (-0.5 * (x * x)); end
code[x_] := N[(1.0 * N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot \left(-0.5 \cdot \left(x \cdot x\right)\right)
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
pow-unpowN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f6497.9
Applied rewrites97.9%
Taylor expanded in x around 0
Applied rewrites9.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f649.7
Applied rewrites9.7%
Taylor expanded in x around inf
Applied rewrites9.7%
Final simplification9.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 2024249
(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)))))