
(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 (log y) x (- (- (log t) y) z)))
double code(double x, double y, double z, double t) {
return fma(log(y), x, ((log(t) - y) - z));
}
function code(x, y, z, t) return fma(log(y), x, Float64(Float64(log(t) - y) - z)) end
code[x_, y_, z_, t_] := N[(N[Log[y], $MachinePrecision] * x + N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log y, x, \left(\log t - y\right) - z\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)))
(if (<= t_1 -2e+253)
(pow (/ -1.0 y) -1.0)
(if (<= t_1 -5000000000000.0)
(fma (/ (- y) z) z (- z))
(if (<= t_1 2e+20) (+ (- z) (log t)) (* (log y) x))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double tmp;
if (t_1 <= -2e+253) {
tmp = pow((-1.0 / y), -1.0);
} else if (t_1 <= -5000000000000.0) {
tmp = fma((-y / z), z, -z);
} else if (t_1 <= 2e+20) {
tmp = -z + log(t);
} else {
tmp = log(y) * x;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - y) tmp = 0.0 if (t_1 <= -2e+253) tmp = Float64(-1.0 / y) ^ -1.0; elseif (t_1 <= -5000000000000.0) tmp = fma(Float64(Float64(-y) / z), z, Float64(-z)); elseif (t_1 <= 2e+20) tmp = Float64(Float64(-z) + log(t)); else tmp = Float64(log(y) * x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+253], N[Power[N[(-1.0 / y), $MachinePrecision], -1.0], $MachinePrecision], If[LessEqual[t$95$1, -5000000000000.0], N[(N[((-y) / z), $MachinePrecision] * z + (-z)), $MachinePrecision], If[LessEqual[t$95$1, 2e+20], N[((-z) + N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+253}:\\
\;\;\;\;{\left(\frac{-1}{y}\right)}^{-1}\\
\mathbf{elif}\;t\_1 \leq -5000000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{-y}{z}, z, -z\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+20}:\\
\;\;\;\;\left(-z\right) + \log t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot x\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -1.9999999999999999e253Initial program 99.9%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
Applied rewrites99.8%
Taylor expanded in y around inf
lower-/.f6461.8
Applied rewrites61.8%
if -1.9999999999999999e253 < (-.f64 (*.f64 x (log.f64 y)) y) < -5e12Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites99.9%
Taylor expanded in z around -inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
neg-mul-1N/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
remove-double-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites80.4%
Taylor expanded in y around inf
Applied rewrites58.7%
if -5e12 < (-.f64 (*.f64 x (log.f64 y)) y) < 2e20Initial program 100.0%
lift--.f64N/A
sub-negN/A
lift--.f64N/A
flip--N/A
div-invN/A
difference-of-squaresN/A
lift--.f64N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6497.2
Applied rewrites97.2%
if 2e20 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.6%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6486.3
Applied rewrites86.3%
Final simplification74.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.3e+98) (not (<= z 2.45e+20))) (fma (/ (* (log y) x) z) z (- z)) (fma (log y) x (- (log t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+98) || !(z <= 2.45e+20)) {
tmp = fma(((log(y) * x) / z), z, -z);
} else {
tmp = fma(log(y), x, (log(t) - y));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.3e+98) || !(z <= 2.45e+20)) tmp = fma(Float64(Float64(log(y) * x) / z), z, Float64(-z)); else tmp = fma(log(y), x, Float64(log(t) - y)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.3e+98], N[Not[LessEqual[z, 2.45e+20]], $MachinePrecision]], N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision] * z + (-z)), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x + N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+98} \lor \neg \left(z \leq 2.45 \cdot 10^{+20}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{\log y \cdot x}{z}, z, -z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t - y\right)\\
\end{array}
\end{array}
if z < -1.3e98 or 2.45e20 < z Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites100.0%
Taylor expanded in z around -inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
neg-mul-1N/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
remove-double-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites86.1%
if -1.3e98 < z < 2.45e20Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6498.8
Applied rewrites98.8%
Applied rewrites98.8%
Final simplification93.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.3e+98) (not (<= z 2.45e+20))) (fma (/ (* (log y) x) z) z (- z)) (- (fma (log y) x (log t)) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+98) || !(z <= 2.45e+20)) {
tmp = fma(((log(y) * x) / z), z, -z);
} else {
tmp = fma(log(y), x, log(t)) - y;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.3e+98) || !(z <= 2.45e+20)) tmp = fma(Float64(Float64(log(y) * x) / z), z, Float64(-z)); else tmp = Float64(fma(log(y), x, log(t)) - y); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.3e+98], N[Not[LessEqual[z, 2.45e+20]], $MachinePrecision]], N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision] * z + (-z)), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+98} \lor \neg \left(z \leq 2.45 \cdot 10^{+20}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{\log y \cdot x}{z}, z, -z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\
\end{array}
\end{array}
if z < -1.3e98 or 2.45e20 < z Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites100.0%
Taylor expanded in z around -inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
neg-mul-1N/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
remove-double-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites86.1%
if -1.3e98 < z < 2.45e20Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6498.8
Applied rewrites98.8%
Final simplification93.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)) (t_2 (/ (- y) z)))
(if (<= z -1.05e+87)
(* z (+ t_2 -1.0))
(if (<= z -1.4e-51)
t_1
(if (<= z 1.55e-162)
(- (log t) y)
(if (<= z 7.8e-22) t_1 (fma t_2 z (- z))))))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double t_2 = -y / z;
double tmp;
if (z <= -1.05e+87) {
tmp = z * (t_2 + -1.0);
} else if (z <= -1.4e-51) {
tmp = t_1;
} else if (z <= 1.55e-162) {
tmp = log(t) - y;
} else if (z <= 7.8e-22) {
tmp = t_1;
} else {
tmp = fma(t_2, z, -z);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(log(y) * x) t_2 = Float64(Float64(-y) / z) tmp = 0.0 if (z <= -1.05e+87) tmp = Float64(z * Float64(t_2 + -1.0)); elseif (z <= -1.4e-51) tmp = t_1; elseif (z <= 1.55e-162) tmp = Float64(log(t) - y); elseif (z <= 7.8e-22) tmp = t_1; else tmp = fma(t_2, z, Float64(-z)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[((-y) / z), $MachinePrecision]}, If[LessEqual[z, -1.05e+87], N[(z * N[(t$95$2 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.4e-51], t$95$1, If[LessEqual[z, 1.55e-162], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[z, 7.8e-22], t$95$1, N[(t$95$2 * z + (-z)), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
t_2 := \frac{-y}{z}\\
\mathbf{if}\;z \leq -1.05 \cdot 10^{+87}:\\
\;\;\;\;z \cdot \left(t\_2 + -1\right)\\
\mathbf{elif}\;z \leq -1.4 \cdot 10^{-51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-162}:\\
\;\;\;\;\log t - y\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, z, -z\right)\\
\end{array}
\end{array}
if z < -1.05e87Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites99.9%
Taylor expanded in z around -inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
neg-mul-1N/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
remove-double-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites84.6%
Applied rewrites84.6%
if -1.05e87 < z < -1.4e-51 or 1.5499999999999999e-162 < z < 7.79999999999999996e-22Initial program 99.8%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6465.5
Applied rewrites65.5%
if -1.4e-51 < z < 1.5499999999999999e-162Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites61.6%
if 7.79999999999999996e-22 < z Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites99.9%
Taylor expanded in z around -inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
neg-mul-1N/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
remove-double-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
Applied rewrites79.7%
Final simplification71.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.8e+136) (not (<= x 8.5e+136))) (* (log y) x) (- (- (log t) y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.8e+136) || !(x <= 8.5e+136)) {
tmp = log(y) * x;
} else {
tmp = (log(t) - 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+136)) .or. (.not. (x <= 8.5d+136))) then
tmp = log(y) * x
else
tmp = (log(t) - 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+136) || !(x <= 8.5e+136)) {
tmp = Math.log(y) * x;
} else {
tmp = (Math.log(t) - y) - z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.8e+136) or not (x <= 8.5e+136): tmp = math.log(y) * x else: tmp = (math.log(t) - y) - z return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.8e+136) || !(x <= 8.5e+136)) tmp = Float64(log(y) * x); else tmp = Float64(Float64(log(t) - y) - z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6.8e+136) || ~((x <= 8.5e+136))) tmp = log(y) * x; else tmp = (log(t) - y) - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.8e+136], N[Not[LessEqual[x, 8.5e+136]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+136} \lor \neg \left(x \leq 8.5 \cdot 10^{+136}\right):\\
\;\;\;\;\log y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\end{array}
\end{array}
if x < -6.79999999999999993e136 or 8.49999999999999966e136 < x Initial program 99.7%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6478.1
Applied rewrites78.1%
if -6.79999999999999993e136 < x < 8.49999999999999966e136Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-log.f6488.2
Applied rewrites88.2%
Final simplification84.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.3e+62) (not (<= z 420.0))) (fma (/ (- y) z) z (- z)) (- (log t) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+62) || !(z <= 420.0)) {
tmp = fma((-y / z), z, -z);
} else {
tmp = log(t) - y;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.3e+62) || !(z <= 420.0)) tmp = fma(Float64(Float64(-y) / z), z, Float64(-z)); else tmp = Float64(log(t) - y); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.3e+62], N[Not[LessEqual[z, 420.0]], $MachinePrecision]], N[(N[((-y) / z), $MachinePrecision] * z + (-z)), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+62} \lor \neg \left(z \leq 420\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{-y}{z}, z, -z\right)\\
\mathbf{else}:\\
\;\;\;\;\log t - y\\
\end{array}
\end{array}
if z < -1.29999999999999992e62 or 420 < z Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites100.0%
Taylor expanded in z around -inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
neg-mul-1N/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
remove-double-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites80.2%
if -1.29999999999999992e62 < z < 420Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6499.4
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites53.5%
Final simplification65.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.55e-25) (not (<= z 5.4e-14))) (fma (/ (- y) z) z (- z)) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.55e-25) || !(z <= 5.4e-14)) {
tmp = fma((-y / z), z, -z);
} else {
tmp = -y;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.55e-25) || !(z <= 5.4e-14)) tmp = fma(Float64(Float64(-y) / z), z, Float64(-z)); else tmp = Float64(-y); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.55e-25], N[Not[LessEqual[z, 5.4e-14]], $MachinePrecision]], N[(N[((-y) / z), $MachinePrecision] * z + (-z)), $MachinePrecision], (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-25} \lor \neg \left(z \leq 5.4 \cdot 10^{-14}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{-y}{z}, z, -z\right)\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if z < -1.54999999999999997e-25 or 5.3999999999999997e-14 < z Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites99.9%
Taylor expanded in z around -inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
neg-mul-1N/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
remove-double-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites74.1%
if -1.54999999999999997e-25 < z < 5.3999999999999997e-14Initial program 99.8%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
Applied rewrites99.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6434.1
Applied rewrites34.1%
Final simplification55.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.55e-25) (not (<= z 5.4e-14))) (* z (+ (/ (- y) z) -1.0)) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.55e-25) || !(z <= 5.4e-14)) {
tmp = z * ((-y / z) + -1.0);
} 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 ((z <= (-1.55d-25)) .or. (.not. (z <= 5.4d-14))) then
tmp = z * ((-y / z) + (-1.0d0))
else
tmp = -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.55e-25) || !(z <= 5.4e-14)) {
tmp = z * ((-y / z) + -1.0);
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.55e-25) or not (z <= 5.4e-14): tmp = z * ((-y / z) + -1.0) else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.55e-25) || !(z <= 5.4e-14)) tmp = Float64(z * Float64(Float64(Float64(-y) / z) + -1.0)); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.55e-25) || ~((z <= 5.4e-14))) tmp = z * ((-y / z) + -1.0); else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.55e-25], N[Not[LessEqual[z, 5.4e-14]], $MachinePrecision]], N[(z * N[(N[((-y) / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-25} \lor \neg \left(z \leq 5.4 \cdot 10^{-14}\right):\\
\;\;\;\;z \cdot \left(\frac{-y}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if z < -1.54999999999999997e-25 or 5.3999999999999997e-14 < z Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
sub-negN/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
sub-negN/A
Applied rewrites99.9%
Taylor expanded in z around -inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
neg-mul-1N/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
remove-double-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites74.1%
Applied rewrites74.1%
if -1.54999999999999997e-25 < z < 5.3999999999999997e-14Initial program 99.8%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
Applied rewrites99.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6434.1
Applied rewrites34.1%
Final simplification55.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.3e+98) (not (<= z 2e+20))) (- z) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+98) || !(z <= 2e+20)) {
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 ((z <= (-1.3d+98)) .or. (.not. (z <= 2d+20))) 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 ((z <= -1.3e+98) || !(z <= 2e+20)) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.3e+98) or not (z <= 2e+20): tmp = -z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.3e+98) || !(z <= 2e+20)) tmp = Float64(-z); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.3e+98) || ~((z <= 2e+20))) tmp = -z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.3e+98], N[Not[LessEqual[z, 2e+20]], $MachinePrecision]], (-z), (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+98} \lor \neg \left(z \leq 2 \cdot 10^{+20}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if z < -1.3e98 or 2e20 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6470.0
Applied rewrites70.0%
if -1.3e98 < z < 2e20Initial program 99.8%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
Applied rewrites99.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6434.6
Applied rewrites34.6%
Final simplification49.4%
(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.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6431.0
Applied rewrites31.0%
Final simplification31.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 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.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6431.0
Applied rewrites31.0%
Applied rewrites12.1%
Applied rewrites2.2%
Final simplification2.2%
herbie shell --seed 2024313
(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)))