
(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 11 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 (+ x (- (fma (log y) (- -0.5 y) y) z)))
double code(double x, double y, double z) {
return x + (fma(log(y), (-0.5 - y), y) - z);
}
function code(x, y, z) return Float64(x + Float64(fma(log(y), Float64(-0.5 - y), y) - z)) end
code[x_, y_, z_] := N[(x + N[(N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\mathsf{fma}\left(\log y, -0.5 - y, y\right) - z\right)
\end{array}
Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
associate-+l+99.8%
associate-+r-99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
(FPCore (x y z)
:precision binary64
(if (<= x -1.55e+117)
(- x z)
(if (<= x 1.3e+62)
(- (- y (* (log y) (+ y 0.5))) z)
(- (- x (* (log y) 0.5)) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.55e+117) {
tmp = x - z;
} else if (x <= 1.3e+62) {
tmp = (y - (log(y) * (y + 0.5))) - z;
} else {
tmp = (x - (log(y) * 0.5)) - z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.55d+117)) then
tmp = x - z
else if (x <= 1.3d+62) then
tmp = (y - (log(y) * (y + 0.5d0))) - z
else
tmp = (x - (log(y) * 0.5d0)) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.55e+117) {
tmp = x - z;
} else if (x <= 1.3e+62) {
tmp = (y - (Math.log(y) * (y + 0.5))) - z;
} else {
tmp = (x - (Math.log(y) * 0.5)) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.55e+117: tmp = x - z elif x <= 1.3e+62: tmp = (y - (math.log(y) * (y + 0.5))) - z else: tmp = (x - (math.log(y) * 0.5)) - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.55e+117) tmp = Float64(x - z); elseif (x <= 1.3e+62) tmp = Float64(Float64(y - Float64(log(y) * Float64(y + 0.5))) - z); else tmp = Float64(Float64(x - Float64(log(y) * 0.5)) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.55e+117) tmp = x - z; elseif (x <= 1.3e+62) tmp = (y - (log(y) * (y + 0.5))) - z; else tmp = (x - (log(y) * 0.5)) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.55e+117], N[(x - z), $MachinePrecision], If[LessEqual[x, 1.3e+62], N[(N[(y - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+117}:\\
\;\;\;\;x - z\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+62}:\\
\;\;\;\;\left(y - \log y \cdot \left(y + 0.5\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(x - \log y \cdot 0.5\right) - z\\
\end{array}
\end{array}
if x < -1.54999999999999988e117Initial program 100.0%
flip-+88.6%
div-inv88.6%
fmm-def88.6%
metadata-eval88.6%
metadata-eval88.6%
sub-neg88.6%
metadata-eval88.6%
Applied egg-rr88.6%
*-commutative88.6%
associate-/r/88.6%
Simplified88.6%
associate-+l-88.6%
associate-*l/88.6%
*-un-lft-identity88.6%
clear-num88.6%
metadata-eval88.6%
metadata-eval88.6%
fmm-def88.6%
*-un-lft-identity88.6%
fma-define88.6%
metadata-eval88.6%
fmm-def88.6%
*-un-lft-identity88.6%
flip-+100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 90.7%
if -1.54999999999999988e117 < x < 1.29999999999999992e62Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
associate-+l+99.8%
associate-+r-99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 96.6%
associate-*r*96.6%
neg-mul-196.6%
+-commutative96.6%
cancel-sign-sub-inv96.6%
Simplified96.6%
if 1.29999999999999992e62 < x Initial program 99.9%
Taylor expanded in y around 0 87.0%
Final simplification93.9%
(FPCore (x y z) :precision binary64 (if (<= y 3.3e-147) (- (* (log y) -0.5) z) (if (<= y 1.5e+78) (- x z) (- (* y (- 1.0 (log y))) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.3e-147) {
tmp = (log(y) * -0.5) - z;
} else if (y <= 1.5e+78) {
tmp = x - z;
} else {
tmp = (y * (1.0 - log(y))) - 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 <= 3.3d-147) then
tmp = (log(y) * (-0.5d0)) - z
else if (y <= 1.5d+78) then
tmp = x - z
else
tmp = (y * (1.0d0 - log(y))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.3e-147) {
tmp = (Math.log(y) * -0.5) - z;
} else if (y <= 1.5e+78) {
tmp = x - z;
} else {
tmp = (y * (1.0 - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.3e-147: tmp = (math.log(y) * -0.5) - z elif y <= 1.5e+78: tmp = x - z else: tmp = (y * (1.0 - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.3e-147) tmp = Float64(Float64(log(y) * -0.5) - z); elseif (y <= 1.5e+78) tmp = Float64(x - z); else tmp = Float64(Float64(y * Float64(1.0 - log(y))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.3e-147) tmp = (log(y) * -0.5) - z; elseif (y <= 1.5e+78) tmp = x - z; else tmp = (y * (1.0 - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.3e-147], N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 1.5e+78], N[(x - z), $MachinePrecision], N[(N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.3 \cdot 10^{-147}:\\
\;\;\;\;\log y \cdot -0.5 - z\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+78}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right) - z\\
\end{array}
\end{array}
if y < 3.29999999999999987e-147Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 76.5%
mul-1-neg76.5%
distribute-neg-in76.5%
sub-neg76.5%
neg-sub076.5%
associate--r+76.5%
+-commutative76.5%
associate--r+76.5%
neg-sub076.5%
distribute-lft-neg-in76.5%
metadata-eval76.5%
*-commutative76.5%
Simplified76.5%
if 3.29999999999999987e-147 < y < 1.49999999999999991e78Initial program 99.9%
flip-+99.9%
div-inv99.9%
fmm-def99.9%
metadata-eval99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
Applied egg-rr99.9%
*-commutative99.9%
associate-/r/100.0%
Simplified100.0%
associate-+l-100.0%
associate-*l/100.0%
*-un-lft-identity100.0%
clear-num100.0%
metadata-eval100.0%
metadata-eval100.0%
fmm-def100.0%
*-un-lft-identity100.0%
fma-define100.0%
metadata-eval100.0%
fmm-def100.0%
*-un-lft-identity100.0%
flip-+100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 79.6%
if 1.49999999999999991e78 < y Initial program 99.6%
Taylor expanded in x around -inf 75.2%
mul-1-neg75.2%
sub-neg75.2%
associate-/l*75.1%
+-commutative75.1%
metadata-eval75.1%
Simplified75.1%
Taylor expanded in y around inf 82.5%
mul-1-neg82.5%
log-rec82.5%
remove-double-neg82.5%
Simplified82.5%
(FPCore (x y z) :precision binary64 (if (<= y 3.2e-149) (- (* (log y) -0.5) z) (if (<= y 2.85e+78) (- x z) (* y (- 1.0 (log y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.2e-149) {
tmp = (log(y) * -0.5) - z;
} else if (y <= 2.85e+78) {
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) :: tmp
if (y <= 3.2d-149) then
tmp = (log(y) * (-0.5d0)) - z
else if (y <= 2.85d+78) 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 tmp;
if (y <= 3.2e-149) {
tmp = (Math.log(y) * -0.5) - z;
} else if (y <= 2.85e+78) {
tmp = x - z;
} else {
tmp = y * (1.0 - Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.2e-149: tmp = (math.log(y) * -0.5) - z elif y <= 2.85e+78: tmp = x - z else: tmp = y * (1.0 - math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.2e-149) tmp = Float64(Float64(log(y) * -0.5) - z); elseif (y <= 2.85e+78) tmp = 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.2e-149) tmp = (log(y) * -0.5) - z; elseif (y <= 2.85e+78) tmp = x - z; else tmp = y * (1.0 - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.2e-149], N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 2.85e+78], N[(x - z), $MachinePrecision], N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.2 \cdot 10^{-149}:\\
\;\;\;\;\log y \cdot -0.5 - z\\
\mathbf{elif}\;y \leq 2.85 \cdot 10^{+78}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 3.20000000000000002e-149Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 76.5%
mul-1-neg76.5%
distribute-neg-in76.5%
sub-neg76.5%
neg-sub076.5%
associate--r+76.5%
+-commutative76.5%
associate--r+76.5%
neg-sub076.5%
distribute-lft-neg-in76.5%
metadata-eval76.5%
*-commutative76.5%
Simplified76.5%
if 3.20000000000000002e-149 < y < 2.84999999999999993e78Initial program 99.9%
flip-+99.9%
div-inv99.9%
fmm-def99.9%
metadata-eval99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
Applied egg-rr99.9%
*-commutative99.9%
associate-/r/100.0%
Simplified100.0%
associate-+l-100.0%
associate-*l/100.0%
*-un-lft-identity100.0%
clear-num100.0%
metadata-eval100.0%
metadata-eval100.0%
fmm-def100.0%
*-un-lft-identity100.0%
fma-define100.0%
metadata-eval100.0%
fmm-def100.0%
*-un-lft-identity100.0%
flip-+100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 79.6%
if 2.84999999999999993e78 < y Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
associate-+l+99.6%
associate-+r-99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-define99.7%
+-commutative99.7%
distribute-neg-in99.7%
unsub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 69.9%
log-rec69.9%
sub-neg69.9%
Simplified69.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -105.0) (not (<= z -7.2e-122))) (- x z) (* (log y) -0.5)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -105.0) || !(z <= -7.2e-122)) {
tmp = x - z;
} else {
tmp = log(y) * -0.5;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-105.0d0)) .or. (.not. (z <= (-7.2d-122)))) then
tmp = x - z
else
tmp = log(y) * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -105.0) || !(z <= -7.2e-122)) {
tmp = x - z;
} else {
tmp = Math.log(y) * -0.5;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -105.0) or not (z <= -7.2e-122): tmp = x - z else: tmp = math.log(y) * -0.5 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -105.0) || !(z <= -7.2e-122)) tmp = Float64(x - z); else tmp = Float64(log(y) * -0.5); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -105.0) || ~((z <= -7.2e-122))) tmp = x - z; else tmp = log(y) * -0.5; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -105.0], N[Not[LessEqual[z, -7.2e-122]], $MachinePrecision]], N[(x - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -105 \lor \neg \left(z \leq -7.2 \cdot 10^{-122}\right):\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot -0.5\\
\end{array}
\end{array}
if z < -105 or -7.19999999999999989e-122 < z Initial program 99.9%
flip-+80.2%
div-inv80.2%
fmm-def80.2%
metadata-eval80.2%
metadata-eval80.2%
sub-neg80.2%
metadata-eval80.2%
Applied egg-rr80.2%
*-commutative80.2%
associate-/r/80.2%
Simplified80.2%
associate-+l-80.2%
associate-*l/80.2%
*-un-lft-identity80.2%
clear-num80.2%
metadata-eval80.2%
metadata-eval80.2%
fmm-def80.2%
*-un-lft-identity80.2%
fma-define80.2%
metadata-eval80.2%
fmm-def80.2%
*-un-lft-identity80.2%
flip-+99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 61.1%
if -105 < z < -7.19999999999999989e-122Initial program 99.7%
Taylor expanded in y around 0 66.4%
Taylor expanded in z around 0 56.3%
Taylor expanded in x around 0 46.4%
*-commutative46.4%
Simplified46.4%
Final simplification59.7%
(FPCore (x y z) :precision binary64 (if (<= y 1.85e+78) (- (- x (* (log y) 0.5)) z) (- (* y (- 1.0 (log y))) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.85e+78) {
tmp = (x - (log(y) * 0.5)) - z;
} else {
tmp = (y * (1.0 - log(y))) - 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 <= 1.85d+78) then
tmp = (x - (log(y) * 0.5d0)) - z
else
tmp = (y * (1.0d0 - log(y))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.85e+78) {
tmp = (x - (Math.log(y) * 0.5)) - z;
} else {
tmp = (y * (1.0 - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.85e+78: tmp = (x - (math.log(y) * 0.5)) - z else: tmp = (y * (1.0 - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.85e+78) tmp = Float64(Float64(x - Float64(log(y) * 0.5)) - z); else tmp = Float64(Float64(y * Float64(1.0 - log(y))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.85e+78) tmp = (x - (log(y) * 0.5)) - z; else tmp = (y * (1.0 - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.85e+78], N[(N[(x - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.85 \cdot 10^{+78}:\\
\;\;\;\;\left(x - \log y \cdot 0.5\right) - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right) - z\\
\end{array}
\end{array}
if y < 1.84999999999999992e78Initial program 100.0%
Taylor expanded in y around 0 96.6%
if 1.84999999999999992e78 < y Initial program 99.6%
Taylor expanded in x around -inf 75.2%
mul-1-neg75.2%
sub-neg75.2%
associate-/l*75.1%
+-commutative75.1%
metadata-eval75.1%
Simplified75.1%
Taylor expanded in y around inf 82.5%
mul-1-neg82.5%
log-rec82.5%
remove-double-neg82.5%
Simplified82.5%
Final simplification91.3%
(FPCore (x y z) :precision binary64 (- (+ y (- x (* (log y) (+ y 0.5)))) z))
double code(double x, double y, double z) {
return (y + (x - (log(y) * (y + 0.5)))) - z;
}
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 - (log(y) * (y + 0.5d0)))) - z
end function
public static double code(double x, double y, double z) {
return (y + (x - (Math.log(y) * (y + 0.5)))) - z;
}
def code(x, y, z): return (y + (x - (math.log(y) * (y + 0.5)))) - z
function code(x, y, z) return Float64(Float64(y + Float64(x - Float64(log(y) * Float64(y + 0.5)))) - z) end
function tmp = code(x, y, z) tmp = (y + (x - (log(y) * (y + 0.5)))) - z; end
code[x_, y_, z_] := N[(N[(y + N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\right) - z
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= y 1.68e+78) (- x z) (* y (- 1.0 (log y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.68e+78) {
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) :: tmp
if (y <= 1.68d+78) 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 tmp;
if (y <= 1.68e+78) {
tmp = x - z;
} else {
tmp = y * (1.0 - Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.68e+78: tmp = x - z else: tmp = y * (1.0 - math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.68e+78) tmp = 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 <= 1.68e+78) tmp = x - z; else tmp = y * (1.0 - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.68e+78], N[(x - z), $MachinePrecision], N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.68 \cdot 10^{+78}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 1.6799999999999999e78Initial program 100.0%
flip-+100.0%
div-inv100.0%
fmm-def100.0%
metadata-eval100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
associate-+l-100.0%
associate-*l/100.0%
*-un-lft-identity100.0%
clear-num100.0%
metadata-eval100.0%
metadata-eval100.0%
fmm-def100.0%
*-un-lft-identity100.0%
fma-define100.0%
metadata-eval100.0%
fmm-def100.0%
*-un-lft-identity100.0%
flip-+100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 72.1%
if 1.6799999999999999e78 < y Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
associate-+l+99.6%
associate-+r-99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-define99.7%
+-commutative99.7%
distribute-neg-in99.7%
unsub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 69.9%
log-rec69.9%
sub-neg69.9%
Simplified69.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.85e+81) x (if (<= x 1.35e+59) (- z) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.85e+81) {
tmp = x;
} else if (x <= 1.35e+59) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.85d+81)) then
tmp = x
else if (x <= 1.35d+59) then
tmp = -z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.85e+81) {
tmp = x;
} else if (x <= 1.35e+59) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.85e+81: tmp = x elif x <= 1.35e+59: tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.85e+81) tmp = x; elseif (x <= 1.35e+59) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.85e+81) tmp = x; elseif (x <= 1.35e+59) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.85e+81], x, If[LessEqual[x, 1.35e+59], (-z), x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+81}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+59}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.85e81 or 1.3500000000000001e59 < x Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
associate-+r-99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 69.8%
if -1.85e81 < x < 1.3500000000000001e59Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
associate-+l+99.8%
associate-+r-99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 39.8%
neg-mul-139.8%
Simplified39.8%
(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%
flip-+79.7%
div-inv79.7%
fmm-def79.7%
metadata-eval79.7%
metadata-eval79.7%
sub-neg79.7%
metadata-eval79.7%
Applied egg-rr79.7%
*-commutative79.7%
associate-/r/79.7%
Simplified79.7%
associate-+l-79.7%
associate-*l/79.8%
*-un-lft-identity79.8%
clear-num79.7%
metadata-eval79.7%
metadata-eval79.7%
fmm-def79.7%
*-un-lft-identity79.7%
fma-define79.7%
metadata-eval79.7%
fmm-def79.7%
*-un-lft-identity79.7%
flip-+99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 56.5%
(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%
sub-neg99.8%
associate-+l+99.8%
associate-+r-99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 27.1%
(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 2024185
(FPCore (x y z)
:name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (- (- (+ y x) z) (* (+ y 1/2) (log y))))
(- (+ (- x (* (+ y 0.5) (log y))) y) z))