
(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 13 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 + fma(log(y), Float64(-0.5 - y), Float64(y - z))) end
code[x_, y_, z_] := N[(x + N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \mathsf{fma}\left(\log y, -0.5 - y, y - z\right)
\end{array}
Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
associate-+l+99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= y 1.25e-144)
(+ x (- y z))
(if (<= y 1.25e-74)
(- (* (log y) -0.5) z)
(if (<= y 6e-31)
(- x (* (log y) 0.5))
(if (or (<= y 7800000000.0) (and (not (<= y 3.8e+79)) (<= y 2.4e+161)))
(- x z)
(+ x (* y (- 1.0 (log y)))))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.25e-144) {
tmp = x + (y - z);
} else if (y <= 1.25e-74) {
tmp = (log(y) * -0.5) - z;
} else if (y <= 6e-31) {
tmp = x - (log(y) * 0.5);
} else if ((y <= 7800000000.0) || (!(y <= 3.8e+79) && (y <= 2.4e+161))) {
tmp = x - z;
} else {
tmp = x + (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.25d-144) then
tmp = x + (y - z)
else if (y <= 1.25d-74) then
tmp = (log(y) * (-0.5d0)) - z
else if (y <= 6d-31) then
tmp = x - (log(y) * 0.5d0)
else if ((y <= 7800000000.0d0) .or. (.not. (y <= 3.8d+79)) .and. (y <= 2.4d+161)) then
tmp = x - z
else
tmp = x + (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.25e-144) {
tmp = x + (y - z);
} else if (y <= 1.25e-74) {
tmp = (Math.log(y) * -0.5) - z;
} else if (y <= 6e-31) {
tmp = x - (Math.log(y) * 0.5);
} else if ((y <= 7800000000.0) || (!(y <= 3.8e+79) && (y <= 2.4e+161))) {
tmp = x - z;
} else {
tmp = x + (y * (1.0 - Math.log(y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.25e-144: tmp = x + (y - z) elif y <= 1.25e-74: tmp = (math.log(y) * -0.5) - z elif y <= 6e-31: tmp = x - (math.log(y) * 0.5) elif (y <= 7800000000.0) or (not (y <= 3.8e+79) and (y <= 2.4e+161)): tmp = x - z else: tmp = x + (y * (1.0 - math.log(y))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.25e-144) tmp = Float64(x + Float64(y - z)); elseif (y <= 1.25e-74) tmp = Float64(Float64(log(y) * -0.5) - z); elseif (y <= 6e-31) tmp = Float64(x - Float64(log(y) * 0.5)); elseif ((y <= 7800000000.0) || (!(y <= 3.8e+79) && (y <= 2.4e+161))) tmp = Float64(x - z); else tmp = Float64(x + Float64(y * Float64(1.0 - log(y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.25e-144) tmp = x + (y - z); elseif (y <= 1.25e-74) tmp = (log(y) * -0.5) - z; elseif (y <= 6e-31) tmp = x - (log(y) * 0.5); elseif ((y <= 7800000000.0) || (~((y <= 3.8e+79)) && (y <= 2.4e+161))) tmp = x - z; else tmp = x + (y * (1.0 - log(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.25e-144], N[(x + N[(y - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e-74], N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 6e-31], N[(x - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 7800000000.0], And[N[Not[LessEqual[y, 3.8e+79]], $MachinePrecision], LessEqual[y, 2.4e+161]]], N[(x - z), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.25 \cdot 10^{-144}:\\
\;\;\;\;x + \left(y - z\right)\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-74}:\\
\;\;\;\;\log y \cdot -0.5 - z\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-31}:\\
\;\;\;\;x - \log y \cdot 0.5\\
\mathbf{elif}\;y \leq 7800000000 \lor \neg \left(y \leq 3.8 \cdot 10^{+79}\right) \land y \leq 2.4 \cdot 10^{+161}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 1.2499999999999999e-144Initial program 100.0%
associate--l+100.0%
associate-+l-100.0%
Simplified100.0%
add-cube-cbrt99.7%
pow399.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 77.4%
neg-mul-177.4%
sub-neg77.4%
Simplified77.4%
if 1.2499999999999999e-144 < y < 1.25e-74Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.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.0%
*-commutative88.0%
Simplified88.0%
if 1.25e-74 < y < 5.99999999999999962e-31Initial program 100.0%
associate--l+100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around 0 100.0%
distribute-lft-out--100.0%
*-rgt-identity100.0%
sub-neg100.0%
associate-+l+100.0%
sub-neg100.0%
associate--r+100.0%
+-commutative100.0%
distribute-rgt-in100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
if 5.99999999999999962e-31 < y < 7.8e9 or 3.8000000000000002e79 < y < 2.3999999999999999e161Initial program 99.8%
associate--l+99.9%
associate-+l-99.9%
Simplified99.9%
Taylor expanded in z around inf 79.5%
if 7.8e9 < y < 3.8000000000000002e79 or 2.3999999999999999e161 < y Initial program 99.6%
associate--l+99.6%
associate-+l-99.6%
Simplified99.6%
Taylor expanded in y around inf 83.2%
sub-neg83.2%
mul-1-neg83.2%
log-rec83.2%
remove-double-neg83.2%
metadata-eval83.2%
Simplified83.2%
Final simplification82.4%
(FPCore (x y z)
:precision binary64
(if (<= y 7e-145)
(+ x (- y z))
(if (<= y 5.6e-75)
(- (* (log y) -0.5) z)
(if (<= y 1.8e-32)
(- x (* (log y) 0.5))
(if (<= y 1.5e+197) (- x z) (* y (- 1.0 (log y))))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 7e-145) {
tmp = x + (y - z);
} else if (y <= 5.6e-75) {
tmp = (log(y) * -0.5) - z;
} else if (y <= 1.8e-32) {
tmp = x - (log(y) * 0.5);
} else if (y <= 1.5e+197) {
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 <= 7d-145) then
tmp = x + (y - z)
else if (y <= 5.6d-75) then
tmp = (log(y) * (-0.5d0)) - z
else if (y <= 1.8d-32) then
tmp = x - (log(y) * 0.5d0)
else if (y <= 1.5d+197) 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 <= 7e-145) {
tmp = x + (y - z);
} else if (y <= 5.6e-75) {
tmp = (Math.log(y) * -0.5) - z;
} else if (y <= 1.8e-32) {
tmp = x - (Math.log(y) * 0.5);
} else if (y <= 1.5e+197) {
tmp = x - z;
} else {
tmp = y * (1.0 - Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 7e-145: tmp = x + (y - z) elif y <= 5.6e-75: tmp = (math.log(y) * -0.5) - z elif y <= 1.8e-32: tmp = x - (math.log(y) * 0.5) elif y <= 1.5e+197: tmp = x - z else: tmp = y * (1.0 - math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 7e-145) tmp = Float64(x + Float64(y - z)); elseif (y <= 5.6e-75) tmp = Float64(Float64(log(y) * -0.5) - z); elseif (y <= 1.8e-32) tmp = Float64(x - Float64(log(y) * 0.5)); elseif (y <= 1.5e+197) 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 <= 7e-145) tmp = x + (y - z); elseif (y <= 5.6e-75) tmp = (log(y) * -0.5) - z; elseif (y <= 1.8e-32) tmp = x - (log(y) * 0.5); elseif (y <= 1.5e+197) tmp = x - z; else tmp = y * (1.0 - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 7e-145], N[(x + N[(y - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.6e-75], N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 1.8e-32], N[(x - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.5e+197], 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 7 \cdot 10^{-145}:\\
\;\;\;\;x + \left(y - z\right)\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-75}:\\
\;\;\;\;\log y \cdot -0.5 - z\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-32}:\\
\;\;\;\;x - \log y \cdot 0.5\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+197}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 6.99999999999999994e-145Initial program 100.0%
associate--l+100.0%
associate-+l-100.0%
Simplified100.0%
add-cube-cbrt99.7%
pow399.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 77.4%
neg-mul-177.4%
sub-neg77.4%
Simplified77.4%
if 6.99999999999999994e-145 < y < 5.59999999999999996e-75Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.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.0%
*-commutative88.0%
Simplified88.0%
if 5.59999999999999996e-75 < y < 1.79999999999999996e-32Initial program 100.0%
associate--l+100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around 0 100.0%
distribute-lft-out--100.0%
*-rgt-identity100.0%
sub-neg100.0%
associate-+l+100.0%
sub-neg100.0%
associate--r+100.0%
+-commutative100.0%
distribute-rgt-in100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
if 1.79999999999999996e-32 < y < 1.5000000000000001e197Initial program 99.8%
associate--l+99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 69.4%
if 1.5000000000000001e197 < y Initial program 99.5%
associate--l+99.5%
associate-+l-99.5%
Simplified99.5%
Taylor expanded in y around 0 99.6%
Taylor expanded in z around 0 88.2%
distribute-lft-out--88.1%
*-rgt-identity88.1%
sub-neg88.1%
associate-+l+88.1%
sub-neg88.1%
associate--r+88.1%
+-commutative88.1%
distribute-rgt-in88.1%
Simplified88.1%
Taylor expanded in y around inf 81.6%
mul-1-neg81.6%
log-rec81.6%
remove-double-neg81.6%
Simplified81.6%
Final simplification77.7%
(FPCore (x y z) :precision binary64 (if (or (<= y 7800000000.0) (and (not (<= y 5.5e+79)) (<= y 2.4e+161))) (- (+ x (* (log y) -0.5)) z) (+ x (* y (- 1.0 (log y))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= 7800000000.0) || (!(y <= 5.5e+79) && (y <= 2.4e+161))) {
tmp = (x + (log(y) * -0.5)) - z;
} else {
tmp = x + (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 <= 7800000000.0d0) .or. (.not. (y <= 5.5d+79)) .and. (y <= 2.4d+161)) then
tmp = (x + (log(y) * (-0.5d0))) - z
else
tmp = x + (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 <= 7800000000.0) || (!(y <= 5.5e+79) && (y <= 2.4e+161))) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else {
tmp = x + (y * (1.0 - Math.log(y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= 7800000000.0) or (not (y <= 5.5e+79) and (y <= 2.4e+161)): tmp = (x + (math.log(y) * -0.5)) - z else: tmp = x + (y * (1.0 - math.log(y))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= 7800000000.0) || (!(y <= 5.5e+79) && (y <= 2.4e+161))) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); else tmp = Float64(x + Float64(y * Float64(1.0 - log(y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= 7800000000.0) || (~((y <= 5.5e+79)) && (y <= 2.4e+161))) tmp = (x + (log(y) * -0.5)) - z; else tmp = x + (y * (1.0 - log(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, 7800000000.0], And[N[Not[LessEqual[y, 5.5e+79]], $MachinePrecision], LessEqual[y, 2.4e+161]]], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7800000000 \lor \neg \left(y \leq 5.5 \cdot 10^{+79}\right) \land y \leq 2.4 \cdot 10^{+161}:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 7.8e9 or 5.50000000000000007e79 < y < 2.3999999999999999e161Initial program 99.9%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 93.2%
if 7.8e9 < y < 5.50000000000000007e79 or 2.3999999999999999e161 < y Initial program 99.6%
associate--l+99.6%
associate-+l-99.6%
Simplified99.6%
Taylor expanded in y around inf 83.2%
sub-neg83.2%
mul-1-neg83.2%
log-rec83.2%
remove-double-neg83.2%
metadata-eval83.2%
Simplified83.2%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (if (or (<= y 8.8e+28) (and (not (<= y 1.66e+93)) (<= y 2.2e+138))) (- (+ x (* (log y) -0.5)) z) (- (- y z) (* y (log y)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= 8.8e+28) || (!(y <= 1.66e+93) && (y <= 2.2e+138))) {
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 <= 8.8d+28) .or. (.not. (y <= 1.66d+93)) .and. (y <= 2.2d+138)) 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 <= 8.8e+28) || (!(y <= 1.66e+93) && (y <= 2.2e+138))) {
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 <= 8.8e+28) or (not (y <= 1.66e+93) and (y <= 2.2e+138)): 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 <= 8.8e+28) || (!(y <= 1.66e+93) && (y <= 2.2e+138))) 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 <= 8.8e+28) || (~((y <= 1.66e+93)) && (y <= 2.2e+138))) tmp = (x + (log(y) * -0.5)) - z; else tmp = (y - z) - (y * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, 8.8e+28], And[N[Not[LessEqual[y, 1.66e+93]], $MachinePrecision], LessEqual[y, 2.2e+138]]], 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 8.8 \cdot 10^{+28} \lor \neg \left(y \leq 1.66 \cdot 10^{+93}\right) \land y \leq 2.2 \cdot 10^{+138}:\\
\;\;\;\;\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 < 8.79999999999999946e28 or 1.65999999999999999e93 < y < 2.2000000000000001e138Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 95.4%
if 8.79999999999999946e28 < y < 1.65999999999999999e93 or 2.2000000000000001e138 < y Initial program 99.6%
associate--l+99.6%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in y around inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
log-rec99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in x around 0 87.4%
associate--r+87.4%
Simplified87.4%
Final simplification92.0%
(FPCore (x y z)
:precision binary64
(if (<= y 3.2e-103)
(+ x (- y z))
(if (<= y 1.7e-32)
(- x (* (log y) 0.5))
(if (<= y 1.5e+197) (- x z) (* y (- 1.0 (log y)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.2e-103) {
tmp = x + (y - z);
} else if (y <= 1.7e-32) {
tmp = x - (log(y) * 0.5);
} else if (y <= 1.5e+197) {
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-103) then
tmp = x + (y - z)
else if (y <= 1.7d-32) then
tmp = x - (log(y) * 0.5d0)
else if (y <= 1.5d+197) 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-103) {
tmp = x + (y - z);
} else if (y <= 1.7e-32) {
tmp = x - (Math.log(y) * 0.5);
} else if (y <= 1.5e+197) {
tmp = x - z;
} else {
tmp = y * (1.0 - Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.2e-103: tmp = x + (y - z) elif y <= 1.7e-32: tmp = x - (math.log(y) * 0.5) elif y <= 1.5e+197: 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-103) tmp = Float64(x + Float64(y - z)); elseif (y <= 1.7e-32) tmp = Float64(x - Float64(log(y) * 0.5)); elseif (y <= 1.5e+197) 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-103) tmp = x + (y - z); elseif (y <= 1.7e-32) tmp = x - (log(y) * 0.5); elseif (y <= 1.5e+197) tmp = x - z; else tmp = y * (1.0 - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.2e-103], N[(x + N[(y - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.7e-32], N[(x - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.5e+197], 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^{-103}:\\
\;\;\;\;x + \left(y - z\right)\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-32}:\\
\;\;\;\;x - \log y \cdot 0.5\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+197}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 3.19999999999999976e-103Initial program 100.0%
associate--l+100.0%
associate-+l-100.0%
Simplified100.0%
add-cube-cbrt99.6%
pow399.6%
*-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 74.9%
neg-mul-174.9%
sub-neg74.9%
Simplified74.9%
if 3.19999999999999976e-103 < y < 1.69999999999999989e-32Initial program 100.0%
associate--l+100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around 0 83.6%
distribute-lft-out--83.6%
*-rgt-identity83.6%
sub-neg83.6%
associate-+l+83.6%
sub-neg83.6%
associate--r+83.6%
+-commutative83.6%
distribute-rgt-in83.6%
Simplified83.6%
Taylor expanded in y around 0 83.6%
if 1.69999999999999989e-32 < y < 1.5000000000000001e197Initial program 99.8%
associate--l+99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 69.4%
if 1.5000000000000001e197 < y Initial program 99.5%
associate--l+99.5%
associate-+l-99.5%
Simplified99.5%
Taylor expanded in y around 0 99.6%
Taylor expanded in z around 0 88.2%
distribute-lft-out--88.1%
*-rgt-identity88.1%
sub-neg88.1%
associate-+l+88.1%
sub-neg88.1%
associate--r+88.1%
+-commutative88.1%
distribute-rgt-in88.1%
Simplified88.1%
Taylor expanded in y around inf 81.6%
mul-1-neg81.6%
log-rec81.6%
remove-double-neg81.6%
Simplified81.6%
Final simplification75.2%
(FPCore (x y z) :precision binary64 (if (<= y 1.15e-30) (- (+ x (* (log y) -0.5)) z) (+ x (- (- y z) (* y (log y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.15e-30) {
tmp = (x + (log(y) * -0.5)) - z;
} else {
tmp = x + ((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.15d-30) then
tmp = (x + (log(y) * (-0.5d0))) - z
else
tmp = x + ((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.15e-30) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else {
tmp = x + ((y - z) - (y * Math.log(y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.15e-30: tmp = (x + (math.log(y) * -0.5)) - z else: tmp = x + ((y - z) - (y * math.log(y))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.15e-30) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); else tmp = Float64(x + 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.15e-30) tmp = (x + (log(y) * -0.5)) - z; else tmp = x + ((y - z) - (y * log(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.15e-30], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{-30}:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(y - z\right) - y \cdot \log y\right)\\
\end{array}
\end{array}
if y < 1.14999999999999992e-30Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
if 1.14999999999999992e-30 < y Initial program 99.7%
associate--l+99.7%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in y around inf 98.9%
mul-1-neg98.9%
distribute-rgt-neg-in98.9%
log-rec98.9%
remove-double-neg98.9%
Simplified98.9%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (<= y 1.15e-30) (- (+ x (* (log y) -0.5)) z) (- (+ x (* y (- 1.0 (log y)))) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.15e-30) {
tmp = (x + (log(y) * -0.5)) - z;
} else {
tmp = (x + (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.15d-30) then
tmp = (x + (log(y) * (-0.5d0))) - z
else
tmp = (x + (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.15e-30) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else {
tmp = (x + (y * (1.0 - Math.log(y)))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.15e-30: tmp = (x + (math.log(y) * -0.5)) - z else: tmp = (x + (y * (1.0 - math.log(y)))) - z return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.15e-30) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); else tmp = Float64(Float64(x + 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.15e-30) tmp = (x + (log(y) * -0.5)) - z; else tmp = (x + (y * (1.0 - log(y)))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.15e-30], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{-30}:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(x + y \cdot \left(1 - \log y\right)\right) - z\\
\end{array}
\end{array}
if y < 1.14999999999999992e-30Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
if 1.14999999999999992e-30 < y Initial program 99.7%
associate--l+99.7%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in y around inf 98.9%
mul-1-neg98.9%
distribute-rgt-neg-in98.9%
log-rec98.9%
remove-double-neg98.9%
Simplified98.9%
Taylor expanded in y around 0 99.0%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (+ x (- (- y z) (* (log y) (+ y 0.5)))))
double code(double x, double y, double z) {
return x + ((y - z) - (log(y) * (y + 0.5)));
}
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) - (log(y) * (y + 0.5d0)))
end function
public static double code(double x, double y, double z) {
return x + ((y - z) - (Math.log(y) * (y + 0.5)));
}
def code(x, y, z): return x + ((y - z) - (math.log(y) * (y + 0.5)))
function code(x, y, z) return Float64(x + Float64(Float64(y - z) - Float64(log(y) * Float64(y + 0.5)))) end
function tmp = code(x, y, z) tmp = x + ((y - z) - (log(y) * (y + 0.5))); end
code[x_, y_, z_] := N[(x + N[(N[(y - z), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - z\right) - \log y \cdot \left(y + 0.5\right)\right)
\end{array}
Initial program 99.8%
associate--l+99.8%
associate-+l-99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= y 1.5e+197) (- x z) (* y (- 1.0 (log y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.5e+197) {
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.5d+197) 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.5e+197) {
tmp = x - z;
} else {
tmp = y * (1.0 - Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.5e+197: tmp = x - z else: tmp = y * (1.0 - math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.5e+197) 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.5e+197) tmp = x - z; else tmp = y * (1.0 - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.5e+197], 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.5 \cdot 10^{+197}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 1.5000000000000001e197Initial program 99.9%
associate--l+99.9%
associate-+l-99.9%
Simplified99.9%
Taylor expanded in z around inf 69.5%
if 1.5000000000000001e197 < y Initial program 99.5%
associate--l+99.5%
associate-+l-99.5%
Simplified99.5%
Taylor expanded in y around 0 99.6%
Taylor expanded in z around 0 88.2%
distribute-lft-out--88.1%
*-rgt-identity88.1%
sub-neg88.1%
associate-+l+88.1%
sub-neg88.1%
associate--r+88.1%
+-commutative88.1%
distribute-rgt-in88.1%
Simplified88.1%
Taylor expanded in y around inf 81.6%
mul-1-neg81.6%
log-rec81.6%
remove-double-neg81.6%
Simplified81.6%
Final simplification72.3%
(FPCore (x y z) :precision binary64 (if (<= x -5.8e+29) x (if (<= x 3.1e+54) (- z) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.8e+29) {
tmp = x;
} else if (x <= 3.1e+54) {
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.8d+29)) then
tmp = x
else if (x <= 3.1d+54) 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.8e+29) {
tmp = x;
} else if (x <= 3.1e+54) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.8e+29: tmp = x elif x <= 3.1e+54: tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.8e+29) tmp = x; elseif (x <= 3.1e+54) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.8e+29) tmp = x; elseif (x <= 3.1e+54) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.8e+29], x, If[LessEqual[x, 3.1e+54], (-z), x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+29}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+54}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.7999999999999999e29 or 3.0999999999999999e54 < x Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 65.4%
if -5.7999999999999999e29 < x < 3.0999999999999999e54Initial program 99.8%
associate--l+99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in y around 0 99.9%
Taylor expanded in z around inf 41.3%
mul-1-neg41.3%
Simplified41.3%
Final simplification50.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%
associate--l+99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 56.7%
Final simplification56.7%
(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%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 28.0%
Final simplification28.0%
(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 2023291
(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))