
(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 19 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 (+ x (* y (log y))))) (if (<= t_0 -1e+53) (exp x) (if (<= t_0 1e+38) (exp (- z)) (pow y y)))))
double code(double x, double y, double z) {
double t_0 = x + (y * log(y));
double tmp;
if (t_0 <= -1e+53) {
tmp = exp(x);
} else if (t_0 <= 1e+38) {
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 = x + (y * log(y))
if (t_0 <= (-1d+53)) then
tmp = exp(x)
else if (t_0 <= 1d+38) 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 = x + (y * Math.log(y));
double tmp;
if (t_0 <= -1e+53) {
tmp = Math.exp(x);
} else if (t_0 <= 1e+38) {
tmp = Math.exp(-z);
} else {
tmp = Math.pow(y, y);
}
return tmp;
}
def code(x, y, z): t_0 = x + (y * math.log(y)) tmp = 0 if t_0 <= -1e+53: tmp = math.exp(x) elif t_0 <= 1e+38: tmp = math.exp(-z) else: tmp = math.pow(y, y) return tmp
function code(x, y, z) t_0 = Float64(x + Float64(y * log(y))) tmp = 0.0 if (t_0 <= -1e+53) tmp = exp(x); elseif (t_0 <= 1e+38) tmp = exp(Float64(-z)); else tmp = y ^ y; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (y * log(y)); tmp = 0.0; if (t_0 <= -1e+53) tmp = exp(x); elseif (t_0 <= 1e+38) tmp = exp(-z); else tmp = y ^ y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+53], N[Exp[x], $MachinePrecision], If[LessEqual[t$95$0, 1e+38], N[Exp[(-z)], $MachinePrecision], N[Power[y, y], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + y \cdot \log y\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+53}:\\
\;\;\;\;e^{x}\\
\mathbf{elif}\;t\_0 \leq 10^{+38}:\\
\;\;\;\;e^{-z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 y (log.f64 y))) < -9.9999999999999999e52Initial program 100.0%
Taylor expanded in y around 0
lower-exp.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
lower-exp.f6489.3
Applied rewrites89.3%
if -9.9999999999999999e52 < (+.f64 x (*.f64 y (log.f64 y))) < 9.99999999999999977e37Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6491.1
Applied rewrites91.1%
if 9.99999999999999977e37 < (+.f64 x (*.f64 y (log.f64 y))) Initial program 100.0%
Taylor expanded in y around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
remove-double-negN/A
lower-*.f64N/A
lower-log.f6468.3
Applied rewrites68.3%
lift-log.f64N/A
*-commutativeN/A
lift-log.f64N/A
exp-to-powN/A
lower-pow.f6468.3
Applied rewrites68.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ x (* y (log y))) z)))
(if (<= t_0 -5e+39)
(* x (* 0.16666666666666666 (* x x)))
(if (<= t_0 4e+103)
(fma
(/ (* z (fma 0.0625 (* (* z z) (* z z)) -1.0)) (fma z (* z 0.25) 1.0))
(/ 1.0 (fma 0.5 z 1.0))
1.0)
(fma
(* z (fma 0.25 (* z z) -1.0))
(/ (+ 2.0 (/ (- (/ (+ 8.0 (/ -16.0 z)) z) 4.0) z)) z)
1.0)))))
double code(double x, double y, double z) {
double t_0 = (x + (y * log(y))) - z;
double tmp;
if (t_0 <= -5e+39) {
tmp = x * (0.16666666666666666 * (x * x));
} else if (t_0 <= 4e+103) {
tmp = fma(((z * fma(0.0625, ((z * z) * (z * z)), -1.0)) / fma(z, (z * 0.25), 1.0)), (1.0 / fma(0.5, z, 1.0)), 1.0);
} else {
tmp = fma((z * fma(0.25, (z * z), -1.0)), ((2.0 + ((((8.0 + (-16.0 / z)) / z) - 4.0) / z)) / z), 1.0);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x + Float64(y * log(y))) - z) tmp = 0.0 if (t_0 <= -5e+39) tmp = Float64(x * Float64(0.16666666666666666 * Float64(x * x))); elseif (t_0 <= 4e+103) tmp = fma(Float64(Float64(z * fma(0.0625, Float64(Float64(z * z) * Float64(z * z)), -1.0)) / fma(z, Float64(z * 0.25), 1.0)), Float64(1.0 / fma(0.5, z, 1.0)), 1.0); else tmp = fma(Float64(z * fma(0.25, Float64(z * z), -1.0)), Float64(Float64(2.0 + Float64(Float64(Float64(Float64(8.0 + Float64(-16.0 / z)) / z) - 4.0) / z)) / z), 1.0); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+39], N[(x * N[(0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+103], N[(N[(N[(z * N[(0.0625 * N[(N[(z * z), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / N[(z * N[(z * 0.25), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(0.5 * z + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(z * N[(0.25 * N[(z * z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 + N[(N[(N[(N[(8.0 + N[(-16.0 / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] - 4.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + y \cdot \log y\right) - z\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+39}:\\
\;\;\;\;x \cdot \left(0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+103}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z \cdot \mathsf{fma}\left(0.0625, \left(z \cdot z\right) \cdot \left(z \cdot z\right), -1\right)}{\mathsf{fma}\left(z, z \cdot 0.25, 1\right)}, \frac{1}{\mathsf{fma}\left(0.5, z, 1\right)}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \mathsf{fma}\left(0.25, z \cdot z, -1\right), \frac{2 + \frac{\frac{8 + \frac{-16}{z}}{z} - 4}{z}}{z}, 1\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z) < -5.00000000000000015e39Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6457.8
Applied rewrites57.8%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites2.0%
Taylor expanded in y around 0
Applied rewrites2.2%
Taylor expanded in x around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6419.6
Applied rewrites19.6%
if -5.00000000000000015e39 < (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z) < 4e103Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6467.9
Applied rewrites67.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6448.4
Applied rewrites48.4%
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
flip-+N/A
associate-*l/N/A
div-invN/A
lower-fma.f64N/A
Applied rewrites48.4%
lift-*.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
sub-negN/A
swap-sqrN/A
pow2N/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
pow2N/A
lower-*.f64N/A
sub-negN/A
Applied rewrites59.0%
if 4e103 < (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z) Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6444.5
Applied rewrites44.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6440.0
Applied rewrites40.0%
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
flip-+N/A
associate-*l/N/A
div-invN/A
lower-fma.f64N/A
Applied rewrites49.4%
Taylor expanded in z around -inf
Applied rewrites65.5%
Final simplification50.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ x (* y (log y))) z)) (t_1 (* 0.5 (* z z)))) (if (<= t_0 -1e+53) t_1 (if (<= t_0 1e+130) (+ x 1.0) t_1))))
double code(double x, double y, double z) {
double t_0 = (x + (y * log(y))) - z;
double t_1 = 0.5 * (z * z);
double tmp;
if (t_0 <= -1e+53) {
tmp = t_1;
} else if (t_0 <= 1e+130) {
tmp = x + 1.0;
} 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 = (x + (y * log(y))) - z
t_1 = 0.5d0 * (z * z)
if (t_0 <= (-1d+53)) then
tmp = t_1
else if (t_0 <= 1d+130) then
tmp = x + 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + (y * Math.log(y))) - z;
double t_1 = 0.5 * (z * z);
double tmp;
if (t_0 <= -1e+53) {
tmp = t_1;
} else if (t_0 <= 1e+130) {
tmp = x + 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (x + (y * math.log(y))) - z t_1 = 0.5 * (z * z) tmp = 0 if t_0 <= -1e+53: tmp = t_1 elif t_0 <= 1e+130: tmp = x + 1.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + Float64(y * log(y))) - z) t_1 = Float64(0.5 * Float64(z * z)) tmp = 0.0 if (t_0 <= -1e+53) tmp = t_1; elseif (t_0 <= 1e+130) tmp = Float64(x + 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + (y * log(y))) - z; t_1 = 0.5 * (z * z); tmp = 0.0; if (t_0 <= -1e+53) tmp = t_1; elseif (t_0 <= 1e+130) tmp = x + 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+53], t$95$1, If[LessEqual[t$95$0, 1e+130], N[(x + 1.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + y \cdot \log y\right) - z\\
t_1 := 0.5 \cdot \left(z \cdot z\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+130}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z) < -9.9999999999999999e52 or 1.0000000000000001e130 < (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z) Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6455.0
Applied rewrites55.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6428.3
Applied rewrites28.3%
Taylor expanded in z around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6431.9
Applied rewrites31.9%
if -9.9999999999999999e52 < (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z) < 1.0000000000000001e130Initial program 100.0%
Taylor expanded in y around 0
lower-exp.f64N/A
lower--.f6472.6
Applied rewrites72.6%
Taylor expanded in z around 0
lower-exp.f6454.5
Applied rewrites54.5%
Taylor expanded in x around 0
lower-+.f6437.0
Applied rewrites37.0%
Final simplification33.3%
(FPCore (x y z) :precision binary64 (if (<= (exp (- (+ x (* y (log y))) z)) 0.0) (* 0.5 (* z z)) (fma z (* z 0.5) 1.0)))
double code(double x, double y, double z) {
double tmp;
if (exp(((x + (y * log(y))) - z)) <= 0.0) {
tmp = 0.5 * (z * z);
} else {
tmp = fma(z, (z * 0.5), 1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (exp(Float64(Float64(x + Float64(y * log(y))) - z)) <= 0.0) tmp = Float64(0.5 * Float64(z * z)); else tmp = fma(z, Float64(z * 0.5), 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[Exp[N[(N[(x + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision], 0.0], N[(0.5 * N[(z * z), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{\left(x + y \cdot \log y\right) - z} \leq 0:\\
\;\;\;\;0.5 \cdot \left(z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, z \cdot 0.5, 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 inf
mul-1-negN/A
lower-neg.f6467.1
Applied rewrites67.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f642.1
Applied rewrites2.1%
Taylor expanded in z around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6411.6
Applied rewrites11.6%
if 0.0 < (exp.f64 (-.f64 (+.f64 x (*.f64 y (log.f64 y))) z)) Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6451.4
Applied rewrites51.4%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6442.5
Applied rewrites42.5%
Taylor expanded in z around inf
lower-*.f6442.3
Applied rewrites42.3%
Final simplification33.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (exp (- x z)))) (if (<= z -2700.0) t_0 (if (<= z 4e+51) (exp (fma y (log y) x)) t_0))))
double code(double x, double y, double z) {
double t_0 = exp((x - z));
double tmp;
if (z <= -2700.0) {
tmp = t_0;
} else if (z <= 4e+51) {
tmp = exp(fma(y, log(y), x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = exp(Float64(x - z)) tmp = 0.0 if (z <= -2700.0) tmp = t_0; elseif (z <= 4e+51) tmp = exp(fma(y, log(y), x)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -2700.0], t$95$0, If[LessEqual[z, 4e+51], N[Exp[N[(y * N[Log[y], $MachinePrecision] + x), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x - z}\\
\mathbf{if}\;z \leq -2700:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+51}:\\
\;\;\;\;e^{\mathsf{fma}\left(y, \log y, x\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2700 or 4e51 < z Initial program 100.0%
Taylor expanded in y around 0
lower-exp.f64N/A
lower--.f6494.2
Applied rewrites94.2%
if -2700 < z < 4e51Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6498.8
Applied rewrites98.8%
(FPCore (x y z) :precision binary64 (if (<= (* y (log y)) 4e+109) (exp (- x z)) (pow y y)))
double code(double x, double y, double z) {
double tmp;
if ((y * log(y)) <= 4e+109) {
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)) <= 4d+109) 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)) <= 4e+109) {
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)) <= 4e+109: 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)) <= 4e+109) 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)) <= 4e+109) 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], 4e+109], 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 4 \cdot 10^{+109}:\\
\;\;\;\;e^{x - z}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y}\\
\end{array}
\end{array}
if (*.f64 y (log.f64 y)) < 3.99999999999999993e109Initial program 100.0%
Taylor expanded in y around 0
lower-exp.f64N/A
lower--.f6491.6
Applied rewrites91.6%
if 3.99999999999999993e109 < (*.f64 y (log.f64 y)) Initial program 100.0%
Taylor expanded in y around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
remove-double-negN/A
lower-*.f64N/A
lower-log.f6489.9
Applied rewrites89.9%
lift-log.f64N/A
*-commutativeN/A
lift-log.f64N/A
exp-to-powN/A
lower-pow.f6489.9
Applied rewrites89.9%
(FPCore (x y z) :precision binary64 (if (<= y 0.26) (exp x) (pow y y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.26) {
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 <= 0.26d0) 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 <= 0.26) {
tmp = Math.exp(x);
} else {
tmp = Math.pow(y, y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.26: tmp = math.exp(x) else: tmp = math.pow(y, y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.26) tmp = exp(x); else tmp = y ^ y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.26) tmp = exp(x); else tmp = y ^ y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.26], N[Exp[x], $MachinePrecision], N[Power[y, y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.26:\\
\;\;\;\;e^{x}\\
\mathbf{else}:\\
\;\;\;\;{y}^{y}\\
\end{array}
\end{array}
if y < 0.26000000000000001Initial program 100.0%
Taylor expanded in y around 0
lower-exp.f64N/A
lower--.f6499.0
Applied rewrites99.0%
Taylor expanded in z around 0
lower-exp.f6468.8
Applied rewrites68.8%
if 0.26000000000000001 < y Initial program 100.0%
Taylor expanded in y around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
remove-double-negN/A
lower-*.f64N/A
lower-log.f6478.1
Applied rewrites78.1%
lift-log.f64N/A
*-commutativeN/A
lift-log.f64N/A
exp-to-powN/A
lower-pow.f6478.1
Applied rewrites78.1%
(FPCore (x y z) :precision binary64 (if (<= z -7.5e+74) (fma z (fma z (fma z -0.16666666666666666 0.5) -1.0) 1.0) (exp x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.5e+74) {
tmp = fma(z, fma(z, fma(z, -0.16666666666666666, 0.5), -1.0), 1.0);
} else {
tmp = exp(x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -7.5e+74) tmp = fma(z, fma(z, fma(z, -0.16666666666666666, 0.5), -1.0), 1.0); else tmp = exp(x); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -7.5e+74], N[(z * N[(z * N[(z * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], N[Exp[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+74}:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(z, \mathsf{fma}\left(z, -0.16666666666666666, 0.5\right), -1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{x}\\
\end{array}
\end{array}
if z < -7.5e74Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6496.5
Applied rewrites96.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6489.8
Applied rewrites89.8%
if -7.5e74 < z Initial program 100.0%
Taylor expanded in y around 0
lower-exp.f64N/A
lower--.f6474.5
Applied rewrites74.5%
Taylor expanded in z around 0
lower-exp.f6456.4
Applied rewrites56.4%
(FPCore (x y z)
:precision binary64
(if (<= z -2e+154)
(* 0.5 (* z z))
(if (<= z -1.55e+61)
(fma
(/ (* z (fma 0.0625 (* (* z z) (* z z)) -1.0)) (fma z (* z 0.25) 1.0))
(/ 1.0 (fma 0.5 z 1.0))
1.0)
(if (<= z 9.2e+27)
(fma
(fma x x -1.0)
(/ -1.0 (- 1.0 x))
(* x (* x (fma x 0.16666666666666666 0.5))))
(* x (* 0.16666666666666666 (* x x)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2e+154) {
tmp = 0.5 * (z * z);
} else if (z <= -1.55e+61) {
tmp = fma(((z * fma(0.0625, ((z * z) * (z * z)), -1.0)) / fma(z, (z * 0.25), 1.0)), (1.0 / fma(0.5, z, 1.0)), 1.0);
} else if (z <= 9.2e+27) {
tmp = fma(fma(x, x, -1.0), (-1.0 / (1.0 - x)), (x * (x * fma(x, 0.16666666666666666, 0.5))));
} else {
tmp = x * (0.16666666666666666 * (x * x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -2e+154) tmp = Float64(0.5 * Float64(z * z)); elseif (z <= -1.55e+61) tmp = fma(Float64(Float64(z * fma(0.0625, Float64(Float64(z * z) * Float64(z * z)), -1.0)) / fma(z, Float64(z * 0.25), 1.0)), Float64(1.0 / fma(0.5, z, 1.0)), 1.0); elseif (z <= 9.2e+27) tmp = fma(fma(x, x, -1.0), Float64(-1.0 / Float64(1.0 - x)), Float64(x * Float64(x * fma(x, 0.16666666666666666, 0.5)))); else tmp = Float64(x * Float64(0.16666666666666666 * Float64(x * x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -2e+154], N[(0.5 * N[(z * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.55e+61], N[(N[(N[(z * N[(0.0625 * N[(N[(z * z), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / N[(z * N[(z * 0.25), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(0.5 * z + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[z, 9.2e+27], N[(N[(x * x + -1.0), $MachinePrecision] * N[(-1.0 / N[(1.0 - x), $MachinePrecision]), $MachinePrecision] + N[(x * N[(x * N[(x * 0.16666666666666666 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot \left(z \cdot z\right)\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z \cdot \mathsf{fma}\left(0.0625, \left(z \cdot z\right) \cdot \left(z \cdot z\right), -1\right)}{\mathsf{fma}\left(z, z \cdot 0.25, 1\right)}, \frac{1}{\mathsf{fma}\left(0.5, z, 1\right)}, 1\right)\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x, x, -1\right), \frac{-1}{1 - x}, x \cdot \left(x \cdot \mathsf{fma}\left(x, 0.16666666666666666, 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if z < -2.00000000000000007e154Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6497.7
Applied rewrites97.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6497.7
Applied rewrites97.7%
Taylor expanded in z around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
if -2.00000000000000007e154 < z < -1.55e61Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6482.1
Applied rewrites82.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f645.4
Applied rewrites5.4%
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
flip-+N/A
associate-*l/N/A
div-invN/A
lower-fma.f64N/A
Applied rewrites43.2%
lift-*.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
sub-negN/A
swap-sqrN/A
pow2N/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
pow2N/A
lower-*.f64N/A
sub-negN/A
Applied rewrites82.1%
if -1.55e61 < z < 9.2000000000000002e27Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6496.5
Applied rewrites96.5%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites72.4%
Taylor expanded in y around 0
Applied rewrites39.6%
lift-fma.f64N/A
distribute-lft-inN/A
*-rgt-identityN/A
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
metadata-evalN/A
sub-negN/A
flip--N/A
metadata-evalN/A
sub-negN/A
metadata-evalN/A
lift-fma.f64N/A
lift-+.f64N/A
un-div-invN/A
lift-/.f64N/A
Applied rewrites39.6%
if 9.2000000000000002e27 < z Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6454.7
Applied rewrites54.7%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites26.1%
Taylor expanded in y around 0
Applied rewrites18.0%
Taylor expanded in x around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6436.6
Applied rewrites36.6%
Final simplification52.0%
(FPCore (x y z)
:precision binary64
(if (<= z -1e+74)
(fma z (fma z (fma z -0.16666666666666666 0.5) -1.0) 1.0)
(if (<= z 9.2e+27)
(fma
(fma x x -1.0)
(/ -1.0 (- 1.0 x))
(* x (* x (fma x 0.16666666666666666 0.5))))
(* x (* 0.16666666666666666 (* x x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1e+74) {
tmp = fma(z, fma(z, fma(z, -0.16666666666666666, 0.5), -1.0), 1.0);
} else if (z <= 9.2e+27) {
tmp = fma(fma(x, x, -1.0), (-1.0 / (1.0 - x)), (x * (x * fma(x, 0.16666666666666666, 0.5))));
} else {
tmp = x * (0.16666666666666666 * (x * x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1e+74) tmp = fma(z, fma(z, fma(z, -0.16666666666666666, 0.5), -1.0), 1.0); elseif (z <= 9.2e+27) tmp = fma(fma(x, x, -1.0), Float64(-1.0 / Float64(1.0 - x)), Float64(x * Float64(x * fma(x, 0.16666666666666666, 0.5)))); else tmp = Float64(x * Float64(0.16666666666666666 * Float64(x * x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1e+74], N[(z * N[(z * N[(z * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[z, 9.2e+27], N[(N[(x * x + -1.0), $MachinePrecision] * N[(-1.0 / N[(1.0 - x), $MachinePrecision]), $MachinePrecision] + N[(x * N[(x * N[(x * 0.16666666666666666 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+74}:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(z, \mathsf{fma}\left(z, -0.16666666666666666, 0.5\right), -1\right), 1\right)\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x, x, -1\right), \frac{-1}{1 - x}, x \cdot \left(x \cdot \mathsf{fma}\left(x, 0.16666666666666666, 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if z < -9.99999999999999952e73Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6493.2
Applied rewrites93.2%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.8
Applied rewrites86.8%
if -9.99999999999999952e73 < z < 9.2000000000000002e27Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6495.1
Applied rewrites95.1%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites71.4%
Taylor expanded in y around 0
Applied rewrites40.1%
lift-fma.f64N/A
distribute-lft-inN/A
*-rgt-identityN/A
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
metadata-evalN/A
sub-negN/A
flip--N/A
metadata-evalN/A
sub-negN/A
metadata-evalN/A
lift-fma.f64N/A
lift-+.f64N/A
un-div-invN/A
lift-/.f64N/A
Applied rewrites40.1%
if 9.2000000000000002e27 < z Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6454.7
Applied rewrites54.7%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites26.1%
Taylor expanded in y around 0
Applied rewrites18.0%
Taylor expanded in x around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6436.6
Applied rewrites36.6%
(FPCore (x y z)
:precision binary64
(if (<= z -1e+74)
(fma z (fma z (fma z -0.16666666666666666 0.5) -1.0) 1.0)
(if (<= z 9.2e+27)
(fma x (fma x (fma x 0.16666666666666666 0.5) 1.0) 1.0)
(* x (* 0.16666666666666666 (* x x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1e+74) {
tmp = fma(z, fma(z, fma(z, -0.16666666666666666, 0.5), -1.0), 1.0);
} else if (z <= 9.2e+27) {
tmp = fma(x, fma(x, fma(x, 0.16666666666666666, 0.5), 1.0), 1.0);
} else {
tmp = x * (0.16666666666666666 * (x * x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1e+74) tmp = fma(z, fma(z, fma(z, -0.16666666666666666, 0.5), -1.0), 1.0); elseif (z <= 9.2e+27) tmp = fma(x, fma(x, fma(x, 0.16666666666666666, 0.5), 1.0), 1.0); else tmp = Float64(x * Float64(0.16666666666666666 * Float64(x * x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1e+74], N[(z * N[(z * N[(z * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[z, 9.2e+27], N[(x * N[(x * N[(x * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision], N[(x * N[(0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+74}:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(z, \mathsf{fma}\left(z, -0.16666666666666666, 0.5\right), -1\right), 1\right)\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if z < -9.99999999999999952e73Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6493.2
Applied rewrites93.2%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.8
Applied rewrites86.8%
if -9.99999999999999952e73 < z < 9.2000000000000002e27Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6495.1
Applied rewrites95.1%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites71.4%
Taylor expanded in y around 0
Applied rewrites40.1%
if 9.2000000000000002e27 < z Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6454.7
Applied rewrites54.7%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites26.1%
Taylor expanded in y around 0
Applied rewrites18.0%
Taylor expanded in x around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6436.6
Applied rewrites36.6%
(FPCore (x y z)
:precision binary64
(if (<= z -4.4e+130)
(* 0.5 (* z z))
(if (<= z 9.2e+27)
(fma x (fma x (fma x 0.16666666666666666 0.5) 1.0) 1.0)
(* x (* 0.16666666666666666 (* x x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.4e+130) {
tmp = 0.5 * (z * z);
} else if (z <= 9.2e+27) {
tmp = fma(x, fma(x, fma(x, 0.16666666666666666, 0.5), 1.0), 1.0);
} else {
tmp = x * (0.16666666666666666 * (x * x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -4.4e+130) tmp = Float64(0.5 * Float64(z * z)); elseif (z <= 9.2e+27) tmp = fma(x, fma(x, fma(x, 0.16666666666666666, 0.5), 1.0), 1.0); else tmp = Float64(x * Float64(0.16666666666666666 * Float64(x * x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -4.4e+130], N[(0.5 * N[(z * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.2e+27], N[(x * N[(x * N[(x * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision], N[(x * N[(0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+130}:\\
\;\;\;\;0.5 \cdot \left(z \cdot z\right)\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if z < -4.39999999999999987e130Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6495.9
Applied rewrites95.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6486.4
Applied rewrites86.4%
Taylor expanded in z around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6486.4
Applied rewrites86.4%
if -4.39999999999999987e130 < z < 9.2000000000000002e27Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6494.1
Applied rewrites94.1%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites70.0%
Taylor expanded in y around 0
Applied rewrites38.9%
if 9.2000000000000002e27 < z Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6454.7
Applied rewrites54.7%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites26.1%
Taylor expanded in y around 0
Applied rewrites18.0%
Taylor expanded in x around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6436.6
Applied rewrites36.6%
(FPCore (x y z)
:precision binary64
(if (<= z -4.4e+130)
(* 0.5 (* z z))
(if (<= z 9.2e+27)
(fma x (fma x (* x 0.16666666666666666) 1.0) 1.0)
(* x (* 0.16666666666666666 (* x x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.4e+130) {
tmp = 0.5 * (z * z);
} else if (z <= 9.2e+27) {
tmp = fma(x, fma(x, (x * 0.16666666666666666), 1.0), 1.0);
} else {
tmp = x * (0.16666666666666666 * (x * x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -4.4e+130) tmp = Float64(0.5 * Float64(z * z)); elseif (z <= 9.2e+27) tmp = fma(x, fma(x, Float64(x * 0.16666666666666666), 1.0), 1.0); else tmp = Float64(x * Float64(0.16666666666666666 * Float64(x * x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -4.4e+130], N[(0.5 * N[(z * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.2e+27], N[(x * N[(x * N[(x * 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision], N[(x * N[(0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+130}:\\
\;\;\;\;0.5 \cdot \left(z \cdot z\right)\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if z < -4.39999999999999987e130Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6495.9
Applied rewrites95.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6486.4
Applied rewrites86.4%
Taylor expanded in z around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6486.4
Applied rewrites86.4%
if -4.39999999999999987e130 < z < 9.2000000000000002e27Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6494.1
Applied rewrites94.1%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites70.0%
Taylor expanded in y around 0
Applied rewrites38.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6438.5
Applied rewrites38.5%
if 9.2000000000000002e27 < z Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6454.7
Applied rewrites54.7%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites26.1%
Taylor expanded in y around 0
Applied rewrites18.0%
Taylor expanded in x around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6436.6
Applied rewrites36.6%
(FPCore (x y z)
:precision binary64
(if (<= x -7.2e+44)
(* 0.5 (* z z))
(if (<= x 3.5e+99)
(fma z (fma z 0.5 -1.0) 1.0)
(* x (* 0.16666666666666666 (* x x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.2e+44) {
tmp = 0.5 * (z * z);
} else if (x <= 3.5e+99) {
tmp = fma(z, fma(z, 0.5, -1.0), 1.0);
} else {
tmp = x * (0.16666666666666666 * (x * x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -7.2e+44) tmp = Float64(0.5 * Float64(z * z)); elseif (x <= 3.5e+99) tmp = fma(z, fma(z, 0.5, -1.0), 1.0); else tmp = Float64(x * Float64(0.16666666666666666 * Float64(x * x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -7.2e+44], N[(0.5 * N[(z * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e+99], N[(z * N[(z * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], N[(x * N[(0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \left(z \cdot z\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+99}:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.5, -1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if x < -7.2e44Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6444.3
Applied rewrites44.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6416.6
Applied rewrites16.6%
Taylor expanded in z around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6429.0
Applied rewrites29.0%
if -7.2e44 < x < 3.4999999999999998e99Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6465.1
Applied rewrites65.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6436.9
Applied rewrites36.9%
if 3.4999999999999998e99 < x Initial program 100.0%
Taylor expanded in z around 0
lower-exp.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6490.7
Applied rewrites90.7%
Taylor expanded in x around 0
distribute-rgt-inN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
distribute-lft1-inN/A
*-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites89.0%
Taylor expanded in y around 0
Applied rewrites89.0%
Taylor expanded in x around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.0
Applied rewrites89.0%
(FPCore (x y z)
:precision binary64
(if (<= x -7.2e+44)
(* 0.5 (* z z))
(if (<= x 7.2e+129)
(fma z (fma z 0.5 -1.0) 1.0)
(fma x (fma x 0.5 1.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.2e+44) {
tmp = 0.5 * (z * z);
} else if (x <= 7.2e+129) {
tmp = fma(z, fma(z, 0.5, -1.0), 1.0);
} else {
tmp = fma(x, fma(x, 0.5, 1.0), 1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -7.2e+44) tmp = Float64(0.5 * Float64(z * z)); elseif (x <= 7.2e+129) tmp = fma(z, fma(z, 0.5, -1.0), 1.0); else tmp = fma(x, fma(x, 0.5, 1.0), 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -7.2e+44], N[(0.5 * N[(z * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e+129], N[(z * N[(z * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], N[(x * N[(x * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \left(z \cdot z\right)\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+129}:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.5, -1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, 1\right), 1\right)\\
\end{array}
\end{array}
if x < -7.2e44Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6444.3
Applied rewrites44.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6416.6
Applied rewrites16.6%
Taylor expanded in z around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6429.0
Applied rewrites29.0%
if -7.2e44 < x < 7.2000000000000002e129Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6464.5
Applied rewrites64.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6436.3
Applied rewrites36.3%
if 7.2000000000000002e129 < x Initial program 100.0%
Taylor expanded in y around 0
lower-exp.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
lower-exp.f6489.5
Applied rewrites89.5%
Taylor expanded in x around 0
+-commutativeN/A
*-lft-identityN/A
rgt-mult-inverseN/A
associate-*r/N/A
*-rgt-identityN/A
/-rgt-identityN/A
times-fracN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-rgt-identityN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
rgt-mult-inverseN/A
distribute-lft-inN/A
associate-*l*N/A
unpow2N/A
cube-multN/A
Applied rewrites72.1%
(FPCore (x y z) :precision binary64 (if (<= x -7.2e+44) (* 0.5 (* z z)) (if (<= x 7.2e+129) (fma z (* z 0.5) 1.0) (fma x (fma x 0.5 1.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.2e+44) {
tmp = 0.5 * (z * z);
} else if (x <= 7.2e+129) {
tmp = fma(z, (z * 0.5), 1.0);
} else {
tmp = fma(x, fma(x, 0.5, 1.0), 1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -7.2e+44) tmp = Float64(0.5 * Float64(z * z)); elseif (x <= 7.2e+129) tmp = fma(z, Float64(z * 0.5), 1.0); else tmp = fma(x, fma(x, 0.5, 1.0), 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -7.2e+44], N[(0.5 * N[(z * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e+129], N[(z * N[(z * 0.5), $MachinePrecision] + 1.0), $MachinePrecision], N[(x * N[(x * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \left(z \cdot z\right)\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+129}:\\
\;\;\;\;\mathsf{fma}\left(z, z \cdot 0.5, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, 1\right), 1\right)\\
\end{array}
\end{array}
if x < -7.2e44Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6444.3
Applied rewrites44.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6416.6
Applied rewrites16.6%
Taylor expanded in z around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6429.0
Applied rewrites29.0%
if -7.2e44 < x < 7.2000000000000002e129Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6464.5
Applied rewrites64.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6436.3
Applied rewrites36.3%
Taylor expanded in z around inf
lower-*.f6436.0
Applied rewrites36.0%
if 7.2000000000000002e129 < x Initial program 100.0%
Taylor expanded in y around 0
lower-exp.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
lower-exp.f6489.5
Applied rewrites89.5%
Taylor expanded in x around 0
+-commutativeN/A
*-lft-identityN/A
rgt-mult-inverseN/A
associate-*r/N/A
*-rgt-identityN/A
/-rgt-identityN/A
times-fracN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-rgt-identityN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
rgt-mult-inverseN/A
distribute-lft-inN/A
associate-*l*N/A
unpow2N/A
cube-multN/A
Applied rewrites72.1%
Final simplification41.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 y around 0
lower-exp.f64N/A
lower--.f6479.7
Applied rewrites79.7%
Taylor expanded in z around 0
lower-exp.f6452.6
Applied rewrites52.6%
Taylor expanded in x around 0
lower-+.f6412.9
Applied rewrites12.9%
Final simplification12.9%
(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 inf
mul-1-negN/A
lower-neg.f6456.0
Applied rewrites56.0%
Taylor expanded in z around 0
Applied rewrites12.5%
(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 2024214
(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)))