
(FPCore (x) :precision binary64 (exp (- (- 1.0 (* x x)))))
double code(double x) {
return exp(-(1.0 - (x * x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = exp(-(1.0d0 - (x * x)))
end function
public static double code(double x) {
return Math.exp(-(1.0 - (x * x)));
}
def code(x): return math.exp(-(1.0 - (x * x)))
function code(x) return exp(Float64(-Float64(1.0 - Float64(x * x)))) end
function tmp = code(x) tmp = exp(-(1.0 - (x * x))); end
code[x_] := N[Exp[(-N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision])], $MachinePrecision]
\begin{array}{l}
\\
e^{-\left(1 - x \cdot x\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (exp (- (- 1.0 (* x x)))))
double code(double x) {
return exp(-(1.0 - (x * x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = exp(-(1.0d0 - (x * x)))
end function
public static double code(double x) {
return Math.exp(-(1.0 - (x * x)));
}
def code(x): return math.exp(-(1.0 - (x * x)))
function code(x) return exp(Float64(-Float64(1.0 - Float64(x * x)))) end
function tmp = code(x) tmp = exp(-(1.0 - (x * x))); end
code[x_] := N[Exp[(-N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision])], $MachinePrecision]
\begin{array}{l}
\\
e^{-\left(1 - x \cdot x\right)}
\end{array}
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (pow (exp (+ x_m -1.0)) (+ x_m 1.0)))
x_m = fabs(x);
double code(double x_m) {
return pow(exp((x_m + -1.0)), (x_m + 1.0));
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
code = exp((x_m + (-1.0d0))) ** (x_m + 1.0d0)
end function
x_m = Math.abs(x);
public static double code(double x_m) {
return Math.pow(Math.exp((x_m + -1.0)), (x_m + 1.0));
}
x_m = math.fabs(x) def code(x_m): return math.pow(math.exp((x_m + -1.0)), (x_m + 1.0))
x_m = abs(x) function code(x_m) return exp(Float64(x_m + -1.0)) ^ Float64(x_m + 1.0) end
x_m = abs(x); function tmp = code(x_m) tmp = exp((x_m + -1.0)) ^ (x_m + 1.0); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[Power[N[Exp[N[(x$95$m + -1.0), $MachinePrecision]], $MachinePrecision], N[(x$95$m + 1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
{\left(e^{x\_m + -1}\right)}^{\left(x\_m + 1\right)}
\end{array}
Initial program 99.9%
lift-*.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
exp-sumN/A
metadata-evalN/A
rec-expN/A
associate-/r/N/A
clear-numN/A
lower-/.f64N/A
lower-exp.f64N/A
exp-1-eN/A
lower-E.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
e-exp-1N/A
div-expN/A
lift-*.f64N/A
difference-of-sqr-1N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-+.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64100.0
Applied rewrites100.0%
lift-+.f64N/A
lift-+.f64N/A
pow-expN/A
*-commutativeN/A
exp-prodN/A
Applied rewrites100.0%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(let* ((t_0 (* x_m (* x_m x_m))))
(if (<= (exp (+ -1.0 (* x_m x_m))) 0.5)
(/ (fma (* x_m (fma x_m (* (* x_m x_m) 0.5) x_m)) E E) (* E E))
(fma
(* x_m x_m)
(fma
(* x_m x_m)
(* (fma t_0 (* t_0 0.004629629629629629) 0.125) 4.0)
1.0)
1.0))))x_m = fabs(x);
double code(double x_m) {
double t_0 = x_m * (x_m * x_m);
double tmp;
if (exp((-1.0 + (x_m * x_m))) <= 0.5) {
tmp = fma((x_m * fma(x_m, ((x_m * x_m) * 0.5), x_m)), ((double) M_E), ((double) M_E)) / (((double) M_E) * ((double) M_E));
} else {
tmp = fma((x_m * x_m), fma((x_m * x_m), (fma(t_0, (t_0 * 0.004629629629629629), 0.125) * 4.0), 1.0), 1.0);
}
return tmp;
}
x_m = abs(x) function code(x_m) t_0 = Float64(x_m * Float64(x_m * x_m)) tmp = 0.0 if (exp(Float64(-1.0 + Float64(x_m * x_m))) <= 0.5) tmp = Float64(fma(Float64(x_m * fma(x_m, Float64(Float64(x_m * x_m) * 0.5), x_m)), exp(1), exp(1)) / Float64(exp(1) * exp(1))); else tmp = fma(Float64(x_m * x_m), fma(Float64(x_m * x_m), Float64(fma(t_0, Float64(t_0 * 0.004629629629629629), 0.125) * 4.0), 1.0), 1.0); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[(x$95$m * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Exp[N[(-1.0 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.5], N[(N[(N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.5), $MachinePrecision] + x$95$m), $MachinePrecision]), $MachinePrecision] * E + E), $MachinePrecision] / N[(E * E), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(t$95$0 * N[(t$95$0 * 0.004629629629629629), $MachinePrecision] + 0.125), $MachinePrecision] * 4.0), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := x\_m \cdot \left(x\_m \cdot x\_m\right)\\
\mathbf{if}\;e^{-1 + x\_m \cdot x\_m} \leq 0.5:\\
\;\;\;\;\frac{\mathsf{fma}\left(x\_m \cdot \mathsf{fma}\left(x\_m, \left(x\_m \cdot x\_m\right) \cdot 0.5, x\_m\right), e, e\right)}{e \cdot e}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(t\_0, t\_0 \cdot 0.004629629629629629, 0.125\right) \cdot 4, 1\right), 1\right)\\
\end{array}
\end{array}
if (exp.f64 (neg.f64 (-.f64 #s(literal 1 binary64) (*.f64 x x)))) < 0.5Initial program 100.0%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
distribute-rgt-inN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
associate-+l+N/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
lift-E.f64N/A
frac-2negN/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
metadata-evalN/A
frac-2negN/A
lift-/.f64N/A
lift-fma.f64N/A
distribute-rgt-inN/A
lift-/.f64N/A
un-div-invN/A
Applied rewrites100.0%
if 0.5 < (exp.f64 (neg.f64 (-.f64 #s(literal 1 binary64) (*.f64 x x)))) Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/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-*.f6481.8
Applied rewrites81.8%
lift-*.f64N/A
flip3-+N/A
div-invN/A
lower-*.f64N/A
unpow-prod-downN/A
lower-fma.f64N/A
cube-multN/A
lift-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
cube-multN/A
lift-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites11.7%
Taylor expanded in x around 0
Applied rewrites90.8%
Final simplification95.5%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(if (<= (exp (+ -1.0 (* x_m x_m))) 0.5)
(/ (fma (* x_m (fma x_m (* (* x_m x_m) 0.5) x_m)) E E) (* E E))
(fma
(* x_m x_m)
(fma (* x_m x_m) (fma x_m (* x_m 0.16666666666666666) 0.5) 1.0)
1.0)))x_m = fabs(x);
double code(double x_m) {
double tmp;
if (exp((-1.0 + (x_m * x_m))) <= 0.5) {
tmp = fma((x_m * fma(x_m, ((x_m * x_m) * 0.5), x_m)), ((double) M_E), ((double) M_E)) / (((double) M_E) * ((double) M_E));
} else {
tmp = fma((x_m * x_m), fma((x_m * x_m), fma(x_m, (x_m * 0.16666666666666666), 0.5), 1.0), 1.0);
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (exp(Float64(-1.0 + Float64(x_m * x_m))) <= 0.5) tmp = Float64(fma(Float64(x_m * fma(x_m, Float64(Float64(x_m * x_m) * 0.5), x_m)), exp(1), exp(1)) / Float64(exp(1) * exp(1))); else tmp = fma(Float64(x_m * x_m), fma(Float64(x_m * x_m), fma(x_m, Float64(x_m * 0.16666666666666666), 0.5), 1.0), 1.0); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[Exp[N[(-1.0 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.5], N[(N[(N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.5), $MachinePrecision] + x$95$m), $MachinePrecision]), $MachinePrecision] * E + E), $MachinePrecision] / N[(E * E), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(x$95$m * N[(x$95$m * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;e^{-1 + x\_m \cdot x\_m} \leq 0.5:\\
\;\;\;\;\frac{\mathsf{fma}\left(x\_m \cdot \mathsf{fma}\left(x\_m, \left(x\_m \cdot x\_m\right) \cdot 0.5, x\_m\right), e, e\right)}{e \cdot e}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(x\_m, x\_m \cdot 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (exp.f64 (neg.f64 (-.f64 #s(literal 1 binary64) (*.f64 x x)))) < 0.5Initial program 100.0%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
distribute-rgt-inN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
associate-+l+N/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
lift-E.f64N/A
frac-2negN/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
metadata-evalN/A
frac-2negN/A
lift-/.f64N/A
lift-fma.f64N/A
distribute-rgt-inN/A
lift-/.f64N/A
un-div-invN/A
Applied rewrites100.0%
if 0.5 < (exp.f64 (neg.f64 (-.f64 #s(literal 1 binary64) (*.f64 x x)))) Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/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-*.f6481.8
Applied rewrites81.8%
Final simplification91.2%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(if (<= (exp (+ -1.0 (* x_m x_m))) 0.5)
(/ (fma x_m (fma x_m (* (* x_m x_m) 0.5) x_m) 1.0) E)
(fma
(* x_m x_m)
(fma (* x_m x_m) (fma x_m (* x_m 0.16666666666666666) 0.5) 1.0)
1.0)))x_m = fabs(x);
double code(double x_m) {
double tmp;
if (exp((-1.0 + (x_m * x_m))) <= 0.5) {
tmp = fma(x_m, fma(x_m, ((x_m * x_m) * 0.5), x_m), 1.0) / ((double) M_E);
} else {
tmp = fma((x_m * x_m), fma((x_m * x_m), fma(x_m, (x_m * 0.16666666666666666), 0.5), 1.0), 1.0);
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (exp(Float64(-1.0 + Float64(x_m * x_m))) <= 0.5) tmp = Float64(fma(x_m, fma(x_m, Float64(Float64(x_m * x_m) * 0.5), x_m), 1.0) / exp(1)); else tmp = fma(Float64(x_m * x_m), fma(Float64(x_m * x_m), fma(x_m, Float64(x_m * 0.16666666666666666), 0.5), 1.0), 1.0); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[Exp[N[(-1.0 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.5], N[(N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.5), $MachinePrecision] + x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] / E), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(x$95$m * N[(x$95$m * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;e^{-1 + x\_m \cdot x\_m} \leq 0.5:\\
\;\;\;\;\frac{\mathsf{fma}\left(x\_m, \mathsf{fma}\left(x\_m, \left(x\_m \cdot x\_m\right) \cdot 0.5, x\_m\right), 1\right)}{e}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(x\_m, x\_m \cdot 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (exp.f64 (neg.f64 (-.f64 #s(literal 1 binary64) (*.f64 x x)))) < 0.5Initial program 100.0%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
distribute-rgt-inN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
associate-+l+N/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
lift-E.f64N/A
frac-2negN/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
associate-*l/N/A
neg-mul-1N/A
frac-2negN/A
lower-/.f64100.0
Applied rewrites100.0%
if 0.5 < (exp.f64 (neg.f64 (-.f64 #s(literal 1 binary64) (*.f64 x x)))) Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/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-*.f6481.8
Applied rewrites81.8%
Final simplification91.2%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(if (<= (exp (+ -1.0 (* x_m x_m))) 0.5)
(/ (fma x_m (fma x_m (* (* x_m x_m) 0.5) x_m) 1.0) E)
(fma
(* x_m x_m)
(* x_m (* x_m (fma (* x_m x_m) 0.16666666666666666 0.5)))
1.0)))x_m = fabs(x);
double code(double x_m) {
double tmp;
if (exp((-1.0 + (x_m * x_m))) <= 0.5) {
tmp = fma(x_m, fma(x_m, ((x_m * x_m) * 0.5), x_m), 1.0) / ((double) M_E);
} else {
tmp = fma((x_m * x_m), (x_m * (x_m * fma((x_m * x_m), 0.16666666666666666, 0.5))), 1.0);
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (exp(Float64(-1.0 + Float64(x_m * x_m))) <= 0.5) tmp = Float64(fma(x_m, fma(x_m, Float64(Float64(x_m * x_m) * 0.5), x_m), 1.0) / exp(1)); else tmp = fma(Float64(x_m * x_m), Float64(x_m * Float64(x_m * fma(Float64(x_m * x_m), 0.16666666666666666, 0.5))), 1.0); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[Exp[N[(-1.0 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.5], N[(N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.5), $MachinePrecision] + x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] / E), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.16666666666666666 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;e^{-1 + x\_m \cdot x\_m} \leq 0.5:\\
\;\;\;\;\frac{\mathsf{fma}\left(x\_m, \mathsf{fma}\left(x\_m, \left(x\_m \cdot x\_m\right) \cdot 0.5, x\_m\right), 1\right)}{e}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, x\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(x\_m \cdot x\_m, 0.16666666666666666, 0.5\right)\right), 1\right)\\
\end{array}
\end{array}
if (exp.f64 (neg.f64 (-.f64 #s(literal 1 binary64) (*.f64 x x)))) < 0.5Initial program 100.0%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
distribute-rgt-inN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
associate-+l+N/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
lift-E.f64N/A
frac-2negN/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
associate-*l/N/A
neg-mul-1N/A
frac-2negN/A
lower-/.f64100.0
Applied rewrites100.0%
if 0.5 < (exp.f64 (neg.f64 (-.f64 #s(literal 1 binary64) (*.f64 x x)))) Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/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-*.f6481.8
Applied rewrites81.8%
Taylor expanded in x around inf
distribute-rgt-inN/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
metadata-evalN/A
pow-plusN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
*-lft-identityN/A
unpow2N/A
Applied rewrites81.8%
Final simplification91.2%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= (exp (+ -1.0 (* x_m x_m))) 0.5) (/ (fma x_m x_m 1.0) E) (* x_m (* x_m (* x_m (* x_m 0.5))))))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if (exp((-1.0 + (x_m * x_m))) <= 0.5) {
tmp = fma(x_m, x_m, 1.0) / ((double) M_E);
} else {
tmp = x_m * (x_m * (x_m * (x_m * 0.5)));
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (exp(Float64(-1.0 + Float64(x_m * x_m))) <= 0.5) tmp = Float64(fma(x_m, x_m, 1.0) / exp(1)); else tmp = Float64(x_m * Float64(x_m * Float64(x_m * Float64(x_m * 0.5)))); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[Exp[N[(-1.0 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.5], N[(N[(x$95$m * x$95$m + 1.0), $MachinePrecision] / E), $MachinePrecision], N[(x$95$m * N[(x$95$m * N[(x$95$m * N[(x$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;e^{-1 + x\_m \cdot x\_m} \leq 0.5:\\
\;\;\;\;\frac{\mathsf{fma}\left(x\_m, x\_m, 1\right)}{e}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(x\_m \cdot \left(x\_m \cdot \left(x\_m \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if (exp.f64 (neg.f64 (-.f64 #s(literal 1 binary64) (*.f64 x x)))) < 0.5Initial program 100.0%
lift-*.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
exp-sumN/A
metadata-evalN/A
rec-expN/A
associate-/r/N/A
clear-numN/A
lower-/.f64N/A
lower-exp.f64N/A
exp-1-eN/A
lower-E.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
e-exp-1N/A
rec-expN/A
metadata-evalN/A
*-rgt-identityN/A
associate-*r/N/A
e-exp-1N/A
rec-expN/A
metadata-evalN/A
distribute-rgt1-inN/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
rec-expN/A
e-exp-1N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-E.f6499.8
Applied rewrites99.8%
if 0.5 < (exp.f64 (neg.f64 (-.f64 #s(literal 1 binary64) (*.f64 x x)))) Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6471.8
Applied rewrites71.8%
Taylor expanded in x around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
unpow3N/A
*-commutativeN/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.8
Applied rewrites71.8%
Final simplification86.3%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (/ (exp (* x_m x_m)) E))
x_m = fabs(x);
double code(double x_m) {
return exp((x_m * x_m)) / ((double) M_E);
}
x_m = Math.abs(x);
public static double code(double x_m) {
return Math.exp((x_m * x_m)) / Math.E;
}
x_m = math.fabs(x) def code(x_m): return math.exp((x_m * x_m)) / math.e
x_m = abs(x) function code(x_m) return Float64(exp(Float64(x_m * x_m)) / exp(1)) end
x_m = abs(x); function tmp = code(x_m) tmp = exp((x_m * x_m)) / 2.71828182845904523536; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[(N[Exp[N[(x$95$m * x$95$m), $MachinePrecision]], $MachinePrecision] / E), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{e^{x\_m \cdot x\_m}}{e}
\end{array}
Initial program 99.9%
lift-*.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
exp-sumN/A
metadata-evalN/A
rec-expN/A
associate-/r/N/A
clear-numN/A
lower-/.f64N/A
lower-exp.f64N/A
exp-1-eN/A
lower-E.f6499.9
Applied rewrites99.9%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (exp (fma x_m x_m -1.0)))
x_m = fabs(x);
double code(double x_m) {
return exp(fma(x_m, x_m, -1.0));
}
x_m = abs(x) function code(x_m) return exp(fma(x_m, x_m, -1.0)) end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[Exp[N[(x$95$m * x$95$m + -1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
e^{\mathsf{fma}\left(x\_m, x\_m, -1\right)}
\end{array}
Initial program 99.9%
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
lift-*.f64N/A
metadata-evalN/A
lower-fma.f6499.9
Applied rewrites99.9%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (pow E (+ x_m -1.0)))
x_m = fabs(x);
double code(double x_m) {
return pow(((double) M_E), (x_m + -1.0));
}
x_m = Math.abs(x);
public static double code(double x_m) {
return Math.pow(Math.E, (x_m + -1.0));
}
x_m = math.fabs(x) def code(x_m): return math.pow(math.e, (x_m + -1.0))
x_m = abs(x) function code(x_m) return exp(1) ^ Float64(x_m + -1.0) end
x_m = abs(x); function tmp = code(x_m) tmp = 2.71828182845904523536 ^ (x_m + -1.0); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[Power[E, N[(x$95$m + -1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
{e}^{\left(x\_m + -1\right)}
\end{array}
Initial program 99.9%
lift-*.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
exp-sumN/A
metadata-evalN/A
rec-expN/A
associate-/r/N/A
clear-numN/A
lower-/.f64N/A
lower-exp.f64N/A
exp-1-eN/A
lower-E.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
e-exp-1N/A
div-expN/A
lift-*.f64N/A
difference-of-sqr-1N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-+.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
exp-1-eN/A
lower-E.f6474.4
Applied rewrites74.4%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(let* ((t_0 (* x_m (* x_m x_m))))
(if (<= (* x_m x_m) 1e-6)
(/ (fma (* x_m (fma x_m (* (* x_m x_m) 0.5) x_m)) E E) (* E E))
(fma
(* x_m x_m)
(fma
(* x_m x_m)
(*
(fma t_0 (* t_0 0.004629629629629629) 0.125)
(fma x_m (* x_m 1.3333333333333333) 4.0))
1.0)
1.0))))x_m = fabs(x);
double code(double x_m) {
double t_0 = x_m * (x_m * x_m);
double tmp;
if ((x_m * x_m) <= 1e-6) {
tmp = fma((x_m * fma(x_m, ((x_m * x_m) * 0.5), x_m)), ((double) M_E), ((double) M_E)) / (((double) M_E) * ((double) M_E));
} else {
tmp = fma((x_m * x_m), fma((x_m * x_m), (fma(t_0, (t_0 * 0.004629629629629629), 0.125) * fma(x_m, (x_m * 1.3333333333333333), 4.0)), 1.0), 1.0);
}
return tmp;
}
x_m = abs(x) function code(x_m) t_0 = Float64(x_m * Float64(x_m * x_m)) tmp = 0.0 if (Float64(x_m * x_m) <= 1e-6) tmp = Float64(fma(Float64(x_m * fma(x_m, Float64(Float64(x_m * x_m) * 0.5), x_m)), exp(1), exp(1)) / Float64(exp(1) * exp(1))); else tmp = fma(Float64(x_m * x_m), fma(Float64(x_m * x_m), Float64(fma(t_0, Float64(t_0 * 0.004629629629629629), 0.125) * fma(x_m, Float64(x_m * 1.3333333333333333), 4.0)), 1.0), 1.0); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[(x$95$m * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x$95$m * x$95$m), $MachinePrecision], 1e-6], N[(N[(N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.5), $MachinePrecision] + x$95$m), $MachinePrecision]), $MachinePrecision] * E + E), $MachinePrecision] / N[(E * E), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(t$95$0 * N[(t$95$0 * 0.004629629629629629), $MachinePrecision] + 0.125), $MachinePrecision] * N[(x$95$m * N[(x$95$m * 1.3333333333333333), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := x\_m \cdot \left(x\_m \cdot x\_m\right)\\
\mathbf{if}\;x\_m \cdot x\_m \leq 10^{-6}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x\_m \cdot \mathsf{fma}\left(x\_m, \left(x\_m \cdot x\_m\right) \cdot 0.5, x\_m\right), e, e\right)}{e \cdot e}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(t\_0, t\_0 \cdot 0.004629629629629629, 0.125\right) \cdot \mathsf{fma}\left(x\_m, x\_m \cdot 1.3333333333333333, 4\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 9.99999999999999955e-7Initial program 100.0%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
distribute-rgt-inN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
associate-+l+N/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
lift-E.f64N/A
frac-2negN/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
metadata-evalN/A
frac-2negN/A
lift-/.f64N/A
lift-fma.f64N/A
distribute-rgt-inN/A
lift-/.f64N/A
un-div-invN/A
Applied rewrites100.0%
if 9.99999999999999955e-7 < (*.f64 x x) Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/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-*.f6481.8
Applied rewrites81.8%
lift-*.f64N/A
flip3-+N/A
div-invN/A
lower-*.f64N/A
unpow-prod-downN/A
lower-fma.f64N/A
cube-multN/A
lift-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
cube-multN/A
lift-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites11.7%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6492.3
Applied rewrites92.3%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (* (/ 1.0 E) (fma x_m (fma (fma (* x_m x_m) 0.16666666666666666 0.5) (* x_m (* x_m x_m)) x_m) 1.0)))
x_m = fabs(x);
double code(double x_m) {
return (1.0 / ((double) M_E)) * fma(x_m, fma(fma((x_m * x_m), 0.16666666666666666, 0.5), (x_m * (x_m * x_m)), x_m), 1.0);
}
x_m = abs(x) function code(x_m) return Float64(Float64(1.0 / exp(1)) * fma(x_m, fma(fma(Float64(x_m * x_m), 0.16666666666666666, 0.5), Float64(x_m * Float64(x_m * x_m)), x_m), 1.0)) end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[(N[(1.0 / E), $MachinePrecision] * N[(x$95$m * N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.16666666666666666 + 0.5), $MachinePrecision] * N[(x$95$m * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] + x$95$m), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{1}{e} \cdot \mathsf{fma}\left(x\_m, \mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.16666666666666666, 0.5\right), x\_m \cdot \left(x\_m \cdot x\_m\right), x\_m\right), 1\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+r+N/A
distribute-rgt1-inN/A
*-commutativeN/A
associate-*l*N/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
Applied rewrites91.2%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(if (<= (- 1.0 (* x_m x_m)) -500.0)
(fma
(* x_m x_m)
(* x_m (* x_m (fma (* x_m x_m) 0.16666666666666666 0.5)))
1.0)
(/ 1.0 (/ E (fma x_m x_m 1.0)))))x_m = fabs(x);
double code(double x_m) {
double tmp;
if ((1.0 - (x_m * x_m)) <= -500.0) {
tmp = fma((x_m * x_m), (x_m * (x_m * fma((x_m * x_m), 0.16666666666666666, 0.5))), 1.0);
} else {
tmp = 1.0 / (((double) M_E) / fma(x_m, x_m, 1.0));
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0) tmp = fma(Float64(x_m * x_m), Float64(x_m * Float64(x_m * fma(Float64(x_m * x_m), 0.16666666666666666, 0.5))), 1.0); else tmp = Float64(1.0 / Float64(exp(1) / fma(x_m, x_m, 1.0))); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.16666666666666666 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(1.0 / N[(E / N[(x$95$m * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, x\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(x\_m \cdot x\_m, 0.16666666666666666, 0.5\right)\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 x x)) < -500Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/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-*.f6481.8
Applied rewrites81.8%
Taylor expanded in x around inf
distribute-rgt-inN/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
metadata-evalN/A
pow-plusN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
*-lft-identityN/A
unpow2N/A
Applied rewrites81.8%
if -500 < (-.f64 #s(literal 1 binary64) (*.f64 x x)) Initial program 100.0%
lift-*.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
exp-sumN/A
metadata-evalN/A
rec-expN/A
associate-/r/N/A
clear-numN/A
lower-/.f64N/A
lower-exp.f64N/A
exp-1-eN/A
lower-E.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
e-exp-1N/A
rec-expN/A
metadata-evalN/A
*-rgt-identityN/A
associate-*r/N/A
e-exp-1N/A
rec-expN/A
metadata-evalN/A
distribute-rgt1-inN/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
rec-expN/A
e-exp-1N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-E.f6499.8
Applied rewrites99.8%
lift-fma.f64N/A
lift-E.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= (- 1.0 (* x_m x_m)) -500.0) (fma (* x_m x_m) (* (* x_m x_m) (* (* x_m x_m) 0.16666666666666666)) 1.0) (/ 1.0 (/ E (fma x_m x_m 1.0)))))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if ((1.0 - (x_m * x_m)) <= -500.0) {
tmp = fma((x_m * x_m), ((x_m * x_m) * ((x_m * x_m) * 0.16666666666666666)), 1.0);
} else {
tmp = 1.0 / (((double) M_E) / fma(x_m, x_m, 1.0));
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0) tmp = fma(Float64(x_m * x_m), Float64(Float64(x_m * x_m) * Float64(Float64(x_m * x_m) * 0.16666666666666666)), 1.0); else tmp = Float64(1.0 / Float64(exp(1) / fma(x_m, x_m, 1.0))); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(1.0 / N[(E / N[(x$95$m * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, \left(x\_m \cdot x\_m\right) \cdot \left(\left(x\_m \cdot x\_m\right) \cdot 0.16666666666666666\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 x x)) < -500Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/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-*.f6481.8
Applied rewrites81.8%
Taylor expanded in x around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.8
Applied rewrites81.8%
if -500 < (-.f64 #s(literal 1 binary64) (*.f64 x x)) Initial program 100.0%
lift-*.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
exp-sumN/A
metadata-evalN/A
rec-expN/A
associate-/r/N/A
clear-numN/A
lower-/.f64N/A
lower-exp.f64N/A
exp-1-eN/A
lower-E.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
e-exp-1N/A
rec-expN/A
metadata-evalN/A
*-rgt-identityN/A
associate-*r/N/A
e-exp-1N/A
rec-expN/A
metadata-evalN/A
distribute-rgt1-inN/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
rec-expN/A
e-exp-1N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-E.f6499.8
Applied rewrites99.8%
lift-fma.f64N/A
lift-E.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(let* ((t_0 (* x_m (* x_m x_m))))
(if (<= (- 1.0 (* x_m x_m)) -500.0)
(* 0.16666666666666666 (* t_0 t_0))
(/ 1.0 (/ E (fma x_m x_m 1.0))))))x_m = fabs(x);
double code(double x_m) {
double t_0 = x_m * (x_m * x_m);
double tmp;
if ((1.0 - (x_m * x_m)) <= -500.0) {
tmp = 0.16666666666666666 * (t_0 * t_0);
} else {
tmp = 1.0 / (((double) M_E) / fma(x_m, x_m, 1.0));
}
return tmp;
}
x_m = abs(x) function code(x_m) t_0 = Float64(x_m * Float64(x_m * x_m)) tmp = 0.0 if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0) tmp = Float64(0.16666666666666666 * Float64(t_0 * t_0)); else tmp = Float64(1.0 / Float64(exp(1) / fma(x_m, x_m, 1.0))); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[(x$95$m * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(0.16666666666666666 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(E / N[(x$95$m * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := x\_m \cdot \left(x\_m \cdot x\_m\right)\\
\mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
\;\;\;\;0.16666666666666666 \cdot \left(t\_0 \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 x x)) < -500Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/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-*.f6481.8
Applied rewrites81.8%
Taylor expanded in x around inf
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.8
Applied rewrites81.8%
if -500 < (-.f64 #s(literal 1 binary64) (*.f64 x x)) Initial program 100.0%
lift-*.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
exp-sumN/A
metadata-evalN/A
rec-expN/A
associate-/r/N/A
clear-numN/A
lower-/.f64N/A
lower-exp.f64N/A
exp-1-eN/A
lower-E.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
e-exp-1N/A
rec-expN/A
metadata-evalN/A
*-rgt-identityN/A
associate-*r/N/A
e-exp-1N/A
rec-expN/A
metadata-evalN/A
distribute-rgt1-inN/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
rec-expN/A
e-exp-1N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-E.f6499.8
Applied rewrites99.8%
lift-fma.f64N/A
lift-E.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= (- 1.0 (* x_m x_m)) -500.0) (fma x_m (* x_m (fma (* x_m x_m) 0.5 1.0)) 1.0) (/ 1.0 (/ E (fma x_m x_m 1.0)))))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if ((1.0 - (x_m * x_m)) <= -500.0) {
tmp = fma(x_m, (x_m * fma((x_m * x_m), 0.5, 1.0)), 1.0);
} else {
tmp = 1.0 / (((double) M_E) / fma(x_m, x_m, 1.0));
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0) tmp = fma(x_m, Float64(x_m * fma(Float64(x_m * x_m), 0.5, 1.0)), 1.0); else tmp = Float64(1.0 / Float64(exp(1) / fma(x_m, x_m, 1.0))); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(1.0 / N[(E / N[(x$95$m * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
\;\;\;\;\mathsf{fma}\left(x\_m, x\_m \cdot \mathsf{fma}\left(x\_m \cdot x\_m, 0.5, 1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 x x)) < -500Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6471.8
Applied rewrites71.8%
if -500 < (-.f64 #s(literal 1 binary64) (*.f64 x x)) Initial program 100.0%
lift-*.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
exp-sumN/A
metadata-evalN/A
rec-expN/A
associate-/r/N/A
clear-numN/A
lower-/.f64N/A
lower-exp.f64N/A
exp-1-eN/A
lower-E.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
e-exp-1N/A
rec-expN/A
metadata-evalN/A
*-rgt-identityN/A
associate-*r/N/A
e-exp-1N/A
rec-expN/A
metadata-evalN/A
distribute-rgt1-inN/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
rec-expN/A
e-exp-1N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-E.f6499.8
Applied rewrites99.8%
lift-fma.f64N/A
lift-E.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= (- 1.0 (* x_m x_m)) -500.0) (fma x_m (* x_m (fma (* x_m x_m) 0.5 1.0)) 1.0) (/ (fma x_m x_m 1.0) E)))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if ((1.0 - (x_m * x_m)) <= -500.0) {
tmp = fma(x_m, (x_m * fma((x_m * x_m), 0.5, 1.0)), 1.0);
} else {
tmp = fma(x_m, x_m, 1.0) / ((double) M_E);
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0) tmp = fma(x_m, Float64(x_m * fma(Float64(x_m * x_m), 0.5, 1.0)), 1.0); else tmp = Float64(fma(x_m, x_m, 1.0) / exp(1)); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(x$95$m * x$95$m + 1.0), $MachinePrecision] / E), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
\;\;\;\;\mathsf{fma}\left(x\_m, x\_m \cdot \mathsf{fma}\left(x\_m \cdot x\_m, 0.5, 1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x\_m, x\_m, 1\right)}{e}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 x x)) < -500Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6471.8
Applied rewrites71.8%
if -500 < (-.f64 #s(literal 1 binary64) (*.f64 x x)) Initial program 100.0%
lift-*.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
exp-sumN/A
metadata-evalN/A
rec-expN/A
associate-/r/N/A
clear-numN/A
lower-/.f64N/A
lower-exp.f64N/A
exp-1-eN/A
lower-E.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
e-exp-1N/A
rec-expN/A
metadata-evalN/A
*-rgt-identityN/A
associate-*r/N/A
e-exp-1N/A
rec-expN/A
metadata-evalN/A
distribute-rgt1-inN/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
rec-expN/A
e-exp-1N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-E.f6499.8
Applied rewrites99.8%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= (- 1.0 (* x_m x_m)) -500.0) (* x_m (fma x_m (* x_m (* x_m 0.5)) x_m)) (/ (fma x_m x_m 1.0) E)))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if ((1.0 - (x_m * x_m)) <= -500.0) {
tmp = x_m * fma(x_m, (x_m * (x_m * 0.5)), x_m);
} else {
tmp = fma(x_m, x_m, 1.0) / ((double) M_E);
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0) tmp = Float64(x_m * fma(x_m, Float64(x_m * Float64(x_m * 0.5)), x_m)); else tmp = Float64(fma(x_m, x_m, 1.0) / exp(1)); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(x$95$m * N[(x$95$m * N[(x$95$m * N[(x$95$m * 0.5), $MachinePrecision]), $MachinePrecision] + x$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * x$95$m + 1.0), $MachinePrecision] / E), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
\;\;\;\;x\_m \cdot \mathsf{fma}\left(x\_m, x\_m \cdot \left(x\_m \cdot 0.5\right), x\_m\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x\_m, x\_m, 1\right)}{e}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 x x)) < -500Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6471.8
Applied rewrites71.8%
Taylor expanded in x around inf
distribute-rgt-inN/A
+-commutativeN/A
associate-*l/N/A
*-lft-identityN/A
metadata-evalN/A
pow-plusN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
associate-*r*N/A
unpow2N/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
distribute-rgt-inN/A
unpow2N/A
Applied rewrites71.8%
if -500 < (-.f64 #s(literal 1 binary64) (*.f64 x x)) Initial program 100.0%
lift-*.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
exp-sumN/A
metadata-evalN/A
rec-expN/A
associate-/r/N/A
clear-numN/A
lower-/.f64N/A
lower-exp.f64N/A
exp-1-eN/A
lower-E.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
e-exp-1N/A
rec-expN/A
metadata-evalN/A
*-rgt-identityN/A
associate-*r/N/A
e-exp-1N/A
rec-expN/A
metadata-evalN/A
distribute-rgt1-inN/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
rec-expN/A
e-exp-1N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-E.f6499.8
Applied rewrites99.8%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= (* x_m x_m) 1e-6) (/ 1.0 E) (fma x_m x_m 1.0)))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if ((x_m * x_m) <= 1e-6) {
tmp = 1.0 / ((double) M_E);
} else {
tmp = fma(x_m, x_m, 1.0);
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (Float64(x_m * x_m) <= 1e-6) tmp = Float64(1.0 / exp(1)); else tmp = fma(x_m, x_m, 1.0); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[(x$95$m * x$95$m), $MachinePrecision], 1e-6], N[(1.0 / E), $MachinePrecision], N[(x$95$m * x$95$m + 1.0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \cdot x\_m \leq 10^{-6}:\\
\;\;\;\;\frac{1}{e}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x\_m, x\_m, 1\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 9.99999999999999955e-7Initial program 100.0%
Taylor expanded in x around 0
metadata-evalN/A
rec-expN/A
lower-/.f64N/A
exp-1-eN/A
lower-E.f6499.3
Applied rewrites99.3%
if 9.99999999999999955e-7 < (*.f64 x x) Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6447.2
Applied rewrites47.2%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= (- 1.0 (* x_m x_m)) -500.0) (* x_m x_m) 1.0))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if ((1.0 - (x_m * x_m)) <= -500.0) {
tmp = x_m * x_m;
} else {
tmp = 1.0;
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
real(8) :: tmp
if ((1.0d0 - (x_m * x_m)) <= (-500.0d0)) then
tmp = x_m * x_m
else
tmp = 1.0d0
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m) {
double tmp;
if ((1.0 - (x_m * x_m)) <= -500.0) {
tmp = x_m * x_m;
} else {
tmp = 1.0;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m): tmp = 0 if (1.0 - (x_m * x_m)) <= -500.0: tmp = x_m * x_m else: tmp = 1.0 return tmp
x_m = abs(x) function code(x_m) tmp = 0.0 if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0) tmp = Float64(x_m * x_m); else tmp = 1.0; end return tmp end
x_m = abs(x); function tmp_2 = code(x_m) tmp = 0.0; if ((1.0 - (x_m * x_m)) <= -500.0) tmp = x_m * x_m; else tmp = 1.0; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(x$95$m * x$95$m), $MachinePrecision], 1.0]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
\;\;\;\;x\_m \cdot x\_m\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 x x)) < -500Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6447.2
Applied rewrites47.2%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6447.2
Applied rewrites47.2%
if -500 < (-.f64 #s(literal 1 binary64) (*.f64 x x)) Initial program 100.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6417.8
Applied rewrites17.8%
Taylor expanded in x around 0
Applied rewrites17.8%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (/ (fma x_m x_m 1.0) E))
x_m = fabs(x);
double code(double x_m) {
return fma(x_m, x_m, 1.0) / ((double) M_E);
}
x_m = abs(x) function code(x_m) return Float64(fma(x_m, x_m, 1.0) / exp(1)) end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[(N[(x$95$m * x$95$m + 1.0), $MachinePrecision] / E), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{\mathsf{fma}\left(x\_m, x\_m, 1\right)}{e}
\end{array}
Initial program 99.9%
lift-*.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
exp-sumN/A
metadata-evalN/A
rec-expN/A
associate-/r/N/A
clear-numN/A
lower-/.f64N/A
lower-exp.f64N/A
exp-1-eN/A
lower-E.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
e-exp-1N/A
rec-expN/A
metadata-evalN/A
*-rgt-identityN/A
associate-*r/N/A
e-exp-1N/A
rec-expN/A
metadata-evalN/A
distribute-rgt1-inN/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
rec-expN/A
e-exp-1N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-E.f6474.4
Applied rewrites74.4%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (fma x_m x_m 1.0))
x_m = fabs(x);
double code(double x_m) {
return fma(x_m, x_m, 1.0);
}
x_m = abs(x) function code(x_m) return fma(x_m, x_m, 1.0) end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := N[(x$95$m * x$95$m + 1.0), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
\mathsf{fma}\left(x\_m, x\_m, 1\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6457.3
Applied rewrites57.3%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6432.1
Applied rewrites32.1%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 1.0)
x_m = fabs(x);
double code(double x_m) {
return 1.0;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
code = 1.0d0
end function
x_m = Math.abs(x);
public static double code(double x_m) {
return 1.0;
}
x_m = math.fabs(x) def code(x_m): return 1.0
x_m = abs(x) function code(x_m) return 1.0 end
x_m = abs(x); function tmp = code(x_m) tmp = 1.0; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := 1.0
\begin{array}{l}
x_m = \left|x\right|
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6457.3
Applied rewrites57.3%
Taylor expanded in x around 0
Applied rewrites10.7%
herbie shell --seed 2024219
(FPCore (x)
:name "exp neg sub"
:precision binary64
(exp (- (- 1.0 (* x x)))))