
(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 13 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}
Initial program 100.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* y (log y)))) (if (<= t_0 20000.0) (* (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 <= 20000.0) {
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 <= 20000.0d0) 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 <= 20000.0) {
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 <= 20000.0: 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 <= 20000.0) 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 <= 20000.0) 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, 20000.0], 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 20000:\\
\;\;\;\;{y}^{y} \cdot e^{x - z}\\
\mathbf{else}:\\
\;\;\;\;e^{t\_0 - z}\\
\end{array}
\end{array}
if (*.f64 y (log.f64 y)) < 2e4Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum100.0%
*-commutative100.0%
exp-to-pow100.0%
Simplified100.0%
if 2e4 < (*.f64 y (log.f64 y)) Initial program 100.0%
Taylor expanded in x around 0 95.1%
(FPCore (x y z) :precision binary64 (if (<= x -8.8e+123) (exp x) (if (<= x 1.9e-19) (exp (- (* y (log y)) z)) (* (pow y y) (exp x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -8.8e+123) {
tmp = exp(x);
} else if (x <= 1.9e-19) {
tmp = exp(((y * log(y)) - 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 (x <= (-8.8d+123)) then
tmp = exp(x)
else if (x <= 1.9d-19) then
tmp = exp(((y * log(y)) - 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 (x <= -8.8e+123) {
tmp = Math.exp(x);
} else if (x <= 1.9e-19) {
tmp = Math.exp(((y * Math.log(y)) - z));
} else {
tmp = Math.pow(y, y) * Math.exp(x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -8.8e+123: tmp = math.exp(x) elif x <= 1.9e-19: tmp = math.exp(((y * math.log(y)) - z)) else: tmp = math.pow(y, y) * math.exp(x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -8.8e+123) tmp = exp(x); elseif (x <= 1.9e-19) tmp = exp(Float64(Float64(y * log(y)) - z)); else tmp = Float64((y ^ y) * exp(x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -8.8e+123) tmp = exp(x); elseif (x <= 1.9e-19) tmp = exp(((y * log(y)) - z)); else tmp = (y ^ y) * exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -8.8e+123], N[Exp[x], $MachinePrecision], If[LessEqual[x, 1.9e-19], N[Exp[N[(N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision], N[(N[Power[y, y], $MachinePrecision] * N[Exp[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{+123}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-19}:\\
\;\;\;\;e^{y \cdot \log y - z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\end{array}
\end{array}
if x < -8.79999999999999969e123Initial program 100.0%
Taylor expanded in x around inf 79.3%
if -8.79999999999999969e123 < x < 1.9e-19Initial program 100.0%
Taylor expanded in x around 0 95.4%
if 1.9e-19 < x Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum95.5%
*-commutative95.5%
exp-to-pow95.5%
Simplified95.5%
Taylor expanded in z around 0 98.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.5e+58) (not (<= z 2.25e+126))) (exp (- z)) (* (pow y y) (exp x))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.5e+58) || !(z <= 2.25e+126)) {
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 <= (-3.5d+58)) .or. (.not. (z <= 2.25d+126))) 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 <= -3.5e+58) || !(z <= 2.25e+126)) {
tmp = Math.exp(-z);
} else {
tmp = Math.pow(y, y) * Math.exp(x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.5e+58) or not (z <= 2.25e+126): 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 <= -3.5e+58) || !(z <= 2.25e+126)) 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 <= -3.5e+58) || ~((z <= 2.25e+126))) tmp = exp(-z); else tmp = (y ^ y) * exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.5e+58], N[Not[LessEqual[z, 2.25e+126]], $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 -3.5 \cdot 10^{+58} \lor \neg \left(z \leq 2.25 \cdot 10^{+126}\right):\\
\;\;\;\;e^{-z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\end{array}
\end{array}
if z < -3.4999999999999997e58 or 2.24999999999999987e126 < z Initial program 100.0%
Taylor expanded in z around inf 91.0%
neg-mul-191.0%
Simplified91.0%
if -3.4999999999999997e58 < z < 2.24999999999999987e126Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum86.7%
*-commutative86.7%
exp-to-pow86.7%
Simplified86.7%
Taylor expanded in z around 0 85.0%
Final simplification87.3%
(FPCore (x y z) :precision binary64 (if (<= z -3.2e-25) (/ (pow y y) (exp z)) (if (<= z 1.85e+123) (* (pow y y) (exp x)) (exp (- z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.2e-25) {
tmp = pow(y, y) / exp(z);
} else if (z <= 1.85e+123) {
tmp = pow(y, y) * 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 (z <= (-3.2d-25)) then
tmp = (y ** y) / exp(z)
else if (z <= 1.85d+123) then
tmp = (y ** y) * 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 (z <= -3.2e-25) {
tmp = Math.pow(y, y) / Math.exp(z);
} else if (z <= 1.85e+123) {
tmp = Math.pow(y, y) * Math.exp(x);
} else {
tmp = Math.exp(-z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.2e-25: tmp = math.pow(y, y) / math.exp(z) elif z <= 1.85e+123: tmp = math.pow(y, y) * math.exp(x) else: tmp = math.exp(-z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.2e-25) tmp = Float64((y ^ y) / exp(z)); elseif (z <= 1.85e+123) tmp = Float64((y ^ y) * exp(x)); else tmp = exp(Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.2e-25) tmp = (y ^ y) / exp(z); elseif (z <= 1.85e+123) tmp = (y ^ y) * exp(x); else tmp = exp(-z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.2e-25], N[(N[Power[y, y], $MachinePrecision] / N[Exp[z], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e+123], N[(N[Power[y, y], $MachinePrecision] * N[Exp[x], $MachinePrecision]), $MachinePrecision], N[Exp[(-z)], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-25}:\\
\;\;\;\;\frac{{y}^{y}}{e^{z}}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+123}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\mathbf{else}:\\
\;\;\;\;e^{-z}\\
\end{array}
\end{array}
if z < -3.2000000000000001e-25Initial program 100.0%
Taylor expanded in x around 0 89.9%
exp-diff89.9%
*-commutative89.9%
exp-to-pow89.9%
Simplified89.9%
if -3.2000000000000001e-25 < z < 1.84999999999999998e123Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum86.2%
*-commutative86.2%
exp-to-pow86.2%
Simplified86.2%
Taylor expanded in z around 0 86.7%
if 1.84999999999999998e123 < z Initial program 100.0%
Taylor expanded in z around inf 85.2%
neg-mul-185.2%
Simplified85.2%
(FPCore (x y z) :precision binary64 (if (<= x -1.38e+75) (exp x) (if (<= x 1e-80) (exp (- z)) (if (<= x 650.0) (pow y y) (exp x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.38e+75) {
tmp = exp(x);
} else if (x <= 1e-80) {
tmp = exp(-z);
} else if (x <= 650.0) {
tmp = pow(y, y);
} 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) :: tmp
if (x <= (-1.38d+75)) then
tmp = exp(x)
else if (x <= 1d-80) then
tmp = exp(-z)
else if (x <= 650.0d0) then
tmp = y ** y
else
tmp = exp(x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.38e+75) {
tmp = Math.exp(x);
} else if (x <= 1e-80) {
tmp = Math.exp(-z);
} else if (x <= 650.0) {
tmp = Math.pow(y, y);
} else {
tmp = Math.exp(x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.38e+75: tmp = math.exp(x) elif x <= 1e-80: tmp = math.exp(-z) elif x <= 650.0: tmp = math.pow(y, y) else: tmp = math.exp(x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.38e+75) tmp = exp(x); elseif (x <= 1e-80) tmp = exp(Float64(-z)); elseif (x <= 650.0) tmp = y ^ y; else tmp = exp(x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.38e+75) tmp = exp(x); elseif (x <= 1e-80) tmp = exp(-z); elseif (x <= 650.0) tmp = y ^ y; else tmp = exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.38e+75], N[Exp[x], $MachinePrecision], If[LessEqual[x, 1e-80], N[Exp[(-z)], $MachinePrecision], If[LessEqual[x, 650.0], N[Power[y, y], $MachinePrecision], N[Exp[x], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.38 \cdot 10^{+75}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;x \leq 10^{-80}:\\
\;\;\;\;e^{-z}\\
\mathbf{elif}\;x \leq 650:\\
\;\;\;\;{y}^{y}\\
\mathbf{else}:\\
\;\;\;\;e^{x}\\
\end{array}
\end{array}
if x < -1.3799999999999999e75 or 650 < x Initial program 100.0%
Taylor expanded in x around inf 87.1%
if -1.3799999999999999e75 < x < 9.99999999999999961e-81Initial program 100.0%
Taylor expanded in z around inf 75.9%
neg-mul-175.9%
Simplified75.9%
if 9.99999999999999961e-81 < x < 650Initial program 100.0%
Taylor expanded in x around 0 97.0%
Taylor expanded in z around 0 78.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.6e+74) (not (<= x 660.0))) (exp x) (exp (- z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.6e+74) || !(x <= 660.0)) {
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 <= (-3.6d+74)) .or. (.not. (x <= 660.0d0))) 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 <= -3.6e+74) || !(x <= 660.0)) {
tmp = Math.exp(x);
} else {
tmp = Math.exp(-z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.6e+74) or not (x <= 660.0): tmp = math.exp(x) else: tmp = math.exp(-z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.6e+74) || !(x <= 660.0)) tmp = exp(x); else tmp = exp(Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.6e+74) || ~((x <= 660.0))) tmp = exp(x); else tmp = exp(-z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.6e+74], N[Not[LessEqual[x, 660.0]], $MachinePrecision]], N[Exp[x], $MachinePrecision], N[Exp[(-z)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{+74} \lor \neg \left(x \leq 660\right):\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;e^{-z}\\
\end{array}
\end{array}
if x < -3.59999999999999988e74 or 660 < x Initial program 100.0%
Taylor expanded in x around inf 87.1%
if -3.59999999999999988e74 < x < 660Initial program 100.0%
Taylor expanded in z around inf 72.4%
neg-mul-172.4%
Simplified72.4%
Final simplification78.5%
(FPCore (x y z) :precision binary64 (if (<= z -2.6e+84) (+ 1.0 (* z (+ (* z (* z -0.16666666666666666)) -1.0))) (exp x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.6e+84) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.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) :: tmp
if (z <= (-2.6d+84)) then
tmp = 1.0d0 + (z * ((z * (z * (-0.16666666666666666d0))) + (-1.0d0)))
else
tmp = exp(x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.6e+84) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
} else {
tmp = Math.exp(x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.6e+84: tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)) else: tmp = math.exp(x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.6e+84) tmp = Float64(1.0 + Float64(z * Float64(Float64(z * Float64(z * -0.16666666666666666)) + -1.0))); else tmp = exp(x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.6e+84) tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)); else tmp = exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.6e+84], N[(1.0 + N[(z * N[(N[(z * N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Exp[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+84}:\\
\;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{x}\\
\end{array}
\end{array}
if z < -2.6000000000000001e84Initial program 100.0%
Taylor expanded in z around inf 94.5%
neg-mul-194.5%
Simplified94.5%
Taylor expanded in z around 0 82.6%
Taylor expanded in z around inf 82.6%
*-commutative82.6%
Simplified82.6%
if -2.6000000000000001e84 < z Initial program 100.0%
Taylor expanded in x around inf 61.5%
Final simplification66.0%
(FPCore (x y z) :precision binary64 (if (<= z -1.75e+87) (+ 1.0 (* z (+ (* z (* z -0.16666666666666666)) -1.0))) (+ 1.0 (* x (+ 1.0 (* x 0.5))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.75e+87) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
} else {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
}
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.75d+87)) then
tmp = 1.0d0 + (z * ((z * (z * (-0.16666666666666666d0))) + (-1.0d0)))
else
tmp = 1.0d0 + (x * (1.0d0 + (x * 0.5d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.75e+87) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
} else {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.75e+87: tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)) else: tmp = 1.0 + (x * (1.0 + (x * 0.5))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.75e+87) tmp = Float64(1.0 + Float64(z * Float64(Float64(z * Float64(z * -0.16666666666666666)) + -1.0))); else tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.75e+87) tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)); else tmp = 1.0 + (x * (1.0 + (x * 0.5))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.75e+87], N[(1.0 + N[(z * N[(N[(z * N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+87}:\\
\;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < -1.74999999999999993e87Initial program 100.0%
Taylor expanded in z around inf 94.4%
neg-mul-194.4%
Simplified94.4%
Taylor expanded in z around 0 84.1%
Taylor expanded in z around inf 84.1%
*-commutative84.1%
Simplified84.1%
if -1.74999999999999993e87 < z Initial program 100.0%
Taylor expanded in x around inf 61.2%
Taylor expanded in x around 0 35.3%
Final simplification45.4%
(FPCore (x y z) :precision binary64 (if (<= z -7.5e+128) (+ 1.0 (* z (* z 0.5))) (+ 1.0 (* x (+ 1.0 (* x 0.5))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.5e+128) {
tmp = 1.0 + (z * (z * 0.5));
} else {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
}
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 <= (-7.5d+128)) then
tmp = 1.0d0 + (z * (z * 0.5d0))
else
tmp = 1.0d0 + (x * (1.0d0 + (x * 0.5d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -7.5e+128) {
tmp = 1.0 + (z * (z * 0.5));
} else {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.5e+128: tmp = 1.0 + (z * (z * 0.5)) else: tmp = 1.0 + (x * (1.0 + (x * 0.5))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.5e+128) tmp = Float64(1.0 + Float64(z * Float64(z * 0.5))); else tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7.5e+128) tmp = 1.0 + (z * (z * 0.5)); else tmp = 1.0 + (x * (1.0 + (x * 0.5))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.5e+128], N[(1.0 + N[(z * N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+128}:\\
\;\;\;\;1 + z \cdot \left(z \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < -7.50000000000000076e128Initial program 100.0%
Taylor expanded in z around inf 92.6%
neg-mul-192.6%
Simplified92.6%
Taylor expanded in z around 0 85.7%
Taylor expanded in z around inf 85.7%
*-commutative85.7%
Simplified85.7%
if -7.50000000000000076e128 < z Initial program 100.0%
Taylor expanded in x around inf 58.6%
Taylor expanded in x around 0 34.3%
Final simplification42.3%
(FPCore (x y z) :precision binary64 (+ 1.0 (* z (* z 0.5))))
double code(double x, double y, double z) {
return 1.0 + (z * (z * 0.5));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + (z * (z * 0.5d0))
end function
public static double code(double x, double y, double z) {
return 1.0 + (z * (z * 0.5));
}
def code(x, y, z): return 1.0 + (z * (z * 0.5))
function code(x, y, z) return Float64(1.0 + Float64(z * Float64(z * 0.5))) end
function tmp = code(x, y, z) tmp = 1.0 + (z * (z * 0.5)); end
code[x_, y_, z_] := N[(1.0 + N[(z * N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + z \cdot \left(z \cdot 0.5\right)
\end{array}
Initial program 100.0%
Taylor expanded in z around inf 55.8%
neg-mul-155.8%
Simplified55.8%
Taylor expanded in z around 0 30.0%
Taylor expanded in z around inf 29.8%
*-commutative29.8%
Simplified29.8%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 53.7%
Taylor expanded in x around 0 15.3%
Final simplification15.3%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 53.7%
Taylor expanded in x around 0 14.9%
(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 2024137
(FPCore (x y z)
:name "Statistics.Distribution.Poisson.Internal:probability from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (exp (+ (- x z) (* (log y) y))))
(exp (- (+ x (* y (log y))) z)))