
(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 (- (+ (* (log y) y) x) z)))
double code(double x, double y, double z) {
return exp((((log(y) * y) + x) - 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((((log(y) * y) + x) - z))
end function
public static double code(double x, double y, double z) {
return Math.exp((((Math.log(y) * y) + x) - z));
}
def code(x, y, z): return math.exp((((math.log(y) * y) + x) - z))
function code(x, y, z) return exp(Float64(Float64(Float64(log(y) * y) + x) - z)) end
function tmp = code(x, y, z) tmp = exp((((log(y) * y) + x) - z)); end
code[x_, y_, z_] := N[Exp[N[(N[(N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(\log y \cdot y + x\right) - z}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (* (log y) y) x))) (if (<= t_0 -2e+121) (exp x) (if (<= t_0 1e+44) (exp (- z)) (pow y y)))))
double code(double x, double y, double z) {
double t_0 = (log(y) * y) + x;
double tmp;
if (t_0 <= -2e+121) {
tmp = exp(x);
} else if (t_0 <= 1e+44) {
tmp = exp(-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) :: t_0
real(8) :: tmp
t_0 = (log(y) * y) + x
if (t_0 <= (-2d+121)) then
tmp = exp(x)
else if (t_0 <= 1d+44) then
tmp = exp(-z)
else
tmp = y ** y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (Math.log(y) * y) + x;
double tmp;
if (t_0 <= -2e+121) {
tmp = Math.exp(x);
} else if (t_0 <= 1e+44) {
tmp = Math.exp(-z);
} else {
tmp = Math.pow(y, y);
}
return tmp;
}
def code(x, y, z): t_0 = (math.log(y) * y) + x tmp = 0 if t_0 <= -2e+121: tmp = math.exp(x) elif t_0 <= 1e+44: tmp = math.exp(-z) else: tmp = math.pow(y, y) return tmp
function code(x, y, z) t_0 = Float64(Float64(log(y) * y) + x) tmp = 0.0 if (t_0 <= -2e+121) tmp = exp(x); elseif (t_0 <= 1e+44) tmp = exp(Float64(-z)); else tmp = y ^ y; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (log(y) * y) + x; tmp = 0.0; if (t_0 <= -2e+121) tmp = exp(x); elseif (t_0 <= 1e+44) tmp = exp(-z); else tmp = y ^ y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+121], N[Exp[x], $MachinePrecision], If[LessEqual[t$95$0, 1e+44], N[Exp[(-z)], $MachinePrecision], N[Power[y, y], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log y \cdot y + x\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+121}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;t\_0 \leq 10^{+44}:\\
\;\;\;\;e^{-z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 y (log.f64 y))) < -2.00000000000000007e121Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6465.5
Applied rewrites65.5%
Taylor expanded in y around 0
Applied rewrites93.2%
if -2.00000000000000007e121 < (+.f64 x (*.f64 y (log.f64 y))) < 1.0000000000000001e44Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6489.5
Applied rewrites89.5%
if 1.0000000000000001e44 < (+.f64 x (*.f64 y (log.f64 y))) Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6484.5
Applied rewrites84.5%
Taylor expanded in x around 0
Applied rewrites71.7%
Final simplification80.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (log y) y))) (if (<= t_0 2e+138) (exp (- x z)) (exp t_0))))
double code(double x, double y, double z) {
double t_0 = log(y) * y;
double tmp;
if (t_0 <= 2e+138) {
tmp = exp((x - z));
} else {
tmp = exp(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 = log(y) * y
if (t_0 <= 2d+138) then
tmp = exp((x - z))
else
tmp = exp(t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.log(y) * y;
double tmp;
if (t_0 <= 2e+138) {
tmp = Math.exp((x - z));
} else {
tmp = Math.exp(t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.log(y) * y tmp = 0 if t_0 <= 2e+138: tmp = math.exp((x - z)) else: tmp = math.exp(t_0) return tmp
function code(x, y, z) t_0 = Float64(log(y) * y) tmp = 0.0 if (t_0 <= 2e+138) tmp = exp(Float64(x - z)); else tmp = exp(t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = log(y) * y; tmp = 0.0; if (t_0 <= 2e+138) tmp = exp((x - z)); else tmp = exp(t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+138], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], N[Exp[t$95$0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log y \cdot y\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+138}:\\
\;\;\;\;e^{x - z}\\
\mathbf{else}:\\
\;\;\;\;e^{t\_0}\\
\end{array}
\end{array}
if (*.f64 y (log.f64 y)) < 2.0000000000000001e138Initial program 99.9%
Taylor expanded in y around 0
lower--.f6493.9
Applied rewrites93.9%
if 2.0000000000000001e138 < (*.f64 y (log.f64 y)) Initial program 100.0%
Taylor expanded in y around inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
log-recN/A
remove-double-negN/A
lower-*.f64N/A
lower-log.f6488.9
Applied rewrites88.9%
Final simplification92.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ (* (log y) y) x) z)) (t_1 (* (* x x) 0.5))) (if (<= t_0 -5e+23) t_1 (if (<= t_0 1e+81) (+ 1.0 x) t_1))))
double code(double x, double y, double z) {
double t_0 = ((log(y) * y) + x) - z;
double t_1 = (x * x) * 0.5;
double tmp;
if (t_0 <= -5e+23) {
tmp = t_1;
} else if (t_0 <= 1e+81) {
tmp = 1.0 + x;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = ((log(y) * y) + x) - z
t_1 = (x * x) * 0.5d0
if (t_0 <= (-5d+23)) then
tmp = t_1
else if (t_0 <= 1d+81) then
tmp = 1.0d0 + x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((Math.log(y) * y) + x) - z;
double t_1 = (x * x) * 0.5;
double tmp;
if (t_0 <= -5e+23) {
tmp = t_1;
} else if (t_0 <= 1e+81) {
tmp = 1.0 + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = ((math.log(y) * y) + x) - z t_1 = (x * x) * 0.5 tmp = 0 if t_0 <= -5e+23: tmp = t_1 elif t_0 <= 1e+81: tmp = 1.0 + x else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(log(y) * y) + x) - z) t_1 = Float64(Float64(x * x) * 0.5) tmp = 0.0 if (t_0 <= -5e+23) tmp = t_1; elseif (t_0 <= 1e+81) tmp = Float64(1.0 + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((log(y) * y) + x) - z; t_1 = (x * x) * 0.5; tmp = 0.0; if (t_0 <= -5e+23) tmp = t_1; elseif (t_0 <= 1e+81) tmp = 1.0 + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+23], t$95$1, If[LessEqual[t$95$0, 1e+81], N[(1.0 + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\log y \cdot y + x\right) - z\\
t_1 := \left(x \cdot x\right) \cdot 0.5\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+81}:\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z) < -4.9999999999999999e23 or 9.99999999999999921e80 < (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z) Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6467.8
Applied rewrites67.8%
Taylor expanded in y around 0
Applied rewrites47.8%
Taylor expanded in x around 0
Applied rewrites20.5%
Taylor expanded in x around inf
Applied rewrites28.4%
if -4.9999999999999999e23 < (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z) < 9.99999999999999921e80Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6487.0
Applied rewrites87.0%
Taylor expanded in y around 0
Applied rewrites70.9%
Taylor expanded in x around 0
Applied rewrites52.5%
Final simplification32.3%
(FPCore (x y z) :precision binary64 (if (<= (exp (- (+ (* (log y) y) x) z)) 0.0) (* (* x x) 0.5) (fma (fma (fma 0.16666666666666666 x 0.5) x 1.0) x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (exp((((log(y) * y) + x) - z)) <= 0.0) {
tmp = (x * x) * 0.5;
} else {
tmp = fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (exp(Float64(Float64(Float64(log(y) * y) + x) - z)) <= 0.0) tmp = Float64(Float64(x * x) * 0.5); else tmp = fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[Exp[N[(N[(N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision], 0.0], N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(0.16666666666666666 * x + 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{\left(\log y \cdot y + x\right) - z} \leq 0:\\
\;\;\;\;\left(x \cdot x\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)\\
\end{array}
\end{array}
if (exp.f64 (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z)) < 0.0Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6439.9
Applied rewrites39.9%
Taylor expanded in y around 0
Applied rewrites55.5%
Taylor expanded in x around 0
Applied rewrites2.4%
Taylor expanded in x around inf
Applied rewrites27.0%
if 0.0 < (exp.f64 (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z)) Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6483.1
Applied rewrites83.1%
Taylor expanded in y around 0
Applied rewrites50.0%
Taylor expanded in x around 0
Applied rewrites38.0%
Final simplification34.9%
(FPCore (x y z) :precision binary64 (if (<= (* (log y) y) 2e+138) (exp (- x z)) (pow y y)))
double code(double x, double y, double z) {
double tmp;
if ((log(y) * y) <= 2e+138) {
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 ((log(y) * y) <= 2d+138) 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 ((Math.log(y) * y) <= 2e+138) {
tmp = Math.exp((x - z));
} else {
tmp = Math.pow(y, y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (math.log(y) * y) <= 2e+138: tmp = math.exp((x - z)) else: tmp = math.pow(y, y) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(log(y) * y) <= 2e+138) tmp = exp(Float64(x - z)); else tmp = y ^ y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((log(y) * y) <= 2e+138) tmp = exp((x - z)); else tmp = y ^ y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision], 2e+138], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], N[Power[y, y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log y \cdot y \leq 2 \cdot 10^{+138}:\\
\;\;\;\;e^{x - z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y}\\
\end{array}
\end{array}
if (*.f64 y (log.f64 y)) < 2.0000000000000001e138Initial program 99.9%
Taylor expanded in y around 0
lower--.f6493.9
Applied rewrites93.9%
if 2.0000000000000001e138 < (*.f64 y (log.f64 y)) Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6481.3
Applied rewrites81.3%
Taylor expanded in x around 0
Applied rewrites88.9%
Final simplification92.4%
(FPCore (x y z) :precision binary64 (if (<= (* (log y) y) -1e-302) (exp x) (pow y y)))
double code(double x, double y, double z) {
double tmp;
if ((log(y) * y) <= -1e-302) {
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 ((log(y) * y) <= (-1d-302)) 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 ((Math.log(y) * y) <= -1e-302) {
tmp = Math.exp(x);
} else {
tmp = Math.pow(y, y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (math.log(y) * y) <= -1e-302: tmp = math.exp(x) else: tmp = math.pow(y, y) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(log(y) * y) <= -1e-302) tmp = exp(x); else tmp = y ^ y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((log(y) * y) <= -1e-302) tmp = exp(x); else tmp = y ^ y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision], -1e-302], N[Exp[x], $MachinePrecision], N[Power[y, y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log y \cdot y \leq -1 \cdot 10^{-302}:\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y}\\
\end{array}
\end{array}
if (*.f64 y (log.f64 y)) < -9.9999999999999996e-303Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6468.4
Applied rewrites68.4%
Taylor expanded in y around 0
Applied rewrites68.4%
if -9.9999999999999996e-303 < (*.f64 y (log.f64 y)) Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6473.2
Applied rewrites73.2%
Taylor expanded in x around 0
Applied rewrites81.3%
Final simplification75.3%
(FPCore (x y z) :precision binary64 (if (<= (- (+ (* (log y) y) x) z) -5e+23) (* (* x x) 0.5) (fma (fma 0.5 x 1.0) x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((((log(y) * y) + x) - z) <= -5e+23) {
tmp = (x * x) * 0.5;
} else {
tmp = fma(fma(0.5, x, 1.0), x, 1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(Float64(log(y) * y) + x) - z) <= -5e+23) tmp = Float64(Float64(x * x) * 0.5); else tmp = fma(fma(0.5, x, 1.0), x, 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision], -5e+23], N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(0.5 * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\log y \cdot y + x\right) - z \leq -5 \cdot 10^{+23}:\\
\;\;\;\;\left(x \cdot x\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, 1\right), x, 1\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z) < -4.9999999999999999e23Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6439.9
Applied rewrites39.9%
Taylor expanded in y around 0
Applied rewrites55.5%
Taylor expanded in x around 0
Applied rewrites2.4%
Taylor expanded in x around inf
Applied rewrites27.0%
if -4.9999999999999999e23 < (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z) Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6483.1
Applied rewrites83.1%
Taylor expanded in y around 0
Applied rewrites50.0%
Taylor expanded in x around 0
Applied rewrites34.9%
Final simplification32.7%
(FPCore (x y z)
:precision binary64
(if (<= x -1.02e-164)
(exp x)
(if (<= x 1.16e-186)
(* (* (- x) x) (fma -0.16666666666666666 x (- -0.5 (/ 1.0 x))))
(exp x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.02e-164) {
tmp = exp(x);
} else if (x <= 1.16e-186) {
tmp = (-x * x) * fma(-0.16666666666666666, x, (-0.5 - (1.0 / x)));
} else {
tmp = exp(x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -1.02e-164) tmp = exp(x); elseif (x <= 1.16e-186) tmp = Float64(Float64(Float64(-x) * x) * fma(-0.16666666666666666, x, Float64(-0.5 - Float64(1.0 / x)))); else tmp = exp(x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -1.02e-164], N[Exp[x], $MachinePrecision], If[LessEqual[x, 1.16e-186], N[(N[((-x) * x), $MachinePrecision] * N[(-0.16666666666666666 * x + N[(-0.5 - N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Exp[x], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{-164}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;x \leq 1.16 \cdot 10^{-186}:\\
\;\;\;\;\left(\left(-x\right) \cdot x\right) \cdot \mathsf{fma}\left(-0.16666666666666666, x, -0.5 - \frac{1}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{x}\\
\end{array}
\end{array}
if x < -1.02e-164 or 1.15999999999999995e-186 < x Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6475.7
Applied rewrites75.7%
Taylor expanded in y around 0
Applied rewrites64.5%
if -1.02e-164 < x < 1.15999999999999995e-186Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6456.1
Applied rewrites56.1%
Taylor expanded in y around 0
Applied rewrites11.0%
Taylor expanded in x around 0
Applied rewrites11.0%
Taylor expanded in x around -inf
Applied rewrites30.3%
Final simplification56.2%
(FPCore (x y z) :precision binary64 (if (<= z 2.2e-61) (fma (fma 0.5 x 1.0) x 1.0) (* (* (fma 0.16666666666666666 x 0.5) x) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.2e-61) {
tmp = fma(fma(0.5, x, 1.0), x, 1.0);
} else {
tmp = (fma(0.16666666666666666, x, 0.5) * x) * x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 2.2e-61) tmp = fma(fma(0.5, x, 1.0), x, 1.0); else tmp = Float64(Float64(fma(0.16666666666666666, x, 0.5) * x) * x); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 2.2e-61], N[(N[(0.5 * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision], N[(N[(N[(0.16666666666666666 * x + 0.5), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.2 \cdot 10^{-61}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, 1\right), x, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right) \cdot x\right) \cdot x\\
\end{array}
\end{array}
if z < 2.20000000000000009e-61Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6479.2
Applied rewrites79.2%
Taylor expanded in y around 0
Applied rewrites54.2%
Taylor expanded in x around 0
Applied rewrites31.7%
if 2.20000000000000009e-61 < z Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6454.9
Applied rewrites54.9%
Taylor expanded in y around 0
Applied rewrites46.5%
Taylor expanded in x around 0
Applied rewrites19.6%
Taylor expanded in x around inf
Applied rewrites39.8%
(FPCore (x y z) :precision binary64 (+ 1.0 x))
double code(double x, double y, double z) {
return 1.0 + x;
}
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
end function
public static double code(double x, double y, double z) {
return 1.0 + x;
}
def code(x, y, z): return 1.0 + x
function code(x, y, z) return Float64(1.0 + x) end
function tmp = code(x, y, z) tmp = 1.0 + x; end
code[x_, y_, z_] := N[(1.0 + x), $MachinePrecision]
\begin{array}{l}
\\
1 + x
\end{array}
Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6471.0
Applied rewrites71.0%
Taylor expanded in y around 0
Applied rewrites51.6%
Taylor expanded in x around 0
Applied rewrites11.5%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-exp.f6471.0
Applied rewrites71.0%
Taylor expanded in x around 0
Applied rewrites52.5%
Taylor expanded in y around 0
Applied rewrites11.1%
(FPCore (x y z) :precision binary64 (exp (+ (- x z) (* (log y) y))))
double code(double x, double y, double z) {
return exp(((x - z) + (log(y) * y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = exp(((x - z) + (log(y) * y)))
end function
public static double code(double x, double y, double z) {
return Math.exp(((x - z) + (Math.log(y) * y)));
}
def code(x, y, z): return math.exp(((x - z) + (math.log(y) * y)))
function code(x, y, z) return exp(Float64(Float64(x - z) + Float64(log(y) * y))) end
function tmp = code(x, y, z) tmp = exp(((x - z) + (log(y) * y))); end
code[x_, y_, z_] := N[Exp[N[(N[(x - z), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(x - z\right) + \log y \cdot y}
\end{array}
herbie shell --seed 2024276
(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)))