
(FPCore (x y z) :precision binary64 (exp (- (+ x (* y (log y))) z)))
double code(double x, double y, double z) {
return exp(((x + (y * log(y))) - z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = exp(((x + (y * log(y))) - z))
end function
public static double code(double x, double y, double z) {
return Math.exp(((x + (y * Math.log(y))) - z));
}
def code(x, y, z): return math.exp(((x + (y * math.log(y))) - z))
function code(x, y, z) return exp(Float64(Float64(x + Float64(y * log(y))) - z)) end
function tmp = code(x, y, z) tmp = exp(((x + (y * log(y))) - z)); end
code[x_, y_, z_] := N[Exp[N[(N[(x + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(x + y \cdot \log y\right) - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (exp (- (+ x (* y (log y))) z)))
double code(double x, double y, double z) {
return exp(((x + (y * log(y))) - z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = exp(((x + (y * log(y))) - z))
end function
public static double code(double x, double y, double z) {
return Math.exp(((x + (y * Math.log(y))) - z));
}
def code(x, y, z): return math.exp(((x + (y * math.log(y))) - z))
function code(x, y, z) return exp(Float64(Float64(x + Float64(y * log(y))) - z)) end
function tmp = code(x, y, z) tmp = exp(((x + (y * log(y))) - z)); end
code[x_, y_, z_] := N[Exp[N[(N[(x + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(x + y \cdot \log y\right) - z}
\end{array}
(FPCore (x y z) :precision binary64 (exp (- (+ x (* y (log y))) z)))
double code(double x, double y, double z) {
return exp(((x + (y * log(y))) - z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = exp(((x + (y * log(y))) - z))
end function
public static double code(double x, double y, double z) {
return Math.exp(((x + (y * Math.log(y))) - z));
}
def code(x, y, z): return math.exp(((x + (y * math.log(y))) - z))
function code(x, y, z) return exp(Float64(Float64(x + Float64(y * log(y))) - z)) end
function tmp = code(x, y, z) tmp = exp(((x + (y * log(y))) - z)); end
code[x_, y_, z_] := N[Exp[N[(N[(x + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(x + y \cdot \log y\right) - z}
\end{array}
(FPCore (x y z) :precision binary64 (let* ((t_0 (* y (log y)))) (if (<= t_0 -1e-305) (* (pow y y) (exp (- x z))) (exp (- t_0 z)))))
double code(double x, double y, double z) {
double t_0 = y * log(y);
double tmp;
if (t_0 <= -1e-305) {
tmp = pow(y, y) * exp((x - z));
} else {
tmp = exp((t_0 - z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = y * log(y)
if (t_0 <= (-1d-305)) then
tmp = (y ** y) * exp((x - z))
else
tmp = exp((t_0 - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * Math.log(y);
double tmp;
if (t_0 <= -1e-305) {
tmp = Math.pow(y, y) * Math.exp((x - z));
} else {
tmp = Math.exp((t_0 - z));
}
return tmp;
}
def code(x, y, z): t_0 = y * math.log(y) tmp = 0 if t_0 <= -1e-305: tmp = math.pow(y, y) * math.exp((x - z)) else: tmp = math.exp((t_0 - z)) return tmp
function code(x, y, z) t_0 = Float64(y * log(y)) tmp = 0.0 if (t_0 <= -1e-305) tmp = Float64((y ^ y) * exp(Float64(x - z))); else tmp = exp(Float64(t_0 - z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * log(y); tmp = 0.0; if (t_0 <= -1e-305) tmp = (y ^ y) * exp((x - z)); else tmp = exp((t_0 - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-305], N[(N[Power[y, y], $MachinePrecision] * N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(t$95$0 - z), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \log y\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{-305}:\\
\;\;\;\;{y}^{y} \cdot e^{x - z}\\
\mathbf{else}:\\
\;\;\;\;e^{t_0 - z}\\
\end{array}
\end{array}
(FPCore (x y z)
:precision binary64
(if (or (<= x -4.4e+172)
(and (not (<= x -9.2e+145)) (or (<= x -2.8e+41) (not (<= x 7e+14)))))
(exp x)
(exp (- (* y (log y)) z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.4e+172) || (!(x <= -9.2e+145) && ((x <= -2.8e+41) || !(x <= 7e+14)))) {
tmp = exp(x);
} else {
tmp = exp(((y * log(y)) - z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-4.4d+172)) .or. (.not. (x <= (-9.2d+145))) .and. (x <= (-2.8d+41)) .or. (.not. (x <= 7d+14))) then
tmp = exp(x)
else
tmp = exp(((y * log(y)) - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.4e+172) || (!(x <= -9.2e+145) && ((x <= -2.8e+41) || !(x <= 7e+14)))) {
tmp = Math.exp(x);
} else {
tmp = Math.exp(((y * Math.log(y)) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.4e+172) or (not (x <= -9.2e+145) and ((x <= -2.8e+41) or not (x <= 7e+14))): tmp = math.exp(x) else: tmp = math.exp(((y * math.log(y)) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.4e+172) || (!(x <= -9.2e+145) && ((x <= -2.8e+41) || !(x <= 7e+14)))) tmp = exp(x); else tmp = exp(Float64(Float64(y * log(y)) - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.4e+172) || (~((x <= -9.2e+145)) && ((x <= -2.8e+41) || ~((x <= 7e+14))))) tmp = exp(x); else tmp = exp(((y * log(y)) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.4e+172], And[N[Not[LessEqual[x, -9.2e+145]], $MachinePrecision], Or[LessEqual[x, -2.8e+41], N[Not[LessEqual[x, 7e+14]], $MachinePrecision]]]], N[Exp[x], $MachinePrecision], N[Exp[N[(N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+172} \lor \neg \left(x \leq -9.2 \cdot 10^{+145}\right) \land \left(x \leq -2.8 \cdot 10^{+41} \lor \neg \left(x \leq 7 \cdot 10^{+14}\right)\right):\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;e^{y \cdot \log y - z}\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= z -1.4e-14) (not (<= z 7e+24))) (exp (- z)) (* (pow y y) (exp x))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.4e-14) || !(z <= 7e+24)) {
tmp = exp(-z);
} else {
tmp = pow(y, y) * exp(x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.4d-14)) .or. (.not. (z <= 7d+24))) then
tmp = exp(-z)
else
tmp = (y ** y) * exp(x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.4e-14) || !(z <= 7e+24)) {
tmp = Math.exp(-z);
} else {
tmp = Math.pow(y, y) * Math.exp(x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.4e-14) or not (z <= 7e+24): tmp = math.exp(-z) else: tmp = math.pow(y, y) * math.exp(x) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.4e-14) || !(z <= 7e+24)) tmp = exp(Float64(-z)); else tmp = Float64((y ^ y) * exp(x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.4e-14) || ~((z <= 7e+24))) tmp = exp(-z); else tmp = (y ^ y) * exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.4e-14], N[Not[LessEqual[z, 7e+24]], $MachinePrecision]], N[Exp[(-z)], $MachinePrecision], N[(N[Power[y, y], $MachinePrecision] * N[Exp[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-14} \lor \neg \left(z \leq 7 \cdot 10^{+24}\right):\\
\;\;\;\;e^{-z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= x -1.35e+26) (not (<= x 3e+14))) (exp x) (/ (pow y y) (exp z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.35e+26) || !(x <= 3e+14)) {
tmp = exp(x);
} else {
tmp = pow(y, y) / exp(z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.35d+26)) .or. (.not. (x <= 3d+14))) then
tmp = exp(x)
else
tmp = (y ** y) / exp(z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.35e+26) || !(x <= 3e+14)) {
tmp = Math.exp(x);
} else {
tmp = Math.pow(y, y) / Math.exp(z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.35e+26) or not (x <= 3e+14): tmp = math.exp(x) else: tmp = math.pow(y, y) / math.exp(z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.35e+26) || !(x <= 3e+14)) tmp = exp(x); else tmp = Float64((y ^ y) / exp(z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.35e+26) || ~((x <= 3e+14))) tmp = exp(x); else tmp = (y ^ y) / exp(z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.35e+26], N[Not[LessEqual[x, 3e+14]], $MachinePrecision]], N[Exp[x], $MachinePrecision], N[(N[Power[y, y], $MachinePrecision] / N[Exp[z], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+26} \lor \neg \left(x \leq 3 \cdot 10^{+14}\right):\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{{y}^{y}}{e^{z}}\\
\end{array}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (exp (- z))))
(if (<= x -3.8e+20)
(exp x)
(if (<= x -6.6e-94)
t_0
(if (<= x 3.6e-158) (pow y y) (if (<= x 3e+14) t_0 (exp x)))))))
double code(double x, double y, double z) {
double t_0 = exp(-z);
double tmp;
if (x <= -3.8e+20) {
tmp = exp(x);
} else if (x <= -6.6e-94) {
tmp = t_0;
} else if (x <= 3.6e-158) {
tmp = pow(y, y);
} else if (x <= 3e+14) {
tmp = t_0;
} else {
tmp = exp(x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-z)
if (x <= (-3.8d+20)) then
tmp = exp(x)
else if (x <= (-6.6d-94)) then
tmp = t_0
else if (x <= 3.6d-158) then
tmp = y ** y
else if (x <= 3d+14) then
tmp = t_0
else
tmp = exp(x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.exp(-z);
double tmp;
if (x <= -3.8e+20) {
tmp = Math.exp(x);
} else if (x <= -6.6e-94) {
tmp = t_0;
} else if (x <= 3.6e-158) {
tmp = Math.pow(y, y);
} else if (x <= 3e+14) {
tmp = t_0;
} else {
tmp = Math.exp(x);
}
return tmp;
}
def code(x, y, z): t_0 = math.exp(-z) tmp = 0 if x <= -3.8e+20: tmp = math.exp(x) elif x <= -6.6e-94: tmp = t_0 elif x <= 3.6e-158: tmp = math.pow(y, y) elif x <= 3e+14: tmp = t_0 else: tmp = math.exp(x) return tmp
function code(x, y, z) t_0 = exp(Float64(-z)) tmp = 0.0 if (x <= -3.8e+20) tmp = exp(x); elseif (x <= -6.6e-94) tmp = t_0; elseif (x <= 3.6e-158) tmp = y ^ y; elseif (x <= 3e+14) tmp = t_0; else tmp = exp(x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = exp(-z); tmp = 0.0; if (x <= -3.8e+20) tmp = exp(x); elseif (x <= -6.6e-94) tmp = t_0; elseif (x <= 3.6e-158) tmp = y ^ y; elseif (x <= 3e+14) tmp = t_0; else tmp = exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Exp[(-z)], $MachinePrecision]}, If[LessEqual[x, -3.8e+20], N[Exp[x], $MachinePrecision], If[LessEqual[x, -6.6e-94], t$95$0, If[LessEqual[x, 3.6e-158], N[Power[y, y], $MachinePrecision], If[LessEqual[x, 3e+14], t$95$0, N[Exp[x], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-z}\\
\mathbf{if}\;x \leq -3.8 \cdot 10^{+20}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;x \leq -6.6 \cdot 10^{-94}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-158}:\\
\;\;\;\;{y}^{y}\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+14}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{x}\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= x -1.45e+22) (not (<= x 3e+14))) (exp x) (exp (- z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.45e+22) || !(x <= 3e+14)) {
tmp = exp(x);
} else {
tmp = exp(-z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.45d+22)) .or. (.not. (x <= 3d+14))) then
tmp = exp(x)
else
tmp = exp(-z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.45e+22) || !(x <= 3e+14)) {
tmp = Math.exp(x);
} else {
tmp = Math.exp(-z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.45e+22) or not (x <= 3e+14): tmp = math.exp(x) else: tmp = math.exp(-z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.45e+22) || !(x <= 3e+14)) tmp = exp(x); else tmp = exp(Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.45e+22) || ~((x <= 3e+14))) tmp = exp(x); else tmp = exp(-z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.45e+22], N[Not[LessEqual[x, 3e+14]], $MachinePrecision]], N[Exp[x], $MachinePrecision], N[Exp[(-z)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{+22} \lor \neg \left(x \leq 3 \cdot 10^{+14}\right):\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;e^{-z}\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (exp x))
double code(double x, double y, double z) {
return exp(x);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = exp(x)
end function
public static double code(double x, double y, double z) {
return Math.exp(x);
}
def code(x, y, z): return math.exp(x)
function code(x, y, z) return exp(x) end
function tmp = code(x, y, z) tmp = exp(x); end
code[x_, y_, z_] := N[Exp[x], $MachinePrecision]
\begin{array}{l}
\\
e^{x}
\end{array}
(FPCore (x y z) :precision binary64 (exp (+ (- x z) (* (log y) y))))
double code(double x, double y, double z) {
return exp(((x - z) + (log(y) * y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = exp(((x - z) + (log(y) * y)))
end function
public static double code(double x, double y, double z) {
return Math.exp(((x - z) + (Math.log(y) * y)));
}
def code(x, y, z): return math.exp(((x - z) + (math.log(y) * y)))
function code(x, y, z) return exp(Float64(Float64(x - z) + Float64(log(y) * y))) end
function tmp = code(x, y, z) tmp = exp(((x - z) + (log(y) * y))); end
code[x_, y_, z_] := N[Exp[N[(N[(x - z), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(x - z\right) + \log y \cdot y}
\end{array}
herbie shell --seed 2024008
(FPCore (x y z)
:name "Statistics.Distribution.Poisson.Internal:probability from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(exp (+ (- x z) (* (log y) y)))
(exp (- (+ x (* y (log y))) z)))