
(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.9%
associate-+l-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
unsub-neg99.9%
fma-udef99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)))
(if (<= t_1 -1e+159)
t_1
(if (<= t_1 -1000000000000.0)
(- (- z) y)
(if (<= t_1 20000000000000.0) (- (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 <= -1e+159) {
tmp = t_1;
} else if (t_1 <= -1000000000000.0) {
tmp = -z - y;
} else if (t_1 <= 20000000000000.0) {
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 <= (-1d+159)) then
tmp = t_1
else if (t_1 <= (-1000000000000.0d0)) then
tmp = -z - y
else if (t_1 <= 20000000000000.0d0) 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 <= -1e+159) {
tmp = t_1;
} else if (t_1 <= -1000000000000.0) {
tmp = -z - y;
} else if (t_1 <= 20000000000000.0) {
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 <= -1e+159: tmp = t_1 elif t_1 <= -1000000000000.0: tmp = -z - y elif t_1 <= 20000000000000.0: 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 <= -1e+159) tmp = t_1; elseif (t_1 <= -1000000000000.0) tmp = Float64(Float64(-z) - y); elseif (t_1 <= 20000000000000.0) 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 <= -1e+159) tmp = t_1; elseif (t_1 <= -1000000000000.0) tmp = -z - y; elseif (t_1 <= 20000000000000.0) 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, -1e+159], t$95$1, If[LessEqual[t$95$1, -1000000000000.0], N[((-z) - y), $MachinePrecision], If[LessEqual[t$95$1, 20000000000000.0], 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 -1 \cdot 10^{+159}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq -1000000000000:\\
\;\;\;\;\left(-z\right) - y\\
\mathbf{elif}\;t_1 \leq 20000000000000:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -9.9999999999999993e158 or 2e13 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around 0 89.6%
if -9.9999999999999993e158 < (-.f64 (*.f64 x (log.f64 y)) y) < -1e12Initial program 99.9%
associate-+l-99.9%
Simplified99.9%
Taylor expanded in z around inf 98.9%
Taylor expanded in x around 0 82.7%
neg-mul-182.7%
distribute-neg-in82.7%
+-commutative82.7%
unsub-neg82.7%
Simplified82.7%
if -1e12 < (-.f64 (*.f64 x (log.f64 y)) y) < 2e13Initial program 100.0%
sub-neg100.0%
associate--l+100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in z around inf 98.8%
neg-mul-198.8%
Simplified98.8%
Final simplification90.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- t_1 y)))
(if (<= t_2 -1e+159)
t_2
(if (<= t_2 -1000000000000.0)
(- (- z) y)
(if (<= t_2 1e-17) (- (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 <= -1e+159) {
tmp = t_2;
} else if (t_2 <= -1000000000000.0) {
tmp = -z - y;
} else if (t_2 <= 1e-17) {
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 <= (-1d+159)) then
tmp = t_2
else if (t_2 <= (-1000000000000.0d0)) then
tmp = -z - y
else if (t_2 <= 1d-17) 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 <= -1e+159) {
tmp = t_2;
} else if (t_2 <= -1000000000000.0) {
tmp = -z - y;
} else if (t_2 <= 1e-17) {
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 <= -1e+159: tmp = t_2 elif t_2 <= -1000000000000.0: tmp = -z - y elif t_2 <= 1e-17: 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 <= -1e+159) tmp = t_2; elseif (t_2 <= -1000000000000.0) tmp = Float64(Float64(-z) - y); elseif (t_2 <= 1e-17) 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 <= -1e+159) tmp = t_2; elseif (t_2 <= -1000000000000.0) tmp = -z - y; elseif (t_2 <= 1e-17) 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, -1e+159], t$95$2, If[LessEqual[t$95$2, -1000000000000.0], N[((-z) - y), $MachinePrecision], If[LessEqual[t$95$2, 1e-17], 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 -1 \cdot 10^{+159}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_2 \leq -1000000000000:\\
\;\;\;\;\left(-z\right) - y\\
\mathbf{elif}\;t_2 \leq 10^{-17}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;t_1 - z\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -9.9999999999999993e158Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around 0 93.0%
if -9.9999999999999993e158 < (-.f64 (*.f64 x (log.f64 y)) y) < -1e12Initial program 99.9%
associate-+l-99.9%
Simplified99.9%
Taylor expanded in z around inf 98.9%
Taylor expanded in x around 0 82.7%
neg-mul-182.7%
distribute-neg-in82.7%
+-commutative82.7%
unsub-neg82.7%
Simplified82.7%
if -1e12 < (-.f64 (*.f64 x (log.f64 y)) y) < 1.00000000000000007e-17Initial program 100.0%
sub-neg100.0%
associate--l+100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in z around inf 98.7%
neg-mul-198.7%
Simplified98.7%
if 1.00000000000000007e-17 < (-.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 y around 0 99.6%
Final simplification93.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- t_1 y)))
(if (<= t_2 -1e+159)
t_2
(if (<= t_2 1e-17) (- (- (log t) z) y) (- 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 <= -1e+159) {
tmp = t_2;
} else if (t_2 <= 1e-17) {
tmp = (log(t) - z) - y;
} 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 <= (-1d+159)) then
tmp = t_2
else if (t_2 <= 1d-17) then
tmp = (log(t) - z) - y
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 <= -1e+159) {
tmp = t_2;
} else if (t_2 <= 1e-17) {
tmp = (Math.log(t) - z) - y;
} 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 <= -1e+159: tmp = t_2 elif t_2 <= 1e-17: tmp = (math.log(t) - z) - y 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 <= -1e+159) tmp = t_2; elseif (t_2 <= 1e-17) tmp = Float64(Float64(log(t) - z) - y); 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 <= -1e+159) tmp = t_2; elseif (t_2 <= 1e-17) tmp = (log(t) - z) - y; 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, -1e+159], t$95$2, If[LessEqual[t$95$2, 1e-17], N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $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 -1 \cdot 10^{+159}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_2 \leq 10^{-17}:\\
\;\;\;\;\left(\log t - z\right) - y\\
\mathbf{else}:\\
\;\;\;\;t_1 - z\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -9.9999999999999993e158Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around 0 93.0%
if -9.9999999999999993e158 < (-.f64 (*.f64 x (log.f64 y)) y) < 1.00000000000000007e-17Initial 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 91.9%
if 1.00000000000000007e-17 < (-.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 y around 0 99.6%
Final simplification93.8%
(FPCore (x y z t) :precision binary64 (if (<= x -4.4e+15) (fma (log y) x (- (- z) y)) (if (<= x 0.00023) (- (- (log t) z) y) (- (- (* x (log y)) y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.4e+15) {
tmp = fma(log(y), x, (-z - y));
} else if (x <= 0.00023) {
tmp = (log(t) - z) - y;
} else {
tmp = ((x * log(y)) - y) - z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -4.4e+15) tmp = fma(log(y), x, Float64(Float64(-z) - y)); elseif (x <= 0.00023) tmp = Float64(Float64(log(t) - z) - y); else tmp = Float64(Float64(Float64(x * log(y)) - y) - z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.4e+15], N[(N[Log[y], $MachinePrecision] * x + N[((-z) - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.00023], N[(N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \left(-z\right) - y\right)\\
\mathbf{elif}\;x \leq 0.00023:\\
\;\;\;\;\left(\log t - z\right) - y\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \log y - y\right) - z\\
\end{array}
\end{array}
if x < -4.4e15Initial program 99.7%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
associate--l-99.7%
*-commutative99.7%
fma-neg99.8%
Applied egg-rr99.8%
if -4.4e15 < x < 2.3000000000000001e-4Initial 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 100.0%
if 2.3000000000000001e-4 < x Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
Taylor expanded in z around inf 99.5%
Final simplification99.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 (- (- z) y)))
(if (<= x -5e+74)
t_1
(if (<= x -1.85e-211)
t_2
(if (<= x 1.1e-183) (- (log t) y) (if (<= x 1.75e+157) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double t_2 = -z - y;
double tmp;
if (x <= -5e+74) {
tmp = t_1;
} else if (x <= -1.85e-211) {
tmp = t_2;
} else if (x <= 1.1e-183) {
tmp = log(t) - y;
} else if (x <= 1.75e+157) {
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 = -z - y
if (x <= (-5d+74)) then
tmp = t_1
else if (x <= (-1.85d-211)) then
tmp = t_2
else if (x <= 1.1d-183) then
tmp = log(t) - y
else if (x <= 1.75d+157) 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 = -z - y;
double tmp;
if (x <= -5e+74) {
tmp = t_1;
} else if (x <= -1.85e-211) {
tmp = t_2;
} else if (x <= 1.1e-183) {
tmp = Math.log(t) - y;
} else if (x <= 1.75e+157) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) t_2 = -z - y tmp = 0 if x <= -5e+74: tmp = t_1 elif x <= -1.85e-211: tmp = t_2 elif x <= 1.1e-183: tmp = math.log(t) - y elif x <= 1.75e+157: 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(-z) - y) tmp = 0.0 if (x <= -5e+74) tmp = t_1; elseif (x <= -1.85e-211) tmp = t_2; elseif (x <= 1.1e-183) tmp = Float64(log(t) - y); elseif (x <= 1.75e+157) 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 = -z - y; tmp = 0.0; if (x <= -5e+74) tmp = t_1; elseif (x <= -1.85e-211) tmp = t_2; elseif (x <= 1.1e-183) tmp = log(t) - y; elseif (x <= 1.75e+157) 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[((-z) - y), $MachinePrecision]}, If[LessEqual[x, -5e+74], t$95$1, If[LessEqual[x, -1.85e-211], t$95$2, If[LessEqual[x, 1.1e-183], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 1.75e+157], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \left(-z\right) - y\\
\mathbf{if}\;x \leq -5 \cdot 10^{+74}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-211}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-183}:\\
\;\;\;\;\log t - y\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+157}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -4.99999999999999963e74 or 1.75000000000000001e157 < x Initial program 99.6%
associate-+l-99.6%
Simplified99.6%
Taylor expanded in z around inf 99.6%
associate--l-99.6%
*-commutative99.6%
fma-neg99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 78.3%
*-commutative78.3%
Simplified78.3%
if -4.99999999999999963e74 < x < -1.8499999999999999e-211 or 1.1e-183 < x < 1.75000000000000001e157Initial program 100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in z around inf 87.4%
Taylor expanded in x around 0 77.1%
neg-mul-177.1%
distribute-neg-in77.1%
+-commutative77.1%
unsub-neg77.1%
Simplified77.1%
if -1.8499999999999999e-211 < x < 1.1e-183Initial program 100.0%
sub-neg100.0%
associate--l+100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around inf 90.2%
mul-1-neg90.2%
Simplified90.2%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.4e+15) (not (<= x 2e-16))) (- (- (* x (log y)) y) z) (- (- (log t) z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.4e+15) || !(x <= 2e-16)) {
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 <= (-4.4d+15)) .or. (.not. (x <= 2d-16))) 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 <= -4.4e+15) || !(x <= 2e-16)) {
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 <= -4.4e+15) or not (x <= 2e-16): 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 <= -4.4e+15) || !(x <= 2e-16)) 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 <= -4.4e+15) || ~((x <= 2e-16))) 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, -4.4e+15], N[Not[LessEqual[x, 2e-16]], $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 -4.4 \cdot 10^{+15} \lor \neg \left(x \leq 2 \cdot 10^{-16}\right):\\
\;\;\;\;\left(x \cdot \log y - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(\log t - z\right) - y\\
\end{array}
\end{array}
if x < -4.4e15 or 2e-16 < x Initial program 99.7%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in z around inf 99.6%
if -4.4e15 < x < 2e-16Initial 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 100.0%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.1e+74) (not (<= x 1.3e+160))) (* x (log y)) (- (- z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.1e+74) || !(x <= 1.3e+160)) {
tmp = x * log(y);
} else {
tmp = -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 <= (-3.1d+74)) .or. (.not. (x <= 1.3d+160))) then
tmp = x * log(y)
else
tmp = -z - y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.1e+74) || !(x <= 1.3e+160)) {
tmp = x * Math.log(y);
} else {
tmp = -z - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.1e+74) or not (x <= 1.3e+160): tmp = x * math.log(y) else: tmp = -z - y return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.1e+74) || !(x <= 1.3e+160)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(-z) - y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.1e+74) || ~((x <= 1.3e+160))) tmp = x * log(y); else tmp = -z - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.1e+74], N[Not[LessEqual[x, 1.3e+160]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[((-z) - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+74} \lor \neg \left(x \leq 1.3 \cdot 10^{+160}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) - y\\
\end{array}
\end{array}
if x < -3.10000000000000021e74 or 1.3e160 < x Initial program 99.6%
associate-+l-99.6%
Simplified99.6%
Taylor expanded in z around inf 99.6%
associate--l-99.6%
*-commutative99.6%
fma-neg99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 78.3%
*-commutative78.3%
Simplified78.3%
if -3.10000000000000021e74 < x < 1.3e160Initial program 100.0%
associate-+l-100.0%
Simplified100.0%
Taylor expanded in z around inf 83.1%
Taylor expanded in x around 0 75.0%
neg-mul-175.0%
distribute-neg-in75.0%
+-commutative75.0%
unsub-neg75.0%
Simplified75.0%
Final simplification76.1%
(FPCore (x y z t) :precision binary64 (if (<= y 4.8e+21) (- z) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.8e+21) {
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 <= 4.8d+21) 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 <= 4.8e+21) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 4.8e+21: tmp = -z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 4.8e+21) tmp = Float64(-z); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4.8e+21) tmp = -z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 4.8e+21], (-z), (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{+21}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if y < 4.8e21Initial program 99.8%
associate-+l-99.8%
Simplified99.8%
add-cube-cbrt99.2%
pow399.2%
Applied egg-rr99.2%
Taylor expanded in z around inf 40.4%
neg-mul-140.4%
Simplified40.4%
if 4.8e21 < y Initial program 99.9%
associate-+l-99.9%
Simplified99.9%
add-cube-cbrt99.5%
pow399.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 61.7%
neg-mul-161.7%
Simplified61.7%
Final simplification51.1%
(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%
associate-+l-99.9%
Simplified99.9%
Taylor expanded in z around inf 88.1%
Taylor expanded in x around 0 58.2%
neg-mul-158.2%
distribute-neg-in58.2%
+-commutative58.2%
unsub-neg58.2%
Simplified58.2%
Final simplification58.2%
(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%
associate-+l-99.9%
Simplified99.9%
add-cube-cbrt99.3%
pow399.3%
Applied egg-rr99.3%
Taylor expanded in y around inf 32.8%
neg-mul-132.8%
Simplified32.8%
Final simplification32.8%
herbie shell --seed 2024020
(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)))