
(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 16 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 (or (<= x -6.8e+52) (not (<= x 0.0115))) (exp (- x z)) (exp (- (* y (log y)) z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6.8e+52) || !(x <= 0.0115)) {
tmp = 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 ((x <= (-6.8d+52)) .or. (.not. (x <= 0.0115d0))) then
tmp = 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 ((x <= -6.8e+52) || !(x <= 0.0115)) {
tmp = Math.exp((x - z));
} else {
tmp = Math.exp(((y * Math.log(y)) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -6.8e+52) or not (x <= 0.0115): tmp = math.exp((x - z)) else: tmp = math.exp(((y * math.log(y)) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -6.8e+52) || !(x <= 0.0115)) tmp = 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 ((x <= -6.8e+52) || ~((x <= 0.0115))) tmp = exp((x - z)); else tmp = exp(((y * log(y)) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -6.8e+52], N[Not[LessEqual[x, 0.0115]], $MachinePrecision]], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+52} \lor \neg \left(x \leq 0.0115\right):\\
\;\;\;\;e^{x - z}\\
\mathbf{else}:\\
\;\;\;\;e^{y \cdot \log y - z}\\
\end{array}
\end{array}
if x < -6.8e52 or 0.0115 < x Initial program 100.0%
Taylor expanded in y around 0 92.8%
if -6.8e52 < x < 0.0115Initial program 100.0%
Taylor expanded in x around 0 98.4%
Final simplification96.3%
(FPCore (x y z) :precision binary64 (if (<= (* y (log y)) 1e+31) (exp (- x z)) (pow y y)))
double code(double x, double y, double z) {
double tmp;
if ((y * log(y)) <= 1e+31) {
tmp = exp((x - z));
} 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 * log(y)) <= 1d+31) then
tmp = exp((x - z))
else
tmp = y ** y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y * Math.log(y)) <= 1e+31) {
tmp = Math.exp((x - z));
} else {
tmp = Math.pow(y, y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y * math.log(y)) <= 1e+31: tmp = math.exp((x - z)) else: tmp = math.pow(y, y) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(y * log(y)) <= 1e+31) tmp = exp(Float64(x - z)); else tmp = y ^ y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y * log(y)) <= 1e+31) tmp = exp((x - z)); else tmp = y ^ y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision], 1e+31], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], N[Power[y, y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \log y \leq 10^{+31}:\\
\;\;\;\;e^{x - z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y}\\
\end{array}
\end{array}
if (*.f64 y (log.f64 y)) < 9.9999999999999996e30Initial program 100.0%
Taylor expanded in y around 0 96.7%
if 9.9999999999999996e30 < (*.f64 y (log.f64 y)) Initial program 100.0%
Taylor expanded in x around 0 87.5%
Taylor expanded in z around 0 78.7%
(FPCore (x y z) :precision binary64 (if (<= y 5.9e-204) (exp x) (if (<= y 1.8e-33) (exp (- z)) (if (<= y 1.36e-15) (exp x) (pow y y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.9e-204) {
tmp = exp(x);
} else if (y <= 1.8e-33) {
tmp = exp(-z);
} else if (y <= 1.36e-15) {
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 <= 5.9d-204) then
tmp = exp(x)
else if (y <= 1.8d-33) then
tmp = exp(-z)
else if (y <= 1.36d-15) 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 <= 5.9e-204) {
tmp = Math.exp(x);
} else if (y <= 1.8e-33) {
tmp = Math.exp(-z);
} else if (y <= 1.36e-15) {
tmp = Math.exp(x);
} else {
tmp = Math.pow(y, y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 5.9e-204: tmp = math.exp(x) elif y <= 1.8e-33: tmp = math.exp(-z) elif y <= 1.36e-15: tmp = math.exp(x) else: tmp = math.pow(y, y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 5.9e-204) tmp = exp(x); elseif (y <= 1.8e-33) tmp = exp(Float64(-z)); elseif (y <= 1.36e-15) tmp = exp(x); else tmp = y ^ y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 5.9e-204) tmp = exp(x); elseif (y <= 1.8e-33) tmp = exp(-z); elseif (y <= 1.36e-15) tmp = exp(x); else tmp = y ^ y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 5.9e-204], N[Exp[x], $MachinePrecision], If[LessEqual[y, 1.8e-33], N[Exp[(-z)], $MachinePrecision], If[LessEqual[y, 1.36e-15], N[Exp[x], $MachinePrecision], N[Power[y, y], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.9 \cdot 10^{-204}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-33}:\\
\;\;\;\;e^{-z}\\
\mathbf{elif}\;y \leq 1.36 \cdot 10^{-15}:\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y}\\
\end{array}
\end{array}
if y < 5.9000000000000003e-204 or 1.80000000000000017e-33 < y < 1.36e-15Initial program 100.0%
Taylor expanded in x around inf 78.0%
if 5.9000000000000003e-204 < y < 1.80000000000000017e-33Initial program 100.0%
Taylor expanded in z around inf 82.6%
neg-mul-182.6%
Simplified82.6%
if 1.36e-15 < y Initial program 100.0%
Taylor expanded in x around 0 87.2%
Taylor expanded in z around 0 77.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.3) (not (<= x 9.5e+18))) (exp x) (exp (- z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.3) || !(x <= 9.5e+18)) {
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 <= (-5.3d0)) .or. (.not. (x <= 9.5d+18))) 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 <= -5.3) || !(x <= 9.5e+18)) {
tmp = Math.exp(x);
} else {
tmp = Math.exp(-z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.3) or not (x <= 9.5e+18): tmp = math.exp(x) else: tmp = math.exp(-z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.3) || !(x <= 9.5e+18)) tmp = exp(x); else tmp = exp(Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.3) || ~((x <= 9.5e+18))) tmp = exp(x); else tmp = exp(-z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.3], N[Not[LessEqual[x, 9.5e+18]], $MachinePrecision]], N[Exp[x], $MachinePrecision], N[Exp[(-z)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.3 \lor \neg \left(x \leq 9.5 \cdot 10^{+18}\right):\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;e^{-z}\\
\end{array}
\end{array}
if x < -5.29999999999999982 or 9.5e18 < x Initial program 100.0%
Taylor expanded in x around inf 83.1%
if -5.29999999999999982 < x < 9.5e18Initial program 100.0%
Taylor expanded in z around inf 61.1%
neg-mul-161.1%
Simplified61.1%
Final simplification69.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.05e+103) (+ 1.0 (* z (+ (* z (* z -0.16666666666666666)) -1.0))) (if (<= z 9.8e+20) (exp x) (exp z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.05e+103) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
} else if (z <= 9.8e+20) {
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 (z <= (-1.05d+103)) then
tmp = 1.0d0 + (z * ((z * (z * (-0.16666666666666666d0))) + (-1.0d0)))
else if (z <= 9.8d+20) 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 (z <= -1.05e+103) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
} else if (z <= 9.8e+20) {
tmp = Math.exp(x);
} else {
tmp = Math.exp(z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.05e+103: tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)) elif z <= 9.8e+20: tmp = math.exp(x) else: tmp = math.exp(z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.05e+103) tmp = Float64(1.0 + Float64(z * Float64(Float64(z * Float64(z * -0.16666666666666666)) + -1.0))); elseif (z <= 9.8e+20) tmp = exp(x); else tmp = exp(z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.05e+103) tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)); elseif (z <= 9.8e+20) tmp = exp(x); else tmp = exp(z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.05e+103], N[(1.0 + N[(z * N[(N[(z * N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.8e+20], N[Exp[x], $MachinePrecision], N[Exp[z], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+103}:\\
\;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{+20}:\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;e^{z}\\
\end{array}
\end{array}
if z < -1.0500000000000001e103Initial program 100.0%
Taylor expanded in z around inf 93.1%
neg-mul-193.1%
Simplified93.1%
Taylor expanded in z around 0 93.1%
Taylor expanded in z around inf 93.1%
*-commutative93.1%
Simplified93.1%
if -1.0500000000000001e103 < z < 9.8e20Initial program 100.0%
Taylor expanded in x around inf 57.7%
if 9.8e20 < z Initial program 100.0%
Taylor expanded in z around inf 65.3%
neg-mul-165.3%
Simplified65.3%
expm1-log1p-u65.3%
expm1-undefine65.3%
add-sqr-sqrt0.0%
sqrt-unprod36.3%
sqr-neg36.3%
sqrt-unprod36.3%
add-sqr-sqrt36.3%
Applied egg-rr36.3%
log1p-undefine36.3%
rem-exp-log36.3%
associate-+r-36.3%
expm1-undefine36.3%
rem-exp-log36.3%
log1p-define36.3%
log1p-expm136.3%
Simplified36.3%
Final simplification59.4%
(FPCore (x y z) :precision binary64 (if (<= z -1.05e+103) (+ 1.0 (* z (+ (* z (* z -0.16666666666666666)) -1.0))) (exp x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.05e+103) {
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 <= (-1.05d+103)) 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 <= -1.05e+103) {
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 <= -1.05e+103: 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 <= -1.05e+103) 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 <= -1.05e+103) 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, -1.05e+103], 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 -1.05 \cdot 10^{+103}:\\
\;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{x}\\
\end{array}
\end{array}
if z < -1.0500000000000001e103Initial program 100.0%
Taylor expanded in z around inf 93.1%
neg-mul-193.1%
Simplified93.1%
Taylor expanded in z around 0 93.1%
Taylor expanded in z around inf 93.1%
*-commutative93.1%
Simplified93.1%
if -1.0500000000000001e103 < z Initial program 100.0%
Taylor expanded in x around inf 48.6%
Final simplification56.1%
(FPCore (x y z)
:precision binary64
(if (<= z -4.5e+69)
(+ 1.0 (* z (+ (* z (* z -0.16666666666666666)) -1.0)))
(if (<= z -3.5e-307)
(+ 1.0 (* x (+ 1.0 (* x 0.5))))
(if (<= z 1.32e+95)
(+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))))
(+ 1.0 (* z (+ 1.0 (* z (+ 0.5 (* z 0.16666666666666666))))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.5e+69) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
} else if (z <= -3.5e-307) {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
} else if (z <= 1.32e+95) {
tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))));
} else {
tmp = 1.0 + (z * (1.0 + (z * (0.5 + (z * 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 <= (-4.5d+69)) then
tmp = 1.0d0 + (z * ((z * (z * (-0.16666666666666666d0))) + (-1.0d0)))
else if (z <= (-3.5d-307)) then
tmp = 1.0d0 + (x * (1.0d0 + (x * 0.5d0)))
else if (z <= 1.32d+95) then
tmp = 1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0)))))
else
tmp = 1.0d0 + (z * (1.0d0 + (z * (0.5d0 + (z * 0.16666666666666666d0)))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.5e+69) {
tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
} else if (z <= -3.5e-307) {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
} else if (z <= 1.32e+95) {
tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))));
} else {
tmp = 1.0 + (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666)))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.5e+69: tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)) elif z <= -3.5e-307: tmp = 1.0 + (x * (1.0 + (x * 0.5))) elif z <= 1.32e+95: tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) else: tmp = 1.0 + (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.5e+69) tmp = Float64(1.0 + Float64(z * Float64(Float64(z * Float64(z * -0.16666666666666666)) + -1.0))); elseif (z <= -3.5e-307) tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))); elseif (z <= 1.32e+95) tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666)))))); else tmp = Float64(1.0 + Float64(z * Float64(1.0 + Float64(z * Float64(0.5 + Float64(z * 0.16666666666666666)))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.5e+69) tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0)); elseif (z <= -3.5e-307) tmp = 1.0 + (x * (1.0 + (x * 0.5))); elseif (z <= 1.32e+95) tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))); else tmp = 1.0 + (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.5e+69], N[(1.0 + N[(z * N[(N[(z * N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.5e-307], N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.32e+95], N[(1.0 + N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(z * N[(1.0 + N[(z * N[(0.5 + N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+69}:\\
\;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{-307}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot 0.5\right)\\
\mathbf{elif}\;z \leq 1.32 \cdot 10^{+95}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + z \cdot \left(1 + z \cdot \left(0.5 + z \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if z < -4.4999999999999999e69Initial program 100.0%
Taylor expanded in z around inf 89.7%
neg-mul-189.7%
Simplified89.7%
Taylor expanded in z around 0 83.9%
Taylor expanded in z around inf 83.9%
*-commutative83.9%
Simplified83.9%
if -4.4999999999999999e69 < z < -3.5000000000000002e-307Initial program 100.0%
Taylor expanded in x around inf 56.9%
Taylor expanded in x around 0 33.6%
if -3.5000000000000002e-307 < z < 1.32e95Initial program 100.0%
Taylor expanded in x around inf 54.9%
Taylor expanded in x around 0 34.6%
if 1.32e95 < z Initial program 100.0%
Taylor expanded in z around inf 76.1%
neg-mul-176.1%
Simplified76.1%
expm1-log1p-u76.1%
expm1-undefine76.1%
add-sqr-sqrt0.0%
sqrt-unprod25.5%
sqr-neg25.5%
sqrt-unprod25.5%
add-sqr-sqrt25.5%
Applied egg-rr25.5%
log1p-undefine25.5%
rem-exp-log25.5%
associate-+r-25.5%
expm1-undefine25.5%
rem-exp-log25.5%
log1p-define25.5%
log1p-expm125.5%
Simplified25.5%
Taylor expanded in z around 0 20.7%
*-commutative20.7%
Simplified20.7%
Final simplification41.5%
(FPCore (x y z)
:precision binary64
(if (<= x -9e+153)
(+ 1.0 (* x (+ 1.0 (* x 0.5))))
(if (<= x 1.95e+90)
(+ 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 (x <= -9e+153) {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
} else if (x <= 1.95e+90) {
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 (x <= (-9d+153)) then
tmp = 1.0d0 + (x * (1.0d0 + (x * 0.5d0)))
else if (x <= 1.95d+90) 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 (x <= -9e+153) {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
} else if (x <= 1.95e+90) {
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 x <= -9e+153: tmp = 1.0 + (x * (1.0 + (x * 0.5))) elif x <= 1.95e+90: 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 (x <= -9e+153) tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))); elseif (x <= 1.95e+90) 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 (x <= -9e+153) tmp = 1.0 + (x * (1.0 + (x * 0.5))); elseif (x <= 1.95e+90) 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[x, -9e+153], N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.95e+90], 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}\;x \leq -9 \cdot 10^{+153}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot 0.5\right)\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+90}:\\
\;\;\;\;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 x < -9.0000000000000002e153Initial program 100.0%
Taylor expanded in x around inf 82.6%
Taylor expanded in x around 0 16.5%
if -9.0000000000000002e153 < x < 1.9500000000000001e90Initial program 100.0%
Taylor expanded in z around inf 56.0%
neg-mul-156.0%
Simplified56.0%
Taylor expanded in z around 0 35.1%
Taylor expanded in z around inf 35.0%
*-commutative35.0%
Simplified35.0%
if 1.9500000000000001e90 < x Initial program 100.0%
Taylor expanded in x around inf 91.6%
Taylor expanded in x around 0 86.3%
Final simplification39.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.06e+151) (not (<= x 1.95e+90))) (+ 1.0 (* x (+ 1.0 (* x 0.5)))) (+ 1.0 (* z (+ (* z 0.5) -1.0)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.06e+151) || !(x <= 1.95e+90)) {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
} 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.06d+151)) .or. (.not. (x <= 1.95d+90))) then
tmp = 1.0d0 + (x * (1.0d0 + (x * 0.5d0)))
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.06e+151) || !(x <= 1.95e+90)) {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
} else {
tmp = 1.0 + (z * ((z * 0.5) + -1.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.06e+151) or not (x <= 1.95e+90): tmp = 1.0 + (x * (1.0 + (x * 0.5))) else: tmp = 1.0 + (z * ((z * 0.5) + -1.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.06e+151) || !(x <= 1.95e+90)) tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))); 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.06e+151) || ~((x <= 1.95e+90))) tmp = 1.0 + (x * (1.0 + (x * 0.5))); else tmp = 1.0 + (z * ((z * 0.5) + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.06e+151], N[Not[LessEqual[x, 1.95e+90]], $MachinePrecision]], N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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.06 \cdot 10^{+151} \lor \neg \left(x \leq 1.95 \cdot 10^{+90}\right):\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;1 + z \cdot \left(z \cdot 0.5 + -1\right)\\
\end{array}
\end{array}
if x < -1.06000000000000003e151 or 1.9500000000000001e90 < x Initial program 100.0%
Taylor expanded in x around inf 87.2%
Taylor expanded in x around 0 43.8%
if -1.06000000000000003e151 < x < 1.9500000000000001e90Initial program 100.0%
Taylor expanded in z around inf 56.0%
neg-mul-156.0%
Simplified56.0%
Taylor expanded in z around 0 33.4%
Final simplification36.2%
(FPCore (x y z) :precision binary64 (if (<= z -4.5e+69) (+ 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 <= -4.5e+69) {
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 <= (-4.5d+69)) 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 <= -4.5e+69) {
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 <= -4.5e+69: 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 <= -4.5e+69) 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 <= -4.5e+69) 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, -4.5e+69], 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 -4.5 \cdot 10^{+69}:\\
\;\;\;\;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 < -4.4999999999999999e69Initial program 100.0%
Taylor expanded in z around inf 89.7%
neg-mul-189.7%
Simplified89.7%
Taylor expanded in z around 0 83.9%
Taylor expanded in z around inf 83.9%
*-commutative83.9%
Simplified83.9%
if -4.4999999999999999e69 < z Initial program 100.0%
Taylor expanded in x around inf 48.8%
Taylor expanded in x around 0 26.9%
Final simplification37.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.3e+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 <= -1.3e+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 <= (-1.3d+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 <= -1.3e+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 <= -1.3e+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 <= -1.3e+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 <= -1.3e+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, -1.3e+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 -1.3 \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 < -1.3e128Initial program 100.0%
Taylor expanded in z around inf 97.2%
neg-mul-197.2%
Simplified97.2%
Taylor expanded in z around 0 86.7%
Taylor expanded in z around inf 86.7%
*-commutative86.7%
Simplified86.7%
if -1.3e128 < z Initial program 100.0%
Taylor expanded in x around inf 48.7%
Taylor expanded in x around 0 26.3%
Final simplification34.6%
(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.7%
neg-mul-147.7%
Simplified47.7%
Taylor expanded in z around 0 26.8%
Taylor expanded in z around inf 26.6%
*-commutative26.6%
Simplified26.6%
(FPCore (x y z) :precision binary64 (- 1.0 z))
double code(double x, double y, double z) {
return 1.0 - z;
}
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
end function
public static double code(double x, double y, double z) {
return 1.0 - z;
}
def code(x, y, z): return 1.0 - z
function code(x, y, z) return Float64(1.0 - z) end
function tmp = code(x, y, z) tmp = 1.0 - z; end
code[x_, y_, z_] := N[(1.0 - z), $MachinePrecision]
\begin{array}{l}
\\
1 - z
\end{array}
Initial program 100.0%
Taylor expanded in z around inf 47.7%
neg-mul-147.7%
Simplified47.7%
Taylor expanded in z around 0 13.5%
neg-mul-113.5%
unsub-neg13.5%
Simplified13.5%
(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 45.1%
Taylor expanded in x around 0 13.4%
Final simplification13.4%
(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 45.1%
Taylor expanded in x around 0 13.2%
(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 2024144
(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)))