
(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 20 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 (* (pow (pow (exp y_m) (* 0.5 y_m)) 2.0) x))
y_m = fabs(y);
double code(double x, double y_m) {
return pow(pow(exp(y_m), (0.5 * y_m)), 2.0) * x;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = ((exp(y_m) ** (0.5d0 * y_m)) ** 2.0d0) * x
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return Math.pow(Math.pow(Math.exp(y_m), (0.5 * y_m)), 2.0) * x;
}
y_m = math.fabs(y) def code(x, y_m): return math.pow(math.pow(math.exp(y_m), (0.5 * y_m)), 2.0) * x
y_m = abs(y) function code(x, y_m) return Float64(((exp(y_m) ^ Float64(0.5 * y_m)) ^ 2.0) * x) end
y_m = abs(y); function tmp = code(x, y_m) tmp = ((exp(y_m) ^ (0.5 * y_m)) ^ 2.0) * x; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[Power[N[Power[N[Exp[y$95$m], $MachinePrecision], N[(0.5 * y$95$m), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
{\left({\left(e^{y\_m}\right)}^{\left(0.5 \cdot y\_m\right)}\right)}^{2} \cdot x
\end{array}
Initial program 100.0%
Taylor expanded in y around inf
unpow2N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
Applied rewrites100.0%
Final simplification100.0%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* (pow (exp y_m) y_m) x))
y_m = fabs(y);
double code(double x, double y_m) {
return pow(exp(y_m), y_m) * x;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = (exp(y_m) ** y_m) * x
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return Math.pow(Math.exp(y_m), y_m) * x;
}
y_m = math.fabs(y) def code(x, y_m): return math.pow(math.exp(y_m), y_m) * x
y_m = abs(y) function code(x, y_m) return Float64((exp(y_m) ^ y_m) * x) end
y_m = abs(y); function tmp = code(x, y_m) tmp = (exp(y_m) ^ y_m) * x; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[Power[N[Exp[y$95$m], $MachinePrecision], y$95$m], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
{\left(e^{y\_m}\right)}^{y\_m} \cdot x
\end{array}
Initial program 100.0%
Taylor expanded in y around inf
unpow2N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64100.0
Applied rewrites100.0%
Final simplification100.0%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (exp (* y_m y_m)) 2.0) (* 1.0 x) (* (* y_m x) y_m)))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if (exp((y_m * y_m)) <= 2.0) {
tmp = 1.0 * x;
} else {
tmp = (y_m * 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 (exp((y_m * y_m)) <= 2.0d0) then
tmp = 1.0d0 * x
else
tmp = (y_m * 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 (Math.exp((y_m * y_m)) <= 2.0) {
tmp = 1.0 * x;
} else {
tmp = (y_m * x) * y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): tmp = 0 if math.exp((y_m * y_m)) <= 2.0: tmp = 1.0 * x else: tmp = (y_m * x) * y_m return tmp
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (exp(Float64(y_m * y_m)) <= 2.0) tmp = Float64(1.0 * x); else tmp = Float64(Float64(y_m * x) * y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) tmp = 0.0; if (exp((y_m * y_m)) <= 2.0) tmp = 1.0 * x; else tmp = (y_m * x) * y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[N[Exp[N[(y$95$m * y$95$m), $MachinePrecision]], $MachinePrecision], 2.0], N[(1.0 * x), $MachinePrecision], N[(N[(y$95$m * x), $MachinePrecision] * y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;e^{y\_m \cdot y\_m} \leq 2:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(y\_m \cdot x\right) \cdot y\_m\\
\end{array}
\end{array}
if (exp.f64 (*.f64 y y)) < 2Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.9%
if 2 < (exp.f64 (*.f64 y y)) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.9
Applied rewrites58.9%
Taylor expanded in y around inf
Applied rewrites58.9%
Applied rewrites44.6%
Final simplification71.4%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (exp (* y_m y_m)) 2.0) (* 1.0 x) (* y_m x)))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if (exp((y_m * y_m)) <= 2.0) {
tmp = 1.0 * x;
} else {
tmp = y_m * x;
}
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 (exp((y_m * y_m)) <= 2.0d0) then
tmp = 1.0d0 * x
else
tmp = y_m * x
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double tmp;
if (Math.exp((y_m * y_m)) <= 2.0) {
tmp = 1.0 * x;
} else {
tmp = y_m * x;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): tmp = 0 if math.exp((y_m * y_m)) <= 2.0: tmp = 1.0 * x else: tmp = y_m * x return tmp
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (exp(Float64(y_m * y_m)) <= 2.0) tmp = Float64(1.0 * x); else tmp = Float64(y_m * x); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) tmp = 0.0; if (exp((y_m * y_m)) <= 2.0) tmp = 1.0 * x; else tmp = y_m * x; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[N[Exp[N[(y$95$m * y$95$m), $MachinePrecision]], $MachinePrecision], 2.0], N[(1.0 * x), $MachinePrecision], N[(y$95$m * x), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;e^{y\_m \cdot y\_m} \leq 2:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot x\\
\end{array}
\end{array}
if (exp.f64 (*.f64 y y)) < 2Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.9%
if 2 < (exp.f64 (*.f64 y y)) Initial program 99.9%
lift-*.f64N/A
*-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
Applied rewrites48.7%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6412.5
Applied rewrites12.5%
Taylor expanded in y around inf
Applied rewrites12.5%
Final simplification54.8%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* (exp (* y_m y_m)) x))
y_m = fabs(y);
double code(double x, double y_m) {
return exp((y_m * y_m)) * x;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = exp((y_m * y_m)) * x
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return Math.exp((y_m * y_m)) * x;
}
y_m = math.fabs(y) def code(x, y_m): return math.exp((y_m * y_m)) * x
y_m = abs(y) function code(x, y_m) return Float64(exp(Float64(y_m * y_m)) * x) end
y_m = abs(y); function tmp = code(x, y_m) tmp = exp((y_m * y_m)) * x; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[Exp[N[(y$95$m * y$95$m), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
e^{y\_m \cdot y\_m} \cdot x
\end{array}
Initial program 100.0%
Final simplification100.0%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* (pow (- y_m -1.0) y_m) x))
y_m = fabs(y);
double code(double x, double y_m) {
return pow((y_m - -1.0), y_m) * x;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = ((y_m - (-1.0d0)) ** y_m) * x
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return Math.pow((y_m - -1.0), y_m) * x;
}
y_m = math.fabs(y) def code(x, y_m): return math.pow((y_m - -1.0), y_m) * x
y_m = abs(y) function code(x, y_m) return Float64((Float64(y_m - -1.0) ^ y_m) * x) end
y_m = abs(y); function tmp = code(x, y_m) tmp = ((y_m - -1.0) ^ y_m) * x; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[Power[N[(y$95$m - -1.0), $MachinePrecision], y$95$m], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
{\left(y\_m - -1\right)}^{y\_m} \cdot x
\end{array}
Initial program 100.0%
Taylor expanded in y around inf
unpow2N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites73.4%
Final simplification73.4%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* (exp y_m) x))
y_m = fabs(y);
double code(double x, double y_m) {
return exp(y_m) * x;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = exp(y_m) * x
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return Math.exp(y_m) * x;
}
y_m = math.fabs(y) def code(x, y_m): return math.exp(y_m) * x
y_m = abs(y) function code(x, y_m) return Float64(exp(y_m) * x) end
y_m = abs(y); function tmp = code(x, y_m) tmp = exp(y_m) * x; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[Exp[y$95$m], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
e^{y\_m} \cdot x
\end{array}
Initial program 100.0%
lift-*.f64N/A
*-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
Applied rewrites73.3%
Final simplification73.3%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (* y_m y_m) 2e+204) (fma (* (* (fma (* y_m y_m) 0.5 1.0) x) y_m) y_m x) (* (fma (fma (fma 0.16666666666666666 y_m 0.5) y_m 1.0) y_m 1.0) x)))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 2e+204) {
tmp = fma(((fma((y_m * y_m), 0.5, 1.0) * x) * y_m), y_m, x);
} else {
tmp = fma(fma(fma(0.16666666666666666, y_m, 0.5), y_m, 1.0), y_m, 1.0) * x;
}
return tmp;
}
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(y_m * y_m) <= 2e+204) tmp = fma(Float64(Float64(fma(Float64(y_m * y_m), 0.5, 1.0) * x) * y_m), y_m, x); else tmp = Float64(fma(fma(fma(0.16666666666666666, y_m, 0.5), y_m, 1.0), y_m, 1.0) * x); 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], 2e+204], N[(N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * x), $MachinePrecision] * y$95$m), $MachinePrecision] * y$95$m + x), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * y$95$m + 0.5), $MachinePrecision] * y$95$m + 1.0), $MachinePrecision] * y$95$m + 1.0), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \cdot y\_m \leq 2 \cdot 10^{+204}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(y\_m \cdot y\_m, 0.5, 1\right) \cdot x\right) \cdot y\_m, y\_m, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, y\_m, 0.5\right), y\_m, 1\right), y\_m, 1\right) \cdot x\\
\end{array}
\end{array}
if (*.f64 y y) < 1.99999999999999998e204Initial program 99.9%
Taylor expanded in y around inf
unpow2N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.3
Applied rewrites82.3%
Applied rewrites82.3%
if 1.99999999999999998e204 < (*.f64 y y) Initial program 100.0%
lift-*.f64N/A
*-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
Applied rewrites49.6%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6448.8
Applied rewrites48.8%
Final simplification71.0%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (fma (fma (* (fma 0.16666666666666666 (* y_m y_m) 0.5) x) (* y_m y_m) x) (* y_m y_m) x))
y_m = fabs(y);
double code(double x, double y_m) {
return fma(fma((fma(0.16666666666666666, (y_m * y_m), 0.5) * x), (y_m * y_m), x), (y_m * y_m), x);
}
y_m = abs(y) function code(x, y_m) return fma(fma(Float64(fma(0.16666666666666666, Float64(y_m * y_m), 0.5) * x), Float64(y_m * y_m), x), Float64(y_m * y_m), x) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[(N[(N[(0.16666666666666666 * N[(y$95$m * y$95$m), $MachinePrecision] + 0.5), $MachinePrecision] * x), $MachinePrecision] * N[(y$95$m * y$95$m), $MachinePrecision] + x), $MachinePrecision] * N[(y$95$m * y$95$m), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, y\_m \cdot y\_m, 0.5\right) \cdot x, y\_m \cdot y\_m, x\right), y\_m \cdot y\_m, x\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around inf
unpow2N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites91.5%
Final simplification91.5%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (* y_m y_m) 2e+204) (fma (* (* (* 0.5 y_m) x) y_m) (* y_m y_m) x) (* (fma (fma (fma 0.16666666666666666 y_m 0.5) y_m 1.0) y_m 1.0) x)))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 2e+204) {
tmp = fma((((0.5 * y_m) * x) * y_m), (y_m * y_m), x);
} else {
tmp = fma(fma(fma(0.16666666666666666, y_m, 0.5), y_m, 1.0), y_m, 1.0) * x;
}
return tmp;
}
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(y_m * y_m) <= 2e+204) tmp = fma(Float64(Float64(Float64(0.5 * y_m) * x) * y_m), Float64(y_m * y_m), x); else tmp = Float64(fma(fma(fma(0.16666666666666666, y_m, 0.5), y_m, 1.0), y_m, 1.0) * x); 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], 2e+204], N[(N[(N[(N[(0.5 * y$95$m), $MachinePrecision] * x), $MachinePrecision] * y$95$m), $MachinePrecision] * N[(y$95$m * y$95$m), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * y$95$m + 0.5), $MachinePrecision] * y$95$m + 1.0), $MachinePrecision] * y$95$m + 1.0), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \cdot y\_m \leq 2 \cdot 10^{+204}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(0.5 \cdot y\_m\right) \cdot x\right) \cdot y\_m, y\_m \cdot y\_m, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, y\_m, 0.5\right), y\_m, 1\right), y\_m, 1\right) \cdot x\\
\end{array}
\end{array}
if (*.f64 y y) < 1.99999999999999998e204Initial program 99.9%
Taylor expanded in y around inf
unpow2N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.3
Applied rewrites82.3%
Taylor expanded in y around inf
Applied rewrites82.2%
if 1.99999999999999998e204 < (*.f64 y y) Initial program 100.0%
lift-*.f64N/A
*-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
Applied rewrites49.6%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6448.8
Applied rewrites48.8%
Final simplification71.0%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (* y_m y_m) 5.0) (fma (* y_m x) y_m x) (* (* (* (fma 0.16666666666666666 y_m 0.5) y_m) x) y_m)))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 5.0) {
tmp = fma((y_m * x), y_m, x);
} else {
tmp = ((fma(0.16666666666666666, y_m, 0.5) * y_m) * x) * y_m;
}
return tmp;
}
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(y_m * y_m) <= 5.0) tmp = fma(Float64(y_m * x), y_m, x); else tmp = Float64(Float64(Float64(fma(0.16666666666666666, y_m, 0.5) * y_m) * x) * 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], 5.0], N[(N[(y$95$m * x), $MachinePrecision] * y$95$m + x), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * y$95$m + 0.5), $MachinePrecision] * y$95$m), $MachinePrecision] * x), $MachinePrecision] * y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \cdot y\_m \leq 5:\\
\;\;\;\;\mathsf{fma}\left(y\_m \cdot x, y\_m, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(0.16666666666666666, y\_m, 0.5\right) \cdot y\_m\right) \cdot x\right) \cdot y\_m\\
\end{array}
\end{array}
if (*.f64 y y) < 5Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Applied rewrites99.3%
if 5 < (*.f64 y y) Initial program 99.9%
lift-*.f64N/A
*-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
Applied rewrites48.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6412.5
Applied rewrites12.5%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6430.8
Applied rewrites30.8%
Taylor expanded in y around inf
Applied rewrites32.2%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (fma (* (fma (* y_m y_m) 0.5 1.0) (* y_m y_m)) x x))
y_m = fabs(y);
double code(double x, double y_m) {
return fma((fma((y_m * y_m), 0.5, 1.0) * (y_m * y_m)), x, x);
}
y_m = abs(y) function code(x, y_m) return fma(Float64(fma(Float64(y_m * y_m), 0.5, 1.0) * Float64(y_m * y_m)), x, x) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\mathsf{fma}\left(\mathsf{fma}\left(y\_m \cdot y\_m, 0.5, 1\right) \cdot \left(y\_m \cdot y\_m\right), x, x\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around inf
unpow2N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6486.5
Applied rewrites86.5%
Applied rewrites89.7%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* (fma (fma (fma 0.16666666666666666 y_m 0.5) y_m 1.0) y_m 1.0) x))
y_m = fabs(y);
double code(double x, double y_m) {
return fma(fma(fma(0.16666666666666666, y_m, 0.5), y_m, 1.0), y_m, 1.0) * x;
}
y_m = abs(y) function code(x, y_m) return Float64(fma(fma(fma(0.16666666666666666, y_m, 0.5), y_m, 1.0), y_m, 1.0) * x) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[(N[(N[(0.16666666666666666 * y$95$m + 0.5), $MachinePrecision] * y$95$m + 1.0), $MachinePrecision] * y$95$m + 1.0), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, y\_m, 0.5\right), y\_m, 1\right), y\_m, 1\right) \cdot x
\end{array}
Initial program 100.0%
lift-*.f64N/A
*-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
Applied rewrites73.3%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6466.9
Applied rewrites66.9%
Final simplification66.9%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (fma (fma (* (fma 0.16666666666666666 y_m 0.5) y_m) x x) y_m x))
y_m = fabs(y);
double code(double x, double y_m) {
return fma(fma((fma(0.16666666666666666, y_m, 0.5) * y_m), x, x), y_m, x);
}
y_m = abs(y) function code(x, y_m) return fma(fma(Float64(fma(0.16666666666666666, y_m, 0.5) * y_m), x, x), y_m, x) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[(N[(N[(0.16666666666666666 * y$95$m + 0.5), $MachinePrecision] * y$95$m), $MachinePrecision] * x + x), $MachinePrecision] * y$95$m + x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, y\_m, 0.5\right) \cdot y\_m, x, x\right), y\_m, x\right)
\end{array}
Initial program 100.0%
lift-*.f64N/A
*-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
Applied rewrites73.3%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6454.6
Applied rewrites54.6%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6464.0
Applied rewrites64.0%
Applied rewrites64.7%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (* y_m y_m) 5e+48) (fma (* y_m x) y_m x) (* (* y_m y_m) x)))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 5e+48) {
tmp = fma((y_m * x), y_m, x);
} else {
tmp = (y_m * y_m) * x;
}
return tmp;
}
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(y_m * y_m) <= 5e+48) tmp = fma(Float64(y_m * x), y_m, x); else tmp = Float64(Float64(y_m * y_m) * x); 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], 5e+48], N[(N[(y$95$m * x), $MachinePrecision] * y$95$m + x), $MachinePrecision], N[(N[(y$95$m * y$95$m), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \cdot y\_m \leq 5 \cdot 10^{+48}:\\
\;\;\;\;\mathsf{fma}\left(y\_m \cdot x, y\_m, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y\_m \cdot y\_m\right) \cdot x\\
\end{array}
\end{array}
if (*.f64 y y) < 4.99999999999999973e48Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6492.3
Applied rewrites92.3%
Applied rewrites92.3%
if 4.99999999999999973e48 < (*.f64 y y) Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.5
Applied rewrites63.5%
Taylor expanded in y around inf
Applied rewrites63.5%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (* y_m y_m) 4e-15) (* 1.0 x) (* (* y_m y_m) x)))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((y_m * y_m) <= 4e-15) {
tmp = 1.0 * x;
} else {
tmp = (y_m * y_m) * x;
}
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) <= 4d-15) then
tmp = 1.0d0 * x
else
tmp = (y_m * y_m) * x
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) <= 4e-15) {
tmp = 1.0 * x;
} else {
tmp = (y_m * y_m) * x;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): tmp = 0 if (y_m * y_m) <= 4e-15: tmp = 1.0 * x else: tmp = (y_m * y_m) * x return tmp
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(y_m * y_m) <= 4e-15) tmp = Float64(1.0 * x); else tmp = Float64(Float64(y_m * y_m) * x); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) tmp = 0.0; if ((y_m * y_m) <= 4e-15) tmp = 1.0 * x; else tmp = (y_m * y_m) * x; 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], 4e-15], N[(1.0 * x), $MachinePrecision], N[(N[(y$95$m * y$95$m), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \cdot y\_m \leq 4 \cdot 10^{-15}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(y\_m \cdot y\_m\right) \cdot x\\
\end{array}
\end{array}
if (*.f64 y y) < 4.0000000000000003e-15Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.9%
if 4.0000000000000003e-15 < (*.f64 y y) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.9
Applied rewrites58.9%
Taylor expanded in y around inf
Applied rewrites58.9%
Final simplification78.8%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (fma (* (* (* y_m x) y_m) 0.16666666666666666) y_m x))
y_m = fabs(y);
double code(double x, double y_m) {
return fma((((y_m * x) * y_m) * 0.16666666666666666), y_m, x);
}
y_m = abs(y) function code(x, y_m) return fma(Float64(Float64(Float64(y_m * x) * y_m) * 0.16666666666666666), y_m, x) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[(N[(N[(y$95$m * x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * y$95$m + x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\mathsf{fma}\left(\left(\left(y\_m \cdot x\right) \cdot y\_m\right) \cdot 0.16666666666666666, y\_m, x\right)
\end{array}
Initial program 100.0%
lift-*.f64N/A
*-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
Applied rewrites73.3%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6454.6
Applied rewrites54.6%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6464.0
Applied rewrites64.0%
Taylor expanded in y around inf
Applied rewrites64.3%
Final simplification64.3%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (fma (* y_m y_m) x x))
y_m = fabs(y);
double code(double x, double y_m) {
return fma((y_m * y_m), x, x);
}
y_m = abs(y) function code(x, y_m) return fma(Float64(y_m * y_m), x, x) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(N[(y$95$m * y$95$m), $MachinePrecision] * x + x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\mathsf{fma}\left(y\_m \cdot y\_m, x, x\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.8
Applied rewrites78.8%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (fma y_m x x))
y_m = fabs(y);
double code(double x, double y_m) {
return fma(y_m, x, x);
}
y_m = abs(y) function code(x, y_m) return fma(y_m, x, x) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(y$95$m * x + x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\mathsf{fma}\left(y\_m, x, x\right)
\end{array}
Initial program 100.0%
lift-*.f64N/A
*-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
Applied rewrites73.3%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6454.6
Applied rewrites54.6%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* y_m x))
y_m = fabs(y);
double code(double x, double y_m) {
return y_m * x;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = y_m * x
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return y_m * x;
}
y_m = math.fabs(y) def code(x, y_m): return y_m * x
y_m = abs(y) function code(x, y_m) return Float64(y_m * x) end
y_m = abs(y); function tmp = code(x, y_m) tmp = y_m * x; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(y$95$m * x), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y\_m \cdot x
\end{array}
Initial program 100.0%
lift-*.f64N/A
*-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
Applied rewrites73.3%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6454.6
Applied rewrites54.6%
Taylor expanded in y around inf
Applied rewrites8.5%
Final simplification8.5%
(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 2024296
(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))))