
(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 15 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 -2e-302) (* (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 <= -2e-302) {
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 <= (-2d-302)) 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 <= -2e-302) {
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 <= -2e-302: 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 <= -2e-302) 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 <= -2e-302) 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, -2e-302], 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 -2 \cdot 10^{-302}:\\
\;\;\;\;{y}^{y} \cdot e^{x - z}\\
\mathbf{else}:\\
\;\;\;\;e^{t\_0 - z}\\
\end{array}
\end{array}
if (*.f64 y (log.f64 y)) < -1.9999999999999999e-302Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum100.0%
*-commutative100.0%
exp-to-pow100.0%
Simplified100.0%
if -1.9999999999999999e-302 < (*.f64 y (log.f64 y)) Initial program 100.0%
Taylor expanded in x around 0 87.1%
(FPCore (x y z) :precision binary64 (if (<= x -3.1e+19) (exp x) (if (<= x 1.35e+47) (exp (- (* y (log y)) z)) (* (pow y y) (exp x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.1e+19) {
tmp = exp(x);
} else if (x <= 1.35e+47) {
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 <= (-3.1d+19)) then
tmp = exp(x)
else if (x <= 1.35d+47) 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 <= -3.1e+19) {
tmp = Math.exp(x);
} else if (x <= 1.35e+47) {
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 <= -3.1e+19: tmp = math.exp(x) elif x <= 1.35e+47: 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 <= -3.1e+19) tmp = exp(x); elseif (x <= 1.35e+47) 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 <= -3.1e+19) tmp = exp(x); elseif (x <= 1.35e+47) tmp = exp(((y * log(y)) - z)); else tmp = (y ^ y) * exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.1e+19], N[Exp[x], $MachinePrecision], If[LessEqual[x, 1.35e+47], 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 -3.1 \cdot 10^{+19}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+47}:\\
\;\;\;\;e^{y \cdot \log y - z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\end{array}
\end{array}
if x < -3.1e19Initial program 100.0%
Taylor expanded in x around inf 81.3%
if -3.1e19 < x < 1.34999999999999998e47Initial program 100.0%
Taylor expanded in x around 0 98.2%
if 1.34999999999999998e47 < x Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum94.8%
*-commutative94.8%
exp-to-pow94.8%
Simplified94.8%
Taylor expanded in z around 0 96.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -9.5e+16) (not (<= x 1.45e-17))) (exp x) (/ (pow y y) (exp z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9.5e+16) || !(x <= 1.45e-17)) {
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 <= (-9.5d+16)) .or. (.not. (x <= 1.45d-17))) 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 <= -9.5e+16) || !(x <= 1.45e-17)) {
tmp = Math.exp(x);
} else {
tmp = Math.pow(y, y) / Math.exp(z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -9.5e+16) or not (x <= 1.45e-17): 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 <= -9.5e+16) || !(x <= 1.45e-17)) 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 <= -9.5e+16) || ~((x <= 1.45e-17))) tmp = exp(x); else tmp = (y ^ y) / exp(z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -9.5e+16], N[Not[LessEqual[x, 1.45e-17]], $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 -9.5 \cdot 10^{+16} \lor \neg \left(x \leq 1.45 \cdot 10^{-17}\right):\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{{y}^{y}}{e^{z}}\\
\end{array}
\end{array}
if x < -9.5e16 or 1.4500000000000001e-17 < x Initial program 100.0%
Taylor expanded in x around inf 88.2%
if -9.5e16 < x < 1.4500000000000001e-17Initial program 100.0%
Taylor expanded in x around 0 99.3%
exp-diff86.3%
*-commutative86.3%
exp-to-pow86.3%
Simplified86.3%
Final simplification87.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.6e+76) (not (<= z 1.05e+21))) (exp (- z)) (* (pow y y) (exp x))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.6e+76) || !(z <= 1.05e+21)) {
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 <= (-4.6d+76)) .or. (.not. (z <= 1.05d+21))) 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 <= -4.6e+76) || !(z <= 1.05e+21)) {
tmp = Math.exp(-z);
} else {
tmp = Math.pow(y, y) * Math.exp(x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.6e+76) or not (z <= 1.05e+21): 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 <= -4.6e+76) || !(z <= 1.05e+21)) 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 <= -4.6e+76) || ~((z <= 1.05e+21))) tmp = exp(-z); else tmp = (y ^ y) * exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.6e+76], N[Not[LessEqual[z, 1.05e+21]], $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 -4.6 \cdot 10^{+76} \lor \neg \left(z \leq 1.05 \cdot 10^{+21}\right):\\
\;\;\;\;e^{-z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\end{array}
\end{array}
if z < -4.60000000000000002e76 or 1.05e21 < z Initial program 100.0%
Taylor expanded in z around inf 78.0%
neg-mul-178.0%
Simplified78.0%
if -4.60000000000000002e76 < z < 1.05e21Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum90.2%
*-commutative90.2%
exp-to-pow90.2%
Simplified90.2%
Taylor expanded in z around 0 89.4%
Final simplification84.8%
(FPCore (x y z) :precision binary64 (if (<= x -17500000000.0) (exp x) (if (<= x 2.7e-126) (pow y y) (if (<= x 1.45e-17) (exp (- z)) (exp x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -17500000000.0) {
tmp = exp(x);
} else if (x <= 2.7e-126) {
tmp = pow(y, y);
} else if (x <= 1.45e-17) {
tmp = exp(-z);
} 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 <= (-17500000000.0d0)) then
tmp = exp(x)
else if (x <= 2.7d-126) then
tmp = y ** y
else if (x <= 1.45d-17) then
tmp = exp(-z)
else
tmp = exp(x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -17500000000.0) {
tmp = Math.exp(x);
} else if (x <= 2.7e-126) {
tmp = Math.pow(y, y);
} else if (x <= 1.45e-17) {
tmp = Math.exp(-z);
} else {
tmp = Math.exp(x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -17500000000.0: tmp = math.exp(x) elif x <= 2.7e-126: tmp = math.pow(y, y) elif x <= 1.45e-17: tmp = math.exp(-z) else: tmp = math.exp(x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -17500000000.0) tmp = exp(x); elseif (x <= 2.7e-126) tmp = y ^ y; elseif (x <= 1.45e-17) tmp = exp(Float64(-z)); else tmp = exp(x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -17500000000.0) tmp = exp(x); elseif (x <= 2.7e-126) tmp = y ^ y; elseif (x <= 1.45e-17) tmp = exp(-z); else tmp = exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -17500000000.0], N[Exp[x], $MachinePrecision], If[LessEqual[x, 2.7e-126], N[Power[y, y], $MachinePrecision], If[LessEqual[x, 1.45e-17], N[Exp[(-z)], $MachinePrecision], N[Exp[x], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -17500000000:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-126}:\\
\;\;\;\;{y}^{y}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-17}:\\
\;\;\;\;e^{-z}\\
\mathbf{else}:\\
\;\;\;\;e^{x}\\
\end{array}
\end{array}
if x < -1.75e10 or 1.4500000000000001e-17 < x Initial program 100.0%
Taylor expanded in x around inf 88.4%
if -1.75e10 < x < 2.69999999999999995e-126Initial program 100.0%
Taylor expanded in x around 0 99.1%
Taylor expanded in z around 0 73.8%
if 2.69999999999999995e-126 < x < 1.4500000000000001e-17Initial program 100.0%
Taylor expanded in z around inf 80.6%
neg-mul-180.6%
Simplified80.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -170000000.0) (not (<= x 1.45e-17))) (exp x) (exp (- z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -170000000.0) || !(x <= 1.45e-17)) {
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 <= (-170000000.0d0)) .or. (.not. (x <= 1.45d-17))) 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 <= -170000000.0) || !(x <= 1.45e-17)) {
tmp = Math.exp(x);
} else {
tmp = Math.exp(-z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -170000000.0) or not (x <= 1.45e-17): tmp = math.exp(x) else: tmp = math.exp(-z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -170000000.0) || !(x <= 1.45e-17)) tmp = exp(x); else tmp = exp(Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -170000000.0) || ~((x <= 1.45e-17))) tmp = exp(x); else tmp = exp(-z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -170000000.0], N[Not[LessEqual[x, 1.45e-17]], $MachinePrecision]], N[Exp[x], $MachinePrecision], N[Exp[(-z)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -170000000 \lor \neg \left(x \leq 1.45 \cdot 10^{-17}\right):\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;e^{-z}\\
\end{array}
\end{array}
if x < -1.7e8 or 1.4500000000000001e-17 < x Initial program 100.0%
Taylor expanded in x around inf 87.8%
if -1.7e8 < x < 1.4500000000000001e-17Initial program 100.0%
Taylor expanded in z around inf 65.2%
neg-mul-165.2%
Simplified65.2%
Final simplification76.6%
(FPCore (x y z) :precision binary64 (if (<= z -5.3e+160) (+ 1.0 (* z (* z 0.5))) (exp x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.3e+160) {
tmp = 1.0 + (z * (z * 0.5));
} 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 <= (-5.3d+160)) then
tmp = 1.0d0 + (z * (z * 0.5d0))
else
tmp = exp(x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.3e+160) {
tmp = 1.0 + (z * (z * 0.5));
} else {
tmp = Math.exp(x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.3e+160: tmp = 1.0 + (z * (z * 0.5)) else: tmp = math.exp(x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.3e+160) tmp = Float64(1.0 + Float64(z * Float64(z * 0.5))); else tmp = exp(x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.3e+160) tmp = 1.0 + (z * (z * 0.5)); else tmp = exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.3e+160], N[(1.0 + N[(z * N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Exp[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{+160}:\\
\;\;\;\;1 + z \cdot \left(z \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;e^{x}\\
\end{array}
\end{array}
if z < -5.3000000000000001e160Initial program 100.0%
Taylor expanded in z around inf 96.5%
neg-mul-196.5%
Simplified96.5%
Taylor expanded in z around 0 96.5%
Taylor expanded in z around inf 96.5%
*-commutative96.5%
Simplified96.5%
if -5.3000000000000001e160 < z Initial program 100.0%
Taylor expanded in x around inf 60.0%
(FPCore (x y z) :precision binary64 (if (<= z -6.4e+102) (+ 1.0 (* z (+ (* z (* z -0.16666666666666666)) -1.0))) (+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+102) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
} else {
tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))));
}
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 <= (-6.4d+102)) then
tmp = 1.0d0 + (z * ((z * (z * (-0.16666666666666666d0))) + (-1.0d0)))
else
tmp = 1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0)))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+102) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
} else {
tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.4e+102: tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)) else: tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.4e+102) 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 * Float64(0.5 + Float64(x * 0.16666666666666666)))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.4e+102) tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)); else tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.4e+102], 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 * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+102}:\\
\;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if z < -6.3999999999999999e102Initial program 100.0%
Taylor expanded in z around inf 84.9%
neg-mul-184.9%
Simplified84.9%
Taylor expanded in z around 0 84.9%
Taylor expanded in z around inf 84.9%
*-commutative84.9%
Simplified84.9%
if -6.3999999999999999e102 < z Initial program 100.0%
Taylor expanded in x around inf 59.8%
Taylor expanded in x around 0 32.5%
Final simplification40.5%
(FPCore (x y z) :precision binary64 (if (<= z -9e+102) (+ 1.0 (* z (+ (* z (* z -0.16666666666666666)) -1.0))) (+ 1.0 (* x (+ 1.0 (* x (* x 0.16666666666666666)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -9e+102) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
} else {
tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))));
}
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 <= (-9d+102)) then
tmp = 1.0d0 + (z * ((z * (z * (-0.16666666666666666d0))) + (-1.0d0)))
else
tmp = 1.0d0 + (x * (1.0d0 + (x * (x * 0.16666666666666666d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -9e+102) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
} else {
tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9e+102: tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)) else: tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666)))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9e+102) 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 * Float64(x * 0.16666666666666666))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9e+102) tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)); else tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9e+102], 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 * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+102}:\\
\;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot \left(x \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if z < -9.00000000000000042e102Initial program 100.0%
Taylor expanded in z around inf 84.9%
neg-mul-184.9%
Simplified84.9%
Taylor expanded in z around 0 84.9%
Taylor expanded in z around inf 84.9%
*-commutative84.9%
Simplified84.9%
if -9.00000000000000042e102 < z Initial program 100.0%
Taylor expanded in x around inf 59.8%
Taylor expanded in x around 0 32.5%
Taylor expanded in x around inf 32.4%
*-commutative32.4%
Simplified32.4%
Final simplification40.4%
(FPCore (x y z) :precision binary64 (if (<= x 1.45e+88) (+ 1.0 (* z (+ (* z 0.5) -1.0))) (+ 1.0 (* x (+ 1.0 (* x (* x 0.16666666666666666)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.45e+88) {
tmp = 1.0 + (z * ((z * 0.5) + -1.0));
} else {
tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))));
}
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+88) then
tmp = 1.0d0 + (z * ((z * 0.5d0) + (-1.0d0)))
else
tmp = 1.0d0 + (x * (1.0d0 + (x * (x * 0.16666666666666666d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.45e+88) {
tmp = 1.0 + (z * ((z * 0.5) + -1.0));
} else {
tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.45e+88: tmp = 1.0 + (z * ((z * 0.5) + -1.0)) else: tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666)))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.45e+88) tmp = Float64(1.0 + Float64(z * Float64(Float64(z * 0.5) + -1.0))); else tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(x * 0.16666666666666666))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.45e+88) tmp = 1.0 + (z * ((z * 0.5) + -1.0)); else tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.45e+88], N[(1.0 + N[(z * N[(N[(z * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(1.0 + N[(x * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.45 \cdot 10^{+88}:\\
\;\;\;\;1 + z \cdot \left(z \cdot 0.5 + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot \left(x \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if x < 1.45e88Initial program 100.0%
Taylor expanded in z around inf 54.2%
neg-mul-154.2%
Simplified54.2%
Taylor expanded in z around 0 28.2%
if 1.45e88 < x Initial program 100.0%
Taylor expanded in x around inf 95.9%
Taylor expanded in x around 0 88.2%
Taylor expanded in x around inf 88.2%
*-commutative88.2%
Simplified88.2%
Final simplification39.5%
(FPCore (x y z) :precision binary64 (if (<= z -3.4e+130) (+ 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 <= -3.4e+130) {
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 <= (-3.4d+130)) 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 <= -3.4e+130) {
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 <= -3.4e+130: 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 <= -3.4e+130) 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 <= -3.4e+130) 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, -3.4e+130], 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 -3.4 \cdot 10^{+130}:\\
\;\;\;\;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 < -3.4000000000000001e130Initial program 100.0%
Taylor expanded in z around inf 85.9%
neg-mul-185.9%
Simplified85.9%
Taylor expanded in z around 0 78.2%
Taylor expanded in z around inf 78.2%
*-commutative78.2%
Simplified78.2%
if -3.4000000000000001e130 < z Initial program 100.0%
Taylor expanded in x around inf 59.7%
Taylor expanded in x around 0 30.8%
Final simplification37.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 49.1%
neg-mul-149.1%
Simplified49.1%
Taylor expanded in z around 0 27.0%
Taylor expanded in z around inf 26.9%
*-commutative26.9%
Simplified26.9%
(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 57.2%
Taylor expanded in x around 0 15.5%
Final simplification15.5%
(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 57.2%
Taylor expanded in x around 0 15.1%
(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 2024180
(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)))