
(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 14 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 x (log y) (- (log t) y)) z))
double code(double x, double y, double z, double t) {
return fma(x, log(y), (log(t) - y)) - z;
}
function code(x, y, z, t) return Float64(fma(x, log(y), Float64(log(t) - y)) - z) end
code[x_, y_, z_, t_] := N[(N[(x * N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \log y, \log t - y\right) - z
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6499.9
Applied rewrites99.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* x (log y)) y)) (t_2 (- (fma x (log y) (- y)) z))) (if (<= t_1 -2e+16) t_2 (if (<= t_1 2e-27) (- (log t) (+ y z)) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double t_2 = fma(x, log(y), -y) - z;
double tmp;
if (t_1 <= -2e+16) {
tmp = t_2;
} else if (t_1 <= 2e-27) {
tmp = log(t) - (y + z);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - y) t_2 = Float64(fma(x, log(y), Float64(-y)) - z) tmp = 0.0 if (t_1 <= -2e+16) tmp = t_2; elseif (t_1 <= 2e-27) tmp = Float64(log(t) - Float64(y + z)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[Log[y], $MachinePrecision] + (-y)), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+16], t$95$2, If[LessEqual[t$95$1, 2e-27], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
t_2 := \mathsf{fma}\left(x, \log y, -y\right) - z\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+16}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-27}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -2e16 or 2.0000000000000001e-27 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6499.5
Applied rewrites99.5%
if -2e16 < (-.f64 (*.f64 x (log.f64 y)) y) < 2.0000000000000001e-27Initial program 99.9%
Taylor expanded in x around 0
lower--.f64N/A
lower-log.f64N/A
lower-+.f6497.5
Applied rewrites97.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (- (* x (log y)) y) z)) (t_2 (- (- z) y))) (if (<= t_1 -2e+16) t_2 (if (<= t_1 10000000.0) (log t) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = ((x * log(y)) - y) - z;
double t_2 = -z - y;
double tmp;
if (t_1 <= -2e+16) {
tmp = t_2;
} else if (t_1 <= 10000000.0) {
tmp = log(t);
} else {
tmp = t_2;
}
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)) - y) - z
t_2 = -z - y
if (t_1 <= (-2d+16)) then
tmp = t_2
else if (t_1 <= 10000000.0d0) then
tmp = log(t)
else
tmp = t_2
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)) - y) - z;
double t_2 = -z - y;
double tmp;
if (t_1 <= -2e+16) {
tmp = t_2;
} else if (t_1 <= 10000000.0) {
tmp = Math.log(t);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((x * math.log(y)) - y) - z t_2 = -z - y tmp = 0 if t_1 <= -2e+16: tmp = t_2 elif t_1 <= 10000000.0: tmp = math.log(t) else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x * log(y)) - y) - z) t_2 = Float64(Float64(-z) - y) tmp = 0.0 if (t_1 <= -2e+16) tmp = t_2; elseif (t_1 <= 10000000.0) tmp = log(t); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((x * log(y)) - y) - z; t_2 = -z - y; tmp = 0.0; if (t_1 <= -2e+16) tmp = t_2; elseif (t_1 <= 10000000.0) tmp = log(t); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$2 = N[((-z) - y), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+16], t$95$2, If[LessEqual[t$95$1, 10000000.0], N[Log[t], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot \log y - y\right) - z\\
t_2 := \left(-z\right) - y\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+16}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10000000:\\
\;\;\;\;\log t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) < -2e16 or 1e7 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6462.2
Applied rewrites62.2%
if -2e16 < (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) < 1e7Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6490.9
Applied rewrites90.9%
Taylor expanded in z around 0
lower-log.f6489.1
Applied rewrites89.1%
Final simplification66.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (log y))) (t_2 (- t_1 y))) (if (<= t_2 -2e+16) (- (- z) y) (if (<= t_2 5e+33) (- (log t) 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;
double tmp;
if (t_2 <= -2e+16) {
tmp = -z - y;
} else if (t_2 <= 5e+33) {
tmp = log(t) - 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
if (t_2 <= (-2d+16)) then
tmp = -z - y
else if (t_2 <= 5d+33) then
tmp = log(t) - 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;
double tmp;
if (t_2 <= -2e+16) {
tmp = -z - y;
} else if (t_2 <= 5e+33) {
tmp = Math.log(t) - z;
} 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 <= -2e+16: tmp = -z - y elif t_2 <= 5e+33: tmp = math.log(t) - z 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 <= -2e+16) tmp = Float64(Float64(-z) - y); elseif (t_2 <= 5e+33) tmp = Float64(log(t) - 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; tmp = 0.0; if (t_2 <= -2e+16) tmp = -z - y; elseif (t_2 <= 5e+33) tmp = log(t) - 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[(t$95$1 - y), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+16], N[((-z) - y), $MachinePrecision], If[LessEqual[t$95$2, 5e+33], N[(N[Log[t], $MachinePrecision] - z), $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 -2 \cdot 10^{+16}:\\
\;\;\;\;\left(-z\right) - y\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+33}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -2e16Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6469.2
Applied rewrites69.2%
if -2e16 < (-.f64 (*.f64 x (log.f64 y)) y) < 4.99999999999999973e33Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6494.9
Applied rewrites94.9%
lift-neg.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-negN/A
lift--.f6494.9
Applied rewrites94.9%
if 4.99999999999999973e33 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-log.f6480.8
Applied rewrites80.8%
Final simplification78.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (fma x (log y) (- y)) z)))
(if (<= z -410.0)
t_1
(if (<= z 1.9e-26) (fma x (log y) (- (log t) y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, log(y), -y) - z;
double tmp;
if (z <= -410.0) {
tmp = t_1;
} else if (z <= 1.9e-26) {
tmp = fma(x, log(y), (log(t) - y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(x, log(y), Float64(-y)) - z) tmp = 0.0 if (z <= -410.0) tmp = t_1; elseif (z <= 1.9e-26) tmp = fma(x, log(y), Float64(log(t) - y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision] + (-y)), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[z, -410.0], t$95$1, If[LessEqual[z, 1.9e-26], N[(x * N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, \log y, -y\right) - z\\
\mathbf{if}\;z \leq -410:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-26}:\\
\;\;\;\;\mathsf{fma}\left(x, \log y, \log t - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -410 or 1.90000000000000007e-26 < z Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6499.4
Applied rewrites99.4%
if -410 < z < 1.90000000000000007e-26Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6499.3
Applied rewrites99.3%
(FPCore (x y z t) :precision binary64 (if (<= (- (* x (log y)) y) -2e+16) (- (- z) y) (- (log t) z)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x * log(y)) - y) <= -2e+16) {
tmp = -z - y;
} else {
tmp = log(t) - 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 (((x * log(y)) - y) <= (-2d+16)) then
tmp = -z - y
else
tmp = log(t) - z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x * Math.log(y)) - y) <= -2e+16) {
tmp = -z - y;
} else {
tmp = Math.log(t) - z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x * math.log(y)) - y) <= -2e+16: tmp = -z - y else: tmp = math.log(t) - z return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x * log(y)) - y) <= -2e+16) tmp = Float64(Float64(-z) - y); else tmp = Float64(log(t) - z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x * log(y)) - y) <= -2e+16) tmp = -z - y; else tmp = log(t) - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], -2e+16], N[((-z) - y), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot \log y - y \leq -2 \cdot 10^{+16}:\\
\;\;\;\;\left(-z\right) - y\\
\mathbf{else}:\\
\;\;\;\;\log t - z\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -2e16Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6469.2
Applied rewrites69.2%
if -2e16 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6463.8
Applied rewrites63.8%
lift-neg.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-negN/A
lift--.f6463.8
Applied rewrites63.8%
Final simplification66.9%
(FPCore (x y z t) :precision binary64 (if (<= y 0.00016) (fma x (log y) (- (log t) z)) (- (fma x (log y) (- y)) z)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.00016) {
tmp = fma(x, log(y), (log(t) - z));
} else {
tmp = fma(x, log(y), -y) - z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 0.00016) tmp = fma(x, log(y), Float64(log(t) - z)); else tmp = Float64(fma(x, log(y), Float64(-y)) - z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 0.00016], N[(x * N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[Log[y], $MachinePrecision] + (-y)), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00016:\\
\;\;\;\;\mathsf{fma}\left(x, \log y, \log t - z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \log y, -y\right) - z\\
\end{array}
\end{array}
if y < 1.60000000000000013e-4Initial program 99.8%
Taylor expanded in y around 0
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-log.f64N/A
unsub-negN/A
lower--.f64N/A
lower-log.f6499.1
Applied rewrites99.1%
if 1.60000000000000013e-4 < y Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6499.8
Applied rewrites99.8%
(FPCore (x y z t) :precision binary64 (if (<= x -2.8e+33) (fma x (log y) (- y)) (if (<= x 2.6e+31) (- (log t) (+ y z)) (fma x (log y) (- z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.8e+33) {
tmp = fma(x, log(y), -y);
} else if (x <= 2.6e+31) {
tmp = log(t) - (y + z);
} else {
tmp = fma(x, log(y), -z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -2.8e+33) tmp = fma(x, log(y), Float64(-y)); elseif (x <= 2.6e+31) tmp = Float64(log(t) - Float64(y + z)); else tmp = fma(x, log(y), Float64(-z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.8e+33], N[(x * N[Log[y], $MachinePrecision] + (-y)), $MachinePrecision], If[LessEqual[x, 2.6e+31], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], N[(x * N[Log[y], $MachinePrecision] + (-z)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(x, \log y, -y\right)\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+31}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \log y, -z\right)\\
\end{array}
\end{array}
if x < -2.8000000000000001e33Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6491.1
Applied rewrites91.1%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6491.1
Applied rewrites91.1%
if -2.8000000000000001e33 < x < 2.6e31Initial program 99.9%
Taylor expanded in x around 0
lower--.f64N/A
lower-log.f64N/A
lower-+.f6497.6
Applied rewrites97.6%
if 2.6e31 < x Initial program 99.8%
Taylor expanded in y around 0
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-log.f64N/A
unsub-negN/A
lower--.f64N/A
lower-log.f6485.1
Applied rewrites85.1%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6485.1
Applied rewrites85.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma x (log y) (- y)))) (if (<= x -2.8e+33) t_1 (if (<= x 5.6e+28) (- (log t) (+ y z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, log(y), -y);
double tmp;
if (x <= -2.8e+33) {
tmp = t_1;
} else if (x <= 5.6e+28) {
tmp = log(t) - (y + z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(x, log(y), Float64(-y)) tmp = 0.0 if (x <= -2.8e+33) tmp = t_1; elseif (x <= 5.6e+28) tmp = Float64(log(t) - Float64(y + z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision] + (-y)), $MachinePrecision]}, If[LessEqual[x, -2.8e+33], t$95$1, If[LessEqual[x, 5.6e+28], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, \log y, -y\right)\\
\mathbf{if}\;x \leq -2.8 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+28}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.8000000000000001e33 or 5.6000000000000003e28 < x Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6487.4
Applied rewrites87.4%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6487.4
Applied rewrites87.4%
if -2.8000000000000001e33 < x < 5.6000000000000003e28Initial program 99.9%
Taylor expanded in x around 0
lower--.f64N/A
lower-log.f64N/A
lower-+.f6497.6
Applied rewrites97.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (log y)))) (if (<= x -3.45e+87) t_1 (if (<= x 5.9e+37) (- (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 <= -3.45e+87) {
tmp = t_1;
} else if (x <= 5.9e+37) {
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 <= (-3.45d+87)) then
tmp = t_1
else if (x <= 5.9d+37) 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 <= -3.45e+87) {
tmp = t_1;
} else if (x <= 5.9e+37) {
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 <= -3.45e+87: tmp = t_1 elif x <= 5.9e+37: 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 <= -3.45e+87) tmp = t_1; elseif (x <= 5.9e+37) tmp = Float64(log(t) - Float64(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 <= -3.45e+87) tmp = t_1; elseif (x <= 5.9e+37) 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, -3.45e+87], t$95$1, If[LessEqual[x, 5.9e+37], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -3.45 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5.9 \cdot 10^{+37}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.44999999999999982e87 or 5.9e37 < x Initial program 99.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-log.f6471.1
Applied rewrites71.1%
if -3.44999999999999982e87 < x < 5.9e37Initial program 99.9%
Taylor expanded in x around 0
lower--.f64N/A
lower-log.f64N/A
lower-+.f6493.2
Applied rewrites93.2%
(FPCore (x y z t) :precision binary64 (if (<= (- (* x (log y)) y) -5e+98) (- y) (- z)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x * log(y)) - y) <= -5e+98) {
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 (((x * log(y)) - y) <= (-5d+98)) 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 (((x * Math.log(y)) - y) <= -5e+98) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x * math.log(y)) - y) <= -5e+98: tmp = -y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x * log(y)) - y) <= -5e+98) tmp = Float64(-y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x * log(y)) - y) <= -5e+98) tmp = -y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], -5e+98], (-y), (-z)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot \log y - y \leq -5 \cdot 10^{+98}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -4.9999999999999998e98Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6457.3
Applied rewrites57.3%
if -4.9999999999999998e98 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6437.2
Applied rewrites37.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (- z) y))) (if (<= z -420.0) t_1 (if (<= z 1.9e-26) (- (log t) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -z - y;
double tmp;
if (z <= -420.0) {
tmp = t_1;
} else if (z <= 1.9e-26) {
tmp = log(t) - 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 = -z - y
if (z <= (-420.0d0)) then
tmp = t_1
else if (z <= 1.9d-26) then
tmp = log(t) - 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 = -z - y;
double tmp;
if (z <= -420.0) {
tmp = t_1;
} else if (z <= 1.9e-26) {
tmp = Math.log(t) - y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -z - y tmp = 0 if z <= -420.0: tmp = t_1 elif z <= 1.9e-26: tmp = math.log(t) - y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-z) - y) tmp = 0.0 if (z <= -420.0) tmp = t_1; elseif (z <= 1.9e-26) tmp = Float64(log(t) - y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -z - y; tmp = 0.0; if (z <= -420.0) tmp = t_1; elseif (z <= 1.9e-26) tmp = log(t) - y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-z) - y), $MachinePrecision]}, If[LessEqual[z, -420.0], t$95$1, If[LessEqual[z, 1.9e-26], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) - y\\
\mathbf{if}\;z \leq -420:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-26}:\\
\;\;\;\;\log t - y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -420 or 1.90000000000000007e-26 < z Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6476.1
Applied rewrites76.1%
if -420 < z < 1.90000000000000007e-26Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6499.3
Applied rewrites99.3%
Taylor expanded in x around 0
lower--.f64N/A
lower-log.f6459.3
Applied rewrites59.3%
Final simplification66.6%
(FPCore (x y z t) :precision binary64 (- (- z) y))
double code(double x, double y, double z, double t) {
return -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 = -z - y
end function
public static double code(double x, double y, double z, double t) {
return -z - y;
}
def code(x, y, z, t): return -z - y
function code(x, y, z, t) return Float64(Float64(-z) - y) end
function tmp = code(x, y, z, t) tmp = -z - y; end
code[x_, y_, z_, t_] := N[((-z) - y), $MachinePrecision]
\begin{array}{l}
\\
\left(-z\right) - y
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-log.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6453.6
Applied rewrites53.6%
Final simplification53.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.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6430.2
Applied rewrites30.2%
herbie shell --seed 2024219
(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)))