
(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 19 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 x))))
double code(double x) {
return cos(x) * pow(pow(exp(20.0), x), (0.5 * x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * ((exp(20.0d0) ** x) ** (0.5d0 * x))
end function
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.pow(Math.exp(20.0), x), (0.5 * x));
}
def code(x): return math.cos(x) * math.pow(math.pow(math.exp(20.0), x), (0.5 * x))
function code(x) return Float64(cos(x) * ((exp(20.0) ^ x) ^ Float64(0.5 * x))) end
function tmp = code(x) tmp = cos(x) * ((exp(20.0) ^ x) ^ (0.5 * x)); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Power[N[Exp[20.0], $MachinePrecision], x], $MachinePrecision], N[(0.5 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left({\left(e^{20}\right)}^{x}\right)}^{\left(0.5 \cdot x\right)}
\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
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
exp-lft-sqr-revN/A
metadata-evalN/A
metadata-evalN/A
lower-exp.f64N/A
metadata-eval99.4
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
metadata-evalN/A
lower-*.f6499.4
Applied rewrites99.4%
(FPCore (x) :precision binary64 (* (sin (fma (PI) 0.5 (- x))) (pow (pow (exp 10.0) (* (- x) x)) -1.0)))
\begin{array}{l}
\\
\sin \left(\mathsf{fma}\left(\mathsf{PI}\left(\right), 0.5, -x\right)\right) \cdot {\left({\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}\right)}^{-1}
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
sqr-neg-revN/A
distribute-lft-neg-outN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f6495.3
Applied rewrites95.3%
lift-cos.f64N/A
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2-revN/A
lift-PI.f64N/A
div-invN/A
metadata-evalN/A
+-commutativeN/A
lift-fma.f64N/A
lower-sin.f6495.3
Applied rewrites95.3%
Final simplification95.3%
(FPCore (x) :precision binary64 (* (cos x) (pow (pow (exp 10.0) (* (- x) x)) -1.0)))
double code(double x) {
return cos(x) * pow(pow(exp(10.0), (-x * x)), -1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * ((exp(10.0d0) ** (-x * x)) ** (-1.0d0))
end function
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.pow(Math.exp(10.0), (-x * x)), -1.0);
}
def code(x): return math.cos(x) * math.pow(math.pow(math.exp(10.0), (-x * x)), -1.0)
function code(x) return Float64(cos(x) * ((exp(10.0) ^ Float64(Float64(-x) * x)) ^ -1.0)) end
function tmp = code(x) tmp = cos(x) * ((exp(10.0) ^ (-x * x)) ^ -1.0); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Power[N[Exp[10.0], $MachinePrecision], N[((-x) * x), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left({\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}\right)}^{-1}
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
sqr-neg-revN/A
distribute-lft-neg-outN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f6495.3
Applied rewrites95.3%
Final simplification95.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) ^ Float64(-x)) ^ Float64(-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)}^{\left(-x\right)}\right)}^{\left(-x\right)}
\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
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-powN/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-powN/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqr-powN/A
lift-*.f64N/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
pow-unpowN/A
lower-pow.f64N/A
Applied rewrites98.0%
(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.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.f6498.0
Applied rewrites98.0%
(FPCore (x) :precision binary64 (* (cos x) (pow (pow (exp x) 10.0) x)))
double code(double x) {
return cos(x) * pow(pow(exp(x), 10.0), x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * ((exp(x) ** 10.0d0) ** x)
end function
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.pow(Math.exp(x), 10.0), x);
}
def code(x): return math.cos(x) * math.pow(math.pow(math.exp(x), 10.0), x)
function code(x) return Float64(cos(x) * ((exp(x) ^ 10.0) ^ x)) end
function tmp = code(x) tmp = cos(x) * ((exp(x) ^ 10.0) ^ x); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Power[N[Exp[x], $MachinePrecision], 10.0], $MachinePrecision], x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left({\left(e^{x}\right)}^{10}\right)}^{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%
(FPCore (x)
:precision binary64
(*
(sin
(*
(fma x x (* (* (PI) (PI)) (- 0.25)))
(pow
(* (fma (* 0.25 (PI)) (PI) (* (- x) x)) (/ -1.0 (fma 0.5 (PI) x)))
-1.0)))
(exp (* 10.0 (* x x)))))\begin{array}{l}
\\
\sin \left(\mathsf{fma}\left(x, x, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(-0.25\right)\right) \cdot {\left(\mathsf{fma}\left(0.25 \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), \left(-x\right) \cdot x\right) \cdot \frac{-1}{\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), x\right)}\right)}^{-1}\right) \cdot e^{10 \cdot \left(x \cdot x\right)}
\end{array}
Initial program 94.5%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
metadata-evalN/A
lower-PI.f6494.5
Applied rewrites94.5%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites94.1%
lift-/.f64N/A
frac-2negN/A
div-invN/A
lower-*.f64N/A
Applied rewrites94.4%
lift-fma.f64N/A
flip-+N/A
div-invN/A
lower-*.f64N/A
Applied rewrites94.8%
Final simplification94.8%
(FPCore (x)
:precision binary64
(*
(sin
(*
(fma x x (* (* (PI) (PI)) (- 0.25)))
(pow (/ (fma (* 0.25 (PI)) (PI) (* (- x) x)) (- (* (PI) -0.5) x)) -1.0)))
(exp (* 10.0 (* x x)))))\begin{array}{l}
\\
\sin \left(\mathsf{fma}\left(x, x, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \left(-0.25\right)\right) \cdot {\left(\frac{\mathsf{fma}\left(0.25 \cdot \mathsf{PI}\left(\right), \mathsf{PI}\left(\right), \left(-x\right) \cdot x\right)}{\mathsf{PI}\left(\right) \cdot -0.5 - x}\right)}^{-1}\right) \cdot e^{10 \cdot \left(x \cdot x\right)}
\end{array}
Initial program 94.5%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
metadata-evalN/A
lower-PI.f6494.5
Applied rewrites94.5%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites94.1%
lift-/.f64N/A
frac-2negN/A
div-invN/A
lower-*.f64N/A
Applied rewrites94.4%
lift-neg.f64N/A
lift-fma.f64N/A
distribute-neg-inN/A
lift-neg.f64N/A
remove-double-negN/A
flip-+N/A
sqr-neg-revN/A
sqr-neg-revN/A
lift-neg.f64N/A
lift-neg.f64N/A
lower-/.f64N/A
Applied rewrites94.7%
Final simplification94.7%
(FPCore (x) :precision binary64 (* (cos x) (pow (exp (* -10.0 (* x x))) -1.0)))
double code(double x) {
return cos(x) * pow(exp((-10.0 * (x * x))), -1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * (exp(((-10.0d0) * (x * x))) ** (-1.0d0))
end function
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.exp((-10.0 * (x * x))), -1.0);
}
def code(x): return math.cos(x) * math.pow(math.exp((-10.0 * (x * x))), -1.0)
function code(x) return Float64(cos(x) * (exp(Float64(-10.0 * Float64(x * x))) ^ -1.0)) end
function tmp = code(x) tmp = cos(x) * (exp((-10.0 * (x * x))) ^ -1.0); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Exp[N[(-10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left(e^{-10 \cdot \left(x \cdot x\right)}\right)}^{-1}
\end{array}
Initial program 94.5%
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
lower-/.f64N/A
lower-exp.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval94.5
Applied rewrites94.5%
Final simplification94.5%
(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.3
Applied rewrites95.3%
(FPCore (x) :precision binary64 (* (sin (/ (fma (- x) x (* (* (PI) (PI)) 0.25)) (fma (PI) 0.5 (- x)))) (exp (* 10.0 (* x x)))))
\begin{array}{l}
\\
\sin \left(\frac{\mathsf{fma}\left(-x, x, \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 0.25\right)}{\mathsf{fma}\left(\mathsf{PI}\left(\right), 0.5, -x\right)}\right) \cdot e^{10 \cdot \left(x \cdot x\right)}
\end{array}
Initial program 94.5%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
metadata-evalN/A
lower-PI.f6494.5
Applied rewrites94.5%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites94.1%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6494.6
Applied rewrites94.6%
(FPCore (x) :precision binary64 (* (sin (* (fma (/ (PI) x) 0.5 1.0) x)) (exp (* 10.0 (* x x)))))
\begin{array}{l}
\\
\sin \left(\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{x}, 0.5, 1\right) \cdot x\right) \cdot e^{10 \cdot \left(x \cdot x\right)}
\end{array}
Initial program 94.5%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
+-commutativeN/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
metadata-evalN/A
lower-PI.f6494.5
Applied rewrites94.5%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites94.1%
lift-/.f64N/A
lift-fma.f64N/A
+-commutativeN/A
div-addN/A
div-invN/A
lower-fma.f64N/A
inv-powN/A
lower-pow.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.9%
Taylor expanded in x around inf
*-commutativeN/A
associate-+r+N/A
associate-+r+N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
Applied rewrites94.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.5%
(FPCore (x) :precision binary64 (* (fma (fma (fma -0.001388888888888889 (* x x) 0.041666666666666664) (* x x) -0.5) (* x x) 1.0) (exp (* 10.0 (* x x)))))
double code(double x) {
return fma(fma(fma(-0.001388888888888889, (x * x), 0.041666666666666664), (x * x), -0.5), (x * x), 1.0) * exp((10.0 * (x * x)));
}
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(10.0 * Float64(x * x)))) 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[(10.0 * N[(x * x), $MachinePrecision]), $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^{10 \cdot \left(x \cdot x\right)}
\end{array}
Initial program 94.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/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%
(FPCore (x) :precision binary64 (* (fma (fma 0.041666666666666664 (* x x) -0.5) (* x x) 1.0) (exp (* 10.0 (* x x)))))
double code(double x) {
return fma(fma(0.041666666666666664, (x * x), -0.5), (x * x), 1.0) * exp((10.0 * (x * x)));
}
function code(x) return Float64(fma(fma(0.041666666666666664, Float64(x * x), -0.5), Float64(x * x), 1.0) * exp(Float64(10.0 * Float64(x * x)))) 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[(10.0 * N[(x * x), $MachinePrecision]), $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^{10 \cdot \left(x \cdot x\right)}
\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%
(FPCore (x) :precision binary64 (* (fma -0.5 (* x x) 1.0) (exp (* 10.0 (* x x)))))
double code(double x) {
return fma(-0.5, (x * x), 1.0) * exp((10.0 * (x * x)));
}
function code(x) return Float64(fma(-0.5, Float64(x * x), 1.0) * exp(Float64(10.0 * Float64(x * x)))) end
code[x_] := N[(N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.5, x \cdot x, 1\right) \cdot e^{10 \cdot \left(x \cdot x\right)}
\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%
(FPCore (x) :precision binary64 (* (cos x) (fma 10.0 (* x x) 1.0)))
double code(double x) {
return cos(x) * fma(10.0, (x * x), 1.0);
}
function code(x) return Float64(cos(x) * fma(10.0, Float64(x * x), 1.0)) end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[(10.0 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \mathsf{fma}\left(10, x \cdot x, 1\right)
\end{array}
Initial program 94.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f649.8
Applied rewrites9.8%
(FPCore (x) :precision binary64 (* (* (* -0.5 x) x) 1.0))
double code(double x) {
return ((-0.5 * x) * x) * 1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (((-0.5d0) * x) * x) * 1.0d0
end function
public static double code(double x) {
return ((-0.5 * x) * x) * 1.0;
}
def code(x): return ((-0.5 * x) * x) * 1.0
function code(x) return Float64(Float64(Float64(-0.5 * x) * x) * 1.0) end
function tmp = code(x) tmp = ((-0.5 * x) * x) * 1.0; end
code[x_] := N[(N[(N[(-0.5 * x), $MachinePrecision] * x), $MachinePrecision] * 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-0.5 \cdot x\right) \cdot x\right) \cdot 1
\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
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
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 2024305
(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)))))