
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z))
double code(double x, double y, double z) {
return (x * log((x / y))) - z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * log((x / y))) - z
end function
public static double code(double x, double y, double z) {
return (x * Math.log((x / y))) - z;
}
def code(x, y, z): return (x * math.log((x / y))) - z
function code(x, y, z) return Float64(Float64(x * log(Float64(x / y))) - z) end
function tmp = code(x, y, z) tmp = (x * log((x / y))) - z; end
code[x_, y_, z_] := N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \log \left(\frac{x}{y}\right) - z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z))
double code(double x, double y, double z) {
return (x * log((x / y))) - z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * log((x / y))) - z
end function
public static double code(double x, double y, double z) {
return (x * Math.log((x / y))) - z;
}
def code(x, y, z): return (x * math.log((x / y))) - z
function code(x, y, z) return Float64(Float64(x * log(Float64(x / y))) - z) end
function tmp = code(x, y, z) tmp = (x * log((x / y))) - z; end
code[x_, y_, z_] := N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \log \left(\frac{x}{y}\right) - z
\end{array}
(FPCore (x y z) :precision binary64 (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.1%
Taylor expanded in y around -inf 99.4%
metadata-eval99.4%
distribute-neg-frac99.4%
distribute-frac-neg299.4%
neg-mul-199.4%
log-rec99.4%
sub-neg99.4%
Simplified99.4%
if -4.999999999999985e-310 < y Initial program 76.1%
Taylor expanded in x around 0 99.7%
log-rec99.7%
neg-mul-199.7%
neg-mul-199.7%
sub-neg99.7%
Simplified99.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (log (/ x y)))))
(if (<= t_0 (- INFINITY))
(- z)
(if (<= t_0 2e+304) (- t_0 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 = -z;
} else if (t_0 <= 2e+304) {
tmp = t_0 - 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 = -z;
} else if (t_0 <= 2e+304) {
tmp = t_0 - 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 = -z elif t_0 <= 2e+304: tmp = t_0 - 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(-z); elseif (t_0 <= 2e+304) tmp = Float64(t_0 - 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 = -z; elseif (t_0 <= 2e+304) tmp = t_0 - 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)], (-z), If[LessEqual[t$95$0, 2e+304], N[(t$95$0 - 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:\\
\;\;\;\;-z\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+304}:\\
\;\;\;\;t\_0 - 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 4.7%
Taylor expanded in x around 0 43.7%
neg-mul-143.7%
Simplified43.7%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.9999999999999999e304Initial program 99.8%
if 1.9999999999999999e304 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 8.0%
add-cbrt-cube8.0%
pow38.0%
Applied egg-rr8.0%
Taylor expanded in x around inf 48.5%
distribute-lft-in48.4%
mul-1-neg48.4%
log-rec48.4%
remove-double-neg48.4%
distribute-lft-in48.5%
+-commutative48.5%
log-rec48.5%
neg-mul-148.5%
neg-mul-148.5%
sub-neg48.5%
Simplified48.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (log (/ x y))))) (if (or (<= t_0 (- INFINITY)) (not (<= t_0 2e+304))) (- 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 <= 2e+304)) {
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 <= 2e+304)) {
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 <= 2e+304): 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 <= 2e+304)) 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 <= 2e+304))) 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, 2e+304]], $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 2 \cdot 10^{+304}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_0 - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 1.9999999999999999e304 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 6.4%
Taylor expanded in x around 0 43.8%
neg-mul-143.8%
Simplified43.8%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1.9999999999999999e304Initial program 99.8%
Final simplification85.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* x (log (/ x y))) z)))
(if (<= x -5.1e+154)
(* x (- (log (- x)) (log (- y))))
(if (<= x -8.5e-219)
t_0
(if (<= x 4.2e-113)
(- z)
(if (<= x 2.8e+208) t_0 (* x (- (log x) (log y)))))))))
double code(double x, double y, double z) {
double t_0 = (x * log((x / y))) - z;
double tmp;
if (x <= -5.1e+154) {
tmp = x * (log(-x) - log(-y));
} else if (x <= -8.5e-219) {
tmp = t_0;
} else if (x <= 4.2e-113) {
tmp = -z;
} else if (x <= 2.8e+208) {
tmp = t_0;
} else {
tmp = x * (log(x) - log(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) :: t_0
real(8) :: tmp
t_0 = (x * log((x / y))) - z
if (x <= (-5.1d+154)) then
tmp = x * (log(-x) - log(-y))
else if (x <= (-8.5d-219)) then
tmp = t_0
else if (x <= 4.2d-113) then
tmp = -z
else if (x <= 2.8d+208) then
tmp = t_0
else
tmp = x * (log(x) - log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x * Math.log((x / y))) - z;
double tmp;
if (x <= -5.1e+154) {
tmp = x * (Math.log(-x) - Math.log(-y));
} else if (x <= -8.5e-219) {
tmp = t_0;
} else if (x <= 4.2e-113) {
tmp = -z;
} else if (x <= 2.8e+208) {
tmp = t_0;
} else {
tmp = x * (Math.log(x) - Math.log(y));
}
return tmp;
}
def code(x, y, z): t_0 = (x * math.log((x / y))) - z tmp = 0 if x <= -5.1e+154: tmp = x * (math.log(-x) - math.log(-y)) elif x <= -8.5e-219: tmp = t_0 elif x <= 4.2e-113: tmp = -z elif x <= 2.8e+208: tmp = t_0 else: tmp = x * (math.log(x) - math.log(y)) return tmp
function code(x, y, z) t_0 = Float64(Float64(x * log(Float64(x / y))) - z) tmp = 0.0 if (x <= -5.1e+154) tmp = Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))); elseif (x <= -8.5e-219) tmp = t_0; elseif (x <= 4.2e-113) tmp = Float64(-z); elseif (x <= 2.8e+208) tmp = t_0; 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))) - z; tmp = 0.0; if (x <= -5.1e+154) tmp = x * (log(-x) - log(-y)); elseif (x <= -8.5e-219) tmp = t_0; elseif (x <= 4.2e-113) tmp = -z; elseif (x <= 2.8e+208) tmp = t_0; else tmp = x * (log(x) - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[x, -5.1e+154], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.5e-219], t$95$0, If[LessEqual[x, 4.2e-113], (-z), If[LessEqual[x, 2.8e+208], t$95$0, 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) - z\\
\mathbf{if}\;x \leq -5.1 \cdot 10^{+154}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{-219}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-113}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+208}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right)\\
\end{array}
\end{array}
if x < -5.0999999999999999e154Initial program 57.2%
Taylor expanded in z around 0 50.6%
Taylor expanded in y around -inf 89.4%
metadata-eval99.1%
distribute-neg-frac99.1%
distribute-frac-neg299.1%
neg-mul-199.1%
log-rec99.1%
sub-neg99.1%
Simplified89.4%
if -5.0999999999999999e154 < x < -8.49999999999999964e-219 or 4.2e-113 < x < 2.80000000000000022e208Initial program 89.9%
if -8.49999999999999964e-219 < x < 4.2e-113Initial program 58.2%
Taylor expanded in x around 0 84.9%
neg-mul-184.9%
Simplified84.9%
if 2.80000000000000022e208 < x Initial program 55.9%
add-cbrt-cube55.5%
pow355.5%
Applied egg-rr55.5%
Taylor expanded in x around inf 99.4%
distribute-lft-in99.0%
mul-1-neg99.0%
log-rec99.0%
remove-double-neg99.0%
distribute-lft-in99.4%
+-commutative99.4%
log-rec99.4%
neg-mul-199.4%
neg-mul-199.4%
sub-neg99.4%
Simplified99.4%
(FPCore (x y z)
:precision binary64
(if (<= x -5.8e+149)
(* x (- (log (- x)) (log (- y))))
(if (<= x -3.6e-219)
(- (* x (log (/ x y))) z)
(if (<= x -1e-307) (- z) (- (* x (- (log x) (log y))) z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.8e+149) {
tmp = x * (log(-x) - log(-y));
} else if (x <= -3.6e-219) {
tmp = (x * log((x / y))) - z;
} else if (x <= -1e-307) {
tmp = -z;
} else {
tmp = (x * (log(x) - log(y))) - z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-5.8d+149)) then
tmp = x * (log(-x) - log(-y))
else if (x <= (-3.6d-219)) then
tmp = (x * log((x / y))) - z
else if (x <= (-1d-307)) then
tmp = -z
else
tmp = (x * (log(x) - log(y))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -5.8e+149) {
tmp = x * (Math.log(-x) - Math.log(-y));
} else if (x <= -3.6e-219) {
tmp = (x * Math.log((x / y))) - z;
} else if (x <= -1e-307) {
tmp = -z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.8e+149: tmp = x * (math.log(-x) - math.log(-y)) elif x <= -3.6e-219: tmp = (x * math.log((x / y))) - z elif x <= -1e-307: tmp = -z else: tmp = (x * (math.log(x) - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.8e+149) tmp = Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))); elseif (x <= -3.6e-219) tmp = Float64(Float64(x * log(Float64(x / y))) - z); elseif (x <= -1e-307) tmp = Float64(-z); else tmp = Float64(Float64(x * Float64(log(x) - log(y))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.8e+149) tmp = x * (log(-x) - log(-y)); elseif (x <= -3.6e-219) tmp = (x * log((x / y))) - z; elseif (x <= -1e-307) tmp = -z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.8e+149], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.6e-219], N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, -1e-307], (-z), N[(N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+149}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;x \leq -3.6 \cdot 10^{-219}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-307}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\end{array}
if x < -5.8000000000000004e149Initial program 57.2%
Taylor expanded in z around 0 50.6%
Taylor expanded in y around -inf 89.4%
metadata-eval99.1%
distribute-neg-frac99.1%
distribute-frac-neg299.1%
neg-mul-199.1%
log-rec99.1%
sub-neg99.1%
Simplified89.4%
if -5.8000000000000004e149 < x < -3.59999999999999974e-219Initial program 91.1%
if -3.59999999999999974e-219 < x < -9.99999999999999909e-308Initial program 40.6%
Taylor expanded in x around 0 84.4%
neg-mul-184.4%
Simplified84.4%
if -9.99999999999999909e-308 < x Initial program 76.1%
Taylor expanded in x around 0 99.7%
log-rec99.7%
neg-mul-199.7%
neg-mul-199.7%
sub-neg99.7%
Simplified99.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -5e-159) (not (<= z 3.1e-56))) (- z) (* x (log (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5e-159) || !(z <= 3.1e-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 <= (-5d-159)) .or. (.not. (z <= 3.1d-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 <= -5e-159) || !(z <= 3.1e-56)) {
tmp = -z;
} else {
tmp = x * Math.log((x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5e-159) or not (z <= 3.1e-56): tmp = -z else: tmp = x * math.log((x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5e-159) || !(z <= 3.1e-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 <= -5e-159) || ~((z <= 3.1e-56))) tmp = -z; else tmp = x * log((x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5e-159], N[Not[LessEqual[z, 3.1e-56]], $MachinePrecision]], (-z), N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-159} \lor \neg \left(z \leq 3.1 \cdot 10^{-56}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -5.00000000000000032e-159 or 3.09999999999999987e-56 < z Initial program 77.3%
Taylor expanded in x around 0 73.2%
neg-mul-173.2%
Simplified73.2%
if -5.00000000000000032e-159 < z < 3.09999999999999987e-56Initial program 74.1%
Taylor expanded in z around 0 67.5%
Final simplification71.1%
(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 76.1%
Taylor expanded in x around 0 49.7%
neg-mul-149.7%
Simplified49.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 z end
function tmp = code(x, y, z) tmp = z; end
code[x_, y_, z_] := z
\begin{array}{l}
\\
z
\end{array}
Initial program 76.1%
Taylor expanded in x around 0 49.7%
neg-mul-149.7%
Simplified49.7%
neg-sub049.7%
sub-neg49.7%
add-sqr-sqrt26.7%
sqrt-unprod16.6%
sqr-neg16.6%
sqrt-unprod1.2%
add-sqr-sqrt2.2%
Applied egg-rr2.2%
+-lft-identity2.2%
Simplified2.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 2024172
(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))