
(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 10 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 76.3%
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 81.5%
Taylor expanded in x around 0 99.4%
log-rec99.4%
sub-neg99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (log (/ x y))) (t_1 (* x t_0)) (t_2 (* x (log (* y x)))))
(if (<= t_1 (- INFINITY))
(- t_2 z)
(if (<= t_1 5e+305) (fma x t_0 (- z)) (- (fabs t_2) z)))))
double code(double x, double y, double z) {
double t_0 = log((x / y));
double t_1 = x * t_0;
double t_2 = x * log((y * x));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2 - z;
} else if (t_1 <= 5e+305) {
tmp = fma(x, t_0, -z);
} else {
tmp = fabs(t_2) - z;
}
return tmp;
}
function code(x, y, z) t_0 = log(Float64(x / y)) t_1 = Float64(x * t_0) t_2 = Float64(x * log(Float64(y * x))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(t_2 - z); elseif (t_1 <= 5e+305) tmp = fma(x, t_0, Float64(-z)); else tmp = Float64(abs(t_2) - 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]}, Block[{t$95$2 = N[(x * N[Log[N[(y * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(t$95$2 - z), $MachinePrecision], If[LessEqual[t$95$1, 5e+305], N[(x * t$95$0 + (-z)), $MachinePrecision], N[(N[Abs[t$95$2], $MachinePrecision] - z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\frac{x}{y}\right)\\
t_1 := x \cdot t\_0\\
t_2 := x \cdot \log \left(y \cdot x\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2 - z\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(x, t\_0, -z\right)\\
\mathbf{else}:\\
\;\;\;\;\left|t\_2\right| - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0Initial program 7.7%
add-cube-cbrt7.7%
pow37.7%
Applied egg-rr7.7%
rem-cube-cbrt7.7%
diff-log40.6%
sub-neg40.6%
distribute-rgt-in40.6%
Applied egg-rr40.6%
distribute-rgt-out40.6%
sub-neg40.6%
log-div7.7%
*-commutative7.7%
log-div40.6%
sub-neg40.6%
add-log-exp40.6%
sum-log1.0%
add-sqr-sqrt0.0%
sqrt-unprod36.9%
sqr-neg36.9%
sqrt-unprod36.9%
add-sqr-sqrt36.9%
add-exp-log48.9%
Applied egg-rr48.9%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.00000000000000009e305Initial program 99.8%
fma-neg99.8%
Simplified99.8%
if 5.00000000000000009e305 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 8.2%
add-cube-cbrt8.2%
pow38.2%
Applied egg-rr8.2%
rem-cube-cbrt8.2%
diff-log49.8%
sub-neg49.8%
distribute-rgt-in49.9%
Applied egg-rr49.9%
add-sqr-sqrt49.7%
sqrt-unprod17.5%
pow217.5%
distribute-rgt-out17.5%
add-log-exp17.5%
sum-log6.5%
add-sqr-sqrt2.7%
sqrt-unprod6.5%
sqr-neg6.5%
sqrt-unprod3.8%
add-sqr-sqrt14.4%
add-exp-log58.0%
Applied egg-rr58.0%
unpow258.0%
rem-sqrt-square71.3%
Simplified71.3%
Final simplification90.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (log (/ x y))) (t_1 (* x t_0)) (t_2 (log (* y x))))
(if (<= t_1 (- INFINITY))
(- (* x (fabs t_2)) z)
(if (<= t_1 5e+305) (fma x t_0 (- z)) (- (fabs (* x t_2)) z)))))
double code(double x, double y, double z) {
double t_0 = log((x / y));
double t_1 = x * t_0;
double t_2 = log((y * x));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x * fabs(t_2)) - z;
} else if (t_1 <= 5e+305) {
tmp = fma(x, t_0, -z);
} else {
tmp = fabs((x * t_2)) - z;
}
return tmp;
}
function code(x, y, z) t_0 = log(Float64(x / y)) t_1 = Float64(x * t_0) t_2 = log(Float64(y * x)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x * abs(t_2)) - z); elseif (t_1 <= 5e+305) tmp = fma(x, t_0, Float64(-z)); else tmp = Float64(abs(Float64(x * t_2)) - 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]}, Block[{t$95$2 = N[Log[N[(y * x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[t$95$1, 5e+305], N[(x * t$95$0 + (-z)), $MachinePrecision], N[(N[Abs[N[(x * t$95$2), $MachinePrecision]], $MachinePrecision] - z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\frac{x}{y}\right)\\
t_1 := x \cdot t\_0\\
t_2 := \log \left(y \cdot x\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x \cdot \left|t\_2\right| - z\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(x, t\_0, -z\right)\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot t\_2\right| - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0Initial program 7.7%
add-cube-cbrt7.7%
pow37.7%
Applied egg-rr7.7%
rem-cube-cbrt7.7%
add-sqr-sqrt6.6%
sqrt-unprod7.3%
pow27.3%
log-div36.8%
sub-neg36.8%
add-log-exp36.8%
sum-log0.6%
add-sqr-sqrt0.0%
sqrt-unprod36.8%
sqr-neg36.8%
sqrt-unprod36.8%
add-sqr-sqrt36.8%
add-exp-log52.0%
Applied egg-rr52.0%
unpow252.0%
rem-sqrt-square52.0%
Simplified52.0%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.00000000000000009e305Initial program 99.8%
fma-neg99.8%
Simplified99.8%
if 5.00000000000000009e305 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 8.2%
add-cube-cbrt8.2%
pow38.2%
Applied egg-rr8.2%
rem-cube-cbrt8.2%
diff-log49.8%
sub-neg49.8%
distribute-rgt-in49.9%
Applied egg-rr49.9%
add-sqr-sqrt49.7%
sqrt-unprod17.5%
pow217.5%
distribute-rgt-out17.5%
add-log-exp17.5%
sum-log6.5%
add-sqr-sqrt2.7%
sqrt-unprod6.5%
sqr-neg6.5%
sqrt-unprod3.8%
add-sqr-sqrt14.4%
add-exp-log58.0%
Applied egg-rr58.0%
unpow258.0%
rem-sqrt-square71.3%
Simplified71.3%
Final simplification90.9%
(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 5e+305)))
(- (* x (log (* y x))) 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 <= 5e+305)) {
tmp = (x * log((y * x))) - 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 <= 5e+305)) tmp = Float64(Float64(x * log(Float64(y * x))) - 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, 5e+305]], $MachinePrecision]], N[(N[(x * N[Log[N[(y * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], 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 5 \cdot 10^{+305}\right):\\
\;\;\;\;x \cdot \log \left(y \cdot x\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 5.00000000000000009e305 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 7.9%
add-cube-cbrt7.9%
pow37.9%
Applied egg-rr7.9%
rem-cube-cbrt7.9%
diff-log44.7%
sub-neg44.7%
distribute-rgt-in44.8%
Applied egg-rr44.8%
distribute-rgt-out44.7%
sub-neg44.7%
log-div7.9%
*-commutative7.9%
log-div44.7%
sub-neg44.7%
add-log-exp44.7%
sum-log3.5%
add-sqr-sqrt1.2%
sqrt-unprod23.3%
sqr-neg23.3%
sqrt-unprod22.1%
add-sqr-sqrt31.6%
add-exp-log57.3%
Applied egg-rr57.3%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.00000000000000009e305Initial program 99.8%
fma-neg99.8%
Simplified99.8%
Final simplification90.2%
(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 7.9%
Taylor expanded in x around 0 51.1%
mul-1-neg51.1%
Simplified51.1%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.00000000000000009e305Initial program 99.8%
Final simplification88.8%
(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 7.9%
add-cube-cbrt7.9%
pow37.9%
Applied egg-rr7.9%
rem-cube-cbrt7.9%
diff-log44.7%
sub-neg44.7%
distribute-rgt-in44.8%
Applied egg-rr44.8%
distribute-rgt-out44.7%
sub-neg44.7%
log-div7.9%
*-commutative7.9%
log-div44.7%
sub-neg44.7%
add-log-exp44.7%
sum-log3.5%
add-sqr-sqrt1.2%
sqrt-unprod23.3%
sqr-neg23.3%
sqrt-unprod22.1%
add-sqr-sqrt31.6%
add-exp-log57.3%
Applied egg-rr57.3%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.00000000000000009e305Initial program 99.8%
Final simplification90.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -8e-114) (not (<= z 2.6e-48))) (- z) (* (- x) (log (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8e-114) || !(z <= 2.6e-48)) {
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 <= (-8d-114)) .or. (.not. (z <= 2.6d-48))) 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 <= -8e-114) || !(z <= 2.6e-48)) {
tmp = -z;
} else {
tmp = -x * Math.log((y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8e-114) or not (z <= 2.6e-48): tmp = -z else: tmp = -x * math.log((y / x)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8e-114) || !(z <= 2.6e-48)) tmp = Float64(-z); else tmp = Float64(Float64(-x) * log(Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -8e-114) || ~((z <= 2.6e-48))) tmp = -z; else tmp = -x * log((y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8e-114], N[Not[LessEqual[z, 2.6e-48]], $MachinePrecision]], (-z), N[((-x) * N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{-114} \lor \neg \left(z \leq 2.6 \cdot 10^{-48}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \log \left(\frac{y}{x}\right)\\
\end{array}
\end{array}
if z < -8.0000000000000004e-114 or 2.59999999999999987e-48 < z Initial program 77.3%
Taylor expanded in x around 0 68.6%
mul-1-neg68.6%
Simplified68.6%
if -8.0000000000000004e-114 < z < 2.59999999999999987e-48Initial program 81.9%
clear-num81.9%
log-div83.9%
metadata-eval83.9%
Applied egg-rr83.9%
neg-sub083.9%
Simplified83.9%
Taylor expanded in z around 0 79.1%
neg-mul-179.1%
distribute-lft-neg-in79.1%
*-commutative79.1%
Simplified79.1%
Final simplification72.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.48e-117) (not (<= z 4.4e-49))) (- z) (* x (log (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.48e-117) || !(z <= 4.4e-49)) {
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 <= (-1.48d-117)) .or. (.not. (z <= 4.4d-49))) 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 <= -1.48e-117) || !(z <= 4.4e-49)) {
tmp = -z;
} else {
tmp = x * Math.log((x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.48e-117) or not (z <= 4.4e-49): tmp = -z else: tmp = x * math.log((x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.48e-117) || !(z <= 4.4e-49)) 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 <= -1.48e-117) || ~((z <= 4.4e-49))) tmp = -z; else tmp = x * log((x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.48e-117], N[Not[LessEqual[z, 4.4e-49]], $MachinePrecision]], (-z), N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.48 \cdot 10^{-117} \lor \neg \left(z \leq 4.4 \cdot 10^{-49}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -1.48000000000000006e-117 or 4.3999999999999998e-49 < z Initial program 77.3%
Taylor expanded in x around 0 68.6%
mul-1-neg68.6%
Simplified68.6%
if -1.48000000000000006e-117 < z < 4.3999999999999998e-49Initial program 81.9%
Taylor expanded in z around 0 77.1%
Final simplification71.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 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.0%
Taylor expanded in x around 0 48.8%
mul-1-neg48.8%
Simplified48.8%
Final simplification48.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.0%
Taylor expanded in x around inf 47.2%
log-rec47.2%
mul-1-neg47.2%
unsub-neg47.2%
mul-1-neg47.2%
log-rec47.2%
remove-double-neg47.2%
associate-+r-47.2%
+-commutative47.2%
sub-neg47.2%
Simplified47.2%
Taylor expanded in x around 0 38.6%
mul-1-neg38.6%
distribute-frac-neg238.6%
Simplified38.6%
clear-num38.5%
un-div-inv39.1%
add-sqr-sqrt17.9%
sqrt-unprod12.3%
sqr-neg12.3%
sqrt-unprod1.1%
add-sqr-sqrt2.2%
Applied egg-rr2.2%
associate-/r/2.2%
*-inverses2.2%
*-lft-identity2.2%
Simplified2.2%
Final simplification2.2%
(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 2024082
(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))