
(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 12 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) 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.8%
associate-+l-99.8%
sub-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
unsub-neg99.8%
fma-udef99.8%
neg-sub099.8%
associate-+l-99.8%
neg-sub099.8%
+-commutative99.8%
unsub-neg99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)) (t_2 (- (- y) z)))
(if (<= t_1 -2e+164)
t_1
(if (<= t_1 -2e+118)
t_2
(if (<= t_1 -3.5e+79)
t_1
(if (<= t_1 -1400000000.0)
t_2
(if (<= t_1 5e+61) (- (log t) z) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double t_2 = -y - z;
double tmp;
if (t_1 <= -2e+164) {
tmp = t_1;
} else if (t_1 <= -2e+118) {
tmp = t_2;
} else if (t_1 <= -3.5e+79) {
tmp = t_1;
} else if (t_1 <= -1400000000.0) {
tmp = t_2;
} else if (t_1 <= 5e+61) {
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)) - y
t_2 = -y - z
if (t_1 <= (-2d+164)) then
tmp = t_1
else if (t_1 <= (-2d+118)) then
tmp = t_2
else if (t_1 <= (-3.5d+79)) then
tmp = t_1
else if (t_1 <= (-1400000000.0d0)) then
tmp = t_2
else if (t_1 <= 5d+61) 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 t_2 = -y - z;
double tmp;
if (t_1 <= -2e+164) {
tmp = t_1;
} else if (t_1 <= -2e+118) {
tmp = t_2;
} else if (t_1 <= -3.5e+79) {
tmp = t_1;
} else if (t_1 <= -1400000000.0) {
tmp = t_2;
} else if (t_1 <= 5e+61) {
tmp = Math.log(t) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * math.log(y)) - y t_2 = -y - z tmp = 0 if t_1 <= -2e+164: tmp = t_1 elif t_1 <= -2e+118: tmp = t_2 elif t_1 <= -3.5e+79: tmp = t_1 elif t_1 <= -1400000000.0: tmp = t_2 elif t_1 <= 5e+61: 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) t_2 = Float64(Float64(-y) - z) tmp = 0.0 if (t_1 <= -2e+164) tmp = t_1; elseif (t_1 <= -2e+118) tmp = t_2; elseif (t_1 <= -3.5e+79) tmp = t_1; elseif (t_1 <= -1400000000.0) tmp = t_2; elseif (t_1 <= 5e+61) 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; t_2 = -y - z; tmp = 0.0; if (t_1 <= -2e+164) tmp = t_1; elseif (t_1 <= -2e+118) tmp = t_2; elseif (t_1 <= -3.5e+79) tmp = t_1; elseif (t_1 <= -1400000000.0) tmp = t_2; elseif (t_1 <= 5e+61) 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]}, Block[{t$95$2 = N[((-y) - z), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+164], t$95$1, If[LessEqual[t$95$1, -2e+118], t$95$2, If[LessEqual[t$95$1, -3.5e+79], t$95$1, If[LessEqual[t$95$1, -1400000000.0], t$95$2, If[LessEqual[t$95$1, 5e+61], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
t_2 := \left(-y\right) - z\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+164}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq -2 \cdot 10^{+118}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq -3.5 \cdot 10^{+79}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq -1400000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+61}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -2e164 or -1.99999999999999993e118 < (-.f64 (*.f64 x (log.f64 y)) y) < -3.4999999999999998e79 or 5.00000000000000018e61 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.7%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around 0 92.2%
if -2e164 < (-.f64 (*.f64 x (log.f64 y)) y) < -1.99999999999999993e118 or -3.4999999999999998e79 < (-.f64 (*.f64 x (log.f64 y)) y) < -1.4e9Initial program 99.9%
associate-+l-99.9%
Simplified99.9%
Taylor expanded in z around inf 98.1%
Taylor expanded in x around 0 87.1%
neg-mul-187.1%
distribute-neg-in87.1%
sub-neg87.1%
Simplified87.1%
if -1.4e9 < (-.f64 (*.f64 x (log.f64 y)) y) < 5.00000000000000018e61Initial program 99.9%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in y around 0 99.7%
Taylor expanded in x around 0 95.2%
Final simplification91.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- t_1 y)) (t_3 (- (- y) z)))
(if (<= t_2 -2e+164)
t_2
(if (<= t_2 -2e+118)
t_3
(if (<= t_2 -3.5e+79)
t_2
(if (<= t_2 -1400000000.0)
t_3
(if (<= t_2 2e-24) (- (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 t_3 = -y - z;
double tmp;
if (t_2 <= -2e+164) {
tmp = t_2;
} else if (t_2 <= -2e+118) {
tmp = t_3;
} else if (t_2 <= -3.5e+79) {
tmp = t_2;
} else if (t_2 <= -1400000000.0) {
tmp = t_3;
} else if (t_2 <= 2e-24) {
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) :: t_3
real(8) :: tmp
t_1 = x * log(y)
t_2 = t_1 - y
t_3 = -y - z
if (t_2 <= (-2d+164)) then
tmp = t_2
else if (t_2 <= (-2d+118)) then
tmp = t_3
else if (t_2 <= (-3.5d+79)) then
tmp = t_2
else if (t_2 <= (-1400000000.0d0)) then
tmp = t_3
else if (t_2 <= 2d-24) 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 t_3 = -y - z;
double tmp;
if (t_2 <= -2e+164) {
tmp = t_2;
} else if (t_2 <= -2e+118) {
tmp = t_3;
} else if (t_2 <= -3.5e+79) {
tmp = t_2;
} else if (t_2 <= -1400000000.0) {
tmp = t_3;
} else if (t_2 <= 2e-24) {
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 t_3 = -y - z tmp = 0 if t_2 <= -2e+164: tmp = t_2 elif t_2 <= -2e+118: tmp = t_3 elif t_2 <= -3.5e+79: tmp = t_2 elif t_2 <= -1400000000.0: tmp = t_3 elif t_2 <= 2e-24: 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) t_3 = Float64(Float64(-y) - z) tmp = 0.0 if (t_2 <= -2e+164) tmp = t_2; elseif (t_2 <= -2e+118) tmp = t_3; elseif (t_2 <= -3.5e+79) tmp = t_2; elseif (t_2 <= -1400000000.0) tmp = t_3; elseif (t_2 <= 2e-24) 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; t_3 = -y - z; tmp = 0.0; if (t_2 <= -2e+164) tmp = t_2; elseif (t_2 <= -2e+118) tmp = t_3; elseif (t_2 <= -3.5e+79) tmp = t_2; elseif (t_2 <= -1400000000.0) tmp = t_3; elseif (t_2 <= 2e-24) 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]}, Block[{t$95$3 = N[((-y) - z), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+164], t$95$2, If[LessEqual[t$95$2, -2e+118], t$95$3, If[LessEqual[t$95$2, -3.5e+79], t$95$2, If[LessEqual[t$95$2, -1400000000.0], t$95$3, If[LessEqual[t$95$2, 2e-24], 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\\
t_3 := \left(-y\right) - z\\
\mathbf{if}\;t_2 \leq -2 \cdot 10^{+164}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_2 \leq -2 \cdot 10^{+118}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t_2 \leq -3.5 \cdot 10^{+79}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_2 \leq -1400000000:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t_2 \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;t_1 - z\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -2e164 or -1.99999999999999993e118 < (-.f64 (*.f64 x (log.f64 y)) y) < -3.4999999999999998e79Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around 0 93.4%
if -2e164 < (-.f64 (*.f64 x (log.f64 y)) y) < -1.99999999999999993e118 or -3.4999999999999998e79 < (-.f64 (*.f64 x (log.f64 y)) y) < -1.4e9Initial program 99.9%
associate-+l-99.9%
Simplified99.9%
Taylor expanded in z around inf 98.1%
Taylor expanded in x around 0 87.1%
neg-mul-187.1%
distribute-neg-in87.1%
sub-neg87.1%
Simplified87.1%
if -1.4e9 < (-.f64 (*.f64 x (log.f64 y)) y) < 1.99999999999999985e-24Initial program 100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in y around 0 99.7%
Taylor expanded in x around 0 99.5%
if 1.99999999999999985e-24 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.7%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in z around inf 98.5%
Taylor expanded in y around 0 98.0%
Final simplification94.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (log y)))) (if (<= y 0.0003) (- (+ (log t) t_1) z) (- (- t_1 y) z))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (y <= 0.0003) {
tmp = (log(t) + t_1) - z;
} else {
tmp = (t_1 - y) - 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) :: tmp
t_1 = x * log(y)
if (y <= 0.0003d0) then
tmp = (log(t) + t_1) - z
else
tmp = (t_1 - y) - 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 tmp;
if (y <= 0.0003) {
tmp = (Math.log(t) + t_1) - z;
} else {
tmp = (t_1 - y) - z;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if y <= 0.0003: tmp = (math.log(t) + t_1) - z else: tmp = (t_1 - y) - z return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (y <= 0.0003) tmp = Float64(Float64(log(t) + t_1) - z); else tmp = Float64(Float64(t_1 - y) - z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (y <= 0.0003) tmp = (log(t) + t_1) - z; else tmp = (t_1 - y) - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 0.0003], N[(N[(N[Log[t], $MachinePrecision] + t$95$1), $MachinePrecision] - z), $MachinePrecision], N[(N[(t$95$1 - y), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;y \leq 0.0003:\\
\;\;\;\;\left(\log t + t_1\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 - y\right) - z\\
\end{array}
\end{array}
if y < 2.99999999999999974e-4Initial program 99.7%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in y around 0 99.6%
if 2.99999999999999974e-4 < y Initial program 99.9%
associate-+l-99.9%
Simplified99.9%
Taylor expanded in z around inf 99.4%
Final simplification99.5%
(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.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (+ (- (log t) z) (- (* x (log y)) y)))
double code(double x, double y, double z, double t) {
return (log(t) - z) + ((x * log(y)) - 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 = (log(t) - z) + ((x * log(y)) - y)
end function
public static double code(double x, double y, double z, double t) {
return (Math.log(t) - z) + ((x * Math.log(y)) - y);
}
def code(x, y, z, t): return (math.log(t) - z) + ((x * math.log(y)) - y)
function code(x, y, z, t) return Float64(Float64(log(t) - z) + Float64(Float64(x * log(y)) - y)) end
function tmp = code(x, y, z, t) tmp = (log(t) - z) + ((x * log(y)) - y); end
code[x_, y_, z_, t_] := N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log t - z\right) + \left(x \cdot \log y - y\right)
\end{array}
Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- (- y) z)))
(if (<= x -5.2e+105)
t_1
(if (<= x -1.55e-292)
t_2
(if (<= x 4.2e-230) (- (log t) z) (if (<= x 2.7e+67) t_2 t_1))))))
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 <= -5.2e+105) {
tmp = t_1;
} else if (x <= -1.55e-292) {
tmp = t_2;
} else if (x <= 4.2e-230) {
tmp = log(t) - z;
} else if (x <= 2.7e+67) {
tmp = t_2;
} 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 = -y - z
if (x <= (-5.2d+105)) then
tmp = t_1
else if (x <= (-1.55d-292)) then
tmp = t_2
else if (x <= 4.2d-230) then
tmp = log(t) - z
else if (x <= 2.7d+67) then
tmp = t_2
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 = -y - z;
double tmp;
if (x <= -5.2e+105) {
tmp = t_1;
} else if (x <= -1.55e-292) {
tmp = t_2;
} else if (x <= 4.2e-230) {
tmp = Math.log(t) - z;
} else if (x <= 2.7e+67) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) t_2 = -y - z tmp = 0 if x <= -5.2e+105: tmp = t_1 elif x <= -1.55e-292: tmp = t_2 elif x <= 4.2e-230: tmp = math.log(t) - z elif x <= 2.7e+67: tmp = t_2 else: tmp = t_1 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 <= -5.2e+105) tmp = t_1; elseif (x <= -1.55e-292) tmp = t_2; elseif (x <= 4.2e-230) tmp = Float64(log(t) - z); elseif (x <= 2.7e+67) tmp = t_2; else tmp = t_1; 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 <= -5.2e+105) tmp = t_1; elseif (x <= -1.55e-292) tmp = t_2; elseif (x <= 4.2e-230) tmp = log(t) - z; elseif (x <= 2.7e+67) tmp = t_2; 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[((-y) - z), $MachinePrecision]}, If[LessEqual[x, -5.2e+105], t$95$1, If[LessEqual[x, -1.55e-292], t$95$2, If[LessEqual[x, 4.2e-230], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 2.7e+67], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \left(-y\right) - z\\
\mathbf{if}\;x \leq -5.2 \cdot 10^{+105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-292}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-230}:\\
\;\;\;\;\log t - z\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+67}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -5.2000000000000004e105 or 2.6999999999999999e67 < x Initial program 99.6%
associate-+l-99.6%
Simplified99.6%
add-cube-cbrt97.9%
pow398.0%
associate--l-98.0%
associate-+r-98.0%
Applied egg-rr98.0%
Taylor expanded in x around inf 73.6%
rem-cube-cbrt74.7%
*-commutative74.7%
Applied egg-rr74.7%
if -5.2000000000000004e105 < x < -1.55e-292 or 4.1999999999999997e-230 < x < 2.6999999999999999e67Initial program 100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in z around inf 85.9%
Taylor expanded in x around 0 79.7%
neg-mul-179.7%
distribute-neg-in79.7%
sub-neg79.7%
Simplified79.7%
if -1.55e-292 < x < 4.1999999999999997e-230Initial program 100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in y around 0 92.0%
Taylor expanded in x around 0 92.0%
Final simplification78.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- t_1 y)))
(if (<= x -1.9e+62)
t_2
(if (<= x 1.3e-7)
(- (- (log t) z) y)
(if (<= x 5.6e+146) (- t_1 z) t_2)))))
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 (x <= -1.9e+62) {
tmp = t_2;
} else if (x <= 1.3e-7) {
tmp = (log(t) - z) - y;
} else if (x <= 5.6e+146) {
tmp = t_1 - z;
} 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)
t_2 = t_1 - y
if (x <= (-1.9d+62)) then
tmp = t_2
else if (x <= 1.3d-7) then
tmp = (log(t) - z) - y
else if (x <= 5.6d+146) then
tmp = t_1 - z
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);
double t_2 = t_1 - y;
double tmp;
if (x <= -1.9e+62) {
tmp = t_2;
} else if (x <= 1.3e-7) {
tmp = (Math.log(t) - z) - y;
} else if (x <= 5.6e+146) {
tmp = t_1 - z;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) t_2 = t_1 - y tmp = 0 if x <= -1.9e+62: tmp = t_2 elif x <= 1.3e-7: tmp = (math.log(t) - z) - y elif x <= 5.6e+146: tmp = t_1 - z else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) t_2 = Float64(t_1 - y) tmp = 0.0 if (x <= -1.9e+62) tmp = t_2; elseif (x <= 1.3e-7) tmp = Float64(Float64(log(t) - z) - y); elseif (x <= 5.6e+146) tmp = Float64(t_1 - z); else tmp = t_2; 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 (x <= -1.9e+62) tmp = t_2; elseif (x <= 1.3e-7) tmp = (log(t) - z) - y; elseif (x <= 5.6e+146) tmp = t_1 - z; else tmp = t_2; 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[x, -1.9e+62], t$95$2, If[LessEqual[x, 1.3e-7], N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 5.6e+146], N[(t$95$1 - z), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := t_1 - y\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{+62}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-7}:\\
\;\;\;\;\left(\log t - z\right) - y\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+146}:\\
\;\;\;\;t_1 - z\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -1.89999999999999992e62 or 5.6000000000000002e146 < x Initial program 99.7%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around 0 91.9%
if -1.89999999999999992e62 < x < 1.29999999999999999e-7Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
unsub-neg100.0%
fma-udef100.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.7%
if 1.29999999999999999e-7 < x < 5.6000000000000002e146Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 99.1%
Taylor expanded in y around 0 90.5%
Final simplification94.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.5) (not (<= x 8.8e-14))) (- (- (* x (log y)) y) z) (- (- (log t) z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.5) || !(x <= 8.8e-14)) {
tmp = ((x * log(y)) - 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 <= (-0.5d0)) .or. (.not. (x <= 8.8d-14))) then
tmp = ((x * log(y)) - 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 <= -0.5) || !(x <= 8.8e-14)) {
tmp = ((x * Math.log(y)) - y) - z;
} else {
tmp = (Math.log(t) - z) - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.5) or not (x <= 8.8e-14): tmp = ((x * math.log(y)) - y) - z else: tmp = (math.log(t) - z) - y return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.5) || !(x <= 8.8e-14)) tmp = Float64(Float64(Float64(x * log(y)) - 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 <= -0.5) || ~((x <= 8.8e-14))) tmp = ((x * log(y)) - y) - z; else tmp = (log(t) - z) - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.5], N[Not[LessEqual[x, 8.8e-14]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.5 \lor \neg \left(x \leq 8.8 \cdot 10^{-14}\right):\\
\;\;\;\;\left(x \cdot \log y - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(\log t - z\right) - y\\
\end{array}
\end{array}
if x < -0.5 or 8.8000000000000004e-14 < x Initial program 99.7%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in z around inf 99.1%
if -0.5 < x < 8.8000000000000004e-14Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
unsub-neg100.0%
fma-udef100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 99.9%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.8e+105) (not (<= x 1.8e+67))) (* x (log y)) (- (- y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.8e+105) || !(x <= 1.8e+67)) {
tmp = x * log(y);
} else {
tmp = -y - 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 <= (-6.8d+105)) .or. (.not. (x <= 1.8d+67))) then
tmp = x * log(y)
else
tmp = -y - z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.8e+105) || !(x <= 1.8e+67)) {
tmp = x * Math.log(y);
} else {
tmp = -y - z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.8e+105) or not (x <= 1.8e+67): tmp = x * math.log(y) else: tmp = -y - z return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.8e+105) || !(x <= 1.8e+67)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(-y) - z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6.8e+105) || ~((x <= 1.8e+67))) tmp = x * log(y); else tmp = -y - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.8e+105], N[Not[LessEqual[x, 1.8e+67]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[((-y) - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+105} \lor \neg \left(x \leq 1.8 \cdot 10^{+67}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) - z\\
\end{array}
\end{array}
if x < -6.7999999999999999e105 or 1.7999999999999999e67 < x Initial program 99.6%
associate-+l-99.6%
Simplified99.6%
add-cube-cbrt97.9%
pow398.0%
associate--l-98.0%
associate-+r-98.0%
Applied egg-rr98.0%
Taylor expanded in x around inf 73.6%
rem-cube-cbrt74.7%
*-commutative74.7%
Applied egg-rr74.7%
if -6.7999999999999999e105 < x < 1.7999999999999999e67Initial program 100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in z around inf 82.1%
Taylor expanded in x around 0 76.8%
neg-mul-176.8%
distribute-neg-in76.8%
sub-neg76.8%
Simplified76.8%
Final simplification75.9%
(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.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 89.5%
Taylor expanded in x around 0 55.0%
neg-mul-155.0%
distribute-neg-in55.0%
sub-neg55.0%
Simplified55.0%
Final simplification55.0%
(FPCore (x y z t) :precision binary64 (- z))
double code(double x, double y, double z, double t) {
return -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 = -z
end function
public static double code(double x, double y, double z, double t) {
return -z;
}
def code(x, y, z, t): return -z
function code(x, y, z, t) return Float64(-z) end
function tmp = code(x, y, z, t) tmp = -z; end
code[x_, y_, z_, t_] := (-z)
\begin{array}{l}
\\
-z
\end{array}
Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 28.1%
neg-mul-128.1%
Simplified28.1%
Final simplification28.1%
herbie shell --seed 2024018
(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)))