
(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 (+ 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.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%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ x y) z)) (t_1 (* (log y) -0.5)))
(if (<= y 7.2e-258)
t_0
(if (<= y 3.3e-205)
(+ x t_1)
(if (<= y 5.7e-117)
(- t_1 z)
(if (<= y 2.6e+110) t_0 (- y (* y (log y)))))))))
double code(double x, double y, double z) {
double t_0 = (x + y) - z;
double t_1 = log(y) * -0.5;
double tmp;
if (y <= 7.2e-258) {
tmp = t_0;
} else if (y <= 3.3e-205) {
tmp = x + t_1;
} else if (y <= 5.7e-117) {
tmp = t_1 - z;
} else if (y <= 2.6e+110) {
tmp = t_0;
} else {
tmp = y - (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) :: t_1
real(8) :: tmp
t_0 = (x + y) - z
t_1 = log(y) * (-0.5d0)
if (y <= 7.2d-258) then
tmp = t_0
else if (y <= 3.3d-205) then
tmp = x + t_1
else if (y <= 5.7d-117) then
tmp = t_1 - z
else if (y <= 2.6d+110) then
tmp = t_0
else
tmp = y - (y * log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + y) - z;
double t_1 = Math.log(y) * -0.5;
double tmp;
if (y <= 7.2e-258) {
tmp = t_0;
} else if (y <= 3.3e-205) {
tmp = x + t_1;
} else if (y <= 5.7e-117) {
tmp = t_1 - z;
} else if (y <= 2.6e+110) {
tmp = t_0;
} else {
tmp = y - (y * Math.log(y));
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) - z t_1 = math.log(y) * -0.5 tmp = 0 if y <= 7.2e-258: tmp = t_0 elif y <= 3.3e-205: tmp = x + t_1 elif y <= 5.7e-117: tmp = t_1 - z elif y <= 2.6e+110: tmp = t_0 else: tmp = y - (y * math.log(y)) return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) - z) t_1 = Float64(log(y) * -0.5) tmp = 0.0 if (y <= 7.2e-258) tmp = t_0; elseif (y <= 3.3e-205) tmp = Float64(x + t_1); elseif (y <= 5.7e-117) tmp = Float64(t_1 - z); elseif (y <= 2.6e+110) tmp = t_0; else tmp = Float64(y - Float64(y * log(y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) - z; t_1 = log(y) * -0.5; tmp = 0.0; if (y <= 7.2e-258) tmp = t_0; elseif (y <= 3.3e-205) tmp = x + t_1; elseif (y <= 5.7e-117) tmp = t_1 - z; elseif (y <= 2.6e+110) tmp = t_0; else tmp = y - (y * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[y, 7.2e-258], t$95$0, If[LessEqual[y, 3.3e-205], N[(x + t$95$1), $MachinePrecision], If[LessEqual[y, 5.7e-117], N[(t$95$1 - z), $MachinePrecision], If[LessEqual[y, 2.6e+110], t$95$0, N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + y\right) - z\\
t_1 := \log y \cdot -0.5\\
\mathbf{if}\;y \leq 7.2 \cdot 10^{-258}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-205}:\\
\;\;\;\;x + t\_1\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{-117}:\\
\;\;\;\;t\_1 - z\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+110}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot \log y\\
\end{array}
\end{array}
if y < 7.19999999999999958e-258 or 5.6999999999999999e-117 < y < 2.6e110Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 89.4%
Taylor expanded in z around inf 67.6%
Taylor expanded in x around 0 77.2%
if 7.19999999999999958e-258 < y < 3.2999999999999999e-205Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around 0 83.5%
if 3.2999999999999999e-205 < y < 5.6999999999999999e-117Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 88.3%
*-commutative88.3%
Simplified88.3%
if 2.6e110 < y Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
associate-+l+99.7%
associate-+r-99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-define99.7%
+-commutative99.7%
distribute-neg-in99.7%
unsub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 73.7%
log-rec73.7%
sub-neg73.7%
Simplified73.7%
sub-neg73.7%
distribute-rgt-in73.8%
*-un-lft-identity73.8%
Applied egg-rr73.8%
Final simplification78.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ x y) z)) (t_1 (* (log y) -0.5)))
(if (<= y 1.55e-260)
t_0
(if (<= y 1.6e-206)
(+ x t_1)
(if (<= y 5e-117)
(- t_1 z)
(if (<= y 2.6e+110) t_0 (* y (- 1.0 (log y)))))))))
double code(double x, double y, double z) {
double t_0 = (x + y) - z;
double t_1 = log(y) * -0.5;
double tmp;
if (y <= 1.55e-260) {
tmp = t_0;
} else if (y <= 1.6e-206) {
tmp = x + t_1;
} else if (y <= 5e-117) {
tmp = t_1 - z;
} else if (y <= 2.6e+110) {
tmp = t_0;
} 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) :: t_1
real(8) :: tmp
t_0 = (x + y) - z
t_1 = log(y) * (-0.5d0)
if (y <= 1.55d-260) then
tmp = t_0
else if (y <= 1.6d-206) then
tmp = x + t_1
else if (y <= 5d-117) then
tmp = t_1 - z
else if (y <= 2.6d+110) then
tmp = t_0
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 + y) - z;
double t_1 = Math.log(y) * -0.5;
double tmp;
if (y <= 1.55e-260) {
tmp = t_0;
} else if (y <= 1.6e-206) {
tmp = x + t_1;
} else if (y <= 5e-117) {
tmp = t_1 - z;
} else if (y <= 2.6e+110) {
tmp = t_0;
} else {
tmp = y * (1.0 - Math.log(y));
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) - z t_1 = math.log(y) * -0.5 tmp = 0 if y <= 1.55e-260: tmp = t_0 elif y <= 1.6e-206: tmp = x + t_1 elif y <= 5e-117: tmp = t_1 - z elif y <= 2.6e+110: tmp = t_0 else: tmp = y * (1.0 - math.log(y)) return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) - z) t_1 = Float64(log(y) * -0.5) tmp = 0.0 if (y <= 1.55e-260) tmp = t_0; elseif (y <= 1.6e-206) tmp = Float64(x + t_1); elseif (y <= 5e-117) tmp = Float64(t_1 - z); elseif (y <= 2.6e+110) tmp = t_0; else tmp = Float64(y * Float64(1.0 - log(y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) - z; t_1 = log(y) * -0.5; tmp = 0.0; if (y <= 1.55e-260) tmp = t_0; elseif (y <= 1.6e-206) tmp = x + t_1; elseif (y <= 5e-117) tmp = t_1 - z; elseif (y <= 2.6e+110) tmp = t_0; else tmp = y * (1.0 - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[y, 1.55e-260], t$95$0, If[LessEqual[y, 1.6e-206], N[(x + t$95$1), $MachinePrecision], If[LessEqual[y, 5e-117], N[(t$95$1 - z), $MachinePrecision], If[LessEqual[y, 2.6e+110], t$95$0, N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + y\right) - z\\
t_1 := \log y \cdot -0.5\\
\mathbf{if}\;y \leq 1.55 \cdot 10^{-260}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-206}:\\
\;\;\;\;x + t\_1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-117}:\\
\;\;\;\;t\_1 - z\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+110}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 1.54999999999999991e-260 or 5e-117 < y < 2.6e110Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 89.4%
Taylor expanded in z around inf 67.6%
Taylor expanded in x around 0 77.2%
if 1.54999999999999991e-260 < y < 1.59999999999999988e-206Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around 0 83.5%
if 1.59999999999999988e-206 < y < 5e-117Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 88.3%
*-commutative88.3%
Simplified88.3%
if 2.6e110 < y Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
associate-+l+99.7%
associate-+r-99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-define99.7%
+-commutative99.7%
distribute-neg-in99.7%
unsub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 73.7%
log-rec73.7%
sub-neg73.7%
Simplified73.7%
Final simplification78.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ x y) z)))
(if (<= z -1.15e+29)
t_0
(if (<= z 2.5e-235)
(- y (* (log y) (+ y 0.5)))
(if (<= z 12500000.0) (+ x (* (log y) -0.5)) t_0)))))
double code(double x, double y, double z) {
double t_0 = (x + y) - z;
double tmp;
if (z <= -1.15e+29) {
tmp = t_0;
} else if (z <= 2.5e-235) {
tmp = y - (log(y) * (y + 0.5));
} else if (z <= 12500000.0) {
tmp = x + (log(y) * -0.5);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x + y) - z
if (z <= (-1.15d+29)) then
tmp = t_0
else if (z <= 2.5d-235) then
tmp = y - (log(y) * (y + 0.5d0))
else if (z <= 12500000.0d0) then
tmp = x + (log(y) * (-0.5d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + y) - z;
double tmp;
if (z <= -1.15e+29) {
tmp = t_0;
} else if (z <= 2.5e-235) {
tmp = y - (Math.log(y) * (y + 0.5));
} else if (z <= 12500000.0) {
tmp = x + (Math.log(y) * -0.5);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) - z tmp = 0 if z <= -1.15e+29: tmp = t_0 elif z <= 2.5e-235: tmp = y - (math.log(y) * (y + 0.5)) elif z <= 12500000.0: tmp = x + (math.log(y) * -0.5) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) - z) tmp = 0.0 if (z <= -1.15e+29) tmp = t_0; elseif (z <= 2.5e-235) tmp = Float64(y - Float64(log(y) * Float64(y + 0.5))); elseif (z <= 12500000.0) tmp = Float64(x + Float64(log(y) * -0.5)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) - z; tmp = 0.0; if (z <= -1.15e+29) tmp = t_0; elseif (z <= 2.5e-235) tmp = y - (log(y) * (y + 0.5)); elseif (z <= 12500000.0) tmp = x + (log(y) * -0.5); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[z, -1.15e+29], t$95$0, If[LessEqual[z, 2.5e-235], N[(y - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 12500000.0], N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + y\right) - z\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+29}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-235}:\\
\;\;\;\;y - \log y \cdot \left(y + 0.5\right)\\
\mathbf{elif}\;z \leq 12500000:\\
\;\;\;\;x + \log y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.1500000000000001e29 or 1.25e7 < z Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 72.4%
Taylor expanded in z around inf 65.3%
Taylor expanded in x around 0 83.8%
if -1.1500000000000001e29 < z < 2.4999999999999999e-235Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in x around 0 77.7%
Taylor expanded in z around 0 74.5%
if 2.4999999999999999e-235 < z < 1.25e7Initial 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 y around 0 75.1%
Taylor expanded in z around 0 74.0%
Final simplification78.7%
(FPCore (x y z)
:precision binary64
(if (<= x -2.95e+87)
(* x (- 1.0 (/ z x)))
(if (<= x 7200000.0)
(- y (+ z (* (log y) (+ y 0.5))))
(- (+ x (* (log y) -0.5)) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.95e+87) {
tmp = x * (1.0 - (z / x));
} else if (x <= 7200000.0) {
tmp = y - (z + (log(y) * (y + 0.5)));
} 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 <= (-2.95d+87)) then
tmp = x * (1.0d0 - (z / x))
else if (x <= 7200000.0d0) then
tmp = y - (z + (log(y) * (y + 0.5d0)))
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 <= -2.95e+87) {
tmp = x * (1.0 - (z / x));
} else if (x <= 7200000.0) {
tmp = y - (z + (Math.log(y) * (y + 0.5)));
} else {
tmp = (x + (Math.log(y) * -0.5)) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.95e+87: tmp = x * (1.0 - (z / x)) elif x <= 7200000.0: tmp = y - (z + (math.log(y) * (y + 0.5))) else: tmp = (x + (math.log(y) * -0.5)) - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.95e+87) tmp = Float64(x * Float64(1.0 - Float64(z / x))); elseif (x <= 7200000.0) tmp = Float64(y - Float64(z + Float64(log(y) * Float64(y + 0.5)))); 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 <= -2.95e+87) tmp = x * (1.0 - (z / x)); elseif (x <= 7200000.0) tmp = y - (z + (log(y) * (y + 0.5))); else tmp = (x + (log(y) * -0.5)) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.95e+87], N[(x * N[(1.0 - N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7200000.0], N[(y - N[(z + N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -2.95 \cdot 10^{+87}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{x}\right)\\
\mathbf{elif}\;x \leq 7200000:\\
\;\;\;\;y - \left(z + \log y \cdot \left(y + 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\end{array}
\end{array}
if x < -2.9499999999999998e87Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around inf 99.9%
Taylor expanded in z around inf 86.7%
Taylor expanded in y around 0 87.5%
if -2.9499999999999998e87 < x < 7.2e6Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in x around 0 98.9%
if 7.2e6 < x Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 88.2%
Final simplification94.5%
(FPCore (x y z) :precision binary64 (if (<= y 260000000.0) (- (+ x (* (log y) -0.5)) z) (+ x (- y (* (log y) (+ y 0.5))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 260000000.0) {
tmp = (x + (log(y) * -0.5)) - z;
} else {
tmp = x + (y - (log(y) * (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 (y <= 260000000.0d0) then
tmp = (x + (log(y) * (-0.5d0))) - z
else
tmp = x + (y - (log(y) * (y + 0.5d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 260000000.0) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else {
tmp = x + (y - (Math.log(y) * (y + 0.5)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 260000000.0: tmp = (x + (math.log(y) * -0.5)) - z else: tmp = x + (y - (math.log(y) * (y + 0.5))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 260000000.0) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); else tmp = Float64(x + Float64(y - Float64(log(y) * Float64(y + 0.5)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 260000000.0) tmp = (x + (log(y) * -0.5)) - z; else tmp = x + (y - (log(y) * (y + 0.5))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 260000000.0], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(x + N[(y - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 260000000:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \log y \cdot \left(y + 0.5\right)\right)\\
\end{array}
\end{array}
if y < 2.6e8Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.6%
if 2.6e8 < y Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
associate-+l+99.7%
associate-+r-99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-define99.7%
+-commutative99.7%
distribute-neg-in99.7%
unsub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 82.7%
associate-*r*82.7%
neg-mul-182.7%
+-commutative82.7%
cancel-sign-sub-inv82.7%
Simplified82.7%
Final simplification92.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.6e-126) (not (<= z 4.6e-207))) (- (+ x y) z) (* (log y) -0.5)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.6e-126) || !(z <= 4.6e-207)) {
tmp = (x + y) - 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 <= (-5.6d-126)) .or. (.not. (z <= 4.6d-207))) then
tmp = (x + y) - 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 <= -5.6e-126) || !(z <= 4.6e-207)) {
tmp = (x + y) - z;
} else {
tmp = Math.log(y) * -0.5;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.6e-126) or not (z <= 4.6e-207): tmp = (x + y) - z else: tmp = math.log(y) * -0.5 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.6e-126) || !(z <= 4.6e-207)) tmp = Float64(Float64(x + y) - z); else tmp = Float64(log(y) * -0.5); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.6e-126) || ~((z <= 4.6e-207))) tmp = (x + y) - z; else tmp = log(y) * -0.5; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.6e-126], N[Not[LessEqual[z, 4.6e-207]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{-126} \lor \neg \left(z \leq 4.6 \cdot 10^{-207}\right):\\
\;\;\;\;\left(x + y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot -0.5\\
\end{array}
\end{array}
if z < -5.59999999999999983e-126 or 4.6000000000000001e-207 < z Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 78.2%
Taylor expanded in z around inf 56.9%
Taylor expanded in x around 0 68.4%
if -5.59999999999999983e-126 < z < 4.6000000000000001e-207Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in x around 0 78.1%
Taylor expanded in z around 0 78.1%
Taylor expanded in y around 0 37.8%
*-commutative37.8%
Simplified37.8%
Final simplification60.7%
(FPCore (x y z) :precision binary64 (if (<= y 1.85e+14) (- (+ x (* (log y) -0.5)) z) (- (- y z) (* y (log y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.85e+14) {
tmp = (x + (log(y) * -0.5)) - z;
} 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) :: tmp
if (y <= 1.85d+14) then
tmp = (x + (log(y) * (-0.5d0))) - z
else
tmp = (y - z) - (y * log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.85e+14) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else {
tmp = (y - z) - (y * Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.85e+14: tmp = (x + (math.log(y) * -0.5)) - z else: tmp = (y - z) - (y * math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.85e+14) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); else tmp = Float64(Float64(y - z) - Float64(y * log(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.85e+14) tmp = (x + (log(y) * -0.5)) - z; else tmp = (y - z) - (y * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.85e+14], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(y - z), $MachinePrecision] - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.85 \cdot 10^{+14}:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) - y \cdot \log y\\
\end{array}
\end{array}
if y < 1.85e14Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.0%
if 1.85e14 < y Initial program 99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in y around inf 79.9%
log-rec79.9%
Simplified79.9%
Final simplification90.9%
(FPCore (x y z) :precision binary64 (if (<= y 2.5e+110) (- (+ x (* (log y) -0.5)) z) (- y (* y (log y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5e+110) {
tmp = (x + (log(y) * -0.5)) - z;
} else {
tmp = y - (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 <= 2.5d+110) then
tmp = (x + (log(y) * (-0.5d0))) - z
else
tmp = y - (y * log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.5e+110) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else {
tmp = y - (y * Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5e+110: tmp = (x + (math.log(y) * -0.5)) - z else: tmp = y - (y * math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5e+110) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); else tmp = Float64(y - Float64(y * log(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.5e+110) tmp = (x + (log(y) * -0.5)) - z; else tmp = y - (y * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5e+110], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5 \cdot 10^{+110}:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot \log y\\
\end{array}
\end{array}
if y < 2.49999999999999989e110Initial 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-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 91.5%
if 2.49999999999999989e110 < y Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
associate-+l+99.7%
associate-+r-99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-define99.7%
+-commutative99.7%
distribute-neg-in99.7%
unsub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 73.7%
log-rec73.7%
sub-neg73.7%
Simplified73.7%
sub-neg73.7%
distribute-rgt-in73.8%
*-un-lft-identity73.8%
Applied egg-rr73.8%
Final simplification86.5%
(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.9%
associate--l+99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= y 2.5e+110) (- (+ x y) z) (* y (- 1.0 (log y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5e+110) {
tmp = (x + y) - 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 <= 2.5d+110) then
tmp = (x + y) - 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 <= 2.5e+110) {
tmp = (x + y) - z;
} else {
tmp = y * (1.0 - Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5e+110: tmp = (x + y) - z else: tmp = y * (1.0 - math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5e+110) tmp = Float64(Float64(x + y) - 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 <= 2.5e+110) tmp = (x + y) - z; else tmp = y * (1.0 - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5e+110], N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision], N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5 \cdot 10^{+110}:\\
\;\;\;\;\left(x + y\right) - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 2.49999999999999989e110Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 88.8%
Taylor expanded in z around inf 60.0%
Taylor expanded in x around 0 70.5%
if 2.49999999999999989e110 < y Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
associate-+l+99.7%
associate-+r-99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-define99.7%
+-commutative99.7%
distribute-neg-in99.7%
unsub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 73.7%
log-rec73.7%
sub-neg73.7%
Simplified73.7%
(FPCore (x y z) :precision binary64 (if (<= x -5.2e+70) x (if (<= x 1.55e+14) (- z) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.2e+70) {
tmp = x;
} else if (x <= 1.55e+14) {
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 <= (-5.2d+70)) then
tmp = x
else if (x <= 1.55d+14) 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 <= -5.2e+70) {
tmp = x;
} else if (x <= 1.55e+14) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.2e+70: tmp = x elif x <= 1.55e+14: tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.2e+70) tmp = x; elseif (x <= 1.55e+14) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.2e+70) tmp = x; elseif (x <= 1.55e+14) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.2e+70], x, If[LessEqual[x, 1.55e+14], (-z), x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+70}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+14}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.2000000000000001e70 or 1.55e14 < x Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 72.4%
if -5.2000000000000001e70 < x < 1.55e14Initial 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 37.3%
neg-mul-137.3%
Simplified37.3%
(FPCore (x y z) :precision binary64 (- (+ x y) z))
double code(double x, double y, double z) {
return (x + 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) - z
end function
public static double code(double x, double y, double z) {
return (x + y) - z;
}
def code(x, y, z): return (x + y) - z
function code(x, y, z) return Float64(Float64(x + y) - z) end
function tmp = code(x, y, z) tmp = (x + y) - z; end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - z
\end{array}
Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 79.0%
Taylor expanded in z around inf 48.2%
Taylor expanded in x around 0 56.8%
(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.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 31.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 2024176
(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))