
(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 x (log y) (- (- y) z)) (log t)))
double code(double x, double y, double z, double t) {
return fma(x, log(y), (-y - z)) + log(t);
}
function code(x, y, z, t) return Float64(fma(x, log(y), Float64(Float64(-y) - z)) + log(t)) end
code[x_, y_, z_, t_] := N[(N[(x * N[Log[y], $MachinePrecision] + N[((-y) - z), $MachinePrecision]), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \log y, \left(-y\right) - z\right) + \log t
\end{array}
Initial program 99.9%
sub-neg99.9%
associate--l+99.9%
fma-define99.9%
Simplified99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- t_1 y)))
(if (<= t_2 -2e+176)
t_2
(if (<= t_2 -500.0)
(- (- y) z)
(if (<= t_2 -2e-29)
(- (log t) y)
(if (<= t_2 5e-8) (- (log t) z) (- t_1 z)))))))
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+176) {
tmp = t_2;
} else if (t_2 <= -500.0) {
tmp = -y - z;
} else if (t_2 <= -2e-29) {
tmp = log(t) - y;
} else if (t_2 <= 5e-8) {
tmp = log(t) - z;
} else {
tmp = t_1 - 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * log(y)
t_2 = t_1 - y
if (t_2 <= (-2d+176)) then
tmp = t_2
else if (t_2 <= (-500.0d0)) then
tmp = -y - z
else if (t_2 <= (-2d-29)) then
tmp = log(t) - y
else if (t_2 <= 5d-8) then
tmp = log(t) - z
else
tmp = t_1 - z
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+176) {
tmp = t_2;
} else if (t_2 <= -500.0) {
tmp = -y - z;
} else if (t_2 <= -2e-29) {
tmp = Math.log(t) - y;
} else if (t_2 <= 5e-8) {
tmp = Math.log(t) - z;
} else {
tmp = t_1 - z;
}
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+176: tmp = t_2 elif t_2 <= -500.0: tmp = -y - z elif t_2 <= -2e-29: tmp = math.log(t) - y elif t_2 <= 5e-8: tmp = math.log(t) - z else: tmp = t_1 - z 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+176) tmp = t_2; elseif (t_2 <= -500.0) tmp = Float64(Float64(-y) - z); elseif (t_2 <= -2e-29) tmp = Float64(log(t) - y); elseif (t_2 <= 5e-8) tmp = Float64(log(t) - z); else tmp = Float64(t_1 - z); 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+176) tmp = t_2; elseif (t_2 <= -500.0) tmp = -y - z; elseif (t_2 <= -2e-29) tmp = log(t) - y; elseif (t_2 <= 5e-8) tmp = log(t) - z; else tmp = t_1 - z; 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+176], t$95$2, If[LessEqual[t$95$2, -500.0], N[((-y) - z), $MachinePrecision], If[LessEqual[t$95$2, -2e-29], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[t$95$2, 5e-8], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], N[(t$95$1 - z), $MachinePrecision]]]]]]]
\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^{+176}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq -500:\\
\;\;\;\;\left(-y\right) - z\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-29}:\\
\;\;\;\;\log t - y\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-8}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;t\_1 - z\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -2e176Initial program 99.9%
associate-+l-99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in y around inf 85.9%
if -2e176 < (-.f64 (*.f64 x (log.f64 y)) y) < -500Initial program 99.9%
sub-neg99.9%
associate--l+99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around inf 87.8%
+-commutative87.8%
mul-1-neg87.8%
unsub-neg87.8%
log-rec87.8%
mul-1-neg87.8%
associate-/l*87.8%
mul-1-neg87.8%
Simplified87.8%
Taylor expanded in z around -inf 86.2%
mul-1-neg86.2%
*-commutative86.2%
distribute-rgt-neg-in86.2%
Simplified86.1%
Taylor expanded in y around inf 76.0%
Taylor expanded in y around 0 83.7%
mul-1-neg83.7%
sub-neg83.7%
mul-1-neg83.7%
Simplified83.7%
if -500 < (-.f64 (*.f64 x (log.f64 y)) y) < -1.99999999999999989e-29Initial program 99.6%
sub-neg99.6%
associate--l+99.6%
fma-define99.6%
Simplified99.6%
Taylor expanded in y around inf 85.5%
mul-1-neg85.5%
Simplified85.5%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
sub-neg85.5%
Simplified85.5%
if -1.99999999999999989e-29 < (-.f64 (*.f64 x (log.f64 y)) y) < 4.9999999999999998e-8Initial program 100.0%
sub-neg100.0%
associate--l+100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 99.1%
neg-mul-199.1%
Simplified99.1%
Taylor expanded in z around 0 99.1%
mul-1-neg99.1%
sub-neg99.1%
Simplified99.1%
if 4.9999999999999998e-8 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.7%
associate-+l-99.7%
associate--l-99.7%
Simplified99.7%
Taylor expanded in z around inf 97.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)))
(if (<= t_1 -2e+176)
t_1
(if (<= t_1 -500.0)
(- (- y) z)
(if (<= t_1 -2e-29)
(- (log t) y)
(if (<= t_1 5e-8) (- (log t) z) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double tmp;
if (t_1 <= -2e+176) {
tmp = t_1;
} else if (t_1 <= -500.0) {
tmp = -y - z;
} else if (t_1 <= -2e-29) {
tmp = log(t) - y;
} else if (t_1 <= 5e-8) {
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) :: tmp
t_1 = (x * log(y)) - y
if (t_1 <= (-2d+176)) then
tmp = t_1
else if (t_1 <= (-500.0d0)) then
tmp = -y - z
else if (t_1 <= (-2d-29)) then
tmp = log(t) - y
else if (t_1 <= 5d-8) 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)) - y;
double tmp;
if (t_1 <= -2e+176) {
tmp = t_1;
} else if (t_1 <= -500.0) {
tmp = -y - z;
} else if (t_1 <= -2e-29) {
tmp = Math.log(t) - y;
} else if (t_1 <= 5e-8) {
tmp = Math.log(t) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * math.log(y)) - y tmp = 0 if t_1 <= -2e+176: tmp = t_1 elif t_1 <= -500.0: tmp = -y - z elif t_1 <= -2e-29: tmp = math.log(t) - y elif t_1 <= 5e-8: tmp = math.log(t) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - y) tmp = 0.0 if (t_1 <= -2e+176) tmp = t_1; elseif (t_1 <= -500.0) tmp = Float64(Float64(-y) - z); elseif (t_1 <= -2e-29) tmp = Float64(log(t) - y); elseif (t_1 <= 5e-8) 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)) - y; tmp = 0.0; if (t_1 <= -2e+176) tmp = t_1; elseif (t_1 <= -500.0) tmp = -y - z; elseif (t_1 <= -2e-29) tmp = log(t) - y; elseif (t_1 <= 5e-8) tmp = log(t) - z; else tmp = t_1; end tmp_2 = 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+176], t$95$1, If[LessEqual[t$95$1, -500.0], N[((-y) - z), $MachinePrecision], If[LessEqual[t$95$1, -2e-29], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[t$95$1, 5e-8], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+176}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq -500:\\
\;\;\;\;\left(-y\right) - z\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-29}:\\
\;\;\;\;\log t - y\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-8}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -2e176 or 4.9999999999999998e-8 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.8%
associate-+l-99.8%
associate--l-99.8%
Simplified99.8%
Taylor expanded in y around inf 82.5%
if -2e176 < (-.f64 (*.f64 x (log.f64 y)) y) < -500Initial program 99.9%
sub-neg99.9%
associate--l+99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around inf 87.8%
+-commutative87.8%
mul-1-neg87.8%
unsub-neg87.8%
log-rec87.8%
mul-1-neg87.8%
associate-/l*87.8%
mul-1-neg87.8%
Simplified87.8%
Taylor expanded in z around -inf 86.2%
mul-1-neg86.2%
*-commutative86.2%
distribute-rgt-neg-in86.2%
Simplified86.1%
Taylor expanded in y around inf 76.0%
Taylor expanded in y around 0 83.7%
mul-1-neg83.7%
sub-neg83.7%
mul-1-neg83.7%
Simplified83.7%
if -500 < (-.f64 (*.f64 x (log.f64 y)) y) < -1.99999999999999989e-29Initial program 99.6%
sub-neg99.6%
associate--l+99.6%
fma-define99.6%
Simplified99.6%
Taylor expanded in y around inf 85.5%
mul-1-neg85.5%
Simplified85.5%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
sub-neg85.5%
Simplified85.5%
if -1.99999999999999989e-29 < (-.f64 (*.f64 x (log.f64 y)) y) < 4.9999999999999998e-8Initial program 100.0%
sub-neg100.0%
associate--l+100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 99.1%
neg-mul-199.1%
Simplified99.1%
Taylor expanded in z around 0 99.1%
mul-1-neg99.1%
sub-neg99.1%
Simplified99.1%
(FPCore (x y z t) :precision binary64 (- (fma x (log y) (- (log t) z)) y))
double code(double x, double y, double z, double t) {
return fma(x, log(y), (log(t) - z)) - y;
}
function code(x, y, z, t) return Float64(fma(x, log(y), Float64(log(t) - z)) - y) end
code[x_, y_, z_, t_] := N[(N[(x * N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \log y, \log t - z\right) - y
\end{array}
Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
+-commutative99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
unsub-neg99.9%
fma-undefine99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
(FPCore (x y z t) :precision binary64 (if (<= x -2.3e+57) (- (* x (log y)) z) (if (<= x 1.22e+91) (- (- (log t) z) y) (fma (log y) x (- z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e+57) {
tmp = (x * log(y)) - z;
} else if (x <= 1.22e+91) {
tmp = (log(t) - z) - y;
} else {
tmp = fma(log(y), x, -z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -2.3e+57) tmp = Float64(Float64(x * log(y)) - z); elseif (x <= 1.22e+91) tmp = Float64(Float64(log(t) - z) - y); else tmp = fma(log(y), x, Float64(-z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.3e+57], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 1.22e+91], N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x + (-z)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+57}:\\
\;\;\;\;x \cdot \log y - z\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{+91}:\\
\;\;\;\;\left(\log t - z\right) - y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -z\right)\\
\end{array}
\end{array}
if x < -2.2999999999999999e57Initial program 99.7%
associate-+l-99.7%
associate--l-99.7%
Simplified99.7%
Taylor expanded in z around inf 87.0%
if -2.2999999999999999e57 < x < 1.2199999999999999e91Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
fma-undefine100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 97.0%
if 1.2199999999999999e91 < x Initial program 99.7%
associate-+l-99.7%
associate--l-99.7%
Simplified99.7%
Taylor expanded in z around inf 87.7%
*-commutative87.7%
fma-neg87.8%
Applied egg-rr87.8%
(FPCore (x y z t) :precision binary64 (+ (log t) (- (- (* x (log y)) y) z)))
double code(double x, double y, double z, double t) {
return log(t) + (((x * log(y)) - y) - z);
}
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 = log(t) + (((x * log(y)) - y) - z)
end function
public static double code(double x, double y, double z, double t) {
return Math.log(t) + (((x * Math.log(y)) - y) - z);
}
def code(x, y, z, t): return math.log(t) + (((x * math.log(y)) - y) - z)
function code(x, y, z, t) return Float64(log(t) + Float64(Float64(Float64(x * log(y)) - y) - z)) end
function tmp = code(x, y, z, t) tmp = log(t) + (((x * log(y)) - y) - z); end
code[x_, y_, z_, t_] := N[(N[Log[t], $MachinePrecision] + N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log t + \left(\left(x \cdot \log y - y\right) - z\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- (- y) z)))
(if (<= x -4e+130)
t_1
(if (<= x -1.4e+113)
t_2
(if (<= x -2.22e+108)
t_1
(if (<= x 4.1e+95)
t_2
(if (or (<= x 1.25e+159) (not (<= x 3e+160))) t_1 (- z))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double t_2 = -y - z;
double tmp;
if (x <= -4e+130) {
tmp = t_1;
} else if (x <= -1.4e+113) {
tmp = t_2;
} else if (x <= -2.22e+108) {
tmp = t_1;
} else if (x <= 4.1e+95) {
tmp = t_2;
} else if ((x <= 1.25e+159) || !(x <= 3e+160)) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * log(y)
t_2 = -y - z
if (x <= (-4d+130)) then
tmp = t_1
else if (x <= (-1.4d+113)) then
tmp = t_2
else if (x <= (-2.22d+108)) then
tmp = t_1
else if (x <= 4.1d+95) then
tmp = t_2
else if ((x <= 1.25d+159) .or. (.not. (x <= 3d+160))) then
tmp = t_1
else
tmp = -z
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 = -y - z;
double tmp;
if (x <= -4e+130) {
tmp = t_1;
} else if (x <= -1.4e+113) {
tmp = t_2;
} else if (x <= -2.22e+108) {
tmp = t_1;
} else if (x <= 4.1e+95) {
tmp = t_2;
} else if ((x <= 1.25e+159) || !(x <= 3e+160)) {
tmp = t_1;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) t_2 = -y - z tmp = 0 if x <= -4e+130: tmp = t_1 elif x <= -1.4e+113: tmp = t_2 elif x <= -2.22e+108: tmp = t_1 elif x <= 4.1e+95: tmp = t_2 elif (x <= 1.25e+159) or not (x <= 3e+160): tmp = t_1 else: tmp = -z return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) t_2 = Float64(Float64(-y) - z) tmp = 0.0 if (x <= -4e+130) tmp = t_1; elseif (x <= -1.4e+113) tmp = t_2; elseif (x <= -2.22e+108) tmp = t_1; elseif (x <= 4.1e+95) tmp = t_2; elseif ((x <= 1.25e+159) || !(x <= 3e+160)) tmp = t_1; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); t_2 = -y - z; tmp = 0.0; if (x <= -4e+130) tmp = t_1; elseif (x <= -1.4e+113) tmp = t_2; elseif (x <= -2.22e+108) tmp = t_1; elseif (x <= 4.1e+95) tmp = t_2; elseif ((x <= 1.25e+159) || ~((x <= 3e+160))) tmp = t_1; else tmp = -z; 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[((-y) - z), $MachinePrecision]}, If[LessEqual[x, -4e+130], t$95$1, If[LessEqual[x, -1.4e+113], t$95$2, If[LessEqual[x, -2.22e+108], t$95$1, If[LessEqual[x, 4.1e+95], t$95$2, If[Or[LessEqual[x, 1.25e+159], N[Not[LessEqual[x, 3e+160]], $MachinePrecision]], t$95$1, (-z)]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \left(-y\right) - z\\
\mathbf{if}\;x \leq -4 \cdot 10^{+130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{+113}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -2.22 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+95}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+159} \lor \neg \left(x \leq 3 \cdot 10^{+160}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if x < -4.0000000000000002e130 or -1.39999999999999999e113 < x < -2.22e108 or 4.09999999999999986e95 < x < 1.25000000000000001e159 or 2.9999999999999999e160 < x Initial program 99.6%
sub-neg99.6%
associate--l+99.6%
fma-define99.7%
Simplified99.7%
Taylor expanded in x around inf 99.5%
associate--l+99.5%
+-commutative99.5%
associate--r+99.5%
div-sub99.5%
div-sub99.5%
associate--l-99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 81.6%
if -4.0000000000000002e130 < x < -1.39999999999999999e113 or -2.22e108 < x < 4.09999999999999986e95Initial program 100.0%
sub-neg100.0%
associate--l+100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around inf 91.0%
+-commutative91.0%
mul-1-neg91.0%
unsub-neg91.0%
log-rec91.0%
mul-1-neg91.0%
associate-/l*91.0%
mul-1-neg91.0%
Simplified91.0%
Taylor expanded in z around -inf 91.0%
mul-1-neg91.0%
*-commutative91.0%
distribute-rgt-neg-in91.0%
Simplified74.8%
Taylor expanded in y around inf 61.9%
Taylor expanded in y around 0 69.7%
mul-1-neg69.7%
sub-neg69.7%
mul-1-neg69.7%
Simplified69.7%
if 1.25000000000000001e159 < x < 2.9999999999999999e160Initial program 100.0%
associate-+l-100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
Final simplification73.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (- y) z)))
(if (<= z -1.6e+40)
t_1
(if (<= z -8.5e+19)
(* x (log y))
(if (<= z 5.9e-65) (- (log t) y) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = -y - z;
double tmp;
if (z <= -1.6e+40) {
tmp = t_1;
} else if (z <= -8.5e+19) {
tmp = x * log(y);
} else if (z <= 5.9e-65) {
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 = -y - z
if (z <= (-1.6d+40)) then
tmp = t_1
else if (z <= (-8.5d+19)) then
tmp = x * log(y)
else if (z <= 5.9d-65) 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 = -y - z;
double tmp;
if (z <= -1.6e+40) {
tmp = t_1;
} else if (z <= -8.5e+19) {
tmp = x * Math.log(y);
} else if (z <= 5.9e-65) {
tmp = Math.log(t) - y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -y - z tmp = 0 if z <= -1.6e+40: tmp = t_1 elif z <= -8.5e+19: tmp = x * math.log(y) elif z <= 5.9e-65: tmp = math.log(t) - y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-y) - z) tmp = 0.0 if (z <= -1.6e+40) tmp = t_1; elseif (z <= -8.5e+19) tmp = Float64(x * log(y)); elseif (z <= 5.9e-65) tmp = Float64(log(t) - y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -y - z; tmp = 0.0; if (z <= -1.6e+40) tmp = t_1; elseif (z <= -8.5e+19) tmp = x * log(y); elseif (z <= 5.9e-65) tmp = log(t) - y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-y) - z), $MachinePrecision]}, If[LessEqual[z, -1.6e+40], t$95$1, If[LessEqual[z, -8.5e+19], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.9e-65], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) - z\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+19}:\\
\;\;\;\;x \cdot \log y\\
\mathbf{elif}\;z \leq 5.9 \cdot 10^{-65}:\\
\;\;\;\;\log t - y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.5999999999999999e40 or 5.89999999999999978e-65 < z Initial program 99.9%
sub-neg99.9%
associate--l+99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around inf 74.1%
+-commutative74.1%
mul-1-neg74.1%
unsub-neg74.1%
log-rec74.1%
mul-1-neg74.1%
associate-/l*74.1%
mul-1-neg74.1%
Simplified74.1%
Taylor expanded in z around -inf 85.6%
mul-1-neg85.6%
*-commutative85.6%
distribute-rgt-neg-in85.6%
Simplified85.5%
Taylor expanded in y around inf 75.5%
Taylor expanded in y around 0 76.3%
mul-1-neg76.3%
sub-neg76.3%
mul-1-neg76.3%
Simplified76.3%
if -1.5999999999999999e40 < z < -8.5e19Initial program 99.6%
sub-neg99.6%
associate--l+99.6%
fma-define99.6%
Simplified99.6%
Taylor expanded in x around inf 99.3%
associate--l+99.3%
+-commutative99.3%
associate--r+99.3%
div-sub99.3%
div-sub99.3%
associate--l-99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in x around inf 77.5%
if -8.5e19 < z < 5.89999999999999978e-65Initial program 99.8%
sub-neg99.8%
associate--l+99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around inf 69.4%
mul-1-neg69.4%
Simplified69.4%
Taylor expanded in y around 0 69.4%
mul-1-neg69.4%
sub-neg69.4%
Simplified69.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6e+57) (not (<= x 2.6e+92))) (- (* x (log y)) z) (- (- (log t) z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6e+57) || !(x <= 2.6e+92)) {
tmp = (x * log(y)) - z;
} else {
tmp = (log(t) - z) - y;
}
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 <= (-6d+57)) .or. (.not. (x <= 2.6d+92))) then
tmp = (x * log(y)) - z
else
tmp = (log(t) - z) - y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6e+57) || !(x <= 2.6e+92)) {
tmp = (x * Math.log(y)) - z;
} else {
tmp = (Math.log(t) - z) - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6e+57) or not (x <= 2.6e+92): tmp = (x * math.log(y)) - z else: tmp = (math.log(t) - z) - y return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6e+57) || !(x <= 2.6e+92)) tmp = Float64(Float64(x * log(y)) - z); else tmp = Float64(Float64(log(t) - z) - y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6e+57) || ~((x <= 2.6e+92))) tmp = (x * log(y)) - z; else tmp = (log(t) - z) - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6e+57], N[Not[LessEqual[x, 2.6e+92]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+57} \lor \neg \left(x \leq 2.6 \cdot 10^{+92}\right):\\
\;\;\;\;x \cdot \log y - z\\
\mathbf{else}:\\
\;\;\;\;\left(\log t - z\right) - y\\
\end{array}
\end{array}
if x < -5.9999999999999999e57 or 2.5999999999999999e92 < x Initial program 99.7%
associate-+l-99.7%
associate--l-99.7%
Simplified99.7%
Taylor expanded in z around inf 87.3%
if -5.9999999999999999e57 < x < 2.5999999999999999e92Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
fma-undefine100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 97.0%
Final simplification93.5%
(FPCore (x y z t) :precision binary64 (if (<= y 2.9e+72) (- z) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.9e+72) {
tmp = -z;
} else {
tmp = -y;
}
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 (y <= 2.9d+72) then
tmp = -z
else
tmp = -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.9e+72) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.9e+72: tmp = -z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.9e+72) tmp = Float64(-z); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2.9e+72) tmp = -z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.9e+72], (-z), (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.9 \cdot 10^{+72}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if y < 2.90000000000000017e72Initial program 99.8%
associate-+l-99.8%
associate--l-99.8%
Simplified99.8%
Taylor expanded in z around inf 68.0%
Taylor expanded in x around 0 32.0%
neg-mul-132.0%
Simplified32.0%
if 2.90000000000000017e72 < y Initial program 100.0%
sub-neg100.0%
associate--l+100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around inf 67.0%
mul-1-neg67.0%
Simplified67.0%
Taylor expanded in y around inf 67.0%
mul-1-neg67.0%
Simplified67.0%
(FPCore (x y z t) :precision binary64 (- (- y) z))
double code(double x, double y, double z, double t) {
return -y - z;
}
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 - z
end function
public static double code(double x, double y, double z, double t) {
return -y - z;
}
def code(x, y, z, t): return -y - z
function code(x, y, z, t) return Float64(Float64(-y) - z) end
function tmp = code(x, y, z, t) tmp = -y - z; end
code[x_, y_, z_, t_] := N[((-y) - z), $MachinePrecision]
\begin{array}{l}
\\
\left(-y\right) - z
\end{array}
Initial program 99.9%
sub-neg99.9%
associate--l+99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around inf 81.0%
+-commutative81.0%
mul-1-neg81.0%
unsub-neg81.0%
log-rec81.0%
mul-1-neg81.0%
associate-/l*81.0%
mul-1-neg81.0%
Simplified81.0%
Taylor expanded in z around -inf 77.6%
mul-1-neg77.6%
*-commutative77.6%
distribute-rgt-neg-in77.6%
Simplified66.1%
Taylor expanded in y around inf 48.2%
Taylor expanded in y around 0 54.9%
mul-1-neg54.9%
sub-neg54.9%
mul-1-neg54.9%
Simplified54.9%
(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%
sub-neg99.9%
associate--l+99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around inf 47.0%
mul-1-neg47.0%
Simplified47.0%
Taylor expanded in y around inf 29.8%
mul-1-neg29.8%
Simplified29.8%
(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 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%
sub-neg99.9%
associate--l+99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 78.3%
associate--l+78.3%
+-commutative78.3%
associate--r+78.3%
div-sub78.3%
div-sub78.7%
associate--l-78.7%
+-commutative78.7%
Simplified78.7%
add-cube-cbrt77.3%
pow377.3%
Applied egg-rr77.3%
Taylor expanded in x around 0 51.1%
associate-*r/63.3%
Applied egg-rr63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in y around inf 27.3%
associate-*r*27.3%
neg-mul-127.3%
Simplified27.3%
*-commutative27.3%
associate-/l*29.8%
add-sqr-sqrt12.8%
sqrt-unprod10.2%
sqr-neg10.2%
sqrt-unprod1.2%
add-sqr-sqrt2.3%
*-inverses2.3%
Applied egg-rr2.3%
*-rgt-identity2.3%
Simplified2.3%
herbie shell --seed 2024107
(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)))