
(FPCore (x y) :precision binary64 (* x (exp (* y y))))
double code(double x, double y) {
return x * exp((y * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * exp((y * y))
end function
public static double code(double x, double y) {
return x * Math.exp((y * y));
}
def code(x, y): return x * math.exp((y * y))
function code(x, y) return Float64(x * exp(Float64(y * y))) end
function tmp = code(x, y) tmp = x * exp((y * y)); end
code[x_, y_] := N[(x * N[Exp[N[(y * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* x (exp (* y y))))
double code(double x, double y) {
return x * exp((y * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * exp((y * y))
end function
public static double code(double x, double y) {
return x * Math.exp((y * y));
}
def code(x, y): return x * math.exp((y * y))
function code(x, y) return Float64(x * exp(Float64(y * y))) end
function tmp = code(x, y) tmp = x * exp((y * y)); end
code[x_, y_] := N[(x * N[Exp[N[(y * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot y}
\end{array}
y_m = (fabs.f64 y)
(FPCore (x y_m)
:precision binary64
(if (<= (* y_m y_m) 0.001)
(fma
(/
(* y_m y_m)
(fma y_m (* y_m (fma (* y_m y_m) 0.08333333333333333 -0.5)) 1.0))
x
x)
(* x (exp y_m))))y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 0.001) {
tmp = fma(((y_m * y_m) / fma(y_m, (y_m * fma((y_m * y_m), 0.08333333333333333, -0.5)), 1.0)), x, x);
} else {
tmp = x * exp(y_m);
}
return tmp;
}
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(y_m * y_m) <= 0.001) tmp = fma(Float64(Float64(y_m * y_m) / fma(y_m, Float64(y_m * fma(Float64(y_m * y_m), 0.08333333333333333, -0.5)), 1.0)), x, x); else tmp = Float64(x * exp(y_m)); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[N[(y$95$m * y$95$m), $MachinePrecision], 0.001], N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] / N[(y$95$m * N[(y$95$m * N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.08333333333333333 + -0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision], N[(x * N[Exp[y$95$m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \cdot y\_m \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(\frac{y\_m \cdot y\_m}{\mathsf{fma}\left(y\_m, y\_m \cdot \mathsf{fma}\left(y\_m \cdot y\_m, 0.08333333333333333, -0.5\right), 1\right)}, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{y\_m}\\
\end{array}
\end{array}
if (*.f64 y y) < 1e-3Initial program 100.0%
Taylor expanded in y around 0
Simplified99.9%
flip3-+N/A
clear-numN/A
/-lowering-/.f64N/A
clear-numN/A
flip3-+N/A
Applied egg-rr99.9%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64100.0
Simplified100.0%
distribute-rgt-inN/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64100.0
Applied egg-rr100.0%
if 1e-3 < (*.f64 y y) Initial program 100.0%
*-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-outN/A
div-invN/A
div-invN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
associate-*r/N/A
*-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-outN/A
div-invN/A
div-invN/A
+-inversesN/A
difference-of-squaresN/A
+-inversesN/A
flip-+N/A
count-2N/A
associate-*r/N/A
Applied egg-rr50.0%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* x (exp (* y_m y_m))))
y_m = fabs(y);
double code(double x, double y_m) {
return x * exp((y_m * y_m));
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = x * exp((y_m * y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return x * Math.exp((y_m * y_m));
}
y_m = math.fabs(y) def code(x, y_m): return x * math.exp((y_m * y_m))
y_m = abs(y) function code(x, y_m) return Float64(x * exp(Float64(y_m * y_m))) end
y_m = abs(y); function tmp = code(x, y_m) tmp = x * exp((y_m * y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(x * N[Exp[N[(y$95$m * y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
x \cdot e^{y\_m \cdot y\_m}
\end{array}
Initial program 100.0%
y_m = (fabs.f64 y)
(FPCore (x y_m)
:precision binary64
(*
x
(fma
(* y_m y_m)
(fma
y_m
(*
y_m
(fma
(* y_m y_m)
(fma (* y_m y_m) 0.041666666666666664 0.16666666666666666)
0.5))
1.0)
1.0)))y_m = fabs(y);
double code(double x, double y_m) {
return x * fma((y_m * y_m), fma(y_m, (y_m * fma((y_m * y_m), fma((y_m * y_m), 0.041666666666666664, 0.16666666666666666), 0.5)), 1.0), 1.0);
}
y_m = abs(y) function code(x, y_m) return Float64(x * fma(Float64(y_m * y_m), fma(y_m, Float64(y_m * fma(Float64(y_m * y_m), fma(Float64(y_m * y_m), 0.041666666666666664, 0.16666666666666666), 0.5)), 1.0), 1.0)) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(x * N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(y$95$m * N[(y$95$m * N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.041666666666666664 + 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
x \cdot \mathsf{fma}\left(y\_m \cdot y\_m, \mathsf{fma}\left(y\_m, y\_m \cdot \mathsf{fma}\left(y\_m \cdot y\_m, \mathsf{fma}\left(y\_m \cdot y\_m, 0.041666666666666664, 0.16666666666666666\right), 0.5\right), 1\right), 1\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
Simplified94.7%
flip3-+N/A
clear-numN/A
/-lowering-/.f64N/A
clear-numN/A
flip3-+N/A
Applied egg-rr94.7%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6454.8
Simplified54.8%
Taylor expanded in y around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6497.0
Simplified97.0%
y_m = (fabs.f64 y)
(FPCore (x y_m)
:precision binary64
(if (<= (* y_m y_m) 0.001)
(fma y_m (* x (* y_m (fma (* y_m y_m) 0.5 1.0))) x)
(*
x
(*
(* y_m y_m)
(* (* y_m y_m) (fma y_m (* y_m 0.16666666666666666) 0.5))))))y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 0.001) {
tmp = fma(y_m, (x * (y_m * fma((y_m * y_m), 0.5, 1.0))), x);
} else {
tmp = x * ((y_m * y_m) * ((y_m * y_m) * fma(y_m, (y_m * 0.16666666666666666), 0.5)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(y_m * y_m) <= 0.001) tmp = fma(y_m, Float64(x * Float64(y_m * fma(Float64(y_m * y_m), 0.5, 1.0))), x); else tmp = Float64(x * Float64(Float64(y_m * y_m) * Float64(Float64(y_m * y_m) * fma(y_m, Float64(y_m * 0.16666666666666666), 0.5)))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[N[(y$95$m * y$95$m), $MachinePrecision], 0.001], N[(y$95$m * N[(x * N[(y$95$m * N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x * N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(y$95$m * N[(y$95$m * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \cdot y\_m \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(y\_m, x \cdot \left(y\_m \cdot \mathsf{fma}\left(y\_m \cdot y\_m, 0.5, 1\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(y\_m \cdot y\_m\right) \cdot \left(\left(y\_m \cdot y\_m\right) \cdot \mathsf{fma}\left(y\_m, y\_m \cdot 0.16666666666666666, 0.5\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 y y) < 1e-3Initial program 100.0%
Taylor expanded in y around 0
distribute-rgt-inN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*l*N/A
associate-*l*N/A
distribute-lft-outN/A
*-rgt-identityN/A
distribute-lft-inN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified99.8%
distribute-rgt-inN/A
associate-*l*N/A
associate-*l*N/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.8%
if 1e-3 < (*.f64 y y) Initial program 100.0%
Taylor expanded in y around 0
Simplified88.7%
Taylor expanded in y around inf
Simplified88.7%
Final simplification94.7%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (* y_m y_m) 0.001) (fma y_m (* x (* y_m (fma (* y_m y_m) 0.5 1.0))) x) (* x (* 0.16666666666666666 (* (* y_m y_m) (* y_m (* y_m (* y_m y_m))))))))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 0.001) {
tmp = fma(y_m, (x * (y_m * fma((y_m * y_m), 0.5, 1.0))), x);
} else {
tmp = x * (0.16666666666666666 * ((y_m * y_m) * (y_m * (y_m * (y_m * y_m)))));
}
return tmp;
}
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(y_m * y_m) <= 0.001) tmp = fma(y_m, Float64(x * Float64(y_m * fma(Float64(y_m * y_m), 0.5, 1.0))), x); else tmp = Float64(x * Float64(0.16666666666666666 * Float64(Float64(y_m * y_m) * Float64(y_m * Float64(y_m * Float64(y_m * y_m)))))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[N[(y$95$m * y$95$m), $MachinePrecision], 0.001], N[(y$95$m * N[(x * N[(y$95$m * N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x * N[(0.16666666666666666 * N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(y$95$m * N[(y$95$m * N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \cdot y\_m \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(y\_m, x \cdot \left(y\_m \cdot \mathsf{fma}\left(y\_m \cdot y\_m, 0.5, 1\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.16666666666666666 \cdot \left(\left(y\_m \cdot y\_m\right) \cdot \left(y\_m \cdot \left(y\_m \cdot \left(y\_m \cdot y\_m\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 y y) < 1e-3Initial program 100.0%
Taylor expanded in y around 0
distribute-rgt-inN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*l*N/A
associate-*l*N/A
distribute-lft-outN/A
*-rgt-identityN/A
distribute-lft-inN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified99.8%
distribute-rgt-inN/A
associate-*l*N/A
associate-*l*N/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.8%
if 1e-3 < (*.f64 y y) Initial program 100.0%
Taylor expanded in y around 0
Simplified88.7%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
pow-sqrN/A
cube-prodN/A
unpow2N/A
unpow3N/A
pow-sqrN/A
metadata-evalN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-lowering-*.f64N/A
associate-*r*N/A
pow-sqrN/A
metadata-evalN/A
associate-*l*N/A
Simplified88.7%
Final simplification94.7%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (fma (* (* y_m y_m) (fma (* y_m y_m) (fma (* y_m y_m) 0.16666666666666666 0.5) 1.0)) x x))
y_m = fabs(y);
double code(double x, double y_m) {
return fma(((y_m * y_m) * fma((y_m * y_m), fma((y_m * y_m), 0.16666666666666666, 0.5), 1.0)), x, x);
}
y_m = abs(y) function code(x, y_m) return fma(Float64(Float64(y_m * y_m) * fma(Float64(y_m * y_m), fma(Float64(y_m * y_m), 0.16666666666666666, 0.5), 1.0)), x, x) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\mathsf{fma}\left(\left(y\_m \cdot y\_m\right) \cdot \mathsf{fma}\left(y\_m \cdot y\_m, \mathsf{fma}\left(y\_m \cdot y\_m, 0.16666666666666666, 0.5\right), 1\right), x, x\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
Simplified94.7%
distribute-rgt-inN/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6494.8
Applied egg-rr94.8%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* x (fma (* y_m y_m) (fma y_m (* y_m (fma y_m (* y_m 0.16666666666666666) 0.5)) 1.0) 1.0)))
y_m = fabs(y);
double code(double x, double y_m) {
return x * fma((y_m * y_m), fma(y_m, (y_m * fma(y_m, (y_m * 0.16666666666666666), 0.5)), 1.0), 1.0);
}
y_m = abs(y) function code(x, y_m) return Float64(x * fma(Float64(y_m * y_m), fma(y_m, Float64(y_m * fma(y_m, Float64(y_m * 0.16666666666666666), 0.5)), 1.0), 1.0)) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(x * N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(y$95$m * N[(y$95$m * N[(y$95$m * N[(y$95$m * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
x \cdot \mathsf{fma}\left(y\_m \cdot y\_m, \mathsf{fma}\left(y\_m, y\_m \cdot \mathsf{fma}\left(y\_m, y\_m \cdot 0.16666666666666666, 0.5\right), 1\right), 1\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
Simplified94.7%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (fma (* (* y_m y_m) (fma (* y_m y_m) (* (* y_m y_m) 0.16666666666666666) 1.0)) x x))
y_m = fabs(y);
double code(double x, double y_m) {
return fma(((y_m * y_m) * fma((y_m * y_m), ((y_m * y_m) * 0.16666666666666666), 1.0)), x, x);
}
y_m = abs(y) function code(x, y_m) return fma(Float64(Float64(y_m * y_m) * fma(Float64(y_m * y_m), Float64(Float64(y_m * y_m) * 0.16666666666666666), 1.0)), x, x) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\mathsf{fma}\left(\left(y\_m \cdot y\_m\right) \cdot \mathsf{fma}\left(y\_m \cdot y\_m, \left(y\_m \cdot y\_m\right) \cdot 0.16666666666666666, 1\right), x, x\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
Simplified94.7%
distribute-rgt-inN/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6494.8
Applied egg-rr94.8%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6494.6
Simplified94.6%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (* y_m y_m) 0.001) (fma (* x y_m) y_m x) (* x (* y_m (* 0.5 (* y_m (* y_m y_m)))))))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 0.001) {
tmp = fma((x * y_m), y_m, x);
} else {
tmp = x * (y_m * (0.5 * (y_m * (y_m * y_m))));
}
return tmp;
}
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(y_m * y_m) <= 0.001) tmp = fma(Float64(x * y_m), y_m, x); else tmp = Float64(x * Float64(y_m * Float64(0.5 * Float64(y_m * Float64(y_m * y_m))))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[N[(y$95$m * y$95$m), $MachinePrecision], 0.001], N[(N[(x * y$95$m), $MachinePrecision] * y$95$m + x), $MachinePrecision], N[(x * N[(y$95$m * N[(0.5 * N[(y$95$m * N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \cdot y\_m \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(x \cdot y\_m, y\_m, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y\_m \cdot \left(0.5 \cdot \left(y\_m \cdot \left(y\_m \cdot y\_m\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 y y) < 1e-3Initial program 100.0%
Taylor expanded in y around 0
*-rgt-identityN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6499.6
Simplified99.6%
distribute-lft-inN/A
*-rgt-identityN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6499.7
Applied egg-rr99.7%
if 1e-3 < (*.f64 y y) Initial program 100.0%
Taylor expanded in y around 0
distribute-rgt-inN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*l*N/A
associate-*l*N/A
distribute-lft-outN/A
*-rgt-identityN/A
distribute-lft-inN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified84.6%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
unpow3N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.6
Simplified84.6%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* x (fma (* y_m y_m) (* y_m (* 0.16666666666666666 (* y_m (* y_m y_m)))) 1.0)))
y_m = fabs(y);
double code(double x, double y_m) {
return x * fma((y_m * y_m), (y_m * (0.16666666666666666 * (y_m * (y_m * y_m)))), 1.0);
}
y_m = abs(y) function code(x, y_m) return Float64(x * fma(Float64(y_m * y_m), Float64(y_m * Float64(0.16666666666666666 * Float64(y_m * Float64(y_m * y_m)))), 1.0)) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(x * N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(y$95$m * N[(0.16666666666666666 * N[(y$95$m * N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
x \cdot \mathsf{fma}\left(y\_m \cdot y\_m, y\_m \cdot \left(0.16666666666666666 \cdot \left(y\_m \cdot \left(y\_m \cdot y\_m\right)\right)\right), 1\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
Simplified94.7%
Taylor expanded in y around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6494.0
Simplified94.0%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* x (fma (* y_m y_m) (fma y_m (* y_m 0.5) 1.0) 1.0)))
y_m = fabs(y);
double code(double x, double y_m) {
return x * fma((y_m * y_m), fma(y_m, (y_m * 0.5), 1.0), 1.0);
}
y_m = abs(y) function code(x, y_m) return Float64(x * fma(Float64(y_m * y_m), fma(y_m, Float64(y_m * 0.5), 1.0), 1.0)) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(x * N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(y$95$m * N[(y$95$m * 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
x \cdot \mathsf{fma}\left(y\_m \cdot y\_m, \mathsf{fma}\left(y\_m, y\_m \cdot 0.5, 1\right), 1\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
distribute-rgt-inN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*l*N/A
associate-*l*N/A
distribute-lft-outN/A
*-rgt-identityN/A
distribute-lft-inN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified92.8%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* x (fma (* y_m y_m) (* (* y_m y_m) 0.5) 1.0)))
y_m = fabs(y);
double code(double x, double y_m) {
return x * fma((y_m * y_m), ((y_m * y_m) * 0.5), 1.0);
}
y_m = abs(y) function code(x, y_m) return Float64(x * fma(Float64(y_m * y_m), Float64(Float64(y_m * y_m) * 0.5), 1.0)) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(x * N[(N[(y$95$m * y$95$m), $MachinePrecision] * N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
x \cdot \mathsf{fma}\left(y\_m \cdot y\_m, \left(y\_m \cdot y\_m\right) \cdot 0.5, 1\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
distribute-rgt-inN/A
*-rgt-identityN/A
*-commutativeN/A
associate-*l*N/A
associate-*l*N/A
distribute-lft-outN/A
*-rgt-identityN/A
distribute-lft-inN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified92.8%
Taylor expanded in y around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6492.2
Simplified92.2%
Final simplification92.2%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (fma x (* y_m (fma y_m (fma y_m 0.16666666666666666 0.5) 1.0)) x))
y_m = fabs(y);
double code(double x, double y_m) {
return fma(x, (y_m * fma(y_m, fma(y_m, 0.16666666666666666, 0.5), 1.0)), x);
}
y_m = abs(y) function code(x, y_m) return fma(x, Float64(y_m * fma(y_m, fma(y_m, 0.16666666666666666, 0.5), 1.0)), x) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(x * N[(y$95$m * N[(y$95$m * N[(y$95$m * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\mathsf{fma}\left(x, y\_m \cdot \mathsf{fma}\left(y\_m, \mathsf{fma}\left(y\_m, 0.16666666666666666, 0.5\right), 1\right), x\right)
\end{array}
Initial program 100.0%
*-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-outN/A
div-invN/A
div-invN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
associate-*r/N/A
*-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-outN/A
div-invN/A
div-invN/A
+-inversesN/A
difference-of-squaresN/A
+-inversesN/A
flip-+N/A
count-2N/A
associate-*r/N/A
Applied egg-rr75.2%
Taylor expanded in y around 0
Simplified69.4%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (* y_m y_m) 0.001) x (* x (* y_m y_m))))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 0.001) {
tmp = x;
} else {
tmp = x * (y_m * y_m);
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: tmp
if ((y_m * y_m) <= 0.001d0) then
tmp = x
else
tmp = x * (y_m * y_m)
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 0.001) {
tmp = x;
} else {
tmp = x * (y_m * y_m);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): tmp = 0 if (y_m * y_m) <= 0.001: tmp = x else: tmp = x * (y_m * y_m) return tmp
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(y_m * y_m) <= 0.001) tmp = x; else tmp = Float64(x * Float64(y_m * y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) tmp = 0.0; if ((y_m * y_m) <= 0.001) tmp = x; else tmp = x * (y_m * y_m); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[N[(y$95$m * y$95$m), $MachinePrecision], 0.001], x, N[(x * N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \cdot y\_m \leq 0.001:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y\_m \cdot y\_m\right)\\
\end{array}
\end{array}
if (*.f64 y y) < 1e-3Initial program 100.0%
Taylor expanded in y around 0
Simplified98.6%
if 1e-3 < (*.f64 y y) Initial program 100.0%
Taylor expanded in y around 0
*-rgt-identityN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6466.1
Simplified66.1%
Taylor expanded in y around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6466.1
Simplified66.1%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (* y_m y_m) 0.001) x (* x y_m)))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 0.001) {
tmp = x;
} else {
tmp = x * y_m;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: tmp
if ((y_m * y_m) <= 0.001d0) then
tmp = x
else
tmp = x * y_m
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 0.001) {
tmp = x;
} else {
tmp = x * y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): tmp = 0 if (y_m * y_m) <= 0.001: tmp = x else: tmp = x * y_m return tmp
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(y_m * y_m) <= 0.001) tmp = x; else tmp = Float64(x * y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) tmp = 0.0; if ((y_m * y_m) <= 0.001) tmp = x; else tmp = x * y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[N[(y$95$m * y$95$m), $MachinePrecision], 0.001], x, N[(x * y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \cdot y\_m \leq 0.001:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\_m\\
\end{array}
\end{array}
if (*.f64 y y) < 1e-3Initial program 100.0%
Taylor expanded in y around 0
Simplified98.6%
if 1e-3 < (*.f64 y y) Initial program 100.0%
*-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-outN/A
div-invN/A
div-invN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
associate-*r/N/A
*-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-outN/A
div-invN/A
div-invN/A
+-inversesN/A
difference-of-squaresN/A
+-inversesN/A
flip-+N/A
count-2N/A
associate-*r/N/A
Applied egg-rr50.0%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f6413.7
Simplified13.7%
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6413.7
Applied egg-rr13.7%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6413.7
Simplified13.7%
Final simplification59.5%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* x (fma y_m y_m 1.0)))
y_m = fabs(y);
double code(double x, double y_m) {
return x * fma(y_m, y_m, 1.0);
}
y_m = abs(y) function code(x, y_m) return Float64(x * fma(y_m, y_m, 1.0)) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(x * N[(y$95$m * y$95$m + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
x \cdot \mathsf{fma}\left(y\_m, y\_m, 1\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
*-rgt-identityN/A
distribute-lft-inN/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6484.2
Simplified84.2%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (fma x y_m x))
y_m = fabs(y);
double code(double x, double y_m) {
return fma(x, y_m, x);
}
y_m = abs(y) function code(x, y_m) return fma(x, y_m, x) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(x * y$95$m + x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\mathsf{fma}\left(x, y\_m, x\right)
\end{array}
Initial program 100.0%
*-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-outN/A
div-invN/A
div-invN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
associate-*r/N/A
*-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-outN/A
div-invN/A
div-invN/A
+-inversesN/A
difference-of-squaresN/A
+-inversesN/A
flip-+N/A
count-2N/A
associate-*r/N/A
Applied egg-rr75.2%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f6458.5
Simplified58.5%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 x)
y_m = fabs(y);
double code(double x, double y_m) {
return x;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = x
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return x;
}
y_m = math.fabs(y) def code(x, y_m): return x
y_m = abs(y) function code(x, y_m) return x end
y_m = abs(y); function tmp = code(x, y_m) tmp = x; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := x
\begin{array}{l}
y_m = \left|y\right|
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
Simplified54.9%
(FPCore (x y) :precision binary64 (* x (pow (exp y) y)))
double code(double x, double y) {
return x * pow(exp(y), y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (exp(y) ** y)
end function
public static double code(double x, double y) {
return x * Math.pow(Math.exp(y), y);
}
def code(x, y): return x * math.pow(math.exp(y), y)
function code(x, y) return Float64(x * (exp(y) ^ y)) end
function tmp = code(x, y) tmp = x * (exp(y) ^ y); end
code[x_, y_] := N[(x * N[Power[N[Exp[y], $MachinePrecision], y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot {\left(e^{y}\right)}^{y}
\end{array}
herbie shell --seed 2024196
(FPCore (x y)
:name "Data.Number.Erf:$dmerfcx from erf-2.0.0.0"
:precision binary64
:alt
(! :herbie-platform default (* x (pow (exp y) y)))
(* x (exp (* y y))))