
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + 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 = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + 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 = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
(FPCore (x y z) :precision binary64 (fma (log y) (- -0.5 y) (+ y (- x z))))
double code(double x, double y, double z) {
return fma(log(y), (-0.5 - y), (y + (x - z)));
}
function code(x, y, z) return fma(log(y), Float64(-0.5 - y), Float64(y + Float64(x - z))) end
code[x_, y_, z_] := N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + N[(y + N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, -0.5 - y, y + \left(x - z\right)\right)
\end{array}
Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
+-commutative99.8%
associate-+l+99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.9%
neg-sub099.9%
+-commutative99.9%
associate--r+99.9%
metadata-eval99.9%
associate-+r-99.9%
+-commutative99.9%
associate-+r-99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ y (- (fma (log y) (- -0.5 y) x) z)))
double code(double x, double y, double z) {
return y + (fma(log(y), (-0.5 - y), x) - z);
}
function code(x, y, z) return Float64(y + Float64(fma(log(y), Float64(-0.5 - y), x) - z)) end
code[x_, y_, z_] := N[(y + N[(N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \left(\mathsf{fma}\left(\log y, -0.5 - y, x\right) - z\right)
\end{array}
Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-+l+99.8%
sub-neg99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
neg-sub099.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- x (* (log y) 0.5))))
(if (<= y 3.5e-133)
t_0
(if (<= y 4e-82)
(- (* (log y) -0.5) z)
(if (<= y 1.75e-18)
t_0
(if (<= y 12500000000000.0)
(+ y (- x z))
(if (or (<= y 1.35e+56) (not (<= y 5e+75)))
(+ x (* y (- 1.0 (log y))))
(- x z))))))))
double code(double x, double y, double z) {
double t_0 = x - (log(y) * 0.5);
double tmp;
if (y <= 3.5e-133) {
tmp = t_0;
} else if (y <= 4e-82) {
tmp = (log(y) * -0.5) - z;
} else if (y <= 1.75e-18) {
tmp = t_0;
} else if (y <= 12500000000000.0) {
tmp = y + (x - z);
} else if ((y <= 1.35e+56) || !(y <= 5e+75)) {
tmp = x + (y * (1.0 - log(y)));
} else {
tmp = x - 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 = x - (log(y) * 0.5d0)
if (y <= 3.5d-133) then
tmp = t_0
else if (y <= 4d-82) then
tmp = (log(y) * (-0.5d0)) - z
else if (y <= 1.75d-18) then
tmp = t_0
else if (y <= 12500000000000.0d0) then
tmp = y + (x - z)
else if ((y <= 1.35d+56) .or. (.not. (y <= 5d+75))) then
tmp = x + (y * (1.0d0 - log(y)))
else
tmp = x - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x - (Math.log(y) * 0.5);
double tmp;
if (y <= 3.5e-133) {
tmp = t_0;
} else if (y <= 4e-82) {
tmp = (Math.log(y) * -0.5) - z;
} else if (y <= 1.75e-18) {
tmp = t_0;
} else if (y <= 12500000000000.0) {
tmp = y + (x - z);
} else if ((y <= 1.35e+56) || !(y <= 5e+75)) {
tmp = x + (y * (1.0 - Math.log(y)));
} else {
tmp = x - z;
}
return tmp;
}
def code(x, y, z): t_0 = x - (math.log(y) * 0.5) tmp = 0 if y <= 3.5e-133: tmp = t_0 elif y <= 4e-82: tmp = (math.log(y) * -0.5) - z elif y <= 1.75e-18: tmp = t_0 elif y <= 12500000000000.0: tmp = y + (x - z) elif (y <= 1.35e+56) or not (y <= 5e+75): tmp = x + (y * (1.0 - math.log(y))) else: tmp = x - z return tmp
function code(x, y, z) t_0 = Float64(x - Float64(log(y) * 0.5)) tmp = 0.0 if (y <= 3.5e-133) tmp = t_0; elseif (y <= 4e-82) tmp = Float64(Float64(log(y) * -0.5) - z); elseif (y <= 1.75e-18) tmp = t_0; elseif (y <= 12500000000000.0) tmp = Float64(y + Float64(x - z)); elseif ((y <= 1.35e+56) || !(y <= 5e+75)) tmp = Float64(x + Float64(y * Float64(1.0 - log(y)))); else tmp = Float64(x - z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x - (log(y) * 0.5); tmp = 0.0; if (y <= 3.5e-133) tmp = t_0; elseif (y <= 4e-82) tmp = (log(y) * -0.5) - z; elseif (y <= 1.75e-18) tmp = t_0; elseif (y <= 12500000000000.0) tmp = y + (x - z); elseif ((y <= 1.35e+56) || ~((y <= 5e+75))) tmp = x + (y * (1.0 - log(y))); else tmp = x - z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 3.5e-133], t$95$0, If[LessEqual[y, 4e-82], N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 1.75e-18], t$95$0, If[LessEqual[y, 12500000000000.0], N[(y + N[(x - z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1.35e+56], N[Not[LessEqual[y, 5e+75]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - \log y \cdot 0.5\\
\mathbf{if}\;y \leq 3.5 \cdot 10^{-133}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-82}:\\
\;\;\;\;\log y \cdot -0.5 - z\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 12500000000000:\\
\;\;\;\;y + \left(x - z\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+56} \lor \neg \left(y \leq 5 \cdot 10^{+75}\right):\\
\;\;\;\;x + y \cdot \left(1 - \log y\right)\\
\mathbf{else}:\\
\;\;\;\;x - z\\
\end{array}
\end{array}
if y < 3.50000000000000003e-133 or 4e-82 < y < 1.7499999999999999e-18Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 81.3%
Taylor expanded in y around 0 81.3%
if 3.50000000000000003e-133 < y < 4e-82Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-+l+100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
neg-sub0100.0%
+-commutative100.0%
associate--r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 86.1%
*-commutative86.1%
Simplified86.1%
if 1.7499999999999999e-18 < y < 1.25e13Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
associate-+l+99.7%
sub-neg99.7%
sub-neg99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-def99.7%
neg-sub099.7%
+-commutative99.7%
associate--r+99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 74.9%
if 1.25e13 < y < 1.35000000000000005e56 or 5.0000000000000002e75 < y Initial program 99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in z around 0 86.8%
Taylor expanded in y around inf 86.7%
mul-1-neg86.7%
distribute-rgt-neg-in86.7%
log-rec86.7%
remove-double-neg86.7%
Simplified86.7%
Taylor expanded in y around 0 86.7%
if 1.35000000000000005e56 < y < 5.0000000000000002e75Initial program 100.0%
associate--l+100.0%
Simplified100.0%
*-commutative100.0%
flip-+100.0%
associate-*r/100.0%
fma-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
log-rec100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around 0 88.9%
Final simplification84.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (* y (- 1.0 (log y))))))
(if (<= y 225000000.0)
(- (+ x (* (log y) -0.5)) z)
(if (<= y 4.7e+57)
t_0
(if (<= y 7.1e+75)
(- x z)
(if (or (<= y 4.8e+190) (not (<= y 8.8e+251)))
t_0
(- y (+ z (* y (log y))))))))))
double code(double x, double y, double z) {
double t_0 = x + (y * (1.0 - log(y)));
double tmp;
if (y <= 225000000.0) {
tmp = (x + (log(y) * -0.5)) - z;
} else if (y <= 4.7e+57) {
tmp = t_0;
} else if (y <= 7.1e+75) {
tmp = x - z;
} else if ((y <= 4.8e+190) || !(y <= 8.8e+251)) {
tmp = t_0;
} else {
tmp = y - (z + (y * log(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 * (1.0d0 - log(y)))
if (y <= 225000000.0d0) then
tmp = (x + (log(y) * (-0.5d0))) - z
else if (y <= 4.7d+57) then
tmp = t_0
else if (y <= 7.1d+75) then
tmp = x - z
else if ((y <= 4.8d+190) .or. (.not. (y <= 8.8d+251))) then
tmp = t_0
else
tmp = y - (z + (y * log(y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (y * (1.0 - Math.log(y)));
double tmp;
if (y <= 225000000.0) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else if (y <= 4.7e+57) {
tmp = t_0;
} else if (y <= 7.1e+75) {
tmp = x - z;
} else if ((y <= 4.8e+190) || !(y <= 8.8e+251)) {
tmp = t_0;
} else {
tmp = y - (z + (y * Math.log(y)));
}
return tmp;
}
def code(x, y, z): t_0 = x + (y * (1.0 - math.log(y))) tmp = 0 if y <= 225000000.0: tmp = (x + (math.log(y) * -0.5)) - z elif y <= 4.7e+57: tmp = t_0 elif y <= 7.1e+75: tmp = x - z elif (y <= 4.8e+190) or not (y <= 8.8e+251): tmp = t_0 else: tmp = y - (z + (y * math.log(y))) return tmp
function code(x, y, z) t_0 = Float64(x + Float64(y * Float64(1.0 - log(y)))) tmp = 0.0 if (y <= 225000000.0) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); elseif (y <= 4.7e+57) tmp = t_0; elseif (y <= 7.1e+75) tmp = Float64(x - z); elseif ((y <= 4.8e+190) || !(y <= 8.8e+251)) tmp = t_0; else tmp = Float64(y - Float64(z + Float64(y * log(y)))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (y * (1.0 - log(y))); tmp = 0.0; if (y <= 225000000.0) tmp = (x + (log(y) * -0.5)) - z; elseif (y <= 4.7e+57) tmp = t_0; elseif (y <= 7.1e+75) tmp = x - z; elseif ((y <= 4.8e+190) || ~((y <= 8.8e+251))) tmp = t_0; else tmp = y - (z + (y * log(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 225000000.0], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 4.7e+57], t$95$0, If[LessEqual[y, 7.1e+75], N[(x - z), $MachinePrecision], If[Or[LessEqual[y, 4.8e+190], N[Not[LessEqual[y, 8.8e+251]], $MachinePrecision]], t$95$0, N[(y - N[(z + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + y \cdot \left(1 - \log y\right)\\
\mathbf{if}\;y \leq 225000000:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{+57}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 7.1 \cdot 10^{+75}:\\
\;\;\;\;x - z\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+190} \lor \neg \left(y \leq 8.8 \cdot 10^{+251}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y - \left(z + y \cdot \log y\right)\\
\end{array}
\end{array}
if y < 2.25e8Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
associate-+l+99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
neg-sub099.9%
+-commutative99.9%
associate--r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 98.7%
if 2.25e8 < y < 4.7000000000000003e57 or 7.09999999999999982e75 < y < 4.7999999999999997e190 or 8.7999999999999998e251 < y Initial program 99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in z around 0 88.5%
Taylor expanded in y around inf 88.4%
mul-1-neg88.4%
distribute-rgt-neg-in88.4%
log-rec88.4%
remove-double-neg88.4%
Simplified88.4%
Taylor expanded in y around 0 88.4%
if 4.7000000000000003e57 < y < 7.09999999999999982e75Initial program 100.0%
associate--l+100.0%
Simplified100.0%
*-commutative100.0%
flip-+100.0%
associate-*r/100.0%
fma-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
log-rec100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around 0 88.9%
if 4.7999999999999997e190 < y < 8.7999999999999998e251Initial program 99.5%
sub-neg99.5%
+-commutative99.5%
associate-+l+99.5%
sub-neg99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-def99.5%
neg-sub099.5%
+-commutative99.5%
associate--r+99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around inf 96.0%
*-commutative96.0%
log-rec96.0%
distribute-lft-neg-in96.0%
distribute-rgt-neg-in96.0%
Simplified96.0%
Final simplification94.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- x (* (log y) 0.5))))
(if (<= y 9e-140)
t_0
(if (<= y 2.1e-69)
(+ y (- x z))
(if (<= y 1.36e-18)
t_0
(if (<= y 4.9e+88) (- x z) (* y (- 1.0 (log y)))))))))
double code(double x, double y, double z) {
double t_0 = x - (log(y) * 0.5);
double tmp;
if (y <= 9e-140) {
tmp = t_0;
} else if (y <= 2.1e-69) {
tmp = y + (x - z);
} else if (y <= 1.36e-18) {
tmp = t_0;
} else if (y <= 4.9e+88) {
tmp = x - z;
} else {
tmp = y * (1.0 - log(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 - (log(y) * 0.5d0)
if (y <= 9d-140) then
tmp = t_0
else if (y <= 2.1d-69) then
tmp = y + (x - z)
else if (y <= 1.36d-18) then
tmp = t_0
else if (y <= 4.9d+88) then
tmp = x - z
else
tmp = y * (1.0d0 - log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x - (Math.log(y) * 0.5);
double tmp;
if (y <= 9e-140) {
tmp = t_0;
} else if (y <= 2.1e-69) {
tmp = y + (x - z);
} else if (y <= 1.36e-18) {
tmp = t_0;
} else if (y <= 4.9e+88) {
tmp = x - z;
} else {
tmp = y * (1.0 - Math.log(y));
}
return tmp;
}
def code(x, y, z): t_0 = x - (math.log(y) * 0.5) tmp = 0 if y <= 9e-140: tmp = t_0 elif y <= 2.1e-69: tmp = y + (x - z) elif y <= 1.36e-18: tmp = t_0 elif y <= 4.9e+88: tmp = x - z else: tmp = y * (1.0 - math.log(y)) return tmp
function code(x, y, z) t_0 = Float64(x - Float64(log(y) * 0.5)) tmp = 0.0 if (y <= 9e-140) tmp = t_0; elseif (y <= 2.1e-69) tmp = Float64(y + Float64(x - z)); elseif (y <= 1.36e-18) tmp = t_0; elseif (y <= 4.9e+88) tmp = Float64(x - z); else tmp = Float64(y * Float64(1.0 - log(y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x - (log(y) * 0.5); tmp = 0.0; if (y <= 9e-140) tmp = t_0; elseif (y <= 2.1e-69) tmp = y + (x - z); elseif (y <= 1.36e-18) tmp = t_0; elseif (y <= 4.9e+88) tmp = x - z; else tmp = y * (1.0 - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 9e-140], t$95$0, If[LessEqual[y, 2.1e-69], N[(y + N[(x - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.36e-18], t$95$0, If[LessEqual[y, 4.9e+88], N[(x - z), $MachinePrecision], N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - \log y \cdot 0.5\\
\mathbf{if}\;y \leq 9 \cdot 10^{-140}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-69}:\\
\;\;\;\;y + \left(x - z\right)\\
\mathbf{elif}\;y \leq 1.36 \cdot 10^{-18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{+88}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 9.00000000000000008e-140 or 2.1e-69 < y < 1.3600000000000001e-18Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 82.3%
Taylor expanded in y around 0 82.3%
if 9.00000000000000008e-140 < y < 2.1e-69Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-+l+100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
neg-sub0100.0%
+-commutative100.0%
associate--r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 81.4%
if 1.3600000000000001e-18 < y < 4.9000000000000002e88Initial program 99.9%
associate--l+99.9%
Simplified99.9%
*-commutative99.9%
flip-+99.9%
associate-*r/99.9%
fma-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 94.6%
mul-1-neg94.6%
*-commutative94.6%
log-rec94.6%
unpow294.6%
Simplified94.6%
Taylor expanded in y around 0 67.4%
if 4.9000000000000002e88 < y Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
associate-+l+99.6%
sub-neg99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-def99.6%
neg-sub099.6%
+-commutative99.6%
associate--r+99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 73.0%
log-rec73.0%
sub-neg73.0%
Simplified73.0%
Final simplification76.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- x (* (log y) 0.5))))
(if (<= y 1.5e-135)
t_0
(if (<= y 1.25e-83)
(- (* (log y) -0.5) z)
(if (<= y 1.5e-18)
t_0
(if (<= y 4.6e+88) (- x z) (* y (- 1.0 (log y)))))))))
double code(double x, double y, double z) {
double t_0 = x - (log(y) * 0.5);
double tmp;
if (y <= 1.5e-135) {
tmp = t_0;
} else if (y <= 1.25e-83) {
tmp = (log(y) * -0.5) - z;
} else if (y <= 1.5e-18) {
tmp = t_0;
} else if (y <= 4.6e+88) {
tmp = x - z;
} else {
tmp = y * (1.0 - log(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 - (log(y) * 0.5d0)
if (y <= 1.5d-135) then
tmp = t_0
else if (y <= 1.25d-83) then
tmp = (log(y) * (-0.5d0)) - z
else if (y <= 1.5d-18) then
tmp = t_0
else if (y <= 4.6d+88) then
tmp = x - z
else
tmp = y * (1.0d0 - log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x - (Math.log(y) * 0.5);
double tmp;
if (y <= 1.5e-135) {
tmp = t_0;
} else if (y <= 1.25e-83) {
tmp = (Math.log(y) * -0.5) - z;
} else if (y <= 1.5e-18) {
tmp = t_0;
} else if (y <= 4.6e+88) {
tmp = x - z;
} else {
tmp = y * (1.0 - Math.log(y));
}
return tmp;
}
def code(x, y, z): t_0 = x - (math.log(y) * 0.5) tmp = 0 if y <= 1.5e-135: tmp = t_0 elif y <= 1.25e-83: tmp = (math.log(y) * -0.5) - z elif y <= 1.5e-18: tmp = t_0 elif y <= 4.6e+88: tmp = x - z else: tmp = y * (1.0 - math.log(y)) return tmp
function code(x, y, z) t_0 = Float64(x - Float64(log(y) * 0.5)) tmp = 0.0 if (y <= 1.5e-135) tmp = t_0; elseif (y <= 1.25e-83) tmp = Float64(Float64(log(y) * -0.5) - z); elseif (y <= 1.5e-18) tmp = t_0; elseif (y <= 4.6e+88) tmp = Float64(x - z); else tmp = Float64(y * Float64(1.0 - log(y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x - (log(y) * 0.5); tmp = 0.0; if (y <= 1.5e-135) tmp = t_0; elseif (y <= 1.25e-83) tmp = (log(y) * -0.5) - z; elseif (y <= 1.5e-18) tmp = t_0; elseif (y <= 4.6e+88) tmp = x - z; else tmp = y * (1.0 - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.5e-135], t$95$0, If[LessEqual[y, 1.25e-83], N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 1.5e-18], t$95$0, If[LessEqual[y, 4.6e+88], N[(x - z), $MachinePrecision], N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - \log y \cdot 0.5\\
\mathbf{if}\;y \leq 1.5 \cdot 10^{-135}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-83}:\\
\;\;\;\;\log y \cdot -0.5 - z\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+88}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 1.50000000000000006e-135 or 1.25e-83 < y < 1.49999999999999991e-18Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 81.3%
Taylor expanded in y around 0 81.3%
if 1.50000000000000006e-135 < y < 1.25e-83Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-+l+100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
neg-sub0100.0%
+-commutative100.0%
associate--r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 86.1%
*-commutative86.1%
Simplified86.1%
if 1.49999999999999991e-18 < y < 4.6000000000000003e88Initial program 99.9%
associate--l+99.9%
Simplified99.9%
*-commutative99.9%
flip-+99.9%
associate-*r/99.9%
fma-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 94.6%
mul-1-neg94.6%
*-commutative94.6%
log-rec94.6%
unpow294.6%
Simplified94.6%
Taylor expanded in y around 0 67.4%
if 4.6000000000000003e88 < y Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
associate-+l+99.6%
sub-neg99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-def99.6%
neg-sub099.6%
+-commutative99.6%
associate--r+99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 73.0%
log-rec73.0%
sub-neg73.0%
Simplified73.0%
Final simplification76.2%
(FPCore (x y z)
:precision binary64
(if (<= y 470000000000.0)
(- (+ x (* (log y) -0.5)) z)
(if (or (<= y 3.4e+57) (not (<= y 5e+75)))
(+ x (* y (- 1.0 (log y))))
(- x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 470000000000.0) {
tmp = (x + (log(y) * -0.5)) - z;
} else if ((y <= 3.4e+57) || !(y <= 5e+75)) {
tmp = x + (y * (1.0 - log(y)));
} else {
tmp = x - 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 (y <= 470000000000.0d0) then
tmp = (x + (log(y) * (-0.5d0))) - z
else if ((y <= 3.4d+57) .or. (.not. (y <= 5d+75))) then
tmp = x + (y * (1.0d0 - log(y)))
else
tmp = x - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 470000000000.0) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else if ((y <= 3.4e+57) || !(y <= 5e+75)) {
tmp = x + (y * (1.0 - Math.log(y)));
} else {
tmp = x - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 470000000000.0: tmp = (x + (math.log(y) * -0.5)) - z elif (y <= 3.4e+57) or not (y <= 5e+75): tmp = x + (y * (1.0 - math.log(y))) else: tmp = x - z return tmp
function code(x, y, z) tmp = 0.0 if (y <= 470000000000.0) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); elseif ((y <= 3.4e+57) || !(y <= 5e+75)) tmp = Float64(x + Float64(y * Float64(1.0 - log(y)))); else tmp = Float64(x - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 470000000000.0) tmp = (x + (log(y) * -0.5)) - z; elseif ((y <= 3.4e+57) || ~((y <= 5e+75))) tmp = x + (y * (1.0 - log(y))); else tmp = x - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 470000000000.0], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[Or[LessEqual[y, 3.4e+57], N[Not[LessEqual[y, 5e+75]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 470000000000:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+57} \lor \neg \left(y \leq 5 \cdot 10^{+75}\right):\\
\;\;\;\;x + y \cdot \left(1 - \log y\right)\\
\mathbf{else}:\\
\;\;\;\;x - z\\
\end{array}
\end{array}
if y < 4.7e11Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
associate-+l+99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
neg-sub099.9%
+-commutative99.9%
associate--r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 98.7%
if 4.7e11 < y < 3.39999999999999992e57 or 5.0000000000000002e75 < y Initial program 99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in z around 0 86.8%
Taylor expanded in y around inf 86.7%
mul-1-neg86.7%
distribute-rgt-neg-in86.7%
log-rec86.7%
remove-double-neg86.7%
Simplified86.7%
Taylor expanded in y around 0 86.7%
if 3.39999999999999992e57 < y < 5.0000000000000002e75Initial program 100.0%
associate--l+100.0%
Simplified100.0%
*-commutative100.0%
flip-+100.0%
associate-*r/100.0%
fma-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
log-rec100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around 0 88.9%
Final simplification92.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.4e+69) (- (- y z) (* y (log y))) (if (<= z 2.6e+135) (+ y (- x (* (log y) (+ y 0.5)))) (- x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.4e+69) {
tmp = (y - z) - (y * log(y));
} else if (z <= 2.6e+135) {
tmp = y + (x - (log(y) * (y + 0.5)));
} else {
tmp = x - z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.4d+69)) then
tmp = (y - z) - (y * log(y))
else if (z <= 2.6d+135) then
tmp = y + (x - (log(y) * (y + 0.5d0)))
else
tmp = x - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.4e+69) {
tmp = (y - z) - (y * Math.log(y));
} else if (z <= 2.6e+135) {
tmp = y + (x - (Math.log(y) * (y + 0.5)));
} else {
tmp = x - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.4e+69: tmp = (y - z) - (y * math.log(y)) elif z <= 2.6e+135: tmp = y + (x - (math.log(y) * (y + 0.5))) else: tmp = x - z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.4e+69) tmp = Float64(Float64(y - z) - Float64(y * log(y))); elseif (z <= 2.6e+135) tmp = Float64(y + Float64(x - Float64(log(y) * Float64(y + 0.5)))); else tmp = Float64(x - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.4e+69) tmp = (y - z) - (y * log(y)); elseif (z <= 2.6e+135) tmp = y + (x - (log(y) * (y + 0.5))); else tmp = x - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.4e+69], N[(N[(y - z), $MachinePrecision] - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+135], N[(y + N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+69}:\\
\;\;\;\;\left(y - z\right) - y \cdot \log y\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+135}:\\
\;\;\;\;y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x - z\\
\end{array}
\end{array}
if z < -1.39999999999999991e69Initial program 100.0%
associate--l+100.0%
Simplified100.0%
*-commutative100.0%
flip-+78.8%
associate-*r/78.8%
fma-neg78.8%
metadata-eval78.8%
metadata-eval78.8%
sub-neg78.8%
metadata-eval78.8%
Applied egg-rr78.8%
Taylor expanded in y around inf 85.5%
log-rec85.5%
Simplified85.5%
if -1.39999999999999991e69 < z < 2.6e135Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in z around 0 96.8%
associate--l+96.8%
*-commutative96.8%
+-commutative96.8%
Applied egg-rr96.8%
if 2.6e135 < z Initial program 100.0%
associate--l+100.0%
Simplified100.0%
*-commutative100.0%
flip-+75.6%
associate-*r/75.6%
fma-neg75.6%
metadata-eval75.6%
metadata-eval75.6%
sub-neg75.6%
metadata-eval75.6%
Applied egg-rr75.6%
Taylor expanded in y around inf 75.6%
mul-1-neg75.6%
*-commutative75.6%
log-rec75.6%
unpow275.6%
Simplified75.6%
Taylor expanded in y around 0 97.2%
Final simplification95.1%
(FPCore (x y z) :precision binary64 (if (<= y 0.28) (- (+ x (* (log y) -0.5)) z) (+ (- y z) (- x (* y (log y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.28) {
tmp = (x + (log(y) * -0.5)) - z;
} else {
tmp = (y - z) + (x - (y * log(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.28d0) then
tmp = (x + (log(y) * (-0.5d0))) - z
else
tmp = (y - z) + (x - (y * log(y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.28) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else {
tmp = (y - z) + (x - (y * Math.log(y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 0.28: tmp = (x + (math.log(y) * -0.5)) - z else: tmp = (y - z) + (x - (y * math.log(y))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 0.28) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); else tmp = Float64(Float64(y - z) + Float64(x - Float64(y * log(y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 0.28) tmp = (x + (log(y) * -0.5)) - z; else tmp = (y - z) + (x - (y * log(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 0.28], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(y - z), $MachinePrecision] + N[(x - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.28:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) + \left(x - y \cdot \log y\right)\\
\end{array}
\end{array}
if y < 0.28000000000000003Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
associate-+l+99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
neg-sub099.9%
+-commutative99.9%
associate--r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 99.4%
if 0.28000000000000003 < y Initial program 99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in y around inf 99.2%
mul-1-neg99.2%
distribute-rgt-neg-in99.2%
log-rec99.2%
remove-double-neg99.2%
Simplified99.2%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (+ (- x (* (log y) (+ y 0.5))) (- y z)))
double code(double x, double y, double z) {
return (x - (log(y) * (y + 0.5))) + (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 = (x - (log(y) * (y + 0.5d0))) + (y - z)
end function
public static double code(double x, double y, double z) {
return (x - (Math.log(y) * (y + 0.5))) + (y - z);
}
def code(x, y, z): return (x - (math.log(y) * (y + 0.5))) + (y - z)
function code(x, y, z) return Float64(Float64(x - Float64(log(y) * Float64(y + 0.5))) + Float64(y - z)) end
function tmp = code(x, y, z) tmp = (x - (log(y) * (y + 0.5))) + (y - z); end
code[x_, y_, z_] := N[(N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \log y \cdot \left(y + 0.5\right)\right) + \left(y - z\right)
\end{array}
Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= y 3.4e+88) (+ y (- x z)) (* y (- 1.0 (log y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.4e+88) {
tmp = y + (x - z);
} else {
tmp = y * (1.0 - log(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 <= 3.4d+88) then
tmp = y + (x - z)
else
tmp = y * (1.0d0 - log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.4e+88) {
tmp = y + (x - z);
} else {
tmp = y * (1.0 - Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.4e+88: tmp = y + (x - z) else: tmp = y * (1.0 - math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.4e+88) tmp = Float64(y + Float64(x - z)); else tmp = Float64(y * Float64(1.0 - log(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.4e+88) tmp = y + (x - z); else tmp = y * (1.0 - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.4e+88], N[(y + N[(x - z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.4 \cdot 10^{+88}:\\
\;\;\;\;y + \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 3.40000000000000004e88Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-+l+100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
neg-sub0100.0%
+-commutative100.0%
associate--r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 67.8%
if 3.40000000000000004e88 < y Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
associate-+l+99.6%
sub-neg99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-def99.6%
neg-sub099.6%
+-commutative99.6%
associate--r+99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 73.0%
log-rec73.0%
sub-neg73.0%
Simplified73.0%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.55e+104) (- z) (if (<= z 1.3e+167) x (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.55e+104) {
tmp = -z;
} else if (z <= 1.3e+167) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.55d+104)) then
tmp = -z
else if (z <= 1.3d+167) then
tmp = x
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.55e+104) {
tmp = -z;
} else if (z <= 1.3e+167) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.55e+104: tmp = -z elif z <= 1.3e+167: tmp = x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.55e+104) tmp = Float64(-z); elseif (z <= 1.3e+167) tmp = x; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.55e+104) tmp = -z; elseif (z <= 1.3e+167) tmp = x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.55e+104], (-z), If[LessEqual[z, 1.3e+167], x, (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+104}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+167}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -1.55000000000000008e104 or 1.3000000000000001e167 < z Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-+l+100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
neg-sub0100.0%
+-commutative100.0%
associate--r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 81.2%
neg-mul-181.2%
Simplified81.2%
if -1.55000000000000008e104 < z < 1.3000000000000001e167Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in z around 0 94.5%
Taylor expanded in y around inf 76.0%
mul-1-neg76.0%
distribute-rgt-neg-in76.0%
log-rec76.0%
remove-double-neg76.0%
Simplified76.0%
Taylor expanded in y around 0 36.2%
Final simplification46.4%
(FPCore (x y z) :precision binary64 (- x z))
double code(double x, double y, double z) {
return 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 = x - z
end function
public static double code(double x, double y, double z) {
return x - z;
}
def code(x, y, z): return x - z
function code(x, y, z) return Float64(x - z) end
function tmp = code(x, y, z) tmp = x - z; end
code[x_, y_, z_] := N[(x - z), $MachinePrecision]
\begin{array}{l}
\\
x - z
\end{array}
Initial program 99.8%
associate--l+99.8%
Simplified99.8%
*-commutative99.8%
flip-+74.1%
associate-*r/74.1%
fma-neg74.1%
metadata-eval74.1%
metadata-eval74.1%
sub-neg74.1%
metadata-eval74.1%
Applied egg-rr74.1%
Taylor expanded in y around inf 59.4%
mul-1-neg59.4%
*-commutative59.4%
log-rec59.4%
unpow259.4%
Simplified59.4%
Taylor expanded in y around 0 51.2%
Final simplification51.2%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in z around 0 77.3%
Taylor expanded in y around inf 63.0%
mul-1-neg63.0%
distribute-rgt-neg-in63.0%
log-rec63.0%
remove-double-neg63.0%
Simplified63.0%
Taylor expanded in y around 0 29.4%
Final simplification29.4%
(FPCore (x y z) :precision binary64 (- (- (+ y x) z) (* (+ y 0.5) (log y))))
double code(double x, double y, double z) {
return ((y + x) - z) - ((y + 0.5) * log(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((y + x) - z) - ((y + 0.5d0) * log(y))
end function
public static double code(double x, double y, double z) {
return ((y + x) - z) - ((y + 0.5) * Math.log(y));
}
def code(x, y, z): return ((y + x) - z) - ((y + 0.5) * math.log(y))
function code(x, y, z) return Float64(Float64(Float64(y + x) - z) - Float64(Float64(y + 0.5) * log(y))) end
function tmp = code(x, y, z) tmp = ((y + x) - z) - ((y + 0.5) * log(y)); end
code[x_, y_, z_] := N[(N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision] - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(y + x\right) - z\right) - \left(y + 0.5\right) \cdot \log y
\end{array}
herbie shell --seed 2023249
(FPCore (x y z)
:name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(- (- (+ y x) z) (* (+ y 0.5) (log y)))
(- (+ (- x (* (+ y 0.5) (log y))) y) z))