
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + log(t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + log(t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
(FPCore (x y z t) :precision binary64 (fma (log y) x (- (- (log t) z) y)))
double code(double x, double y, double z, double t) {
return fma(log(y), x, ((log(t) - z) - y));
}
function code(x, y, z, t) return fma(log(y), x, Float64(Float64(log(t) - z) - y)) end
code[x_, y_, z_, t_] := N[(N[Log[y], $MachinePrecision] * x + N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x, \left(\log t - z\right) - y\right)
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift--.f64N/A
sub-negN/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower--.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- (- t_1 y) z)))
(if (<= t_2 -5e+14)
(/ 1.0 (/ 1.0 (- (- z) y)))
(if (<= t_2 5e-5) (+ (- y) (log t)) (if (<= t_2 1e+169) (- z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double t_2 = (t_1 - y) - z;
double tmp;
if (t_2 <= -5e+14) {
tmp = 1.0 / (1.0 / (-z - y));
} else if (t_2 <= 5e-5) {
tmp = -y + log(t);
} else if (t_2 <= 1e+169) {
tmp = -z;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * log(y)
t_2 = (t_1 - y) - z
if (t_2 <= (-5d+14)) then
tmp = 1.0d0 / (1.0d0 / (-z - y))
else if (t_2 <= 5d-5) then
tmp = -y + log(t)
else if (t_2 <= 1d+169) then
tmp = -z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * Math.log(y);
double t_2 = (t_1 - y) - z;
double tmp;
if (t_2 <= -5e+14) {
tmp = 1.0 / (1.0 / (-z - y));
} else if (t_2 <= 5e-5) {
tmp = -y + Math.log(t);
} else if (t_2 <= 1e+169) {
tmp = -z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) t_2 = (t_1 - y) - z tmp = 0 if t_2 <= -5e+14: tmp = 1.0 / (1.0 / (-z - y)) elif t_2 <= 5e-5: tmp = -y + math.log(t) elif t_2 <= 1e+169: tmp = -z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) t_2 = Float64(Float64(t_1 - y) - z) tmp = 0.0 if (t_2 <= -5e+14) tmp = Float64(1.0 / Float64(1.0 / Float64(Float64(-z) - y))); elseif (t_2 <= 5e-5) tmp = Float64(Float64(-y) + log(t)); elseif (t_2 <= 1e+169) tmp = Float64(-z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); t_2 = (t_1 - y) - z; tmp = 0.0; if (t_2 <= -5e+14) tmp = 1.0 / (1.0 / (-z - y)); elseif (t_2 <= 5e-5) tmp = -y + log(t); elseif (t_2 <= 1e+169) tmp = -z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 - y), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+14], N[(1.0 / N[(1.0 / N[((-z) - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e-5], N[((-y) + N[Log[t], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+169], (-z), t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \left(t\_1 - y\right) - z\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+14}:\\
\;\;\;\;\frac{1}{\frac{1}{\left(-z\right) - y}}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\left(-y\right) + \log t\\
\mathbf{elif}\;t\_2 \leq 10^{+169}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) < -5e14Initial program 99.9%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
Applied rewrites99.7%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6476.4
Applied rewrites76.4%
if -5e14 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) < 5.00000000000000024e-5Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6494.9
Applied rewrites94.9%
if 5.00000000000000024e-5 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) < 9.99999999999999934e168Initial program 99.7%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6461.4
Applied rewrites61.4%
if 9.99999999999999934e168 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6469.2
Applied rewrites69.2%
Final simplification76.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)))
(if (<= t_1 -4e+156)
(fma (log y) x (- y))
(if (<= t_1 -4000000000000.0)
(* (fma (/ (log y) z) x (- (/ (- y) z) 1.0)) z)
(if (<= t_1 5e-8) (- (- (log t) y) z) (fma (log y) x (- z)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double tmp;
if (t_1 <= -4e+156) {
tmp = fma(log(y), x, -y);
} else if (t_1 <= -4000000000000.0) {
tmp = fma((log(y) / z), x, ((-y / z) - 1.0)) * z;
} else if (t_1 <= 5e-8) {
tmp = (log(t) - y) - z;
} else {
tmp = fma(log(y), x, -z);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - y) tmp = 0.0 if (t_1 <= -4e+156) tmp = fma(log(y), x, Float64(-y)); elseif (t_1 <= -4000000000000.0) tmp = Float64(fma(Float64(log(y) / z), x, Float64(Float64(Float64(-y) / z) - 1.0)) * z); elseif (t_1 <= 5e-8) tmp = Float64(Float64(log(t) - y) - z); else tmp = fma(log(y), x, Float64(-z)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+156], N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision], If[LessEqual[t$95$1, -4000000000000.0], N[(N[(N[(N[Log[y], $MachinePrecision] / z), $MachinePrecision] * x + N[(N[((-y) / z), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t$95$1, 5e-8], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x + (-z)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+156}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -y\right)\\
\mathbf{elif}\;t\_1 \leq -4000000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{\log y}{z}, x, \frac{-y}{z} - 1\right) \cdot z\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-8}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -z\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -3.9999999999999999e156Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift--.f64N/A
sub-negN/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6491.4
Applied rewrites91.4%
if -3.9999999999999999e156 < (-.f64 (*.f64 x (log.f64 y)) y) < -4e12Initial program 99.9%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
Applied rewrites99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites94.2%
Taylor expanded in y around inf
Applied rewrites93.9%
if -4e12 < (-.f64 (*.f64 x (log.f64 y)) y) < 4.9999999999999998e-8Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-log.f6498.4
Applied rewrites98.4%
if 4.9999999999999998e-8 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift--.f64N/A
sub-negN/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6497.5
Applied rewrites97.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)))
(if (<= t_1 -2e+168)
(fma (log y) x (- y))
(if (<= t_1 5e-8) (- (- (log t) y) z) (fma (log y) x (- z))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double tmp;
if (t_1 <= -2e+168) {
tmp = fma(log(y), x, -y);
} else if (t_1 <= 5e-8) {
tmp = (log(t) - y) - z;
} else {
tmp = fma(log(y), x, -z);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - y) tmp = 0.0 if (t_1 <= -2e+168) tmp = fma(log(y), x, Float64(-y)); elseif (t_1 <= 5e-8) tmp = Float64(Float64(log(t) - y) - z); else tmp = fma(log(y), x, Float64(-z)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+168], N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision], If[LessEqual[t$95$1, 5e-8], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x + (-z)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+168}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -y\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-8}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -z\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -1.9999999999999999e168Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift--.f64N/A
sub-negN/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6493.3
Applied rewrites93.3%
if -1.9999999999999999e168 < (-.f64 (*.f64 x (log.f64 y)) y) < 4.9999999999999998e-8Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-log.f6491.3
Applied rewrites91.3%
if 4.9999999999999998e-8 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift--.f64N/A
sub-negN/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6497.5
Applied rewrites97.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- t_1 y)))
(if (<= t_2 -50000000.0)
(/ 1.0 (/ 1.0 (- (- z) y)))
(if (<= t_2 2e+42) (+ (- z) (log t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double t_2 = t_1 - y;
double tmp;
if (t_2 <= -50000000.0) {
tmp = 1.0 / (1.0 / (-z - y));
} else if (t_2 <= 2e+42) {
tmp = -z + log(t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * log(y)
t_2 = t_1 - y
if (t_2 <= (-50000000.0d0)) then
tmp = 1.0d0 / (1.0d0 / (-z - y))
else if (t_2 <= 2d+42) then
tmp = -z + log(t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * Math.log(y);
double t_2 = t_1 - y;
double tmp;
if (t_2 <= -50000000.0) {
tmp = 1.0 / (1.0 / (-z - y));
} else if (t_2 <= 2e+42) {
tmp = -z + Math.log(t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) t_2 = t_1 - y tmp = 0 if t_2 <= -50000000.0: tmp = 1.0 / (1.0 / (-z - y)) elif t_2 <= 2e+42: tmp = -z + math.log(t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) t_2 = Float64(t_1 - y) tmp = 0.0 if (t_2 <= -50000000.0) tmp = Float64(1.0 / Float64(1.0 / Float64(Float64(-z) - y))); elseif (t_2 <= 2e+42) tmp = Float64(Float64(-z) + log(t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); t_2 = t_1 - y; tmp = 0.0; if (t_2 <= -50000000.0) tmp = 1.0 / (1.0 / (-z - y)); elseif (t_2 <= 2e+42) tmp = -z + log(t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - y), $MachinePrecision]}, If[LessEqual[t$95$2, -50000000.0], N[(1.0 / N[(1.0 / N[((-z) - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+42], N[((-z) + N[Log[t], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := t\_1 - y\\
\mathbf{if}\;t\_2 \leq -50000000:\\
\;\;\;\;\frac{1}{\frac{1}{\left(-z\right) - y}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+42}:\\
\;\;\;\;\left(-z\right) + \log t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -5e7Initial program 99.9%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
Applied rewrites99.7%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6476.0
Applied rewrites76.0%
if -5e7 < (-.f64 (*.f64 x (log.f64 y)) y) < 2.00000000000000009e42Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6494.4
Applied rewrites94.4%
if 2.00000000000000009e42 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6483.5
Applied rewrites83.5%
Final simplification82.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma (/ (log y) z) x (- (/ (- y) z) 1.0)) z)))
(if (<= z -1400.0)
t_1
(if (<= z 520.0) (- (fma (log y) x (log t)) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((log(y) / z), x, ((-y / z) - 1.0)) * z;
double tmp;
if (z <= -1400.0) {
tmp = t_1;
} else if (z <= 520.0) {
tmp = fma(log(y), x, log(t)) - y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(Float64(log(y) / z), x, Float64(Float64(Float64(-y) / z) - 1.0)) * z) tmp = 0.0 if (z <= -1400.0) tmp = t_1; elseif (z <= 520.0) tmp = Float64(fma(log(y), x, log(t)) - y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[Log[y], $MachinePrecision] / z), $MachinePrecision] * x + N[(N[((-y) / z), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1400.0], t$95$1, If[LessEqual[z, 520.0], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{\log y}{z}, x, \frac{-y}{z} - 1\right) \cdot z\\
\mathbf{if}\;z \leq -1400:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 520:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1400 or 520 < z Initial program 99.8%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
Applied rewrites99.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.7%
Taylor expanded in y around inf
Applied rewrites98.9%
if -1400 < z < 520Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6499.0
Applied rewrites99.0%
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + log(t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
Initial program 99.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (log y) x (- y)))) (if (<= x -1.1e+36) t_1 (if (<= x 1.65e+62) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(log(y), x, -y);
double tmp;
if (x <= -1.1e+36) {
tmp = t_1;
} else if (x <= 1.65e+62) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(log(y), x, Float64(-y)) tmp = 0.0 if (x <= -1.1e+36) tmp = t_1; elseif (x <= 1.65e+62) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x + (-y)), $MachinePrecision]}, If[LessEqual[x, -1.1e+36], t$95$1, If[LessEqual[x, 1.65e+62], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\log y, x, -y\right)\\
\mathbf{if}\;x \leq -1.1 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+62}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.1e36 or 1.65e62 < x Initial program 99.7%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift--.f64N/A
sub-negN/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower--.f6499.7
Applied rewrites99.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6485.3
Applied rewrites85.3%
if -1.1e36 < x < 1.65e62Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-log.f6497.4
Applied rewrites97.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (log y)))) (if (<= x -6.5e+166) t_1 (if (<= x 4.6e+162) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -6.5e+166) {
tmp = t_1;
} else if (x <= 4.6e+162) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * log(y)
if (x <= (-6.5d+166)) then
tmp = t_1
else if (x <= 4.6d+162) then
tmp = (log(t) - y) - z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * Math.log(y);
double tmp;
if (x <= -6.5e+166) {
tmp = t_1;
} else if (x <= 4.6e+162) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -6.5e+166: tmp = t_1 elif x <= 4.6e+162: tmp = (math.log(t) - y) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -6.5e+166) tmp = t_1; elseif (x <= 4.6e+162) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (x <= -6.5e+166) tmp = t_1; elseif (x <= 4.6e+162) tmp = (log(t) - y) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.5e+166], t$95$1, If[LessEqual[x, 4.6e+162], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+166}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+162}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.5000000000000005e166 or 4.59999999999999987e162 < x Initial program 99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6485.7
Applied rewrites85.7%
if -6.5000000000000005e166 < x < 4.59999999999999987e162Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-log.f6488.6
Applied rewrites88.6%
Final simplification87.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -6.5e+166)
t_1
(if (<= x 4.6e+162) (/ 1.0 (/ 1.0 (- (- z) y))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -6.5e+166) {
tmp = t_1;
} else if (x <= 4.6e+162) {
tmp = 1.0 / (1.0 / (-z - y));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * log(y)
if (x <= (-6.5d+166)) then
tmp = t_1
else if (x <= 4.6d+162) then
tmp = 1.0d0 / (1.0d0 / (-z - y))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * Math.log(y);
double tmp;
if (x <= -6.5e+166) {
tmp = t_1;
} else if (x <= 4.6e+162) {
tmp = 1.0 / (1.0 / (-z - y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -6.5e+166: tmp = t_1 elif x <= 4.6e+162: tmp = 1.0 / (1.0 / (-z - y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -6.5e+166) tmp = t_1; elseif (x <= 4.6e+162) tmp = Float64(1.0 / Float64(1.0 / Float64(Float64(-z) - y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (x <= -6.5e+166) tmp = t_1; elseif (x <= 4.6e+162) tmp = 1.0 / (1.0 / (-z - y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.5e+166], t$95$1, If[LessEqual[x, 4.6e+162], N[(1.0 / N[(1.0 / N[((-z) - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+166}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+162}:\\
\;\;\;\;\frac{1}{\frac{1}{\left(-z\right) - y}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.5000000000000005e166 or 4.59999999999999987e162 < x Initial program 99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6485.7
Applied rewrites85.7%
if -6.5000000000000005e166 < x < 4.59999999999999987e162Initial program 99.9%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
Applied rewrites99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6468.6
Applied rewrites68.6%
Final simplification72.7%
(FPCore (x y z t) :precision binary64 (/ 1.0 (/ 1.0 (- (- z) y))))
double code(double x, double y, double z, double t) {
return 1.0 / (1.0 / (-z - y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 / (1.0d0 / (-z - y))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 / (1.0 / (-z - y));
}
def code(x, y, z, t): return 1.0 / (1.0 / (-z - y))
function code(x, y, z, t) return Float64(1.0 / Float64(1.0 / Float64(Float64(-z) - y))) end
function tmp = code(x, y, z, t) tmp = 1.0 / (1.0 / (-z - y)); end
code[x_, y_, z_, t_] := N[(1.0 / N[(1.0 / N[((-z) - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{1}{\left(-z\right) - y}}
\end{array}
Initial program 99.8%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
Applied rewrites99.7%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6455.4
Applied rewrites55.4%
(FPCore (x y z t) :precision binary64 (if (<= z -6.3e+22) (- z) (if (<= z 1.2e+117) (- y) (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.3e+22) {
tmp = -z;
} else if (z <= 1.2e+117) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-6.3d+22)) then
tmp = -z
else if (z <= 1.2d+117) then
tmp = -y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.3e+22) {
tmp = -z;
} else if (z <= 1.2e+117) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.3e+22: tmp = -z elif z <= 1.2e+117: tmp = -y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.3e+22) tmp = Float64(-z); elseif (z <= 1.2e+117) tmp = Float64(-y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6.3e+22) tmp = -z; elseif (z <= 1.2e+117) tmp = -y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.3e+22], (-z), If[LessEqual[z, 1.2e+117], (-y), (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.3 \cdot 10^{+22}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+117}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -6.30000000000000021e22 or 1.1999999999999999e117 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6466.0
Applied rewrites66.0%
if -6.30000000000000021e22 < z < 1.1999999999999999e117Initial program 99.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6439.6
Applied rewrites39.6%
(FPCore (x y z t) :precision binary64 (- y))
double code(double x, double y, double z, double t) {
return -y;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -y
end function
public static double code(double x, double y, double z, double t) {
return -y;
}
def code(x, y, z, t): return -y
function code(x, y, z, t) return Float64(-y) end
function tmp = code(x, y, z, t) tmp = -y; end
code[x_, y_, z_, t_] := (-y)
\begin{array}{l}
\\
-y
\end{array}
Initial program 99.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6430.3
Applied rewrites30.3%
herbie shell --seed 2024235
(FPCore (x y z t)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, A"
:precision binary64
(+ (- (- (* x (log y)) y) z) (log t)))