
(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 -5e-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 <= -5e-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 <= (-5d-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 <= -5e-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 <= -5e-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 <= -5e-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 <= -5e-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, -5e-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 -5 \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 < -4.999999999999985e-310Initial program 73.6%
Taylor expanded in y around -inf 99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
distribute-frac-neg299.6%
neg-mul-199.6%
log-rec99.6%
sub-neg99.6%
Simplified99.6%
if -4.999999999999985e-310 < y Initial program 64.1%
Taylor expanded in x around 0 99.4%
log-rec99.4%
sub-neg99.4%
Simplified99.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (log (/ x y))) (t_1 (* x t_0)))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+308)))
(- z)
(fma x t_0 (- z)))))
double code(double x, double y, double z) {
double t_0 = log((x / y));
double t_1 = x * t_0;
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1e+308)) {
tmp = -z;
} else {
tmp = fma(x, t_0, -z);
}
return tmp;
}
function code(x, y, z) t_0 = log(Float64(x / y)) t_1 = Float64(x * t_0) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 1e+308)) tmp = Float64(-z); else tmp = fma(x, t_0, Float64(-z)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x * t$95$0), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+308]], $MachinePrecision]], (-z), N[(x * t$95$0 + (-z)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\frac{x}{y}\right)\\
t_1 := x \cdot t\_0\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 10^{+308}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, t\_0, -z\right)\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 1e308 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 4.5%
Taylor expanded in x around 0 55.1%
mul-1-neg55.1%
Simplified55.1%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1e308Initial program 99.6%
fma-neg99.6%
Simplified99.6%
Final simplification85.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (log (/ x y))))) (if (or (<= t_0 (- INFINITY)) (not (<= t_0 1e+308))) (- 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 <= 1e+308)) {
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 <= 1e+308)) {
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 <= 1e+308): 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 <= 1e+308)) 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 <= 1e+308))) 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, 1e+308]], $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 10^{+308}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_0 - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 1e308 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 4.5%
Taylor expanded in x around 0 55.1%
mul-1-neg55.1%
Simplified55.1%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1e308Initial program 99.6%
Final simplification85.0%
(FPCore (x y z)
:precision binary64
(if (<= x -9.5e+142)
(* x (- (log (- x)) (log (- y))))
(if (<= x -1.04e-138)
(- (* x (log (/ x y))) z)
(if (<= x -1e-305) (- z) (- (* x (- (log x) (log y))) z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -9.5e+142) {
tmp = x * (log(-x) - log(-y));
} else if (x <= -1.04e-138) {
tmp = (x * log((x / y))) - z;
} else if (x <= -1e-305) {
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 <= (-9.5d+142)) then
tmp = x * (log(-x) - log(-y))
else if (x <= (-1.04d-138)) then
tmp = (x * log((x / y))) - z
else if (x <= (-1d-305)) 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 <= -9.5e+142) {
tmp = x * (Math.log(-x) - Math.log(-y));
} else if (x <= -1.04e-138) {
tmp = (x * Math.log((x / y))) - z;
} else if (x <= -1e-305) {
tmp = -z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -9.5e+142: tmp = x * (math.log(-x) - math.log(-y)) elif x <= -1.04e-138: tmp = (x * math.log((x / y))) - z elif x <= -1e-305: tmp = -z else: tmp = (x * (math.log(x) - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -9.5e+142) tmp = Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))); elseif (x <= -1.04e-138) tmp = Float64(Float64(x * log(Float64(x / y))) - z); elseif (x <= -1e-305) 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 <= -9.5e+142) tmp = x * (log(-x) - log(-y)); elseif (x <= -1.04e-138) tmp = (x * log((x / y))) - z; elseif (x <= -1e-305) tmp = -z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -9.5e+142], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.04e-138], N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, -1e-305], (-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 -9.5 \cdot 10^{+142}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;x \leq -1.04 \cdot 10^{-138}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-305}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\end{array}
if x < -9.50000000000000001e142Initial program 65.0%
Taylor expanded in y around -inf 99.1%
metadata-eval99.1%
distribute-neg-frac99.1%
distribute-frac-neg299.1%
neg-mul-199.1%
log-rec99.1%
sub-neg99.1%
Simplified99.1%
Taylor expanded in z around 0 79.5%
if -9.50000000000000001e142 < x < -1.0399999999999999e-138Initial program 93.1%
if -1.0399999999999999e-138 < x < -9.99999999999999996e-306Initial program 59.9%
Taylor expanded in x around 0 88.4%
mul-1-neg88.4%
Simplified88.4%
if -9.99999999999999996e-306 < x Initial program 64.1%
Taylor expanded in x around 0 99.4%
log-rec99.4%
sub-neg99.4%
Simplified99.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- x) (log (/ y x)))))
(if (<= x -9.5e+173)
t_0
(if (<= x -1.5e-23)
(- z)
(if (<= x -9.8e-136)
(* x (log (/ x y)))
(if (<= x 6e-55) (- z) t_0))))))
double code(double x, double y, double z) {
double t_0 = -x * log((y / x));
double tmp;
if (x <= -9.5e+173) {
tmp = t_0;
} else if (x <= -1.5e-23) {
tmp = -z;
} else if (x <= -9.8e-136) {
tmp = x * log((x / y));
} else if (x <= 6e-55) {
tmp = -z;
} 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 * log((y / x))
if (x <= (-9.5d+173)) then
tmp = t_0
else if (x <= (-1.5d-23)) then
tmp = -z
else if (x <= (-9.8d-136)) then
tmp = x * log((x / y))
else if (x <= 6d-55) then
tmp = -z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -x * Math.log((y / x));
double tmp;
if (x <= -9.5e+173) {
tmp = t_0;
} else if (x <= -1.5e-23) {
tmp = -z;
} else if (x <= -9.8e-136) {
tmp = x * Math.log((x / y));
} else if (x <= 6e-55) {
tmp = -z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -x * math.log((y / x)) tmp = 0 if x <= -9.5e+173: tmp = t_0 elif x <= -1.5e-23: tmp = -z elif x <= -9.8e-136: tmp = x * math.log((x / y)) elif x <= 6e-55: tmp = -z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-x) * log(Float64(y / x))) tmp = 0.0 if (x <= -9.5e+173) tmp = t_0; elseif (x <= -1.5e-23) tmp = Float64(-z); elseif (x <= -9.8e-136) tmp = Float64(x * log(Float64(x / y))); elseif (x <= 6e-55) tmp = Float64(-z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -x * log((y / x)); tmp = 0.0; if (x <= -9.5e+173) tmp = t_0; elseif (x <= -1.5e-23) tmp = -z; elseif (x <= -9.8e-136) tmp = x * log((x / y)); elseif (x <= 6e-55) tmp = -z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[((-x) * N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.5e+173], t$95$0, If[LessEqual[x, -1.5e-23], (-z), If[LessEqual[x, -9.8e-136], N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6e-55], (-z), t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-x\right) \cdot \log \left(\frac{y}{x}\right)\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{+173}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-23}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq -9.8 \cdot 10^{-136}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-55}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -9.5000000000000005e173 or 6.00000000000000033e-55 < x Initial program 71.5%
Taylor expanded in z around inf 56.8%
sub-neg56.8%
associate-/l*56.7%
metadata-eval56.7%
Simplified56.7%
*-commutative56.7%
frac-2neg56.7%
associate-*l/56.8%
neg-log56.8%
clear-num59.0%
Applied egg-rr59.0%
Taylor expanded in z around 0 57.5%
associate-*r*57.5%
neg-mul-157.5%
Simplified57.5%
if -9.5000000000000005e173 < x < -1.50000000000000001e-23 or -9.7999999999999999e-136 < x < 6.00000000000000033e-55Initial program 62.0%
Taylor expanded in x around 0 76.3%
mul-1-neg76.3%
Simplified76.3%
if -1.50000000000000001e-23 < x < -9.7999999999999999e-136Initial program 100.0%
Taylor expanded in z around 0 72.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.25e+29) (not (<= z 4.4e-12))) (- z) (* x (log (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.25e+29) || !(z <= 4.4e-12)) {
tmp = -z;
} else {
tmp = x * log((x / 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 ((z <= (-2.25d+29)) .or. (.not. (z <= 4.4d-12))) then
tmp = -z
else
tmp = x * log((x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.25e+29) || !(z <= 4.4e-12)) {
tmp = -z;
} else {
tmp = x * Math.log((x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.25e+29) or not (z <= 4.4e-12): tmp = -z else: tmp = x * math.log((x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.25e+29) || !(z <= 4.4e-12)) tmp = Float64(-z); else tmp = Float64(x * log(Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.25e+29) || ~((z <= 4.4e-12))) tmp = -z; else tmp = x * log((x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.25e+29], N[Not[LessEqual[z, 4.4e-12]], $MachinePrecision]], (-z), N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{+29} \lor \neg \left(z \leq 4.4 \cdot 10^{-12}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -2.2500000000000001e29 or 4.39999999999999983e-12 < z Initial program 72.0%
Taylor expanded in x around 0 78.2%
mul-1-neg78.2%
Simplified78.2%
if -2.2500000000000001e29 < z < 4.39999999999999983e-12Initial program 64.7%
Taylor expanded in z around 0 56.2%
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 68.4%
Taylor expanded in x around 0 50.7%
mul-1-neg50.7%
Simplified50.7%
(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 z end
function tmp = code(x, y, z) tmp = z; end
code[x_, y_, z_] := z
\begin{array}{l}
\\
z
\end{array}
Initial program 68.4%
Taylor expanded in x around 0 50.7%
mul-1-neg50.7%
Simplified50.7%
neg-sub050.7%
sub-neg50.7%
add-sqr-sqrt25.8%
sqrt-unprod12.4%
sqr-neg12.4%
sqrt-unprod1.2%
add-sqr-sqrt2.3%
Applied egg-rr2.3%
+-lft-identity2.3%
Simplified2.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 2024110
(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))