
(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 4 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 (* x (pow (exp (* y_m 2.0)) (* y_m 0.5))))
y_m = fabs(y);
double code(double x, double y_m) {
return x * pow(exp((y_m * 2.0)), (y_m * 0.5));
}
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 * 2.0d0)) ** (y_m * 0.5d0))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return x * Math.pow(Math.exp((y_m * 2.0)), (y_m * 0.5));
}
y_m = math.fabs(y) def code(x, y_m): return x * math.pow(math.exp((y_m * 2.0)), (y_m * 0.5))
y_m = abs(y) function code(x, y_m) return Float64(x * (exp(Float64(y_m * 2.0)) ^ Float64(y_m * 0.5))) end
y_m = abs(y); function tmp = code(x, y_m) tmp = x * (exp((y_m * 2.0)) ^ (y_m * 0.5)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := N[(x * N[Power[N[Exp[N[(y$95$m * 2.0), $MachinePrecision]], $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
x \cdot {\left(e^{y_m \cdot 2}\right)}^{\left(y_m \cdot 0.5\right)}
\end{array}
Initial program 100.0%
pow-exp100.0%
sqr-pow100.0%
pow-sqr100.0%
pow-pow100.0%
pow-exp100.0%
div-inv100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Final simplification100.0%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (* x (pow (exp y_m) y_m)))
y_m = fabs(y);
double code(double x, double y_m) {
return x * pow(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.pow(Math.exp(y_m), y_m);
}
y_m = math.fabs(y) def code(x, y_m): return x * math.pow(math.exp(y_m), y_m)
y_m = abs(y) function code(x, y_m) return Float64(x * (exp(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[Power[N[Exp[y$95$m], $MachinePrecision], y$95$m], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
x \cdot {\left(e^{y_m}\right)}^{y_m}
\end{array}
Initial program 100.0%
exp-prod100.0%
Simplified100.0%
Final simplification100.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%
Final simplification100.0%
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 57.6%
Final simplification57.6%
(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 2024013
(FPCore (x y)
:name "Data.Number.Erf:$dmerfcx from erf-2.0.0.0"
:precision binary64
:herbie-target
(* x (pow (exp y) y))
(* x (exp (* y y))))