
(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 12 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 75.6%
Taylor expanded in y around -inf 99.5%
metadata-eval99.5%
distribute-neg-frac99.5%
distribute-frac-neg299.5%
neg-mul-199.5%
log-rec99.5%
sub-neg99.5%
Simplified99.5%
if -4.999999999999985e-310 < y Initial program 78.5%
Taylor expanded in x around 0 99.5%
log-rec99.5%
neg-mul-199.5%
neg-mul-199.5%
sub-neg99.5%
Simplified99.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (log (/ x y)))))
(if (<= t_0 (- INFINITY))
(* x (- (log (- x)) (log (- y))))
(if (<= t_0 5e+305)
(- (* x (log (* x (/ 1.0 y)))) z)
(* x (- (log x) (log y)))))))
double code(double x, double y, double z) {
double t_0 = x * log((x / y));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = x * (log(-x) - log(-y));
} else if (t_0 <= 5e+305) {
tmp = (x * log((x * (1.0 / y)))) - z;
} else {
tmp = x * (log(x) - log(y));
}
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 = x * (Math.log(-x) - Math.log(-y));
} else if (t_0 <= 5e+305) {
tmp = (x * Math.log((x * (1.0 / y)))) - z;
} else {
tmp = x * (Math.log(x) - Math.log(y));
}
return tmp;
}
def code(x, y, z): t_0 = x * math.log((x / y)) tmp = 0 if t_0 <= -math.inf: tmp = x * (math.log(-x) - math.log(-y)) elif t_0 <= 5e+305: tmp = (x * math.log((x * (1.0 / y)))) - z else: tmp = x * (math.log(x) - math.log(y)) 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(x * Float64(log(Float64(-x)) - log(Float64(-y)))); elseif (t_0 <= 5e+305) tmp = Float64(Float64(x * log(Float64(x * Float64(1.0 / y)))) - z); else tmp = Float64(x * Float64(log(x) - log(y))); 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 = x * (log(-x) - log(-y)); elseif (t_0 <= 5e+305) tmp = (x * log((x * (1.0 / y)))) - z; else tmp = x * (log(x) - log(y)); 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)], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+305], N[(N[(x * N[Log[N[(x * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;x \cdot \log \left(x \cdot \frac{1}{y}\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right)\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0Initial program 5.8%
Taylor expanded in z around 0 5.8%
Taylor expanded in y around -inf 69.8%
metadata-eval74.5%
distribute-neg-frac74.5%
distribute-frac-neg274.5%
neg-mul-174.5%
log-rec74.5%
sub-neg74.5%
Simplified69.8%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.00000000000000009e305Initial program 99.6%
clear-num97.8%
associate-/r/99.6%
Applied egg-rr99.6%
if 5.00000000000000009e305 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 11.7%
Taylor expanded in z around 0 11.7%
Taylor expanded in x around 0 56.5%
log-rec64.7%
neg-mul-164.7%
neg-mul-164.7%
sub-neg64.7%
Simplified56.5%
Final simplification90.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (log (/ x y)))))
(if (<= t_0 (- INFINITY))
(- (* (- x) (log (* y x))) z)
(if (<= t_0 5e+305)
(- (* x (log (* x (/ 1.0 y)))) z)
(* x (- (log x) (log y)))))))
double code(double x, double y, double z) {
double t_0 = x * log((x / y));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (-x * log((y * x))) - z;
} else if (t_0 <= 5e+305) {
tmp = (x * log((x * (1.0 / y)))) - z;
} else {
tmp = x * (log(x) - log(y));
}
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 = (-x * Math.log((y * x))) - z;
} else if (t_0 <= 5e+305) {
tmp = (x * Math.log((x * (1.0 / y)))) - z;
} else {
tmp = x * (Math.log(x) - Math.log(y));
}
return tmp;
}
def code(x, y, z): t_0 = x * math.log((x / y)) tmp = 0 if t_0 <= -math.inf: tmp = (-x * math.log((y * x))) - z elif t_0 <= 5e+305: tmp = (x * math.log((x * (1.0 / y)))) - z else: tmp = x * (math.log(x) - math.log(y)) 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(Float64(Float64(-x) * log(Float64(y * x))) - z); elseif (t_0 <= 5e+305) tmp = Float64(Float64(x * log(Float64(x * Float64(1.0 / y)))) - z); else tmp = Float64(x * Float64(log(x) - log(y))); 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 = (-x * log((y * x))) - z; elseif (t_0 <= 5e+305) tmp = (x * log((x * (1.0 / y)))) - z; else tmp = x * (log(x) - log(y)); 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)], N[(N[((-x) * N[Log[N[(y * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[t$95$0, 5e+305], N[(N[(x * N[Log[N[(x * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(-x\right) \cdot \log \left(y \cdot x\right) - z\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;x \cdot \log \left(x \cdot \frac{1}{y}\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right)\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0Initial program 5.8%
Taylor expanded in y around -inf 74.5%
metadata-eval74.5%
distribute-neg-frac74.5%
distribute-frac-neg274.5%
neg-mul-174.5%
log-rec74.5%
sub-neg74.5%
Simplified74.5%
sub-neg74.5%
distribute-rgt-in74.7%
add-sqr-sqrt74.7%
sqrt-unprod25.0%
sqr-neg25.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.6%
sqr-neg0.6%
sqrt-unprod25.0%
add-sqr-sqrt25.0%
Applied egg-rr25.0%
+-commutative25.0%
distribute-rgt-out25.0%
neg-sub025.0%
associate--r-25.0%
log-div15.2%
neg-sub015.2%
distribute-rgt-neg-out15.2%
distribute-lft-neg-in15.2%
add-sqr-sqrt0.6%
sqrt-unprod0.7%
sqr-neg0.7%
neg-log0.7%
clear-num0.7%
neg-log0.7%
clear-num0.7%
sqrt-unprod0.1%
add-sqr-sqrt0.6%
log-div20.9%
sub-neg20.9%
add-log-exp20.9%
sum-log0.5%
Applied egg-rr32.5%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.00000000000000009e305Initial program 99.6%
clear-num97.8%
associate-/r/99.6%
Applied egg-rr99.6%
if 5.00000000000000009e305 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 11.7%
Taylor expanded in z around 0 11.7%
Taylor expanded in x around 0 56.5%
log-rec64.7%
neg-mul-164.7%
neg-mul-164.7%
sub-neg64.7%
Simplified56.5%
Final simplification86.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (log (/ x y)))) (t_1 (log (* y x))))
(if (<= t_0 (- INFINITY))
(- (* (- x) t_1) z)
(if (<= t_0 5e+305) (- (* x (log (* x (/ 1.0 y)))) z) (- (* x t_1) z)))))
double code(double x, double y, double z) {
double t_0 = x * log((x / y));
double t_1 = log((y * x));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (-x * t_1) - z;
} else if (t_0 <= 5e+305) {
tmp = (x * log((x * (1.0 / y)))) - z;
} else {
tmp = (x * t_1) - z;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = x * Math.log((x / y));
double t_1 = Math.log((y * x));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = (-x * t_1) - z;
} else if (t_0 <= 5e+305) {
tmp = (x * Math.log((x * (1.0 / y)))) - z;
} else {
tmp = (x * t_1) - z;
}
return tmp;
}
def code(x, y, z): t_0 = x * math.log((x / y)) t_1 = math.log((y * x)) tmp = 0 if t_0 <= -math.inf: tmp = (-x * t_1) - z elif t_0 <= 5e+305: tmp = (x * math.log((x * (1.0 / y)))) - z else: tmp = (x * t_1) - z return tmp
function code(x, y, z) t_0 = Float64(x * log(Float64(x / y))) t_1 = log(Float64(y * x)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(-x) * t_1) - z); elseif (t_0 <= 5e+305) tmp = Float64(Float64(x * log(Float64(x * Float64(1.0 / y)))) - z); else tmp = Float64(Float64(x * t_1) - z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * log((x / y)); t_1 = log((y * x)); tmp = 0.0; if (t_0 <= -Inf) tmp = (-x * t_1) - z; elseif (t_0 <= 5e+305) tmp = (x * log((x * (1.0 / y)))) - z; else tmp = (x * t_1) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[(y * x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[((-x) * t$95$1), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[t$95$0, 5e+305], N[(N[(x * N[Log[N[(x * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x * t$95$1), $MachinePrecision] - z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
t_1 := \log \left(y \cdot x\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(-x\right) \cdot t\_1 - z\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;x \cdot \log \left(x \cdot \frac{1}{y}\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\_1 - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0Initial program 5.8%
Taylor expanded in y around -inf 74.5%
metadata-eval74.5%
distribute-neg-frac74.5%
distribute-frac-neg274.5%
neg-mul-174.5%
log-rec74.5%
sub-neg74.5%
Simplified74.5%
sub-neg74.5%
distribute-rgt-in74.7%
add-sqr-sqrt74.7%
sqrt-unprod25.0%
sqr-neg25.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.6%
sqr-neg0.6%
sqrt-unprod25.0%
add-sqr-sqrt25.0%
Applied egg-rr25.0%
+-commutative25.0%
distribute-rgt-out25.0%
neg-sub025.0%
associate--r-25.0%
log-div15.2%
neg-sub015.2%
distribute-rgt-neg-out15.2%
distribute-lft-neg-in15.2%
add-sqr-sqrt0.6%
sqrt-unprod0.7%
sqr-neg0.7%
neg-log0.7%
clear-num0.7%
neg-log0.7%
clear-num0.7%
sqrt-unprod0.1%
add-sqr-sqrt0.6%
log-div20.9%
sub-neg20.9%
add-log-exp20.9%
sum-log0.5%
Applied egg-rr32.5%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.00000000000000009e305Initial program 99.6%
clear-num97.8%
associate-/r/99.6%
Applied egg-rr99.6%
if 5.00000000000000009e305 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 11.7%
Taylor expanded in y around -inf 35.0%
metadata-eval35.0%
distribute-neg-frac35.0%
distribute-frac-neg235.0%
neg-mul-135.0%
log-rec35.0%
sub-neg35.0%
Simplified35.0%
sub-neg35.0%
distribute-rgt-in35.0%
add-sqr-sqrt35.0%
sqrt-unprod8.1%
sqr-neg8.1%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod24.0%
sqr-neg24.0%
sqrt-unprod62.4%
add-sqr-sqrt62.4%
Applied egg-rr62.4%
distribute-rgt-out64.7%
sub-neg64.7%
log-div11.7%
*-commutative11.7%
log-div64.7%
sub-neg64.7%
add-log-exp64.7%
sum-log11.1%
add-sqr-sqrt6.1%
sqrt-unprod11.1%
sqr-neg11.1%
sqrt-unprod5.0%
add-sqr-sqrt16.7%
add-exp-log49.3%
Applied egg-rr49.3%
Final simplification85.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (log (/ x y)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 5e+305)))
(- (* x (log (* y x))) 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 <= 5e+305)) {
tmp = (x * log((y * x))) - 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 <= 5e+305)) {
tmp = (x * Math.log((y * x))) - 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 <= 5e+305): tmp = (x * math.log((y * x))) - 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 <= 5e+305)) tmp = Float64(Float64(x * log(Float64(y * x))) - 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 <= 5e+305))) tmp = (x * log((y * x))) - 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, 5e+305]], $MachinePrecision]], N[(N[(x * N[Log[N[(y * x), $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 5 \cdot 10^{+305}\right):\\
\;\;\;\;x \cdot \log \left(y \cdot x\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_0 - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 5.00000000000000009e305 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 9.5%
Taylor expanded in y around -inf 49.8%
metadata-eval49.8%
distribute-neg-frac49.8%
distribute-frac-neg249.8%
neg-mul-149.8%
log-rec49.8%
sub-neg49.8%
Simplified49.8%
sub-neg49.8%
distribute-rgt-in49.9%
add-sqr-sqrt49.9%
sqrt-unprod14.4%
sqr-neg14.4%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod15.2%
sqr-neg15.2%
sqrt-unprod48.4%
add-sqr-sqrt48.4%
Applied egg-rr48.4%
distribute-rgt-out49.8%
sub-neg49.8%
log-div9.5%
*-commutative9.5%
log-div49.8%
sub-neg49.8%
add-log-exp49.8%
sum-log7.1%
add-sqr-sqrt3.8%
sqrt-unprod14.8%
sqr-neg14.8%
sqrt-unprod11.0%
add-sqr-sqrt18.3%
add-exp-log42.4%
Applied egg-rr42.4%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.00000000000000009e305Initial program 99.6%
Final simplification85.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (log (/ x y))))) (if (or (<= t_0 (- INFINITY)) (not (<= t_0 5e+305))) (- 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 <= 5e+305)) {
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 <= 5e+305)) {
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 <= 5e+305): 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 <= 5e+305)) 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 <= 5e+305))) 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, 5e+305]], $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 5 \cdot 10^{+305}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_0 - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 5.00000000000000009e305 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 9.5%
Taylor expanded in x around 0 36.0%
neg-mul-136.0%
Simplified36.0%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.00000000000000009e305Initial program 99.6%
Final simplification83.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (log (/ x y)))) (t_1 (log (* y x))))
(if (<= t_0 (- INFINITY))
(- (* (- x) t_1) z)
(if (<= t_0 5e+305) (- t_0 z) (- (* x t_1) z)))))
double code(double x, double y, double z) {
double t_0 = x * log((x / y));
double t_1 = log((y * x));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (-x * t_1) - z;
} else if (t_0 <= 5e+305) {
tmp = t_0 - z;
} else {
tmp = (x * t_1) - z;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = x * Math.log((x / y));
double t_1 = Math.log((y * x));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = (-x * t_1) - z;
} else if (t_0 <= 5e+305) {
tmp = t_0 - z;
} else {
tmp = (x * t_1) - z;
}
return tmp;
}
def code(x, y, z): t_0 = x * math.log((x / y)) t_1 = math.log((y * x)) tmp = 0 if t_0 <= -math.inf: tmp = (-x * t_1) - z elif t_0 <= 5e+305: tmp = t_0 - z else: tmp = (x * t_1) - z return tmp
function code(x, y, z) t_0 = Float64(x * log(Float64(x / y))) t_1 = log(Float64(y * x)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(-x) * t_1) - z); elseif (t_0 <= 5e+305) tmp = Float64(t_0 - z); else tmp = Float64(Float64(x * t_1) - z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * log((x / y)); t_1 = log((y * x)); tmp = 0.0; if (t_0 <= -Inf) tmp = (-x * t_1) - z; elseif (t_0 <= 5e+305) tmp = t_0 - z; else tmp = (x * t_1) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[(y * x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[((-x) * t$95$1), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[t$95$0, 5e+305], N[(t$95$0 - z), $MachinePrecision], N[(N[(x * t$95$1), $MachinePrecision] - z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
t_1 := \log \left(y \cdot x\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(-x\right) \cdot t\_1 - z\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;t\_0 - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\_1 - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0Initial program 5.8%
Taylor expanded in y around -inf 74.5%
metadata-eval74.5%
distribute-neg-frac74.5%
distribute-frac-neg274.5%
neg-mul-174.5%
log-rec74.5%
sub-neg74.5%
Simplified74.5%
sub-neg74.5%
distribute-rgt-in74.7%
add-sqr-sqrt74.7%
sqrt-unprod25.0%
sqr-neg25.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.6%
sqr-neg0.6%
sqrt-unprod25.0%
add-sqr-sqrt25.0%
Applied egg-rr25.0%
+-commutative25.0%
distribute-rgt-out25.0%
neg-sub025.0%
associate--r-25.0%
log-div15.2%
neg-sub015.2%
distribute-rgt-neg-out15.2%
distribute-lft-neg-in15.2%
add-sqr-sqrt0.6%
sqrt-unprod0.7%
sqr-neg0.7%
neg-log0.7%
clear-num0.7%
neg-log0.7%
clear-num0.7%
sqrt-unprod0.1%
add-sqr-sqrt0.6%
log-div20.9%
sub-neg20.9%
add-log-exp20.9%
sum-log0.5%
Applied egg-rr32.5%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.00000000000000009e305Initial program 99.6%
if 5.00000000000000009e305 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 11.7%
Taylor expanded in y around -inf 35.0%
metadata-eval35.0%
distribute-neg-frac35.0%
distribute-frac-neg235.0%
neg-mul-135.0%
log-rec35.0%
sub-neg35.0%
Simplified35.0%
sub-neg35.0%
distribute-rgt-in35.0%
add-sqr-sqrt35.0%
sqrt-unprod8.1%
sqr-neg8.1%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod24.0%
sqr-neg24.0%
sqrt-unprod62.4%
add-sqr-sqrt62.4%
Applied egg-rr62.4%
distribute-rgt-out64.7%
sub-neg64.7%
log-div11.7%
*-commutative11.7%
log-div64.7%
sub-neg64.7%
add-log-exp64.7%
sum-log11.1%
add-sqr-sqrt6.1%
sqrt-unprod11.1%
sqr-neg11.1%
sqrt-unprod5.0%
add-sqr-sqrt16.7%
add-exp-log49.3%
Applied egg-rr49.3%
Final simplification85.5%
(FPCore (x y z)
:precision binary64
(if (<= x -4.8e+142)
(* x (- (log (- x)) (log (- y))))
(if (<= x -5.8e-128)
(- (* x (log (* x (/ 1.0 y)))) z)
(if (<= x -5e-310) (- z) (- (* x (- (log x) (log y))) z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.8e+142) {
tmp = x * (log(-x) - log(-y));
} else if (x <= -5.8e-128) {
tmp = (x * log((x * (1.0 / y)))) - z;
} else if (x <= -5e-310) {
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 <= (-4.8d+142)) then
tmp = x * (log(-x) - log(-y))
else if (x <= (-5.8d-128)) then
tmp = (x * log((x * (1.0d0 / y)))) - z
else if (x <= (-5d-310)) 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 <= -4.8e+142) {
tmp = x * (Math.log(-x) - Math.log(-y));
} else if (x <= -5.8e-128) {
tmp = (x * Math.log((x * (1.0 / y)))) - z;
} else if (x <= -5e-310) {
tmp = -z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.8e+142: tmp = x * (math.log(-x) - math.log(-y)) elif x <= -5.8e-128: tmp = (x * math.log((x * (1.0 / y)))) - z elif x <= -5e-310: tmp = -z else: tmp = (x * (math.log(x) - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.8e+142) tmp = Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))); elseif (x <= -5.8e-128) tmp = Float64(Float64(x * log(Float64(x * Float64(1.0 / y)))) - z); elseif (x <= -5e-310) 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 <= -4.8e+142) tmp = x * (log(-x) - log(-y)); elseif (x <= -5.8e-128) tmp = (x * log((x * (1.0 / y)))) - z; elseif (x <= -5e-310) tmp = -z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.8e+142], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.8e-128], N[(N[(x * N[Log[N[(x * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, -5e-310], (-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 -4.8 \cdot 10^{+142}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-128}:\\
\;\;\;\;x \cdot \log \left(x \cdot \frac{1}{y}\right) - z\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\end{array}
if x < -4.7999999999999998e142Initial program 55.1%
Taylor expanded in z around 0 54.2%
Taylor expanded in y around -inf 97.6%
metadata-eval99.1%
distribute-neg-frac99.1%
distribute-frac-neg299.1%
neg-mul-199.1%
log-rec99.1%
sub-neg99.1%
Simplified97.6%
if -4.7999999999999998e142 < x < -5.8000000000000001e-128Initial program 93.7%
clear-num93.7%
associate-/r/93.7%
Applied egg-rr93.7%
if -5.8000000000000001e-128 < x < -4.999999999999985e-310Initial program 58.8%
Taylor expanded in x around 0 90.9%
neg-mul-190.9%
Simplified90.9%
if -4.999999999999985e-310 < x Initial program 78.5%
Taylor expanded in x around 0 99.5%
log-rec99.5%
neg-mul-199.5%
neg-mul-199.5%
sub-neg99.5%
Simplified99.5%
Final simplification96.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -49000000000000.0) (not (<= z 1.78e-155))) (- z) (* x (- (log (/ y x))))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -49000000000000.0) || !(z <= 1.78e-155)) {
tmp = -z;
} else {
tmp = x * -log((y / 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 ((z <= (-49000000000000.0d0)) .or. (.not. (z <= 1.78d-155))) then
tmp = -z
else
tmp = x * -log((y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -49000000000000.0) || !(z <= 1.78e-155)) {
tmp = -z;
} else {
tmp = x * -Math.log((y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -49000000000000.0) or not (z <= 1.78e-155): tmp = -z else: tmp = x * -math.log((y / x)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -49000000000000.0) || !(z <= 1.78e-155)) tmp = Float64(-z); else tmp = Float64(x * Float64(-log(Float64(y / x)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -49000000000000.0) || ~((z <= 1.78e-155))) tmp = -z; else tmp = x * -log((y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -49000000000000.0], N[Not[LessEqual[z, 1.78e-155]], $MachinePrecision]], (-z), N[(x * (-N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -49000000000000 \lor \neg \left(z \leq 1.78 \cdot 10^{-155}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\right)\\
\end{array}
\end{array}
if z < -4.9e13 or 1.78e-155 < z Initial program 76.5%
Taylor expanded in x around 0 68.6%
neg-mul-168.6%
Simplified68.6%
if -4.9e13 < z < 1.78e-155Initial program 78.0%
clear-num76.3%
neg-log79.8%
Applied egg-rr79.8%
Taylor expanded in z around 0 66.4%
associate-*r*66.4%
neg-mul-166.4%
Simplified66.4%
Final simplification67.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -130000000.0) (not (<= z 1.78e-155))) (- z) (* x (log (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -130000000.0) || !(z <= 1.78e-155)) {
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 <= (-130000000.0d0)) .or. (.not. (z <= 1.78d-155))) 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 <= -130000000.0) || !(z <= 1.78e-155)) {
tmp = -z;
} else {
tmp = x * Math.log((x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -130000000.0) or not (z <= 1.78e-155): tmp = -z else: tmp = x * math.log((x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -130000000.0) || !(z <= 1.78e-155)) 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 <= -130000000.0) || ~((z <= 1.78e-155))) tmp = -z; else tmp = x * log((x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -130000000.0], N[Not[LessEqual[z, 1.78e-155]], $MachinePrecision]], (-z), N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -130000000 \lor \neg \left(z \leq 1.78 \cdot 10^{-155}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -1.3e8 or 1.78e-155 < z Initial program 76.5%
Taylor expanded in x around 0 68.6%
neg-mul-168.6%
Simplified68.6%
if -1.3e8 < z < 1.78e-155Initial program 78.0%
Taylor expanded in z around 0 63.7%
Final simplification66.6%
(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 77.1%
Taylor expanded in x around 0 48.8%
neg-mul-148.8%
Simplified48.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 77.1%
Taylor expanded in x around 0 48.8%
neg-mul-148.8%
Simplified48.8%
neg-sub048.8%
sub-neg48.8%
add-sqr-sqrt23.3%
sqrt-unprod15.1%
sqr-neg15.1%
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 2024139
(FPCore (x y z)
:name "Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (if (< y 7595077799083773/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* x (log (/ x y))) z) (- (* x (- (log x) (log y))) z)))
(- (* x (log (/ x y))) z))