
(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 (if (<= x -4.6e+69) (exp x) (if (<= x 1.3e-22) (exp (- (* y (log y)) z)) (* (pow y y) (exp x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.6e+69) {
tmp = exp(x);
} else if (x <= 1.3e-22) {
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 <= (-4.6d+69)) then
tmp = exp(x)
else if (x <= 1.3d-22) 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 <= -4.6e+69) {
tmp = Math.exp(x);
} else if (x <= 1.3e-22) {
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 <= -4.6e+69: tmp = math.exp(x) elif x <= 1.3e-22: 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 <= -4.6e+69) tmp = exp(x); elseif (x <= 1.3e-22) 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 <= -4.6e+69) tmp = exp(x); elseif (x <= 1.3e-22) tmp = exp(((y * log(y)) - z)); else tmp = (y ^ y) * exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.6e+69], N[Exp[x], $MachinePrecision], If[LessEqual[x, 1.3e-22], 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 -4.6 \cdot 10^{+69}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-22}:\\
\;\;\;\;e^{y \cdot \log y - z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\end{array}
\end{array}
if x < -4.60000000000000033e69Initial program 100.0%
Taylor expanded in x around inf 85.6%
if -4.60000000000000033e69 < x < 1.3e-22Initial program 100.0%
Taylor expanded in x around 0 97.2%
if 1.3e-22 < x Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum90.1%
*-commutative90.1%
exp-to-pow90.1%
Simplified90.1%
Taylor expanded in z around 0 87.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -8400000000.0) (not (<= z 2e+74))) (exp (- z)) (* (pow y y) (exp x))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8400000000.0) || !(z <= 2e+74)) {
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 <= (-8400000000.0d0)) .or. (.not. (z <= 2d+74))) 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 <= -8400000000.0) || !(z <= 2e+74)) {
tmp = Math.exp(-z);
} else {
tmp = Math.pow(y, y) * Math.exp(x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8400000000.0) or not (z <= 2e+74): 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 <= -8400000000.0) || !(z <= 2e+74)) 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 <= -8400000000.0) || ~((z <= 2e+74))) tmp = exp(-z); else tmp = (y ^ y) * exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8400000000.0], N[Not[LessEqual[z, 2e+74]], $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 -8400000000 \lor \neg \left(z \leq 2 \cdot 10^{+74}\right):\\
\;\;\;\;e^{-z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\end{array}
\end{array}
if z < -8.4e9 or 1.9999999999999999e74 < z Initial program 100.0%
Taylor expanded in z around inf 81.2%
neg-mul-181.2%
Simplified81.2%
if -8.4e9 < z < 1.9999999999999999e74Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum84.2%
*-commutative84.2%
exp-to-pow84.2%
Simplified84.2%
Taylor expanded in z around 0 84.0%
Final simplification82.8%
(FPCore (x y z) :precision binary64 (if (<= x -3.35e+68) (exp x) (if (<= x 4.4e-23) (/ (pow y y) (exp z)) (* (pow y y) (exp x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.35e+68) {
tmp = exp(x);
} else if (x <= 4.4e-23) {
tmp = pow(y, y) / 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 (x <= (-3.35d+68)) then
tmp = exp(x)
else if (x <= 4.4d-23) then
tmp = (y ** y) / 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 (x <= -3.35e+68) {
tmp = Math.exp(x);
} else if (x <= 4.4e-23) {
tmp = Math.pow(y, y) / Math.exp(z);
} else {
tmp = Math.pow(y, y) * Math.exp(x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.35e+68: tmp = math.exp(x) elif x <= 4.4e-23: tmp = math.pow(y, y) / math.exp(z) else: tmp = math.pow(y, y) * math.exp(x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.35e+68) tmp = exp(x); elseif (x <= 4.4e-23) tmp = Float64((y ^ y) / exp(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.35e+68) tmp = exp(x); elseif (x <= 4.4e-23) tmp = (y ^ y) / exp(z); else tmp = (y ^ y) * exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.35e+68], N[Exp[x], $MachinePrecision], If[LessEqual[x, 4.4e-23], N[(N[Power[y, y], $MachinePrecision] / N[Exp[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.35 \cdot 10^{+68}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-23}:\\
\;\;\;\;\frac{{y}^{y}}{e^{z}}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\end{array}
\end{array}
if x < -3.3499999999999999e68Initial program 100.0%
Taylor expanded in x around inf 85.6%
if -3.3499999999999999e68 < x < 4.3999999999999999e-23Initial program 100.0%
Taylor expanded in x around 0 97.2%
exp-diff81.1%
*-commutative81.1%
exp-to-pow81.1%
Simplified81.1%
if 4.3999999999999999e-23 < x Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum90.1%
*-commutative90.1%
exp-to-pow90.1%
Simplified90.1%
Taylor expanded in z around 0 87.5%
(FPCore (x y z) :precision binary64 (if (<= y 4.4e-14) (* (pow y y) (exp (- x z))) (exp (- (* y (log y)) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.4e-14) {
tmp = pow(y, y) * exp((x - z));
} 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 (y <= 4.4d-14) then
tmp = (y ** y) * exp((x - z))
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 (y <= 4.4e-14) {
tmp = Math.pow(y, y) * Math.exp((x - z));
} else {
tmp = Math.exp(((y * Math.log(y)) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4.4e-14: tmp = math.pow(y, y) * math.exp((x - z)) else: tmp = math.exp(((y * math.log(y)) - z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4.4e-14) tmp = Float64((y ^ y) * exp(Float64(x - z))); else tmp = exp(Float64(Float64(y * log(y)) - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4.4e-14) tmp = (y ^ y) * exp((x - z)); else tmp = exp(((y * log(y)) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4.4e-14], N[(N[Power[y, y], $MachinePrecision] * N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.4 \cdot 10^{-14}:\\
\;\;\;\;{y}^{y} \cdot e^{x - z}\\
\mathbf{else}:\\
\;\;\;\;e^{y \cdot \log y - z}\\
\end{array}
\end{array}
if y < 4.4000000000000002e-14Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum100.0%
*-commutative100.0%
exp-to-pow100.0%
Simplified100.0%
if 4.4000000000000002e-14 < y Initial program 100.0%
Taylor expanded in x around 0 91.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.2e+28) (not (<= x 1.3e-22))) (exp x) (exp (- z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.2e+28) || !(x <= 1.3e-22)) {
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.2d+28)) .or. (.not. (x <= 1.3d-22))) 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.2e+28) || !(x <= 1.3e-22)) {
tmp = Math.exp(x);
} else {
tmp = Math.exp(-z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.2e+28) or not (x <= 1.3e-22): tmp = math.exp(x) else: tmp = math.exp(-z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.2e+28) || !(x <= 1.3e-22)) 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.2e+28) || ~((x <= 1.3e-22))) tmp = exp(x); else tmp = exp(-z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.2e+28], N[Not[LessEqual[x, 1.3e-22]], $MachinePrecision]], N[Exp[x], $MachinePrecision], N[Exp[(-z)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+28} \lor \neg \left(x \leq 1.3 \cdot 10^{-22}\right):\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;e^{-z}\\
\end{array}
\end{array}
if x < -1.19999999999999991e28 or 1.3e-22 < x Initial program 100.0%
Taylor expanded in x around inf 81.9%
if -1.19999999999999991e28 < x < 1.3e-22Initial program 100.0%
Taylor expanded in z around inf 60.7%
neg-mul-160.7%
Simplified60.7%
Final simplification71.4%
(FPCore (x y z) :precision binary64 (if (<= y 3.4e-228) (exp (- z)) (if (<= y 3400000000000.0) (exp x) (pow y y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.4e-228) {
tmp = exp(-z);
} else if (y <= 3400000000000.0) {
tmp = exp(x);
} else {
tmp = pow(y, y);
}
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 (y <= 3.4d-228) then
tmp = exp(-z)
else if (y <= 3400000000000.0d0) then
tmp = exp(x)
else
tmp = y ** y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.4e-228) {
tmp = Math.exp(-z);
} else if (y <= 3400000000000.0) {
tmp = Math.exp(x);
} else {
tmp = Math.pow(y, y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.4e-228: tmp = math.exp(-z) elif y <= 3400000000000.0: tmp = math.exp(x) else: tmp = math.pow(y, y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.4e-228) tmp = exp(Float64(-z)); elseif (y <= 3400000000000.0) tmp = exp(x); else tmp = y ^ y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.4e-228) tmp = exp(-z); elseif (y <= 3400000000000.0) tmp = exp(x); else tmp = y ^ y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.4e-228], N[Exp[(-z)], $MachinePrecision], If[LessEqual[y, 3400000000000.0], N[Exp[x], $MachinePrecision], N[Power[y, y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.4 \cdot 10^{-228}:\\
\;\;\;\;e^{-z}\\
\mathbf{elif}\;y \leq 3400000000000:\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y}\\
\end{array}
\end{array}
if y < 3.39999999999999991e-228Initial program 100.0%
Taylor expanded in z around inf 75.6%
neg-mul-175.6%
Simplified75.6%
if 3.39999999999999991e-228 < y < 3.4e12Initial program 100.0%
Taylor expanded in x around inf 75.2%
if 3.4e12 < y Initial program 100.0%
Taylor expanded in x around 0 92.7%
Taylor expanded in z around 0 80.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.05e+28) (not (<= x 1.02e-54))) (exp x) (+ 1.0 (* z (+ (* z 0.5) -1.0)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.05e+28) || !(x <= 1.02e-54)) {
tmp = exp(x);
} else {
tmp = 1.0 + (z * ((z * 0.5) + -1.0));
}
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.05d+28)) .or. (.not. (x <= 1.02d-54))) then
tmp = exp(x)
else
tmp = 1.0d0 + (z * ((z * 0.5d0) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.05e+28) || !(x <= 1.02e-54)) {
tmp = Math.exp(x);
} else {
tmp = 1.0 + (z * ((z * 0.5) + -1.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.05e+28) or not (x <= 1.02e-54): tmp = math.exp(x) else: tmp = 1.0 + (z * ((z * 0.5) + -1.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.05e+28) || !(x <= 1.02e-54)) tmp = exp(x); else tmp = Float64(1.0 + Float64(z * Float64(Float64(z * 0.5) + -1.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.05e+28) || ~((x <= 1.02e-54))) tmp = exp(x); else tmp = 1.0 + (z * ((z * 0.5) + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.05e+28], N[Not[LessEqual[x, 1.02e-54]], $MachinePrecision]], N[Exp[x], $MachinePrecision], N[(1.0 + N[(z * N[(N[(z * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{+28} \lor \neg \left(x \leq 1.02 \cdot 10^{-54}\right):\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;1 + z \cdot \left(z \cdot 0.5 + -1\right)\\
\end{array}
\end{array}
if x < -1.04999999999999995e28 or 1.01999999999999999e-54 < x Initial program 100.0%
Taylor expanded in x around inf 80.0%
if -1.04999999999999995e28 < x < 1.01999999999999999e-54Initial program 100.0%
Taylor expanded in z around inf 59.2%
neg-mul-159.2%
Simplified59.2%
Taylor expanded in z around 0 35.4%
Final simplification59.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.9e+129) (not (<= z 4.3e+136))) (+ 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 <= -4.9e+129) || !(z <= 4.3e+136)) {
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 <= (-4.9d+129)) .or. (.not. (z <= 4.3d+136))) 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 <= -4.9e+129) || !(z <= 4.3e+136)) {
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 <= -4.9e+129) or not (z <= 4.3e+136): 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 <= -4.9e+129) || !(z <= 4.3e+136)) 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 <= -4.9e+129) || ~((z <= 4.3e+136))) 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[Or[LessEqual[z, -4.9e+129], N[Not[LessEqual[z, 4.3e+136]], $MachinePrecision]], 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 -4.9 \cdot 10^{+129} \lor \neg \left(z \leq 4.3 \cdot 10^{+136}\right):\\
\;\;\;\;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 < -4.9e129 or 4.2999999999999999e136 < z Initial program 100.0%
Taylor expanded in z around inf 80.9%
neg-mul-180.9%
Simplified80.9%
Taylor expanded in z around 0 52.5%
Taylor expanded in z around inf 52.5%
*-commutative52.5%
Simplified52.5%
if -4.9e129 < z < 4.2999999999999999e136Initial program 100.0%
Taylor expanded in x around inf 57.6%
Taylor expanded in x around 0 26.4%
Final simplification33.7%
(FPCore (x y z) :precision binary64 (if (<= x 3.8e+31) (+ 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 <= 3.8e+31) {
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 <= 3.8d+31) 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 <= 3.8e+31) {
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 <= 3.8e+31: 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 <= 3.8e+31) 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 <= 3.8e+31) 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, 3.8e+31], 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 3.8 \cdot 10^{+31}:\\
\;\;\;\;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 < 3.8000000000000001e31Initial program 100.0%
Taylor expanded in z around inf 47.7%
neg-mul-147.7%
Simplified47.7%
Taylor expanded in z around 0 25.7%
if 3.8000000000000001e31 < x Initial program 100.0%
Taylor expanded in x around inf 85.5%
Taylor expanded in x around 0 68.5%
Taylor expanded in x around inf 68.5%
Final simplification35.9%
(FPCore (x y z) :precision binary64 (if (<= x 1.55e+153) (+ 1.0 (* z (+ (* z 0.5) -1.0))) (+ 1.0 (* x (+ 1.0 (* x 0.5))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.55e+153) {
tmp = 1.0 + (z * ((z * 0.5) + -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 (x <= 1.55d+153) then
tmp = 1.0d0 + (z * ((z * 0.5d0) + (-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 (x <= 1.55e+153) {
tmp = 1.0 + (z * ((z * 0.5) + -1.0));
} else {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.55e+153: tmp = 1.0 + (z * ((z * 0.5) + -1.0)) else: tmp = 1.0 + (x * (1.0 + (x * 0.5))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.55e+153) 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 * 0.5)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.55e+153) tmp = 1.0 + (z * ((z * 0.5) + -1.0)); else tmp = 1.0 + (x * (1.0 + (x * 0.5))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.55e+153], 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 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.55 \cdot 10^{+153}:\\
\;\;\;\;1 + z \cdot \left(z \cdot 0.5 + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 1.55e153Initial program 100.0%
Taylor expanded in z around inf 48.6%
neg-mul-148.6%
Simplified48.6%
Taylor expanded in z around 0 24.1%
if 1.55e153 < x Initial program 100.0%
Taylor expanded in x around inf 91.1%
Taylor expanded in x around 0 88.5%
Final simplification32.4%
(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 47.6%
neg-mul-147.6%
Simplified47.6%
Taylor expanded in z around 0 24.9%
Taylor expanded in z around inf 24.6%
*-commutative24.6%
Simplified24.6%
(FPCore (x y z) :precision binary64 (/ 1.0 (+ z 1.0)))
double code(double x, double y, double z) {
return 1.0 / (z + 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 / (z + 1.0d0)
end function
public static double code(double x, double y, double z) {
return 1.0 / (z + 1.0);
}
def code(x, y, z): return 1.0 / (z + 1.0)
function code(x, y, z) return Float64(1.0 / Float64(z + 1.0)) end
function tmp = code(x, y, z) tmp = 1.0 / (z + 1.0); end
code[x_, y_, z_] := N[(1.0 / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{z + 1}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 79.1%
exp-diff66.1%
*-commutative66.1%
exp-to-pow66.1%
Simplified66.1%
Taylor expanded in z around 0 41.7%
+-commutative41.7%
Simplified41.7%
Taylor expanded in y around 0 10.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 50.9%
Taylor expanded in x around 0 10.8%
Final simplification10.8%
(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 50.9%
Taylor expanded in x around 0 10.6%
(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 2024186
(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)))