
(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 (if (<= y -5e-310) (- (* x (- (log (- x)) (log (- y)))) z) (- (- (* x (log x)) (* 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)) - (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)) - (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)) - (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)) - (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(Float64(x * log(x)) - Float64(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)) - (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[(N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision] - N[(x * 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}:\\
\;\;\;\;\left(x \cdot \log x - x \cdot \log y\right) - z\\
\end{array}
\end{array}
if y < -4.999999999999985e-310Initial program 84.9%
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 83.0%
add-sqr-sqrt30.4%
pow230.4%
Applied egg-rr30.4%
unpow230.4%
add-sqr-sqrt83.0%
diff-log99.5%
sub-neg99.5%
distribute-rgt-in99.5%
Applied egg-rr99.5%
Final simplification99.5%
(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+269)))
(* z (+ (* (/ x z) (log (* y x))) -1.0))
(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+269)) {
tmp = z * (((x / z) * log((y * x))) + -1.0);
} 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+269)) tmp = Float64(z * Float64(Float64(Float64(x / z) * log(Float64(y * x))) + -1.0)); 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+269]], $MachinePrecision]], N[(z * N[(N[(N[(x / z), $MachinePrecision] * N[Log[N[(y * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $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^{+269}\right):\\
\;\;\;\;z \cdot \left(\frac{x}{z} \cdot \log \left(y \cdot x\right) + -1\right)\\
\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.0000000000000002e269 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 4.5%
Taylor expanded in z around inf 4.5%
sub-neg4.5%
associate-/l*4.5%
metadata-eval4.5%
Simplified4.5%
clear-num4.5%
un-div-inv4.5%
Applied egg-rr4.5%
frac-2neg4.5%
div-inv4.5%
add-sqr-sqrt1.8%
sqrt-unprod1.9%
sqr-neg1.9%
sqrt-unprod1.1%
add-sqr-sqrt1.8%
diff-log23.6%
distribute-neg-frac223.6%
diff-log1.8%
neg-log1.8%
clear-num1.8%
log-div23.6%
sub-neg23.6%
add-sqr-sqrt18.9%
sqrt-unprod27.2%
sqr-neg27.2%
sqrt-unprod8.3%
add-sqr-sqrt27.3%
+-commutative27.3%
sum-log52.6%
Applied egg-rr52.6%
associate-*r/52.6%
*-rgt-identity52.6%
associate-/r/52.6%
Simplified52.6%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.0000000000000002e269Initial program 99.8%
fma-neg99.8%
Simplified99.8%
Final simplification91.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (log (/ x y)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 5e+269)))
(* z (+ (* (/ x z) (log (* y x))) -1.0))
(- 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+269)) {
tmp = z * (((x / z) * log((y * x))) + -1.0);
} 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+269)) {
tmp = z * (((x / z) * Math.log((y * x))) + -1.0);
} 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+269): tmp = z * (((x / z) * math.log((y * x))) + -1.0) 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+269)) tmp = Float64(z * Float64(Float64(Float64(x / z) * log(Float64(y * x))) + -1.0)); 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+269))) tmp = z * (((x / z) * log((y * x))) + -1.0); 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+269]], $MachinePrecision]], N[(z * N[(N[(N[(x / z), $MachinePrecision] * N[Log[N[(y * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $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^{+269}\right):\\
\;\;\;\;z \cdot \left(\frac{x}{z} \cdot \log \left(y \cdot x\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 5.0000000000000002e269 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 4.5%
Taylor expanded in z around inf 4.5%
sub-neg4.5%
associate-/l*4.5%
metadata-eval4.5%
Simplified4.5%
clear-num4.5%
un-div-inv4.5%
Applied egg-rr4.5%
frac-2neg4.5%
div-inv4.5%
add-sqr-sqrt1.8%
sqrt-unprod1.9%
sqr-neg1.9%
sqrt-unprod1.1%
add-sqr-sqrt1.8%
diff-log23.6%
distribute-neg-frac223.6%
diff-log1.8%
neg-log1.8%
clear-num1.8%
log-div23.6%
sub-neg23.6%
add-sqr-sqrt18.9%
sqrt-unprod27.2%
sqr-neg27.2%
sqrt-unprod8.3%
add-sqr-sqrt27.3%
+-commutative27.3%
sum-log52.6%
Applied egg-rr52.6%
associate-*r/52.6%
*-rgt-identity52.6%
associate-/r/52.6%
Simplified52.6%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.0000000000000002e269Initial program 99.8%
Final simplification91.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (log (/ x y))))) (if (or (<= t_0 (- INFINITY)) (not (<= t_0 5e+269))) (- 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+269)) {
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+269)) {
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+269): 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+269)) 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+269))) 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+269]], $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^{+269}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_0 - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 5.0000000000000002e269 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 4.5%
Taylor expanded in x around 0 48.1%
mul-1-neg48.1%
Simplified48.1%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 5.0000000000000002e269Initial program 99.8%
Final simplification91.2%
(FPCore (x y z) :precision binary64 (if (<= x -5.3e-107) (- (* (- x) (log (/ y x))) z) (if (<= x -5e-309) (- z) (- (* x (- (log x) (log y))) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.3e-107) {
tmp = (-x * log((y / x))) - z;
} else if (x <= -5e-309) {
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.3d-107)) then
tmp = (-x * log((y / x))) - z
else if (x <= (-5d-309)) 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.3e-107) {
tmp = (-x * Math.log((y / x))) - z;
} else if (x <= -5e-309) {
tmp = -z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.3e-107: tmp = (-x * math.log((y / x))) - z elif x <= -5e-309: 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.3e-107) tmp = Float64(Float64(Float64(-x) * log(Float64(y / x))) - z); elseif (x <= -5e-309) 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.3e-107) tmp = (-x * log((y / x))) - z; elseif (x <= -5e-309) tmp = -z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.3e-107], N[(N[((-x) * N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, -5e-309], (-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.3 \cdot 10^{-107}:\\
\;\;\;\;\left(-x\right) \cdot \log \left(\frac{y}{x}\right) - z\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-309}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\end{array}
if x < -5.3e-107Initial program 92.1%
clear-num92.1%
log-div92.6%
metadata-eval92.6%
Applied egg-rr92.6%
neg-sub092.6%
Simplified92.6%
if -5.3e-107 < x < -4.9999999999999995e-309Initial program 67.1%
Taylor expanded in x around 0 88.7%
mul-1-neg88.7%
Simplified88.7%
if -4.9999999999999995e-309 < x Initial program 83.0%
Taylor expanded in x around 0 99.5%
log-rec99.5%
sub-neg99.5%
Simplified99.5%
Final simplification95.9%
(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 84.9%
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 83.0%
Taylor expanded in x around 0 99.5%
log-rec99.5%
sub-neg99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z)
:precision binary64
(if (<= z -4.5e+30)
(- z)
(if (<= z -2.7e-9)
(* x (log (/ x y)))
(if (or (<= z -1.8e-92) (not (<= z 1.45e-55)))
(- z)
(* (- x) (log (/ y x)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.5e+30) {
tmp = -z;
} else if (z <= -2.7e-9) {
tmp = x * log((x / y));
} else if ((z <= -1.8e-92) || !(z <= 1.45e-55)) {
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 <= (-4.5d+30)) then
tmp = -z
else if (z <= (-2.7d-9)) then
tmp = x * log((x / y))
else if ((z <= (-1.8d-92)) .or. (.not. (z <= 1.45d-55))) 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 <= -4.5e+30) {
tmp = -z;
} else if (z <= -2.7e-9) {
tmp = x * Math.log((x / y));
} else if ((z <= -1.8e-92) || !(z <= 1.45e-55)) {
tmp = -z;
} else {
tmp = -x * Math.log((y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.5e+30: tmp = -z elif z <= -2.7e-9: tmp = x * math.log((x / y)) elif (z <= -1.8e-92) or not (z <= 1.45e-55): tmp = -z else: tmp = -x * math.log((y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.5e+30) tmp = Float64(-z); elseif (z <= -2.7e-9) tmp = Float64(x * log(Float64(x / y))); elseif ((z <= -1.8e-92) || !(z <= 1.45e-55)) 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 <= -4.5e+30) tmp = -z; elseif (z <= -2.7e-9) tmp = x * log((x / y)); elseif ((z <= -1.8e-92) || ~((z <= 1.45e-55))) tmp = -z; else tmp = -x * log((y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.5e+30], (-z), If[LessEqual[z, -2.7e-9], N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.8e-92], N[Not[LessEqual[z, 1.45e-55]], $MachinePrecision]], (-z), N[((-x) * N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+30}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-9}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-92} \lor \neg \left(z \leq 1.45 \cdot 10^{-55}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \log \left(\frac{y}{x}\right)\\
\end{array}
\end{array}
if z < -4.49999999999999995e30 or -2.7000000000000002e-9 < z < -1.80000000000000008e-92 or 1.45e-55 < z Initial program 82.1%
Taylor expanded in x around 0 78.3%
mul-1-neg78.3%
Simplified78.3%
if -4.49999999999999995e30 < z < -2.7000000000000002e-9Initial program 80.8%
Taylor expanded in z around 0 79.3%
if -1.80000000000000008e-92 < z < 1.45e-55Initial program 86.6%
clear-num86.6%
log-div87.0%
metadata-eval87.0%
Applied egg-rr87.0%
neg-sub087.0%
Simplified87.0%
Taylor expanded in z around 0 79.9%
neg-mul-179.9%
distribute-lft-neg-in79.9%
*-commutative79.9%
Simplified79.9%
Final simplification78.9%
(FPCore (x y z)
:precision binary64
(if (or (<= z -9.8e+29)
(not (or (<= z -2.3e-12) (and (not (<= z -1.8e-92)) (<= z 7.2e-56)))))
(- z)
(* x (log (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -9.8e+29) || !((z <= -2.3e-12) || (!(z <= -1.8e-92) && (z <= 7.2e-56)))) {
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 <= (-9.8d+29)) .or. (.not. (z <= (-2.3d-12)) .or. (.not. (z <= (-1.8d-92))) .and. (z <= 7.2d-56))) 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 <= -9.8e+29) || !((z <= -2.3e-12) || (!(z <= -1.8e-92) && (z <= 7.2e-56)))) {
tmp = -z;
} else {
tmp = x * Math.log((x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -9.8e+29) or not ((z <= -2.3e-12) or (not (z <= -1.8e-92) and (z <= 7.2e-56))): tmp = -z else: tmp = x * math.log((x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -9.8e+29) || !((z <= -2.3e-12) || (!(z <= -1.8e-92) && (z <= 7.2e-56)))) 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 <= -9.8e+29) || ~(((z <= -2.3e-12) || (~((z <= -1.8e-92)) && (z <= 7.2e-56))))) tmp = -z; else tmp = x * log((x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -9.8e+29], N[Not[Or[LessEqual[z, -2.3e-12], And[N[Not[LessEqual[z, -1.8e-92]], $MachinePrecision], LessEqual[z, 7.2e-56]]]], $MachinePrecision]], (-z), N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.8 \cdot 10^{+29} \lor \neg \left(z \leq -2.3 \cdot 10^{-12} \lor \neg \left(z \leq -1.8 \cdot 10^{-92}\right) \land z \leq 7.2 \cdot 10^{-56}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -9.8000000000000003e29 or -2.29999999999999989e-12 < z < -1.80000000000000008e-92 or 7.19999999999999956e-56 < z Initial program 82.1%
Taylor expanded in x around 0 78.3%
mul-1-neg78.3%
Simplified78.3%
if -9.8000000000000003e29 < z < -2.29999999999999989e-12 or -1.80000000000000008e-92 < z < 7.19999999999999956e-56Initial program 86.0%
Taylor expanded in z around 0 79.4%
Final simplification78.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 83.8%
Taylor expanded in x around 0 49.3%
mul-1-neg49.3%
Simplified49.3%
Final simplification49.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 2024076
(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))