
(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 (- (* x (* (log (/ (cbrt x) (cbrt y))) 3.0)) z))
double code(double x, double y, double z) {
return (x * (log((cbrt(x) / cbrt(y))) * 3.0)) - z;
}
public static double code(double x, double y, double z) {
return (x * (Math.log((Math.cbrt(x) / Math.cbrt(y))) * 3.0)) - z;
}
function code(x, y, z) return Float64(Float64(x * Float64(log(Float64(cbrt(x) / cbrt(y))) * 3.0)) - z) end
code[x_, y_, z_] := N[(N[(x * N[(N[Log[N[(N[Power[x, 1/3], $MachinePrecision] / N[Power[y, 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right) \cdot 3\right) - z
\end{array}
Initial program 74.6%
add-cube-cbrt74.6%
associate-*l*74.6%
log-prod74.5%
pow274.5%
metadata-eval74.5%
log-pow74.5%
metadata-eval74.5%
Applied egg-rr74.5%
distribute-rgt1-in74.5%
metadata-eval74.5%
*-commutative74.5%
Simplified74.5%
cbrt-div99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (log (/ x y))) (t_1 (* x t_0)))
(if (<= t_1 (- INFINITY))
(- z)
(if (<= t_1 2e+298) (fma t_0 x (- z)) (- 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)) {
tmp = -z;
} else if (t_1 <= 2e+298) {
tmp = fma(t_0, x, -z);
} else {
tmp = -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)) tmp = Float64(-z); elseif (t_1 <= 2e+298) tmp = fma(t_0, x, Float64(-z)); else tmp = 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[LessEqual[t$95$1, (-Infinity)], (-z), If[LessEqual[t$95$1, 2e+298], N[(t$95$0 * x + (-z)), $MachinePrecision], (-z)]]]]
\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:\\
\;\;\;\;-z\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\mathsf{fma}\left(t_0, x, -z\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 1.9999999999999999e298 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 4.1%
Taylor expanded in x around 0 54.6%
neg-mul-154.6%
Simplified54.6%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.9999999999999999e298Initial program 99.5%
*-commutative99.5%
fma-neg99.5%
Applied egg-rr99.5%
Final simplification87.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (log (/ x y))))) (if (<= t_0 (- INFINITY)) (- z) (if (<= t_0 2e+298) (- t_0 z) (- z)))))
double code(double x, double y, double z) {
double t_0 = x * log((x / y));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = -z;
} else if (t_0 <= 2e+298) {
tmp = t_0 - z;
} else {
tmp = -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) {
tmp = -z;
} else if (t_0 <= 2e+298) {
tmp = t_0 - z;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = x * math.log((x / y)) tmp = 0 if t_0 <= -math.inf: tmp = -z elif t_0 <= 2e+298: tmp = t_0 - z else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(x * log(Float64(x / y))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(-z); elseif (t_0 <= 2e+298) tmp = Float64(t_0 - z); else tmp = Float64(-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) tmp = -z; elseif (t_0 <= 2e+298) tmp = t_0 - z; else tmp = -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[LessEqual[t$95$0, (-Infinity)], (-z), If[LessEqual[t$95$0, 2e+298], N[(t$95$0 - z), $MachinePrecision], (-z)]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;-z\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+298}:\\
\;\;\;\;t_0 - z\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 1.9999999999999999e298 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 4.1%
Taylor expanded in x around 0 54.6%
neg-mul-154.6%
Simplified54.6%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.9999999999999999e298Initial program 99.5%
Final simplification87.8%
(FPCore (x y z) :precision binary64 (if (<= x -5.2e-141) (- (- z) (* x (log (/ y x)))) (if (<= x -2e-307) (- z) (- (* x (- (log x) (log y))) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.2e-141) {
tmp = -z - (x * log((y / x)));
} else if (x <= -2e-307) {
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 <= (-5.2d-141)) then
tmp = -z - (x * log((y / x)))
else if (x <= (-2d-307)) 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 <= -5.2e-141) {
tmp = -z - (x * Math.log((y / x)));
} else if (x <= -2e-307) {
tmp = -z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.2e-141: tmp = -z - (x * math.log((y / x))) elif x <= -2e-307: tmp = -z else: tmp = (x * (math.log(x) - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.2e-141) tmp = Float64(Float64(-z) - Float64(x * log(Float64(y / x)))); elseif (x <= -2e-307) 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 <= -5.2e-141) tmp = -z - (x * log((y / x))); elseif (x <= -2e-307) tmp = -z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.2e-141], N[((-z) - N[(x * N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2e-307], (-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 -5.2 \cdot 10^{-141}:\\
\;\;\;\;\left(-z\right) - x \cdot \log \left(\frac{y}{x}\right)\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-307}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\end{array}
if x < -5.20000000000000022e-141Initial program 86.1%
clear-num86.1%
neg-log88.1%
Applied egg-rr88.1%
if -5.20000000000000022e-141 < x < -1.99999999999999982e-307Initial program 71.5%
Taylor expanded in x around 0 94.1%
neg-mul-194.1%
Simplified94.1%
if -1.99999999999999982e-307 < x Initial program 67.1%
log-div99.5%
Applied egg-rr99.5%
Final simplification94.6%
(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 81.6%
frac-2neg81.6%
log-div99.6%
Applied egg-rr99.6%
if -4.999999999999985e-310 < y Initial program 67.1%
log-div99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- (log (/ y x))))))
(if (<= x -6.9e+22)
t_0
(if (<= x 6.5e-129)
(- z)
(if (<= x 5.6e-82)
(* x (log (/ x y)))
(if (<= x 1.45e+25) (- z) t_0))))))
double code(double x, double y, double z) {
double t_0 = x * -log((y / x));
double tmp;
if (x <= -6.9e+22) {
tmp = t_0;
} else if (x <= 6.5e-129) {
tmp = -z;
} else if (x <= 5.6e-82) {
tmp = x * log((x / y));
} else if (x <= 1.45e+25) {
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 <= (-6.9d+22)) then
tmp = t_0
else if (x <= 6.5d-129) then
tmp = -z
else if (x <= 5.6d-82) then
tmp = x * log((x / y))
else if (x <= 1.45d+25) 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 <= -6.9e+22) {
tmp = t_0;
} else if (x <= 6.5e-129) {
tmp = -z;
} else if (x <= 5.6e-82) {
tmp = x * Math.log((x / y));
} else if (x <= 1.45e+25) {
tmp = -z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * -math.log((y / x)) tmp = 0 if x <= -6.9e+22: tmp = t_0 elif x <= 6.5e-129: tmp = -z elif x <= 5.6e-82: tmp = x * math.log((x / y)) elif x <= 1.45e+25: tmp = -z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-log(Float64(y / x)))) tmp = 0.0 if (x <= -6.9e+22) tmp = t_0; elseif (x <= 6.5e-129) tmp = Float64(-z); elseif (x <= 5.6e-82) tmp = Float64(x * log(Float64(x / y))); elseif (x <= 1.45e+25) 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 <= -6.9e+22) tmp = t_0; elseif (x <= 6.5e-129) tmp = -z; elseif (x <= 5.6e-82) tmp = x * log((x / y)); elseif (x <= 1.45e+25) 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, -6.9e+22], t$95$0, If[LessEqual[x, 6.5e-129], (-z), If[LessEqual[x, 5.6e-82], N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.45e+25], (-z), t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-\log \left(\frac{y}{x}\right)\right)\\
\mathbf{if}\;x \leq -6.9 \cdot 10^{+22}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-129}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-82}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+25}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -6.8999999999999998e22 or 1.44999999999999995e25 < x Initial program 73.7%
clear-num73.7%
neg-log75.2%
Applied egg-rr75.2%
Taylor expanded in z around 0 58.6%
if -6.8999999999999998e22 < x < 6.49999999999999952e-129 or 5.60000000000000049e-82 < x < 1.44999999999999995e25Initial program 74.7%
Taylor expanded in x around 0 84.3%
neg-mul-184.3%
Simplified84.3%
if 6.49999999999999952e-129 < x < 5.60000000000000049e-82Initial program 86.8%
Taylor expanded in z around 0 86.8%
Final simplification72.0%
(FPCore (x y z)
:precision binary64
(if (or (<= x -9e+22)
(not (or (<= x 6.5e-129) (and (not (<= x 5.6e-82)) (<= x 2.6e+25)))))
(* x (log (/ x y)))
(- z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9e+22) || !((x <= 6.5e-129) || (!(x <= 5.6e-82) && (x <= 2.6e+25)))) {
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 <= (-9d+22)) .or. (.not. (x <= 6.5d-129) .or. (.not. (x <= 5.6d-82)) .and. (x <= 2.6d+25))) 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 <= -9e+22) || !((x <= 6.5e-129) || (!(x <= 5.6e-82) && (x <= 2.6e+25)))) {
tmp = x * Math.log((x / y));
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -9e+22) or not ((x <= 6.5e-129) or (not (x <= 5.6e-82) and (x <= 2.6e+25))): tmp = x * math.log((x / y)) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -9e+22) || !((x <= 6.5e-129) || (!(x <= 5.6e-82) && (x <= 2.6e+25)))) 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 <= -9e+22) || ~(((x <= 6.5e-129) || (~((x <= 5.6e-82)) && (x <= 2.6e+25))))) tmp = x * log((x / y)); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -9e+22], N[Not[Or[LessEqual[x, 6.5e-129], And[N[Not[LessEqual[x, 5.6e-82]], $MachinePrecision], LessEqual[x, 2.6e+25]]]], $MachinePrecision]], N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-z)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+22} \lor \neg \left(x \leq 6.5 \cdot 10^{-129} \lor \neg \left(x \leq 5.6 \cdot 10^{-82}\right) \land x \leq 2.6 \cdot 10^{+25}\right):\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if x < -8.9999999999999996e22 or 6.49999999999999952e-129 < x < 5.60000000000000049e-82 or 2.5999999999999998e25 < x Initial program 74.4%
Taylor expanded in z around 0 58.7%
if -8.9999999999999996e22 < x < 6.49999999999999952e-129 or 5.60000000000000049e-82 < x < 2.5999999999999998e25Initial program 74.7%
Taylor expanded in x around 0 84.3%
neg-mul-184.3%
Simplified84.3%
Final simplification71.3%
(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 74.6%
Taylor expanded in x around 0 52.3%
neg-mul-152.3%
Simplified52.3%
Final simplification52.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 2023257
(FPCore (x y z)
:name "Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< y 7.595077799083773e-308) (- (* x (log (/ x y))) z) (- (* x (- (log x) (log y))) z))
(- (* x (log (/ x y))) z))