
(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 9 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 79.1%
add-cube-cbrt79.1%
associate-*l*79.1%
log-prod79.0%
pow279.0%
metadata-eval79.0%
log-pow79.0%
metadata-eval79.0%
Applied egg-rr79.0%
distribute-rgt1-in79.0%
metadata-eval79.0%
*-commutative79.0%
Simplified79.0%
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 (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+301)))
(- (* x (log (* x y))) z)
(fma t_0 x (- 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+301)) {
tmp = (x * log((x * y))) - z;
} else {
tmp = fma(t_0, x, -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+301)) tmp = Float64(Float64(x * log(Float64(x * y))) - z); else tmp = fma(t_0, x, 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+301]], $MachinePrecision]], N[(N[(x * N[Log[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(t$95$0 * x + (-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^{+301}\right):\\
\;\;\;\;x \cdot \log \left(x \cdot y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t_0, x, -z\right)\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 1.00000000000000005e301 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 7.0%
log-div54.2%
Applied egg-rr54.2%
sub-neg54.2%
distribute-rgt-in54.2%
Applied egg-rr54.2%
distribute-rgt-out54.2%
sub-neg54.2%
diff-log7.0%
*-commutative7.0%
clear-num7.0%
associate-/r/7.0%
add-exp-log3.1%
neg-log3.1%
add-sqr-sqrt2.7%
sqrt-unprod23.8%
sqr-neg23.8%
sqrt-unprod21.1%
add-sqr-sqrt24.8%
add-exp-log51.0%
Applied egg-rr51.0%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.00000000000000005e301Initial program 99.8%
*-commutative99.8%
fma-neg99.8%
Applied egg-rr99.8%
Final simplification88.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (log (/ x y)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 1e+301)))
(- (* x (log (* x y))) 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+301)) {
tmp = (x * log((x * y))) - 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+301)) {
tmp = (x * Math.log((x * y))) - 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+301): tmp = (x * math.log((x * y))) - 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+301)) tmp = Float64(Float64(x * log(Float64(x * y))) - 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+301))) tmp = (x * log((x * y))) - 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+301]], $MachinePrecision]], N[(N[(x * N[Log[N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], 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^{+301}\right):\\
\;\;\;\;x \cdot \log \left(x \cdot y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t_0 - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 1.00000000000000005e301 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 7.0%
log-div54.2%
Applied egg-rr54.2%
sub-neg54.2%
distribute-rgt-in54.2%
Applied egg-rr54.2%
distribute-rgt-out54.2%
sub-neg54.2%
diff-log7.0%
*-commutative7.0%
clear-num7.0%
associate-/r/7.0%
add-exp-log3.1%
neg-log3.1%
add-sqr-sqrt2.7%
sqrt-unprod23.8%
sqr-neg23.8%
sqrt-unprod21.1%
add-sqr-sqrt24.8%
add-exp-log51.0%
Applied egg-rr51.0%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.00000000000000005e301Initial program 99.8%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (log (/ x y))))) (if (<= t_0 (- INFINITY)) (- z) (if (<= t_0 1e+301) (- 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 <= 1e+301) {
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 <= 1e+301) {
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 <= 1e+301: 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 <= 1e+301) 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 <= 1e+301) 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, 1e+301], 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 10^{+301}:\\
\;\;\;\;t_0 - z\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 1.00000000000000005e301 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 7.0%
Taylor expanded in x around 0 45.6%
neg-mul-145.6%
Simplified45.6%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.00000000000000005e301Initial program 99.8%
Final simplification87.7%
(FPCore (x y z) :precision binary64 (if (<= x -3.6e-170) (- (* x (- (log (/ y x)))) z) (if (<= x -1e-305) (- z) (- (* x (- (log x) (log y))) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.6e-170) {
tmp = (x * -log((y / x))) - 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 <= (-3.6d-170)) then
tmp = (x * -log((y / x))) - 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 <= -3.6e-170) {
tmp = (x * -Math.log((y / x))) - 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 <= -3.6e-170: tmp = (x * -math.log((y / x))) - 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 <= -3.6e-170) tmp = Float64(Float64(x * Float64(-log(Float64(y / x)))) - 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 <= -3.6e-170) tmp = (x * -log((y / x))) - 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, -3.6e-170], N[(N[(x * (-N[Log[N[(y / x), $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 -3.6 \cdot 10^{-170}:\\
\;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\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 < -3.6000000000000003e-170Initial program 85.3%
clear-num85.3%
neg-log87.4%
Applied egg-rr87.4%
if -3.6000000000000003e-170 < x < -9.99999999999999996e-306Initial program 59.3%
Taylor expanded in x around 0 96.5%
neg-mul-196.5%
Simplified96.5%
if -9.99999999999999996e-306 < x Initial program 78.7%
log-div99.3%
Applied egg-rr99.3%
Final simplification94.8%
(FPCore (x y z) :precision binary64 (if (<= x -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 (x <= -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 (x <= (-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 (x <= -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 x <= -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 (x <= -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 (x <= -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[x, -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}\;x \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 x < -4.999999999999985e-310Initial program 79.5%
frac-2neg79.5%
log-div99.6%
Applied egg-rr99.6%
if -4.999999999999985e-310 < x Initial program 78.7%
log-div99.3%
Applied egg-rr99.3%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (<= z -2.75e-45) (- z) (if (<= z 1.35e+29) (* x (log (/ x y))) (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.75e-45) {
tmp = -z;
} else if (z <= 1.35e+29) {
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 (z <= (-2.75d-45)) then
tmp = -z
else if (z <= 1.35d+29) 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 (z <= -2.75e-45) {
tmp = -z;
} else if (z <= 1.35e+29) {
tmp = x * Math.log((x / y));
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.75e-45: tmp = -z elif z <= 1.35e+29: tmp = x * math.log((x / y)) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.75e-45) tmp = Float64(-z); elseif (z <= 1.35e+29) 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 (z <= -2.75e-45) tmp = -z; elseif (z <= 1.35e+29) tmp = x * log((x / y)); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.75e-45], (-z), If[LessEqual[z, 1.35e+29], N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{-45}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+29}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -2.75000000000000015e-45 or 1.35e29 < z Initial program 74.0%
Taylor expanded in x around 0 70.6%
neg-mul-170.6%
Simplified70.6%
if -2.75000000000000015e-45 < z < 1.35e29Initial program 85.2%
flip--62.0%
clear-num61.9%
fma-def61.9%
pow261.9%
Applied egg-rr61.9%
Taylor expanded in x around inf 46.9%
associate-/r*46.9%
log-rec46.9%
+-commutative46.9%
mul-1-neg46.9%
log-rec46.9%
remove-double-neg46.9%
sub-neg46.9%
log-div70.7%
Simplified70.7%
clear-num70.8%
div-inv70.9%
remove-double-div71.0%
Applied egg-rr71.0%
Final simplification70.8%
(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 79.1%
Taylor expanded in x around 0 47.8%
neg-mul-147.8%
Simplified47.8%
Final simplification47.8%
(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 79.1%
flip--47.4%
clear-num47.3%
fma-def47.3%
pow247.3%
Applied egg-rr47.3%
Taylor expanded in x around 0 47.6%
associate-/r/47.8%
metadata-eval47.8%
neg-mul-147.8%
neg-sub047.8%
metadata-eval47.8%
sub-neg47.8%
add-sqr-sqrt23.8%
sqrt-unprod14.7%
sqr-neg14.7%
sqrt-unprod1.3%
add-sqr-sqrt2.4%
metadata-eval2.4%
Applied egg-rr2.4%
+-lft-identity2.4%
Simplified2.4%
Final simplification2.4%
(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 2023279
(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))