
(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 12 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 -1e-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 <= -1e-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 <= (-1d-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 <= -1e-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 <= -1e-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 <= -1e-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 <= -1e-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, -1e-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 -1 \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)) < -9.9999999999999996e-303Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum100.0%
*-commutative100.0%
exp-to-pow100.0%
Simplified100.0%
if -9.9999999999999996e-303 < (*.f64 y (log.f64 y)) Initial program 100.0%
Taylor expanded in x around 0 88.8%
(FPCore (x y z) :precision binary64 (if (<= x -6.2e+88) (exp x) (if (<= x 1.75e-13) (exp (- (* y (log y)) z)) (* (pow y y) (exp x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.2e+88) {
tmp = exp(x);
} else if (x <= 1.75e-13) {
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 <= (-6.2d+88)) then
tmp = exp(x)
else if (x <= 1.75d-13) 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 <= -6.2e+88) {
tmp = Math.exp(x);
} else if (x <= 1.75e-13) {
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 <= -6.2e+88: tmp = math.exp(x) elif x <= 1.75e-13: 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 <= -6.2e+88) tmp = exp(x); elseif (x <= 1.75e-13) 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 <= -6.2e+88) tmp = exp(x); elseif (x <= 1.75e-13) tmp = exp(((y * log(y)) - z)); else tmp = (y ^ y) * exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.2e+88], N[Exp[x], $MachinePrecision], If[LessEqual[x, 1.75e-13], 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 -6.2 \cdot 10^{+88}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;e^{y \cdot \log y - z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\end{array}
\end{array}
if x < -6.2000000000000003e88Initial program 100.0%
Taylor expanded in x around inf 83.6%
if -6.2000000000000003e88 < x < 1.7500000000000001e-13Initial program 100.0%
Taylor expanded in x around 0 96.9%
if 1.7500000000000001e-13 < x Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum97.2%
*-commutative97.2%
exp-to-pow97.2%
Simplified97.2%
Taylor expanded in z around 0 93.2%
*-commutative93.2%
Simplified93.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -390000.0) (not (<= z 2.8e+192))) (exp (- z)) (* (pow y y) (exp x))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -390000.0) || !(z <= 2.8e+192)) {
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 <= (-390000.0d0)) .or. (.not. (z <= 2.8d+192))) 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 <= -390000.0) || !(z <= 2.8e+192)) {
tmp = Math.exp(-z);
} else {
tmp = Math.pow(y, y) * Math.exp(x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -390000.0) or not (z <= 2.8e+192): 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 <= -390000.0) || !(z <= 2.8e+192)) 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 <= -390000.0) || ~((z <= 2.8e+192))) tmp = exp(-z); else tmp = (y ^ y) * exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -390000.0], N[Not[LessEqual[z, 2.8e+192]], $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 -390000 \lor \neg \left(z \leq 2.8 \cdot 10^{+192}\right):\\
\;\;\;\;e^{-z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\end{array}
\end{array}
if z < -3.9e5 or 2.79999999999999976e192 < z Initial program 100.0%
Taylor expanded in z around inf 88.1%
neg-mul-188.1%
Simplified88.1%
if -3.9e5 < z < 2.79999999999999976e192Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum80.6%
*-commutative80.6%
exp-to-pow80.6%
Simplified80.6%
Taylor expanded in z around 0 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification85.0%
(FPCore (x y z) :precision binary64 (if (<= x -3e+65) (exp x) (if (<= x 1.95e-84) (/ (pow y y) (exp z)) (* (pow y y) (exp x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3e+65) {
tmp = exp(x);
} else if (x <= 1.95e-84) {
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 <= (-3d+65)) then
tmp = exp(x)
else if (x <= 1.95d-84) 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 <= -3e+65) {
tmp = Math.exp(x);
} else if (x <= 1.95e-84) {
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 <= -3e+65: tmp = math.exp(x) elif x <= 1.95e-84: 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 <= -3e+65) tmp = exp(x); elseif (x <= 1.95e-84) 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 <= -3e+65) tmp = exp(x); elseif (x <= 1.95e-84) tmp = (y ^ y) / exp(z); else tmp = (y ^ y) * exp(x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3e+65], N[Exp[x], $MachinePrecision], If[LessEqual[x, 1.95e-84], 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 \cdot 10^{+65}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-84}:\\
\;\;\;\;\frac{{y}^{y}}{e^{z}}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y} \cdot e^{x}\\
\end{array}
\end{array}
if x < -3.0000000000000002e65Initial program 100.0%
Taylor expanded in x around inf 79.1%
if -3.0000000000000002e65 < x < 1.95000000000000011e-84Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum86.1%
*-commutative86.1%
exp-to-pow86.1%
Simplified86.1%
Taylor expanded in x around 0 85.6%
rec-exp85.6%
associate-*l/85.6%
*-lft-identity85.6%
Simplified85.6%
if 1.95000000000000011e-84 < x Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum94.3%
*-commutative94.3%
exp-to-pow94.3%
Simplified94.3%
Taylor expanded in z around 0 91.0%
*-commutative91.0%
Simplified91.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (exp (- z))))
(if (<= y 2.8e-238)
t_0
(if (<= y 7.2e-92) (exp x) (if (<= y 0.65) t_0 (pow y y))))))
double code(double x, double y, double z) {
double t_0 = exp(-z);
double tmp;
if (y <= 2.8e-238) {
tmp = t_0;
} else if (y <= 7.2e-92) {
tmp = exp(x);
} else if (y <= 0.65) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = exp(-z)
if (y <= 2.8d-238) then
tmp = t_0
else if (y <= 7.2d-92) then
tmp = exp(x)
else if (y <= 0.65d0) then
tmp = t_0
else
tmp = y ** y
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 (y <= 2.8e-238) {
tmp = t_0;
} else if (y <= 7.2e-92) {
tmp = Math.exp(x);
} else if (y <= 0.65) {
tmp = t_0;
} else {
tmp = Math.pow(y, y);
}
return tmp;
}
def code(x, y, z): t_0 = math.exp(-z) tmp = 0 if y <= 2.8e-238: tmp = t_0 elif y <= 7.2e-92: tmp = math.exp(x) elif y <= 0.65: tmp = t_0 else: tmp = math.pow(y, y) return tmp
function code(x, y, z) t_0 = exp(Float64(-z)) tmp = 0.0 if (y <= 2.8e-238) tmp = t_0; elseif (y <= 7.2e-92) tmp = exp(x); elseif (y <= 0.65) tmp = t_0; else tmp = y ^ y; end return tmp end
function tmp_2 = code(x, y, z) t_0 = exp(-z); tmp = 0.0; if (y <= 2.8e-238) tmp = t_0; elseif (y <= 7.2e-92) tmp = exp(x); elseif (y <= 0.65) tmp = t_0; else tmp = y ^ y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Exp[(-z)], $MachinePrecision]}, If[LessEqual[y, 2.8e-238], t$95$0, If[LessEqual[y, 7.2e-92], N[Exp[x], $MachinePrecision], If[LessEqual[y, 0.65], t$95$0, N[Power[y, y], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-z}\\
\mathbf{if}\;y \leq 2.8 \cdot 10^{-238}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-92}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;y \leq 0.65:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;{y}^{y}\\
\end{array}
\end{array}
if y < 2.80000000000000004e-238 or 7.20000000000000032e-92 < y < 0.650000000000000022Initial program 100.0%
Taylor expanded in z around inf 75.6%
neg-mul-175.6%
Simplified75.6%
if 2.80000000000000004e-238 < y < 7.20000000000000032e-92Initial program 100.0%
Taylor expanded in x around inf 88.6%
if 0.650000000000000022 < y Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
exp-sum65.2%
*-commutative65.2%
exp-to-pow65.2%
Simplified65.2%
Taylor expanded in z around 0 72.8%
*-commutative72.8%
Simplified72.8%
Taylor expanded in x around 0 83.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -5e+64) (not (<= x 1.75e-13))) (exp x) (exp (- z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5e+64) || !(x <= 1.75e-13)) {
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 <= (-5d+64)) .or. (.not. (x <= 1.75d-13))) 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 <= -5e+64) || !(x <= 1.75e-13)) {
tmp = Math.exp(x);
} else {
tmp = Math.exp(-z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5e+64) or not (x <= 1.75e-13): tmp = math.exp(x) else: tmp = math.exp(-z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5e+64) || !(x <= 1.75e-13)) tmp = exp(x); else tmp = exp(Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5e+64) || ~((x <= 1.75e-13))) tmp = exp(x); else tmp = exp(-z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5e+64], N[Not[LessEqual[x, 1.75e-13]], $MachinePrecision]], N[Exp[x], $MachinePrecision], N[Exp[(-z)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+64} \lor \neg \left(x \leq 1.75 \cdot 10^{-13}\right):\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;e^{-z}\\
\end{array}
\end{array}
if x < -5e64 or 1.7500000000000001e-13 < x Initial program 100.0%
Taylor expanded in x around inf 86.8%
if -5e64 < x < 1.7500000000000001e-13Initial program 100.0%
Taylor expanded in z around inf 66.3%
neg-mul-166.3%
Simplified66.3%
Final simplification75.8%
(FPCore (x y z) :precision binary64 (exp x))
double code(double x, double y, double z) {
return exp(x);
}
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)
end function
public static double code(double x, double y, double z) {
return Math.exp(x);
}
def code(x, y, z): return math.exp(x)
function code(x, y, z) return exp(x) end
function tmp = code(x, y, z) tmp = exp(x); end
code[x_, y_, z_] := N[Exp[x], $MachinePrecision]
\begin{array}{l}
\\
e^{x}
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 55.8%
(FPCore (x y z) :precision binary64 (if (<= x -0.0138) (+ 1.0 (* x (+ 1.0 (* x 0.5)))) (+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.0138) {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
} 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 <= (-0.0138d0)) then
tmp = 1.0d0 + (x * (1.0d0 + (x * 0.5d0)))
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 <= -0.0138) {
tmp = 1.0 + (x * (1.0 + (x * 0.5)));
} else {
tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.0138: tmp = 1.0 + (x * (1.0 + (x * 0.5))) 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 <= -0.0138) tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))); 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 <= -0.0138) tmp = 1.0 + (x * (1.0 + (x * 0.5))); 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, -0.0138], N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $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 -0.0138:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot 0.5\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 < -0.0138Initial program 100.0%
Taylor expanded in x around inf 66.2%
Taylor expanded in x around 0 10.5%
*-commutative10.5%
Simplified10.5%
if -0.0138 < x Initial program 100.0%
Taylor expanded in x around inf 52.5%
Taylor expanded in x around 0 44.2%
*-commutative44.2%
Simplified44.2%
(FPCore (x y z) :precision binary64 (+ 1.0 (* x (+ 1.0 (* x 0.5)))))
double code(double x, double y, double z) {
return 1.0 + (x * (1.0 + (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 * (1.0d0 + (x * 0.5d0)))
end function
public static double code(double x, double y, double z) {
return 1.0 + (x * (1.0 + (x * 0.5)));
}
def code(x, y, z): return 1.0 + (x * (1.0 + (x * 0.5)))
function code(x, y, z) return Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))) end
function tmp = code(x, y, z) tmp = 1.0 + (x * (1.0 + (x * 0.5))); end
code[x_, y_, z_] := N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + x \cdot \left(1 + x \cdot 0.5\right)
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 55.8%
Taylor expanded in x around 0 32.9%
*-commutative32.9%
Simplified32.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 55.8%
Taylor expanded in x around 0 16.0%
+-commutative16.0%
Simplified16.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 55.8%
Taylor expanded in x around 0 15.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 2024111
(FPCore (x y z)
:name "Statistics.Distribution.Poisson.Internal:probability from math-functions-0.1.5.2"
:precision binary64
:alt
(exp (+ (- x z) (* (log y) y)))
(exp (- (+ x (* y (log y))) z)))