
(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 (/ (cos x) (pow (pow (exp 20.0) x) (/ x -2.0))))
double code(double x) {
return cos(x) / pow(pow(exp(20.0), x), (x / -2.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) / ((exp(20.0d0) ** x) ** (x / (-2.0d0)))
end function
public static double code(double x) {
return Math.cos(x) / Math.pow(Math.pow(Math.exp(20.0), x), (x / -2.0));
}
def code(x): return math.cos(x) / math.pow(math.pow(math.exp(20.0), x), (x / -2.0))
function code(x) return Float64(cos(x) / ((exp(20.0) ^ x) ^ Float64(x / -2.0))) end
function tmp = code(x) tmp = cos(x) / ((exp(20.0) ^ x) ^ (x / -2.0)); end
code[x_] := N[(N[Cos[x], $MachinePrecision] / N[Power[N[Power[N[Exp[20.0], $MachinePrecision], x], $MachinePrecision], N[(x / -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos x}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(\frac{x}{-2}\right)}}
\end{array}
Initial program 94.5%
lift-*.f64N/A
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
associate-*r/N/A
lift-cos.f64N/A
sin-PI/2N/A
lower-/.f64N/A
lift-cos.f64N/A
sin-PI/2N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites94.5%
lift-exp.f64N/A
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lift-*.f64N/A
pow-expN/A
lift-exp.f64N/A
sqr-powN/A
pow-prod-downN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
pow-unpowN/A
lower-pow.f64N/A
Applied rewrites99.5%
lift-*.f64N/A
*-lft-identity99.5
Applied rewrites99.5%
(FPCore (x) :precision binary64 (* (sin (+ (- (+ (/ (PI) 2.0) x)) (PI))) (pow (pow (exp 10.0) (* (- x) x)) -1.0)))
\begin{array}{l}
\\
\sin \left(\left(-\left(\frac{\mathsf{PI}\left(\right)}{2} + x\right)\right) + \mathsf{PI}\left(\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-rgt-neg-outN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-neg.f6495.3
Applied rewrites95.3%
remove-double-negN/A
lift-cos.f64N/A
sin-+PI/2-revN/A
sin-neg-revN/A
sin-+PI-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-PI.f6495.4
Applied rewrites95.4%
Final simplification95.4%
(FPCore (x) :precision binary64 (* (sin (- (/ (PI) 2.0) x)) (pow (pow (exp 10.0) (* (- x) x)) -1.0)))
\begin{array}{l}
\\
\sin \left(\frac{\mathsf{PI}\left(\right)}{2} - x\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-rgt-neg-outN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-exp.f64N/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
lower-sin.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-PI.f6495.4
Applied rewrites95.4%
Final simplification95.4%
(FPCore (x) :precision binary64 (* (cos x) (pow (pow (exp 20.0) x) (/ x 2.0))))
double code(double x) {
return cos(x) * pow(pow(exp(20.0), x), (x / 2.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * ((exp(20.0d0) ** x) ** (x / 2.0d0))
end function
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.pow(Math.exp(20.0), x), (x / 2.0));
}
def code(x): return math.cos(x) * math.pow(math.pow(math.exp(20.0), x), (x / 2.0))
function code(x) return Float64(cos(x) * ((exp(20.0) ^ x) ^ Float64(x / 2.0))) end
function tmp = code(x) tmp = cos(x) * ((exp(20.0) ^ x) ^ (x / 2.0)); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Power[N[Exp[20.0], $MachinePrecision], x], $MachinePrecision], N[(x / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left({\left(e^{20}\right)}^{x}\right)}^{\left(\frac{x}{2}\right)}
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
sqr-neg-revN/A
pow-unpowN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f6498.1
Applied rewrites98.1%
lift-/.f64N/A
lift-pow.f64N/A
pow-flipN/A
lift-neg.f64N/A
lift-pow.f64N/A
pow-powN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqr-neg-revN/A
pow-unpowN/A
sqr-powN/A
pow-prod-downN/A
unpow-prod-downN/A
lift-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift-*.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
exp-lft-sqr-revN/A
lower-exp.f64N/A
metadata-evalN/A
lower-/.f6499.3
Applied rewrites99.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) ^ 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)}^{x}\right)}^{\left(-x\right)}
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lift-*.f64N/A
sqr-neg-revN/A
pow-unpowN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f6498.1
Applied rewrites98.1%
lift-/.f64N/A
lift-pow.f64N/A
pow-flipN/A
lift-neg.f64N/A
lower-pow.f6498.1
lift-pow.f64N/A
lift-exp.f64N/A
pow-expN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6496.8
Applied rewrites96.8%
lift-pow.f64N/A
lift-exp.f64N/A
pow-expN/A
*-commutativeN/A
pow-expN/A
lower-pow.f64N/A
lower-exp.f6498.2
Applied rewrites98.2%
(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.f6497.9
Applied rewrites97.9%
(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 -1.5 (PI) x)) (pow (exp -10.0) (* x x))))
\begin{array}{l}
\\
\frac{\sin \left(\mathsf{fma}\left(-1.5, \mathsf{PI}\left(\right), x\right)\right)}{{\left(e^{-10}\right)}^{\left(x \cdot x\right)}}
\end{array}
Initial program 94.5%
lift-*.f64N/A
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
associate-*r/N/A
lift-cos.f64N/A
sin-PI/2N/A
lower-/.f64N/A
lift-cos.f64N/A
sin-PI/2N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites94.5%
remove-double-negN/A
*-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
*-lft-identityN/A
lift-cos.f64N/A
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2-revN/A
sin-+PI-revN/A
sin-neg-revN/A
lower-sin.f64N/A
lower-neg.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-PI.f6494.4
Applied rewrites94.4%
Taylor expanded in x around inf
Applied rewrites95.3%
(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 (+ (+ (+ (PI) x) (PI)) (/ (PI) 2.0))) (exp (* -10.0 (* x x)))))
\begin{array}{l}
\\
\frac{\sin \left(\left(\left(\mathsf{PI}\left(\right) + x\right) + \mathsf{PI}\left(\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}{e^{-10 \cdot \left(x \cdot x\right)}}
\end{array}
Initial program 94.5%
lift-*.f64N/A
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
associate-*r/N/A
lift-cos.f64N/A
sin-PI/2N/A
lower-/.f64N/A
lift-cos.f64N/A
sin-PI/2N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites94.5%
remove-double-negN/A
*-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
*-lft-identityN/A
lift-cos.f64N/A
cos-+PI-revN/A
cos-+PI-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f64N/A
lower-PI.f64N/A
lower-/.f64N/A
lower-PI.f6494.6
Applied rewrites94.6%
Final simplification94.6%
(FPCore (x) :precision binary64 (* (sin (+ (- x) (/ (PI) 2.0))) (exp (* 10.0 (* x x)))))
\begin{array}{l}
\\
\sin \left(\left(-x\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot e^{10 \cdot \left(x \cdot x\right)}
\end{array}
Initial program 94.5%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-PI.f6494.5
Applied rewrites94.5%
(FPCore (x) :precision binary64 (/ (cos (+ (+ (PI) x) (PI))) (exp (* -10.0 (* x x)))))
\begin{array}{l}
\\
\frac{\cos \left(\left(\mathsf{PI}\left(\right) + x\right) + \mathsf{PI}\left(\right)\right)}{e^{-10 \cdot \left(x \cdot x\right)}}
\end{array}
Initial program 94.5%
lift-*.f64N/A
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
associate-*r/N/A
lift-cos.f64N/A
sin-PI/2N/A
lower-/.f64N/A
lift-cos.f64N/A
sin-PI/2N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites94.5%
remove-double-negN/A
*-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
*-lft-identityN/A
lift-cos.f64N/A
cos-+PI-revN/A
cos-+PI-revN/A
lower-cos.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f64N/A
lower-PI.f6494.6
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}
\\
\frac{\cos x}{e^{-10 \cdot \left(x \cdot x\right)}}
\end{array}
Initial program 94.5%
lift-*.f64N/A
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
associate-*r/N/A
lift-cos.f64N/A
sin-PI/2N/A
lower-/.f64N/A
lift-cos.f64N/A
sin-PI/2N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites94.5%
lift-exp.f64N/A
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lift-*.f64N/A
pow-expN/A
lift-exp.f64N/A
sqr-powN/A
pow-prod-downN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
pow-unpowN/A
lower-pow.f64N/A
Applied rewrites99.5%
lift-*.f64N/A
*-lft-identity99.5
Applied rewrites99.5%
lift-pow.f64N/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
distribute-frac-negN/A
pow-negN/A
lift-pow.f64N/A
pow-unpowN/A
lift-exp.f64N/A
associate-/l*N/A
pow-expN/A
*-commutativeN/A
exp-prodN/A
associate-/l*N/A
pow-expN/A
lift-exp.f64N/A
metadata-evalN/A
pow-powN/A
pow2N/A
sqr-powN/A
lift-exp.f64N/A
pow-expN/A
lift-*.f64N/A
pow-expN/A
*-commutativeN/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 (- (* 0.041666666666666664 (* x x)) 0.5) (* x x) 1.0) (exp (* 10.0 (* x x)))))
double code(double x) {
return fma(((0.041666666666666664 * (x * x)) - 0.5), (x * x), 1.0) * exp((10.0 * (x * x)));
}
function code(x) return Float64(fma(Float64(Float64(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.041666666666666664 * N[(x * x), $MachinePrecision]), $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(0.041666666666666664 \cdot \left(x \cdot x\right) - 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
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.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 (* (fma (* -0.5 x) x 1.0) (fma 10.0 (* x x) 1.0)))
double code(double x) {
return fma((-0.5 * x), x, 1.0) * fma(10.0, (x * x), 1.0);
}
function code(x) return Float64(fma(Float64(-0.5 * x), x, 1.0) * fma(10.0, Float64(x * x), 1.0)) end
code[x_] := N[(N[(N[(-0.5 * x), $MachinePrecision] * x + 1.0), $MachinePrecision] * N[(10.0 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.5 \cdot x, x, 1\right) \cdot \mathsf{fma}\left(10, x \cdot x, 1\right)
\end{array}
Initial program 94.5%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
sqr-powN/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
unpow2N/A
exp-lft-sqr-revN/A
rem-log-expN/A
metadata-evalN/A
metadata-evalN/A
unpow2N/A
lower-*.f649.8
Applied rewrites9.8%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f649.9
Applied rewrites9.9%
(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 2024338
(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)))))