
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z))
double code(double x, double y, double z) {
return (x * log((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 * log((x / y))) - z
end function
public static double code(double x, double y, double z) {
return (x * Math.log((x / y))) - z;
}
def code(x, y, z): return (x * math.log((x / y))) - z
function code(x, y, z) return Float64(Float64(x * log(Float64(x / y))) - z) end
function tmp = code(x, y, z) tmp = (x * log((x / y))) - z; end
code[x_, y_, z_] := N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \log \left(\frac{x}{y}\right) - z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z))
double code(double x, double y, double z) {
return (x * log((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 * log((x / y))) - z
end function
public static double code(double x, double y, double z) {
return (x * Math.log((x / y))) - z;
}
def code(x, y, z): return (x * math.log((x / y))) - z
function code(x, y, z) return Float64(Float64(x * log(Float64(x / y))) - z) end
function tmp = code(x, y, z) tmp = (x * log((x / y))) - z; end
code[x_, y_, z_] := N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \log \left(\frac{x}{y}\right) - z
\end{array}
(FPCore (x y z) :precision binary64 (if (<= y -2e-310) (- (* x (- (log (- x)) (log (- y)))) z) (- (* x (- (log x) (log y))) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2e-310) {
tmp = (x * (log(-x) - log(-y))) - z;
} else {
tmp = (x * (log(x) - 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 <= (-2d-310)) then
tmp = (x * (log(-x) - log(-y))) - z
else
tmp = (x * (log(x) - log(y))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2e-310) {
tmp = (x * (Math.log(-x) - Math.log(-y))) - z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2e-310: tmp = (x * (math.log(-x) - math.log(-y))) - z else: tmp = (x * (math.log(x) - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2e-310) tmp = Float64(Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))) - z); else tmp = Float64(Float64(x * Float64(log(x) - log(y))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2e-310) tmp = (x * (log(-x) - log(-y))) - z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2e-310], N[(N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-310}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\end{array}
if y < -1.999999999999994e-310Initial program 74.7%
Taylor expanded in y around -inf 99.4%
neg-mul-199.4%
metadata-eval99.4%
distribute-neg-frac99.4%
distribute-frac-neg299.4%
log-rec99.4%
sub-neg99.4%
Simplified99.4%
if -1.999999999999994e-310 < y Initial program 77.1%
Taylor expanded in x around 0 99.6%
log-rec99.6%
sub-neg99.6%
Simplified99.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (log (/ x y))))) (if (or (<= t_0 (- INFINITY)) (not (<= t_0 2e+288))) (- z) (- t_0 z))))
double code(double x, double y, double z) {
double t_0 = x * log((x / y));
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 2e+288)) {
tmp = -z;
} else {
tmp = t_0 - z;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = x * Math.log((x / y));
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 2e+288)) {
tmp = -z;
} else {
tmp = t_0 - z;
}
return tmp;
}
def code(x, y, z): t_0 = x * math.log((x / y)) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 2e+288): tmp = -z else: tmp = t_0 - z return tmp
function code(x, y, z) t_0 = Float64(x * log(Float64(x / y))) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 2e+288)) tmp = Float64(-z); else tmp = Float64(t_0 - z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * log((x / y)); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 2e+288))) tmp = -z; else tmp = t_0 - z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 2e+288]], $MachinePrecision]], (-z), N[(t$95$0 - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{if}\;t\_0 \leq -\infty \lor \neg \left(t\_0 \leq 2 \cdot 10^{+288}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_0 - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 2e288 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 7.6%
Taylor expanded in x around 0 47.0%
neg-mul-147.0%
Simplified47.0%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 2e288Initial program 99.6%
Final simplification86.0%
(FPCore (x y z)
:precision binary64
(if (<= x -8.6e+145)
(* x (- (log (- x)) (log (- y))))
(if (<= x -4.4e-197)
(- (* x (log (/ x y))) z)
(if (<= x 6.8e-158)
(- z)
(if (<= x 2.3e+219)
(- (* x (- (log (/ y x)))) z)
(* x (- (log x) (log y))))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -8.6e+145) {
tmp = x * (log(-x) - log(-y));
} else if (x <= -4.4e-197) {
tmp = (x * log((x / y))) - z;
} else if (x <= 6.8e-158) {
tmp = -z;
} else if (x <= 2.3e+219) {
tmp = (x * -log((y / x))) - z;
} else {
tmp = x * (log(x) - 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 (x <= (-8.6d+145)) then
tmp = x * (log(-x) - log(-y))
else if (x <= (-4.4d-197)) then
tmp = (x * log((x / y))) - z
else if (x <= 6.8d-158) then
tmp = -z
else if (x <= 2.3d+219) then
tmp = (x * -log((y / x))) - z
else
tmp = x * (log(x) - log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -8.6e+145) {
tmp = x * (Math.log(-x) - Math.log(-y));
} else if (x <= -4.4e-197) {
tmp = (x * Math.log((x / y))) - z;
} else if (x <= 6.8e-158) {
tmp = -z;
} else if (x <= 2.3e+219) {
tmp = (x * -Math.log((y / x))) - z;
} else {
tmp = x * (Math.log(x) - Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -8.6e+145: tmp = x * (math.log(-x) - math.log(-y)) elif x <= -4.4e-197: tmp = (x * math.log((x / y))) - z elif x <= 6.8e-158: tmp = -z elif x <= 2.3e+219: tmp = (x * -math.log((y / x))) - z else: tmp = x * (math.log(x) - math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -8.6e+145) tmp = Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))); elseif (x <= -4.4e-197) tmp = Float64(Float64(x * log(Float64(x / y))) - z); elseif (x <= 6.8e-158) tmp = Float64(-z); elseif (x <= 2.3e+219) tmp = Float64(Float64(x * Float64(-log(Float64(y / x)))) - z); else tmp = Float64(x * Float64(log(x) - log(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -8.6e+145) tmp = x * (log(-x) - log(-y)); elseif (x <= -4.4e-197) tmp = (x * log((x / y))) - z; elseif (x <= 6.8e-158) tmp = -z; elseif (x <= 2.3e+219) tmp = (x * -log((y / x))) - z; else tmp = x * (log(x) - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -8.6e+145], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.4e-197], N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 6.8e-158], (-z), If[LessEqual[x, 2.3e+219], N[(N[(x * (-N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] - z), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.6 \cdot 10^{+145}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-197}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-158}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+219}:\\
\;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right)\\
\end{array}
\end{array}
if x < -8.59999999999999996e145Initial program 69.3%
Taylor expanded in z around 0 62.2%
Taylor expanded in y around -inf 90.7%
neg-mul-198.6%
metadata-eval98.6%
distribute-neg-frac98.6%
distribute-frac-neg298.6%
log-rec98.6%
sub-neg98.6%
Simplified90.7%
if -8.59999999999999996e145 < x < -4.4000000000000001e-197Initial program 88.0%
if -4.4000000000000001e-197 < x < 6.7999999999999999e-158Initial program 54.1%
Taylor expanded in x around 0 94.2%
neg-mul-194.2%
Simplified94.2%
if 6.7999999999999999e-158 < x < 2.3000000000000001e219Initial program 90.0%
clear-num89.2%
log-div92.0%
metadata-eval92.0%
Applied egg-rr92.0%
neg-sub092.0%
Simplified92.0%
if 2.3000000000000001e219 < x Initial program 39.1%
Taylor expanded in z around 0 39.1%
Taylor expanded in x around 0 98.8%
log-rec98.8%
sub-neg98.8%
Simplified98.8%
(FPCore (x y z)
:precision binary64
(if (<= x -1.3e+139)
(* x (- (log (- x)) (log (- y))))
(if (<= x -9.8e-197)
(- (* x (log (/ x y))) z)
(if (<= x -5e-308) (- z) (- (* x (- (log x) (log y))) z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.3e+139) {
tmp = x * (log(-x) - log(-y));
} else if (x <= -9.8e-197) {
tmp = (x * log((x / y))) - z;
} else if (x <= -5e-308) {
tmp = -z;
} else {
tmp = (x * (log(x) - 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 (x <= (-1.3d+139)) then
tmp = x * (log(-x) - log(-y))
else if (x <= (-9.8d-197)) then
tmp = (x * log((x / y))) - z
else if (x <= (-5d-308)) then
tmp = -z
else
tmp = (x * (log(x) - log(y))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.3e+139) {
tmp = x * (Math.log(-x) - Math.log(-y));
} else if (x <= -9.8e-197) {
tmp = (x * Math.log((x / y))) - z;
} else if (x <= -5e-308) {
tmp = -z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.3e+139: tmp = x * (math.log(-x) - math.log(-y)) elif x <= -9.8e-197: tmp = (x * math.log((x / y))) - z elif x <= -5e-308: tmp = -z else: tmp = (x * (math.log(x) - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.3e+139) tmp = Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))); elseif (x <= -9.8e-197) tmp = Float64(Float64(x * log(Float64(x / y))) - z); elseif (x <= -5e-308) tmp = Float64(-z); else tmp = Float64(Float64(x * Float64(log(x) - log(y))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.3e+139) tmp = x * (log(-x) - log(-y)); elseif (x <= -9.8e-197) tmp = (x * log((x / y))) - z; elseif (x <= -5e-308) tmp = -z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.3e+139], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.8e-197], N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, -5e-308], (-z), N[(N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+139}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;x \leq -9.8 \cdot 10^{-197}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-308}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\end{array}
if x < -1.30000000000000011e139Initial program 69.3%
Taylor expanded in z around 0 62.2%
Taylor expanded in y around -inf 90.7%
neg-mul-198.6%
metadata-eval98.6%
distribute-neg-frac98.6%
distribute-frac-neg298.6%
log-rec98.6%
sub-neg98.6%
Simplified90.7%
if -1.30000000000000011e139 < x < -9.8000000000000004e-197Initial program 88.0%
if -9.8000000000000004e-197 < x < -4.99999999999999955e-308Initial program 49.5%
Taylor expanded in x around 0 92.2%
neg-mul-192.2%
Simplified92.2%
if -4.99999999999999955e-308 < x Initial program 77.1%
Taylor expanded in x around 0 99.6%
log-rec99.6%
sub-neg99.6%
Simplified99.6%
(FPCore (x y z)
:precision binary64
(if (<= x -5.4e-198)
(- (* x (log (/ x y))) z)
(if (<= x 7.4e-151)
(- z)
(if (<= x 2.3e+219)
(- (* x (- (log (/ y x)))) z)
(* x (- (log x) (log y)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.4e-198) {
tmp = (x * log((x / y))) - z;
} else if (x <= 7.4e-151) {
tmp = -z;
} else if (x <= 2.3e+219) {
tmp = (x * -log((y / x))) - z;
} else {
tmp = x * (log(x) - 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 (x <= (-5.4d-198)) then
tmp = (x * log((x / y))) - z
else if (x <= 7.4d-151) then
tmp = -z
else if (x <= 2.3d+219) then
tmp = (x * -log((y / x))) - z
else
tmp = x * (log(x) - log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -5.4e-198) {
tmp = (x * Math.log((x / y))) - z;
} else if (x <= 7.4e-151) {
tmp = -z;
} else if (x <= 2.3e+219) {
tmp = (x * -Math.log((y / x))) - z;
} else {
tmp = x * (Math.log(x) - Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.4e-198: tmp = (x * math.log((x / y))) - z elif x <= 7.4e-151: tmp = -z elif x <= 2.3e+219: tmp = (x * -math.log((y / x))) - z else: tmp = x * (math.log(x) - math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.4e-198) tmp = Float64(Float64(x * log(Float64(x / y))) - z); elseif (x <= 7.4e-151) tmp = Float64(-z); elseif (x <= 2.3e+219) tmp = Float64(Float64(x * Float64(-log(Float64(y / x)))) - z); else tmp = Float64(x * Float64(log(x) - log(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.4e-198) tmp = (x * log((x / y))) - z; elseif (x <= 7.4e-151) tmp = -z; elseif (x <= 2.3e+219) tmp = (x * -log((y / x))) - z; else tmp = x * (log(x) - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.4e-198], N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 7.4e-151], (-z), If[LessEqual[x, 2.3e+219], N[(N[(x * (-N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] - z), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.4 \cdot 10^{-198}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{-151}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+219}:\\
\;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right)\\
\end{array}
\end{array}
if x < -5.4000000000000003e-198Initial program 81.0%
if -5.4000000000000003e-198 < x < 7.4e-151Initial program 54.1%
Taylor expanded in x around 0 94.2%
neg-mul-194.2%
Simplified94.2%
if 7.4e-151 < x < 2.3000000000000001e219Initial program 90.0%
clear-num89.2%
log-div92.0%
metadata-eval92.0%
Applied egg-rr92.0%
neg-sub092.0%
Simplified92.0%
if 2.3000000000000001e219 < x Initial program 39.1%
Taylor expanded in z around 0 39.1%
Taylor expanded in x around 0 98.8%
log-rec98.8%
sub-neg98.8%
Simplified98.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.7e+41) (not (<= x 1800.0))) (* x (- (log (/ y x)))) (- z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.7e+41) || !(x <= 1800.0)) {
tmp = x * -log((y / x));
} else {
tmp = -z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.7d+41)) .or. (.not. (x <= 1800.0d0))) then
tmp = x * -log((y / x))
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.7e+41) || !(x <= 1800.0)) {
tmp = x * -Math.log((y / x));
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.7e+41) or not (x <= 1800.0): tmp = x * -math.log((y / x)) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.7e+41) || !(x <= 1800.0)) tmp = Float64(x * Float64(-log(Float64(y / x)))); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.7e+41) || ~((x <= 1800.0))) tmp = x * -log((y / x)); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.7e+41], N[Not[LessEqual[x, 1800.0]], $MachinePrecision]], N[(x * (-N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], (-z)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+41} \lor \neg \left(x \leq 1800\right):\\
\;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if x < -1.69999999999999999e41 or 1800 < x Initial program 76.0%
Taylor expanded in z around 0 59.4%
clear-num76.0%
log-div78.0%
metadata-eval78.0%
Applied egg-rr60.7%
neg-sub078.0%
Simplified60.7%
if -1.69999999999999999e41 < x < 1800Initial program 75.6%
Taylor expanded in x around 0 75.6%
neg-mul-175.6%
Simplified75.6%
Final simplification68.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.02e+40) (not (<= x 0.95))) (* x (log (/ x y))) (- z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.02e+40) || !(x <= 0.95)) {
tmp = x * log((x / y));
} else {
tmp = -z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-2.02d+40)) .or. (.not. (x <= 0.95d0))) then
tmp = x * log((x / y))
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.02e+40) || !(x <= 0.95)) {
tmp = x * Math.log((x / y));
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.02e+40) or not (x <= 0.95): tmp = x * math.log((x / y)) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.02e+40) || !(x <= 0.95)) tmp = Float64(x * log(Float64(x / y))); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.02e+40) || ~((x <= 0.95))) tmp = x * log((x / y)); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.02e+40], N[Not[LessEqual[x, 0.95]], $MachinePrecision]], N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-z)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.02 \cdot 10^{+40} \lor \neg \left(x \leq 0.95\right):\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if x < -2.0200000000000001e40 or 0.94999999999999996 < x Initial program 76.0%
Taylor expanded in z around 0 59.4%
if -2.0200000000000001e40 < x < 0.94999999999999996Initial program 75.6%
Taylor expanded in x around 0 75.6%
neg-mul-175.6%
Simplified75.6%
Final simplification67.4%
(FPCore (x y z) :precision binary64 (- z))
double code(double x, double y, double z) {
return -z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -z
end function
public static double code(double x, double y, double z) {
return -z;
}
def code(x, y, z): return -z
function code(x, y, z) return Float64(-z) end
function tmp = code(x, y, z) tmp = -z; end
code[x_, y_, z_] := (-z)
\begin{array}{l}
\\
-z
\end{array}
Initial program 75.8%
Taylor expanded in x around 0 47.3%
neg-mul-147.3%
Simplified47.3%
(FPCore (x y z) :precision binary64 (if (< y 7.595077799083773e-308) (- (* x (log (/ x y))) z) (- (* x (- (log x) (log y))) z)))
double code(double x, double y, double z) {
double tmp;
if (y < 7.595077799083773e-308) {
tmp = (x * log((x / y))) - z;
} else {
tmp = (x * (log(x) - 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 < 7.595077799083773d-308) then
tmp = (x * log((x / y))) - z
else
tmp = (x * (log(x) - log(y))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y < 7.595077799083773e-308) {
tmp = (x * Math.log((x / y))) - z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y < 7.595077799083773e-308: tmp = (x * math.log((x / y))) - z else: tmp = (x * (math.log(x) - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (y < 7.595077799083773e-308) tmp = Float64(Float64(x * log(Float64(x / y))) - z); else tmp = Float64(Float64(x * Float64(log(x) - log(y))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y < 7.595077799083773e-308) tmp = (x * log((x / y))) - z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Less[y, 7.595077799083773e-308], N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y < 7.595077799083773 \cdot 10^{-308}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\end{array}
herbie shell --seed 2024107
(FPCore (x y z)
:name "Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2"
:precision binary64
:alt
(if (< y 7.595077799083773e-308) (- (* x (log (/ x y))) z) (- (* x (- (log x) (log y))) z))
(- (* x (log (/ x y))) z))