
(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 -2e-311) (- (fma (log (/ -1.0 y)) x (* (log (- x)) x)) z) (fma (log x) x (fma (- (log y)) x (- z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2e-311) {
tmp = fma(log((-1.0 / y)), x, (log(-x) * x)) - z;
} else {
tmp = fma(log(x), x, fma(-log(y), x, -z));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -2e-311) tmp = Float64(fma(log(Float64(-1.0 / y)), x, Float64(log(Float64(-x)) * x)) - z); else tmp = fma(log(x), x, fma(Float64(-log(y)), x, Float64(-z))); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -2e-311], N[(N[(N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision] * x + N[(N[Log[(-x)], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[Log[x], $MachinePrecision] * x + N[((-N[Log[y], $MachinePrecision]) * x + (-z)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\mathsf{fma}\left(\log \left(\frac{-1}{y}\right), x, \log \left(-x\right) \cdot x\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log x, x, \mathsf{fma}\left(-\log y, x, -z\right)\right)\\
\end{array}
\end{array}
if y < -1.9999999999999e-311Initial program 82.0%
lift-log.f64N/A
lift-/.f64N/A
clear-numN/A
log-recN/A
lower-neg.f64N/A
lower-log.f64N/A
lower-/.f6482.5
Applied rewrites82.5%
lift-*.f64N/A
lift-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lift-/.f64N/A
clear-numN/A
diff-logN/A
lift-log.f64N/A
lift-log.f64N/A
flip--N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
Applied rewrites82.0%
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
remove-double-divN/A
lift-log.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
diff-logN/A
lift-log.f64N/A
lift-log.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
lower-fma.f64N/A
Applied rewrites99.4%
if -1.9999999999999e-311 < y Initial program 80.4%
lift-log.f64N/A
lift-/.f64N/A
clear-numN/A
log-recN/A
lower-neg.f64N/A
lower-log.f64N/A
lower-/.f6480.4
Applied rewrites80.4%
lift--.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lift-/.f64N/A
clear-numN/A
diff-logN/A
lift-log.f64N/A
lift-log.f64N/A
sub-negN/A
lift-neg.f64N/A
distribute-rgt-outN/A
lift-*.f64N/A
lift-*.f64N/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (log (/ x y))))) (if (or (<= t_0 (- INFINITY)) (not (<= t_0 1e+308))) (- 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 <= 1e+308)) {
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 <= 1e+308)) {
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 <= 1e+308): 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 <= 1e+308)) 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 <= 1e+308))) 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, 1e+308]], $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 10^{+308}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_0 - z\\
\end{array}
\end{array}
if (*.f64 x (log.f64 (/.f64 x y))) < -inf.0 or 1e308 < (*.f64 x (log.f64 (/.f64 x y))) Initial program 5.7%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6465.2
Applied rewrites65.2%
if -inf.0 < (*.f64 x (log.f64 (/.f64 x y))) < 1e308Initial program 99.7%
Final simplification93.0%
(FPCore (x y z) :precision binary64 (if (<= y -2e-311) (fma (- (log (- x)) (log (- y))) x (- z)) (fma (log x) x (fma (- (log y)) x (- z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2e-311) {
tmp = fma((log(-x) - log(-y)), x, -z);
} else {
tmp = fma(log(x), x, fma(-log(y), x, -z));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -2e-311) tmp = fma(Float64(log(Float64(-x)) - log(Float64(-y))), x, Float64(-z)); else tmp = fma(log(x), x, fma(Float64(-log(y)), x, Float64(-z))); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -2e-311], N[(N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision] * x + (-z)), $MachinePrecision], N[(N[Log[x], $MachinePrecision] * x + N[((-N[Log[y], $MachinePrecision]) * x + (-z)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\mathsf{fma}\left(\log \left(-x\right) - \log \left(-y\right), x, -z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log x, x, \mathsf{fma}\left(-\log y, x, -z\right)\right)\\
\end{array}
\end{array}
if y < -1.9999999999999e-311Initial program 82.0%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6482.1
Applied rewrites82.1%
lift-log.f64N/A
lift-/.f64N/A
frac-2negN/A
log-divN/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f64N/A
lower-log.f64N/A
lower-neg.f6499.4
Applied rewrites99.4%
if -1.9999999999999e-311 < y Initial program 80.4%
lift-log.f64N/A
lift-/.f64N/A
clear-numN/A
log-recN/A
lower-neg.f64N/A
lower-log.f64N/A
lower-/.f6480.4
Applied rewrites80.4%
lift--.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lift-/.f64N/A
clear-numN/A
diff-logN/A
lift-log.f64N/A
lift-log.f64N/A
sub-negN/A
lift-neg.f64N/A
distribute-rgt-outN/A
lift-*.f64N/A
lift-*.f64N/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.7%
(FPCore (x y z) :precision binary64 (if (<= y -2e-311) (fma (- (log (- x)) (log (- y))) x (- z)) (- (fma (log x) x (* (- (log y)) x)) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2e-311) {
tmp = fma((log(-x) - log(-y)), x, -z);
} else {
tmp = fma(log(x), x, (-log(y) * x)) - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -2e-311) tmp = fma(Float64(log(Float64(-x)) - log(Float64(-y))), x, Float64(-z)); else tmp = Float64(fma(log(x), x, Float64(Float64(-log(y)) * x)) - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -2e-311], N[(N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision] * x + (-z)), $MachinePrecision], N[(N[(N[Log[x], $MachinePrecision] * x + N[((-N[Log[y], $MachinePrecision]) * x), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\mathsf{fma}\left(\log \left(-x\right) - \log \left(-y\right), x, -z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log x, x, \left(-\log y\right) \cdot x\right) - z\\
\end{array}
\end{array}
if y < -1.9999999999999e-311Initial program 82.0%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6482.1
Applied rewrites82.1%
lift-log.f64N/A
lift-/.f64N/A
frac-2negN/A
log-divN/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f64N/A
lower-log.f64N/A
lower-neg.f6499.4
Applied rewrites99.4%
if -1.9999999999999e-311 < y Initial program 80.4%
lift-*.f64N/A
lift-log.f64N/A
lift-/.f64N/A
log-divN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-log.f6499.7
Applied rewrites99.7%
(FPCore (x y z) :precision binary64 (if (<= x -5.6e-248) (fma (- (log (- x)) (log (- y))) x (- z)) (if (<= x 5.2e-211) (- z) (- (* x (log (/ x y))) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.6e-248) {
tmp = fma((log(-x) - log(-y)), x, -z);
} else if (x <= 5.2e-211) {
tmp = -z;
} else {
tmp = (x * log((x / y))) - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -5.6e-248) tmp = fma(Float64(log(Float64(-x)) - log(Float64(-y))), x, Float64(-z)); elseif (x <= 5.2e-211) tmp = Float64(-z); else tmp = Float64(Float64(x * log(Float64(x / y))) - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -5.6e-248], N[(N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision] * x + (-z)), $MachinePrecision], If[LessEqual[x, 5.2e-211], (-z), N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-248}:\\
\;\;\;\;\mathsf{fma}\left(\log \left(-x\right) - \log \left(-y\right), x, -z\right)\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-211}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\end{array}
\end{array}
if x < -5.6000000000000002e-248Initial program 82.7%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6482.7
Applied rewrites82.7%
lift-log.f64N/A
lift-/.f64N/A
frac-2negN/A
log-divN/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f64N/A
lower-log.f64N/A
lower-neg.f6499.3
Applied rewrites99.3%
if -5.6000000000000002e-248 < x < 5.2e-211Initial program 66.6%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6495.4
Applied rewrites95.4%
if 5.2e-211 < x Initial program 86.8%
(FPCore (x y z) :precision binary64 (if (<= x -5.6e-248) (- (* x (- (log (- x)) (log (- y)))) z) (if (<= x 5.2e-211) (- z) (- (* x (log (/ x y))) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.6e-248) {
tmp = (x * (log(-x) - log(-y))) - z;
} else if (x <= 5.2e-211) {
tmp = -z;
} else {
tmp = (x * log((x / 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.6d-248)) then
tmp = (x * (log(-x) - log(-y))) - z
else if (x <= 5.2d-211) then
tmp = -z
else
tmp = (x * log((x / y))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -5.6e-248) {
tmp = (x * (Math.log(-x) - Math.log(-y))) - z;
} else if (x <= 5.2e-211) {
tmp = -z;
} else {
tmp = (x * Math.log((x / y))) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.6e-248: tmp = (x * (math.log(-x) - math.log(-y))) - z elif x <= 5.2e-211: tmp = -z else: tmp = (x * math.log((x / y))) - z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.6e-248) tmp = Float64(Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))) - z); elseif (x <= 5.2e-211) tmp = Float64(-z); else tmp = Float64(Float64(x * log(Float64(x / y))) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.6e-248) tmp = (x * (log(-x) - log(-y))) - z; elseif (x <= 5.2e-211) tmp = -z; else tmp = (x * log((x / y))) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.6e-248], N[(N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 5.2e-211], (-z), N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-248}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-211}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\end{array}
\end{array}
if x < -5.6000000000000002e-248Initial program 82.7%
lift-log.f64N/A
lift-/.f64N/A
frac-2negN/A
log-divN/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f64N/A
lower-log.f64N/A
lower-neg.f6499.3
Applied rewrites99.3%
if -5.6000000000000002e-248 < x < 5.2e-211Initial program 66.6%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6495.4
Applied rewrites95.4%
if 5.2e-211 < x Initial program 86.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.38e-67) (not (<= z 4.2e-80))) (- z) (* (log (/ y x)) (- x))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.38e-67) || !(z <= 4.2e-80)) {
tmp = -z;
} else {
tmp = log((y / x)) * -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 <= (-1.38d-67)) .or. (.not. (z <= 4.2d-80))) then
tmp = -z
else
tmp = log((y / x)) * -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.38e-67) || !(z <= 4.2e-80)) {
tmp = -z;
} else {
tmp = Math.log((y / x)) * -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.38e-67) or not (z <= 4.2e-80): tmp = -z else: tmp = math.log((y / x)) * -x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.38e-67) || !(z <= 4.2e-80)) tmp = Float64(-z); else tmp = Float64(log(Float64(y / x)) * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.38e-67) || ~((z <= 4.2e-80))) tmp = -z; else tmp = log((y / x)) * -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.38e-67], N[Not[LessEqual[z, 4.2e-80]], $MachinePrecision]], (-z), N[(N[Log[N[(y / x), $MachinePrecision]], $MachinePrecision] * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.38 \cdot 10^{-67} \lor \neg \left(z \leq 4.2 \cdot 10^{-80}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;\log \left(\frac{y}{x}\right) \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -1.38000000000000006e-67 or 4.20000000000000003e-80 < z Initial program 76.4%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6476.3
Applied rewrites76.3%
if -1.38000000000000006e-67 < z < 4.20000000000000003e-80Initial program 90.9%
lift-log.f64N/A
lift-/.f64N/A
clear-numN/A
log-recN/A
lower-neg.f64N/A
lower-log.f64N/A
lower-/.f6491.7
Applied rewrites91.7%
Taylor expanded in z around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6481.4
Applied rewrites81.4%
Final simplification78.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.38e-67) (not (<= z 4.2e-80))) (- z) (* (log (/ x y)) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.38e-67) || !(z <= 4.2e-80)) {
tmp = -z;
} else {
tmp = log((x / 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 <= (-1.38d-67)) .or. (.not. (z <= 4.2d-80))) then
tmp = -z
else
tmp = log((x / y)) * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.38e-67) || !(z <= 4.2e-80)) {
tmp = -z;
} else {
tmp = Math.log((x / y)) * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.38e-67) or not (z <= 4.2e-80): tmp = -z else: tmp = math.log((x / y)) * x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.38e-67) || !(z <= 4.2e-80)) tmp = Float64(-z); else tmp = Float64(log(Float64(x / y)) * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.38e-67) || ~((z <= 4.2e-80))) tmp = -z; else tmp = log((x / y)) * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.38e-67], N[Not[LessEqual[z, 4.2e-80]], $MachinePrecision]], (-z), N[(N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.38 \cdot 10^{-67} \lor \neg \left(z \leq 4.2 \cdot 10^{-80}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;\log \left(\frac{x}{y}\right) \cdot x\\
\end{array}
\end{array}
if z < -1.38000000000000006e-67 or 4.20000000000000003e-80 < z Initial program 76.4%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6476.3
Applied rewrites76.3%
if -1.38000000000000006e-67 < z < 4.20000000000000003e-80Initial program 90.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6480.6
Applied rewrites80.6%
Final simplification77.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 81.4%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6454.7
Applied rewrites54.7%
(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 2024317
(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))