
(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 14 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+83) (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+83) {
tmp = 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+83) then
tmp = 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+83) {
tmp = 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+83: tmp = 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+83) tmp = 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+83) tmp = 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+83], N[Exp[N[(x - z), $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^{+83}:\\
\;\;\;\;e^{x - z}\\
\mathbf{else}:\\
\;\;\;\;e^{t\_0 - z}\\
\end{array}
\end{array}
if (*.f64 y (log.f64 y)) < 2.00000000000000006e83Initial program 100.0%
Taylor expanded in y around 0 94.7%
if 2.00000000000000006e83 < (*.f64 y (log.f64 y)) Initial program 100.0%
Taylor expanded in x around 0 96.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (exp (- z))))
(if (<= z -28000000000000.0)
t_0
(if (<= z -6.3e-180) (exp x) (if (<= z 1.05e+50) (pow y y) t_0)))))
double code(double x, double y, double z) {
double t_0 = exp(-z);
double tmp;
if (z <= -28000000000000.0) {
tmp = t_0;
} else if (z <= -6.3e-180) {
tmp = exp(x);
} else if (z <= 1.05e+50) {
tmp = pow(y, y);
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = exp(-z)
if (z <= (-28000000000000.0d0)) then
tmp = t_0
else if (z <= (-6.3d-180)) then
tmp = exp(x)
else if (z <= 1.05d+50) then
tmp = y ** y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.exp(-z);
double tmp;
if (z <= -28000000000000.0) {
tmp = t_0;
} else if (z <= -6.3e-180) {
tmp = Math.exp(x);
} else if (z <= 1.05e+50) {
tmp = Math.pow(y, y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.exp(-z) tmp = 0 if z <= -28000000000000.0: tmp = t_0 elif z <= -6.3e-180: tmp = math.exp(x) elif z <= 1.05e+50: tmp = math.pow(y, y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = exp(Float64(-z)) tmp = 0.0 if (z <= -28000000000000.0) tmp = t_0; elseif (z <= -6.3e-180) tmp = exp(x); elseif (z <= 1.05e+50) tmp = y ^ y; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = exp(-z); tmp = 0.0; if (z <= -28000000000000.0) tmp = t_0; elseif (z <= -6.3e-180) tmp = exp(x); elseif (z <= 1.05e+50) tmp = y ^ y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Exp[(-z)], $MachinePrecision]}, If[LessEqual[z, -28000000000000.0], t$95$0, If[LessEqual[z, -6.3e-180], N[Exp[x], $MachinePrecision], If[LessEqual[z, 1.05e+50], N[Power[y, y], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-z}\\
\mathbf{if}\;z \leq -28000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -6.3 \cdot 10^{-180}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+50}:\\
\;\;\;\;{y}^{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.8e13 or 1.05e50 < z Initial program 100.0%
Taylor expanded in z around inf 83.9%
neg-mul-183.9%
Simplified83.9%
if -2.8e13 < z < -6.2999999999999996e-180Initial program 100.0%
Taylor expanded in x around inf 74.6%
if -6.2999999999999996e-180 < z < 1.05e50Initial program 100.0%
Taylor expanded in x around 0 78.8%
Taylor expanded in z around 0 77.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -16500000000.0) (not (<= x 710.0))) (exp x) (exp (- z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -16500000000.0) || !(x <= 710.0)) {
tmp = exp(x);
} else {
tmp = exp(-z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-16500000000.0d0)) .or. (.not. (x <= 710.0d0))) then
tmp = exp(x)
else
tmp = exp(-z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -16500000000.0) || !(x <= 710.0)) {
tmp = Math.exp(x);
} else {
tmp = Math.exp(-z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -16500000000.0) or not (x <= 710.0): tmp = math.exp(x) else: tmp = math.exp(-z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -16500000000.0) || !(x <= 710.0)) tmp = exp(x); else tmp = exp(Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -16500000000.0) || ~((x <= 710.0))) tmp = exp(x); else tmp = exp(-z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -16500000000.0], N[Not[LessEqual[x, 710.0]], $MachinePrecision]], N[Exp[x], $MachinePrecision], N[Exp[(-z)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -16500000000 \lor \neg \left(x \leq 710\right):\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;e^{-z}\\
\end{array}
\end{array}
if x < -1.65e10 or 710 < x Initial program 100.0%
Taylor expanded in x around inf 78.6%
if -1.65e10 < x < 710Initial program 100.0%
Taylor expanded in z around inf 71.4%
neg-mul-171.4%
Simplified71.4%
Final simplification74.6%
(FPCore (x y z) :precision binary64 (if (<= y 2.6e+95) (exp (- x z)) (pow y y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.6e+95) {
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 <= 2.6d+95) 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 <= 2.6e+95) {
tmp = Math.exp((x - z));
} else {
tmp = Math.pow(y, y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.6e+95: tmp = math.exp((x - z)) else: tmp = math.pow(y, y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.6e+95) 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 <= 2.6e+95) tmp = exp((x - z)); else tmp = y ^ y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.6e+95], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], N[Power[y, y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{+95}:\\
\;\;\;\;e^{x - z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y}\\
\end{array}
\end{array}
if y < 2.5999999999999999e95Initial program 100.0%
Taylor expanded in y around 0 94.2%
if 2.5999999999999999e95 < y Initial program 100.0%
Taylor expanded in x around 0 96.6%
Taylor expanded in z around 0 89.9%
(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 95.7%
neg-mul-195.7%
Simplified95.7%
Taylor expanded in z around 0 95.7%
Taylor expanded in z around inf 95.7%
*-commutative95.7%
Simplified95.7%
if -1.0500000000000001e103 < z Initial program 100.0%
Taylor expanded in x around inf 55.1%
Final simplification62.4%
(FPCore (x y z) :precision binary64 (if (<= z -4.4e+98) (+ 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 <= -4.4e+98) {
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 <= (-4.4d+98)) 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 <= -4.4e+98) {
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 <= -4.4e+98: 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 <= -4.4e+98) 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 <= -4.4e+98) 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, -4.4e+98], 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 -4.4 \cdot 10^{+98}:\\
\;\;\;\;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 < -4.40000000000000017e98Initial program 100.0%
Taylor expanded in z around inf 93.7%
neg-mul-193.7%
Simplified93.7%
Taylor expanded in z around 0 93.7%
Taylor expanded in z around inf 93.7%
*-commutative93.7%
Simplified93.7%
if -4.40000000000000017e98 < z Initial program 100.0%
Taylor expanded in x around inf 54.9%
Taylor expanded in x around 0 30.7%
Final simplification42.2%
(FPCore (x y z) :precision binary64 (if (<= z -8.5e+52) (+ 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 <= -8.5e+52) {
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 <= (-8.5d+52)) 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 <= -8.5e+52) {
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 <= -8.5e+52: 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 <= -8.5e+52) 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 <= -8.5e+52) 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, -8.5e+52], 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 -8.5 \cdot 10^{+52}:\\
\;\;\;\;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 < -8.49999999999999994e52Initial program 100.0%
Taylor expanded in z around inf 92.8%
neg-mul-192.8%
Simplified92.8%
Taylor expanded in z around 0 80.9%
Taylor expanded in z around inf 80.9%
*-commutative80.9%
Simplified80.9%
if -8.49999999999999994e52 < z Initial program 100.0%
Taylor expanded in x around inf 55.5%
Taylor expanded in x around 0 29.9%
Final simplification40.9%
(FPCore (x y z) :precision binary64 (if (<= x 4.8e+87) (+ 1.0 (* z (+ (* z 0.5) -1.0))) (+ 1.0 (* x (* x 0.5)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.8e+87) {
tmp = 1.0 + (z * ((z * 0.5) + -1.0));
} else {
tmp = 1.0 + (x * (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 <= 4.8d+87) then
tmp = 1.0d0 + (z * ((z * 0.5d0) + (-1.0d0)))
else
tmp = 1.0d0 + (x * (x * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.8e+87) {
tmp = 1.0 + (z * ((z * 0.5) + -1.0));
} else {
tmp = 1.0 + (x * (x * 0.5));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4.8e+87: tmp = 1.0 + (z * ((z * 0.5) + -1.0)) else: tmp = 1.0 + (x * (x * 0.5)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4.8e+87) tmp = Float64(1.0 + Float64(z * Float64(Float64(z * 0.5) + -1.0))); else tmp = Float64(1.0 + Float64(x * Float64(x * 0.5))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.8e+87) tmp = 1.0 + (z * ((z * 0.5) + -1.0)); else tmp = 1.0 + (x * (x * 0.5)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4.8e+87], N[(1.0 + N[(z * N[(N[(z * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.8 \cdot 10^{+87}:\\
\;\;\;\;1 + z \cdot \left(z \cdot 0.5 + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 4.79999999999999963e87Initial program 100.0%
Taylor expanded in z around inf 59.8%
neg-mul-159.8%
Simplified59.8%
Taylor expanded in z around 0 32.7%
if 4.79999999999999963e87 < x Initial program 100.0%
Taylor expanded in x around inf 97.3%
Taylor expanded in x around 0 67.2%
Taylor expanded in x around inf 67.2%
*-commutative67.2%
Simplified67.2%
Final simplification37.7%
(FPCore (x y z) :precision binary64 (if (<= x 9.2e+85) (+ 1.0 (* z (* z 0.5))) (+ 1.0 (* x (* x 0.5)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 9.2e+85) {
tmp = 1.0 + (z * (z * 0.5));
} else {
tmp = 1.0 + (x * (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 <= 9.2d+85) then
tmp = 1.0d0 + (z * (z * 0.5d0))
else
tmp = 1.0d0 + (x * (x * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 9.2e+85) {
tmp = 1.0 + (z * (z * 0.5));
} else {
tmp = 1.0 + (x * (x * 0.5));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 9.2e+85: tmp = 1.0 + (z * (z * 0.5)) else: tmp = 1.0 + (x * (x * 0.5)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 9.2e+85) tmp = Float64(1.0 + Float64(z * Float64(z * 0.5))); else tmp = Float64(1.0 + Float64(x * Float64(x * 0.5))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 9.2e+85) tmp = 1.0 + (z * (z * 0.5)); else tmp = 1.0 + (x * (x * 0.5)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 9.2e+85], N[(1.0 + N[(z * N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.2 \cdot 10^{+85}:\\
\;\;\;\;1 + z \cdot \left(z \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 9.1999999999999996e85Initial program 100.0%
Taylor expanded in z around inf 59.8%
neg-mul-159.8%
Simplified59.8%
Taylor expanded in z around 0 32.7%
Taylor expanded in z around inf 32.6%
*-commutative32.6%
Simplified32.6%
if 9.1999999999999996e85 < x Initial program 100.0%
Taylor expanded in x around inf 97.3%
Taylor expanded in x around 0 67.2%
Taylor expanded in x around inf 67.2%
*-commutative67.2%
Simplified67.2%
(FPCore (x y z) :precision binary64 (+ 1.0 (* x (* x 0.5))))
double code(double x, double y, double z) {
return 1.0 + (x * (x * 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 + (x * (x * 0.5d0))
end function
public static double code(double x, double y, double z) {
return 1.0 + (x * (x * 0.5));
}
def code(x, y, z): return 1.0 + (x * (x * 0.5))
function code(x, y, z) return Float64(1.0 + Float64(x * Float64(x * 0.5))) end
function tmp = code(x, y, z) tmp = 1.0 + (x * (x * 0.5)); end
code[x_, y_, z_] := N[(1.0 + N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + x \cdot \left(x \cdot 0.5\right)
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 50.3%
Taylor expanded in x around 0 28.0%
Taylor expanded in x around inf 27.9%
*-commutative27.9%
Simplified27.9%
(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 55.4%
neg-mul-155.4%
Simplified55.4%
Taylor expanded in z around 0 16.1%
neg-mul-116.1%
unsub-neg16.1%
Simplified16.1%
(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.3%
Taylor expanded in x around 0 16.0%
Final simplification16.0%
(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.3%
Taylor expanded in x around 0 15.9%
(FPCore (x y z) :precision binary64 (exp (+ (- x z) (* (log y) y))))
double code(double x, double y, double z) {
return exp(((x - z) + (log(y) * y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = exp(((x - z) + (log(y) * y)))
end function
public static double code(double x, double y, double z) {
return Math.exp(((x - z) + (Math.log(y) * y)));
}
def code(x, y, z): return math.exp(((x - z) + (math.log(y) * y)))
function code(x, y, z) return exp(Float64(Float64(x - z) + Float64(log(y) * y))) end
function tmp = code(x, y, z) tmp = exp(((x - z) + (log(y) * y))); end
code[x_, y_, z_] := N[Exp[N[(N[(x - z), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(x - z\right) + \log y \cdot y}
\end{array}
herbie shell --seed 2024170
(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)))