
(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 80.7%
frac-2neg80.7%
log-div99.4%
Applied egg-rr99.4%
if -4.999999999999985e-310 < y Initial program 68.0%
log-div99.7%
Applied egg-rr99.7%
Final simplification99.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (log (/ x y)))))
(if (<= t_0 (- INFINITY))
(- z)
(if (<= t_0 2e+300) (- 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+300) {
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+300) {
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+300: 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+300) 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+300) 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+300], 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^{+300}:\\
\;\;\;\;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.5%
Taylor expanded in x around 0 58.8%
neg-mul-158.8%
Simplified58.8%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 2.0000000000000001e300Initial program 99.8%
if 2.0000000000000001e300 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 7.8%
Taylor expanded in z around 0 7.8%
log-div62.5%
Applied egg-rr54.2%
Final simplification88.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (log (/ x y))))) (if (<= t_0 (- INFINITY)) (- z) (if (<= t_0 2e+300) (- t_0 z) (- z)))))
double code(double x, double y, double z) {
double t_0 = x * log((x / y));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = -z;
} else if (t_0 <= 2e+300) {
tmp = t_0 - z;
} else {
tmp = -z;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = x * Math.log((x / y));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = -z;
} else if (t_0 <= 2e+300) {
tmp = t_0 - z;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = x * math.log((x / y)) tmp = 0 if t_0 <= -math.inf: tmp = -z elif t_0 <= 2e+300: tmp = t_0 - z else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(x * log(Float64(x / y))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(-z); elseif (t_0 <= 2e+300) tmp = Float64(t_0 - z); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * log((x / y)); tmp = 0.0; if (t_0 <= -Inf) tmp = -z; elseif (t_0 <= 2e+300) tmp = t_0 - z; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], (-z), If[LessEqual[t$95$0, 2e+300], N[(t$95$0 - z), $MachinePrecision], (-z)]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;-z\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+300}:\\
\;\;\;\;t_0 - z\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 2.0000000000000001e300 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 6.2%
Taylor expanded in x around 0 50.1%
neg-mul-150.1%
Simplified50.1%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 2.0000000000000001e300Initial program 99.8%
Final simplification86.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (- x) (log (/ y x))) z)))
(if (<= x -1.42e+145)
(* x (- (log (- x)) (log (- y))))
(if (<= x -4.8e-157)
t_0
(if (<= x 1.7e-134)
(- z)
(if (<= x 2.1e+208) t_0 (* x (- (log x) (log y)))))))))
double code(double x, double y, double z) {
double t_0 = (-x * log((y / x))) - z;
double tmp;
if (x <= -1.42e+145) {
tmp = x * (log(-x) - log(-y));
} else if (x <= -4.8e-157) {
tmp = t_0;
} else if (x <= 1.7e-134) {
tmp = -z;
} else if (x <= 2.1e+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((y / x))) - z
if (x <= (-1.42d+145)) then
tmp = x * (log(-x) - log(-y))
else if (x <= (-4.8d-157)) then
tmp = t_0
else if (x <= 1.7d-134) then
tmp = -z
else if (x <= 2.1d+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((y / x))) - z;
double tmp;
if (x <= -1.42e+145) {
tmp = x * (Math.log(-x) - Math.log(-y));
} else if (x <= -4.8e-157) {
tmp = t_0;
} else if (x <= 1.7e-134) {
tmp = -z;
} else if (x <= 2.1e+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((y / x))) - z tmp = 0 if x <= -1.42e+145: tmp = x * (math.log(-x) - math.log(-y)) elif x <= -4.8e-157: tmp = t_0 elif x <= 1.7e-134: tmp = -z elif x <= 2.1e+208: tmp = t_0 else: tmp = x * (math.log(x) - math.log(y)) return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(-x) * log(Float64(y / x))) - z) tmp = 0.0 if (x <= -1.42e+145) tmp = Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))); elseif (x <= -4.8e-157) tmp = t_0; elseif (x <= 1.7e-134) tmp = Float64(-z); elseif (x <= 2.1e+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((y / x))) - z; tmp = 0.0; if (x <= -1.42e+145) tmp = x * (log(-x) - log(-y)); elseif (x <= -4.8e-157) tmp = t_0; elseif (x <= 1.7e-134) tmp = -z; elseif (x <= 2.1e+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[(y / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[x, -1.42e+145], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.8e-157], t$95$0, If[LessEqual[x, 1.7e-134], (-z), If[LessEqual[x, 2.1e+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 := \left(-x\right) \cdot \log \left(\frac{y}{x}\right) - z\\
\mathbf{if}\;x \leq -1.42 \cdot 10^{+145}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-157}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-134}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+208}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right)\\
\end{array}
\end{array}
if x < -1.41999999999999991e145Initial program 72.1%
Taylor expanded in z around 0 69.3%
frac-2neg72.1%
log-div99.0%
Applied egg-rr92.4%
if -1.41999999999999991e145 < x < -4.8e-157 or 1.69999999999999988e-134 < x < 2.0999999999999998e208Initial program 90.5%
clear-num42.8%
neg-log44.0%
Applied egg-rr91.7%
if -4.8e-157 < x < 1.69999999999999988e-134Initial program 59.3%
Taylor expanded in x around 0 91.3%
neg-mul-191.3%
Simplified91.3%
if 2.0999999999999998e208 < x Initial program 40.2%
Taylor expanded in z around 0 40.2%
log-div99.5%
Applied egg-rr95.1%
Final simplification92.0%
(FPCore (x y z)
:precision binary64
(if (<= x -1.8e+149)
(* x (- (log (- x)) (log (- y))))
(if (<= x -9e-154)
(- (* (- x) (log (/ y x))) z)
(if (<= x -2e-308) (- z) (- (* x (- (log x) (log y))) z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.8e+149) {
tmp = x * (log(-x) - log(-y));
} else if (x <= -9e-154) {
tmp = (-x * log((y / x))) - z;
} else if (x <= -2e-308) {
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 <= (-1.8d+149)) then
tmp = x * (log(-x) - log(-y))
else if (x <= (-9d-154)) then
tmp = (-x * log((y / x))) - z
else if (x <= (-2d-308)) 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 <= -1.8e+149) {
tmp = x * (Math.log(-x) - Math.log(-y));
} else if (x <= -9e-154) {
tmp = (-x * Math.log((y / x))) - z;
} else if (x <= -2e-308) {
tmp = -z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.8e+149: tmp = x * (math.log(-x) - math.log(-y)) elif x <= -9e-154: tmp = (-x * math.log((y / x))) - z elif x <= -2e-308: tmp = -z else: tmp = (x * (math.log(x) - math.log(y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.8e+149) tmp = Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))); elseif (x <= -9e-154) tmp = Float64(Float64(Float64(-x) * log(Float64(y / x))) - z); elseif (x <= -2e-308) 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 <= -1.8e+149) tmp = x * (log(-x) - log(-y)); elseif (x <= -9e-154) tmp = (-x * log((y / x))) - z; elseif (x <= -2e-308) tmp = -z; else tmp = (x * (log(x) - log(y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.8e+149], N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9e-154], N[(N[((-x) * N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, -2e-308], (-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 -1.8 \cdot 10^{+149}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;x \leq -9 \cdot 10^{-154}:\\
\;\;\;\;\left(-x\right) \cdot \log \left(\frac{y}{x}\right) - z\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-308}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\end{array}
if x < -1.79999999999999997e149Initial program 72.1%
Taylor expanded in z around 0 69.3%
frac-2neg72.1%
log-div99.0%
Applied egg-rr92.4%
if -1.79999999999999997e149 < x < -8.9999999999999994e-154Initial program 92.4%
clear-num45.6%
neg-log46.4%
Applied egg-rr93.2%
if -8.9999999999999994e-154 < x < -1.9999999999999998e-308Initial program 68.3%
Taylor expanded in x around 0 90.8%
neg-mul-190.8%
Simplified90.8%
if -1.9999999999999998e-308 < x Initial program 68.0%
log-div99.7%
Applied egg-rr99.7%
Final simplification95.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- x) (log (/ y x)))))
(if (<= x -8e+34)
t_0
(if (<= x -4e-32)
(- z)
(if (<= x -2.6e-47)
(* x (log (/ x y)))
(if (<= x 6.2e+138) (- z) t_0))))))
double code(double x, double y, double z) {
double t_0 = -x * log((y / x));
double tmp;
if (x <= -8e+34) {
tmp = t_0;
} else if (x <= -4e-32) {
tmp = -z;
} else if (x <= -2.6e-47) {
tmp = x * log((x / y));
} else if (x <= 6.2e+138) {
tmp = -z;
} else {
tmp = t_0;
}
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((y / x))
if (x <= (-8d+34)) then
tmp = t_0
else if (x <= (-4d-32)) then
tmp = -z
else if (x <= (-2.6d-47)) then
tmp = x * log((x / y))
else if (x <= 6.2d+138) then
tmp = -z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -x * Math.log((y / x));
double tmp;
if (x <= -8e+34) {
tmp = t_0;
} else if (x <= -4e-32) {
tmp = -z;
} else if (x <= -2.6e-47) {
tmp = x * Math.log((x / y));
} else if (x <= 6.2e+138) {
tmp = -z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -x * math.log((y / x)) tmp = 0 if x <= -8e+34: tmp = t_0 elif x <= -4e-32: tmp = -z elif x <= -2.6e-47: tmp = x * math.log((x / y)) elif x <= 6.2e+138: tmp = -z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-x) * log(Float64(y / x))) tmp = 0.0 if (x <= -8e+34) tmp = t_0; elseif (x <= -4e-32) tmp = Float64(-z); elseif (x <= -2.6e-47) tmp = Float64(x * log(Float64(x / y))); elseif (x <= 6.2e+138) tmp = Float64(-z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -x * log((y / x)); tmp = 0.0; if (x <= -8e+34) tmp = t_0; elseif (x <= -4e-32) tmp = -z; elseif (x <= -2.6e-47) tmp = x * log((x / y)); elseif (x <= 6.2e+138) tmp = -z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[((-x) * N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8e+34], t$95$0, If[LessEqual[x, -4e-32], (-z), If[LessEqual[x, -2.6e-47], N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.2e+138], (-z), t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-x\right) \cdot \log \left(\frac{y}{x}\right)\\
\mathbf{if}\;x \leq -8 \cdot 10^{+34}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-32}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{-47}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+138}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -7.99999999999999956e34 or 6.1999999999999995e138 < x Initial program 71.2%
Taylor expanded in z around 0 62.3%
clear-num62.3%
neg-log63.8%
Applied egg-rr63.8%
if -7.99999999999999956e34 < x < -4.00000000000000022e-32 or -2.6e-47 < x < 6.1999999999999995e138Initial program 76.7%
Taylor expanded in x around 0 79.6%
neg-mul-179.6%
Simplified79.6%
if -4.00000000000000022e-32 < x < -2.6e-47Initial program 100.0%
Taylor expanded in z around 0 100.0%
Final simplification73.5%
(FPCore (x y z)
:precision binary64
(if (or (<= x -6.8e+34)
(not
(or (<= x -5.2e-32) (and (not (<= x -2.7e-43)) (<= x 8.5e+134)))))
(* x (log (/ x y)))
(- z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6.8e+34) || !((x <= -5.2e-32) || (!(x <= -2.7e-43) && (x <= 8.5e+134)))) {
tmp = x * log((x / y));
} else {
tmp = -z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-6.8d+34)) .or. (.not. (x <= (-5.2d-32)) .or. (.not. (x <= (-2.7d-43))) .and. (x <= 8.5d+134))) then
tmp = x * log((x / y))
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -6.8e+34) || !((x <= -5.2e-32) || (!(x <= -2.7e-43) && (x <= 8.5e+134)))) {
tmp = x * Math.log((x / y));
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -6.8e+34) or not ((x <= -5.2e-32) or (not (x <= -2.7e-43) and (x <= 8.5e+134))): tmp = x * math.log((x / y)) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -6.8e+34) || !((x <= -5.2e-32) || (!(x <= -2.7e-43) && (x <= 8.5e+134)))) tmp = Float64(x * log(Float64(x / y))); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -6.8e+34) || ~(((x <= -5.2e-32) || (~((x <= -2.7e-43)) && (x <= 8.5e+134))))) tmp = x * log((x / y)); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -6.8e+34], N[Not[Or[LessEqual[x, -5.2e-32], And[N[Not[LessEqual[x, -2.7e-43]], $MachinePrecision], LessEqual[x, 8.5e+134]]]], $MachinePrecision]], N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-z)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+34} \lor \neg \left(x \leq -5.2 \cdot 10^{-32} \lor \neg \left(x \leq -2.7 \cdot 10^{-43}\right) \land x \leq 8.5 \cdot 10^{+134}\right):\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if x < -6.7999999999999999e34 or -5.1999999999999995e-32 < x < -2.69999999999999991e-43 or 8.50000000000000024e134 < x Initial program 72.5%
Taylor expanded in z around 0 64.0%
if -6.7999999999999999e34 < x < -5.1999999999999995e-32 or -2.69999999999999991e-43 < x < 8.50000000000000024e134Initial program 76.7%
Taylor expanded in x around 0 79.6%
neg-mul-179.6%
Simplified79.6%
Final simplification73.0%
(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 74.9%
Taylor expanded in x around 0 51.1%
neg-mul-151.1%
Simplified51.1%
Final simplification51.1%
(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 2023229
(FPCore (x y z)
:name "Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< y 7.595077799083773e-308) (- (* x (log (/ x y))) z) (- (* x (- (log x) (log y))) z))
(- (* x (log (/ x y))) z))