
(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 (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.8%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)) (t_2 (- t_1 y)))
(if (<= t_2 -5e+187)
(+ (- y) (log t))
(if (<= t_2 -3e+163) t_1 (if (<= t_2 2e+104) (- (log t) z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double t_2 = t_1 - y;
double tmp;
if (t_2 <= -5e+187) {
tmp = -y + log(t);
} else if (t_2 <= -3e+163) {
tmp = t_1;
} else if (t_2 <= 2e+104) {
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 = log(y) * x
t_2 = t_1 - y
if (t_2 <= (-5d+187)) then
tmp = -y + log(t)
else if (t_2 <= (-3d+163)) then
tmp = t_1
else if (t_2 <= 2d+104) 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 = Math.log(y) * x;
double t_2 = t_1 - y;
double tmp;
if (t_2 <= -5e+187) {
tmp = -y + Math.log(t);
} else if (t_2 <= -3e+163) {
tmp = t_1;
} else if (t_2 <= 2e+104) {
tmp = Math.log(t) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x t_2 = t_1 - y tmp = 0 if t_2 <= -5e+187: tmp = -y + math.log(t) elif t_2 <= -3e+163: tmp = t_1 elif t_2 <= 2e+104: tmp = math.log(t) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) t_2 = Float64(t_1 - y) tmp = 0.0 if (t_2 <= -5e+187) tmp = Float64(Float64(-y) + log(t)); elseif (t_2 <= -3e+163) tmp = t_1; elseif (t_2 <= 2e+104) tmp = Float64(log(t) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; t_2 = t_1 - y; tmp = 0.0; if (t_2 <= -5e+187) tmp = -y + log(t); elseif (t_2 <= -3e+163) tmp = t_1; elseif (t_2 <= 2e+104) tmp = log(t) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - y), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+187], N[((-y) + N[Log[t], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -3e+163], t$95$1, If[LessEqual[t$95$2, 2e+104], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
t_2 := t\_1 - y\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+187}:\\
\;\;\;\;\left(-y\right) + \log t\\
\mathbf{elif}\;t\_2 \leq -3 \cdot 10^{+163}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+104}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -5.0000000000000001e187Initial program 99.9%
lift--.f64N/A
flip--N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.8%
lift--.f64N/A
lift-fma.f64N/A
associate--l+N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
inv-powN/A
lower-pow.f6499.8
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6471.0
Applied rewrites71.0%
if -5.0000000000000001e187 < (-.f64 (*.f64 x (log.f64 y)) y) < -3.00000000000000013e163 or 2e104 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.5%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6472.3
Applied rewrites72.3%
if -3.00000000000000013e163 < (-.f64 (*.f64 x (log.f64 y)) y) < 2e104Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6481.0
Applied rewrites81.0%
Taylor expanded in x around 0
Applied rewrites71.7%
Final simplification71.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)) (t_2 (- t_1 y)))
(if (<= t_2 -5e+187)
(- y)
(if (<= t_2 -3e+163) t_1 (if (<= t_2 2e+104) (- (log t) z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double t_2 = t_1 - y;
double tmp;
if (t_2 <= -5e+187) {
tmp = -y;
} else if (t_2 <= -3e+163) {
tmp = t_1;
} else if (t_2 <= 2e+104) {
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 = log(y) * x
t_2 = t_1 - y
if (t_2 <= (-5d+187)) then
tmp = -y
else if (t_2 <= (-3d+163)) then
tmp = t_1
else if (t_2 <= 2d+104) 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 = Math.log(y) * x;
double t_2 = t_1 - y;
double tmp;
if (t_2 <= -5e+187) {
tmp = -y;
} else if (t_2 <= -3e+163) {
tmp = t_1;
} else if (t_2 <= 2e+104) {
tmp = Math.log(t) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x t_2 = t_1 - y tmp = 0 if t_2 <= -5e+187: tmp = -y elif t_2 <= -3e+163: tmp = t_1 elif t_2 <= 2e+104: tmp = math.log(t) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) t_2 = Float64(t_1 - y) tmp = 0.0 if (t_2 <= -5e+187) tmp = Float64(-y); elseif (t_2 <= -3e+163) tmp = t_1; elseif (t_2 <= 2e+104) tmp = Float64(log(t) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; t_2 = t_1 - y; tmp = 0.0; if (t_2 <= -5e+187) tmp = -y; elseif (t_2 <= -3e+163) tmp = t_1; elseif (t_2 <= 2e+104) tmp = log(t) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - y), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+187], (-y), If[LessEqual[t$95$2, -3e+163], t$95$1, If[LessEqual[t$95$2, 2e+104], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
t_2 := t\_1 - y\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+187}:\\
\;\;\;\;-y\\
\mathbf{elif}\;t\_2 \leq -3 \cdot 10^{+163}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+104}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -5.0000000000000001e187Initial program 99.9%
lift--.f64N/A
flip--N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.8%
lift--.f64N/A
lift-fma.f64N/A
associate--l+N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6470.9
Applied rewrites70.9%
if -5.0000000000000001e187 < (-.f64 (*.f64 x (log.f64 y)) y) < -3.00000000000000013e163 or 2e104 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.5%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6472.3
Applied rewrites72.3%
if -3.00000000000000013e163 < (-.f64 (*.f64 x (log.f64 y)) y) < 2e104Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6481.0
Applied rewrites81.0%
Taylor expanded in x around 0
Applied rewrites71.7%
Final simplification71.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* (log y) x) y)) (t_2 (- (log t) y)))
(if (<= t_1 -3e+163)
(fma (log y) x t_2)
(if (<= t_1 -2e-7) (- t_2 z) (fma (log y) x (- (log t) z))))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - y;
double t_2 = log(t) - y;
double tmp;
if (t_1 <= -3e+163) {
tmp = fma(log(y), x, t_2);
} else if (t_1 <= -2e-7) {
tmp = t_2 - z;
} else {
tmp = fma(log(y), x, (log(t) - z));
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - y) t_2 = Float64(log(t) - y) tmp = 0.0 if (t_1 <= -3e+163) tmp = fma(log(y), x, t_2); elseif (t_1 <= -2e-7) tmp = Float64(t_2 - z); else tmp = fma(log(y), x, Float64(log(t) - z)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$1, -3e+163], N[(N[Log[y], $MachinePrecision] * x + t$95$2), $MachinePrecision], If[LessEqual[t$95$1, -2e-7], N[(t$95$2 - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x + N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - y\\
t_2 := \log t - y\\
\mathbf{if}\;t\_1 \leq -3 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, t\_2\right)\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-7}:\\
\;\;\;\;t\_2 - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t - z\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -3.00000000000000013e163Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around 0
Applied rewrites92.0%
if -3.00000000000000013e163 < (-.f64 (*.f64 x (log.f64 y)) y) < -1.9999999999999999e-7Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-log.f6488.3
Applied rewrites88.3%
if -1.9999999999999999e-7 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.7%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6498.9
Applied rewrites98.9%
Applied rewrites98.9%
Final simplification94.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* (log y) x) y)) (t_2 (- (log t) y)))
(if (<= t_1 -3e+163)
(fma (log y) x t_2)
(if (<= t_1 -2e-7) (- t_2 z) (- (fma (log y) x (log t)) z)))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - y;
double t_2 = log(t) - y;
double tmp;
if (t_1 <= -3e+163) {
tmp = fma(log(y), x, t_2);
} else if (t_1 <= -2e-7) {
tmp = t_2 - z;
} else {
tmp = fma(log(y), x, log(t)) - z;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - y) t_2 = Float64(log(t) - y) tmp = 0.0 if (t_1 <= -3e+163) tmp = fma(log(y), x, t_2); elseif (t_1 <= -2e-7) tmp = Float64(t_2 - z); else tmp = Float64(fma(log(y), x, log(t)) - z); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$1, -3e+163], N[(N[Log[y], $MachinePrecision] * x + t$95$2), $MachinePrecision], If[LessEqual[t$95$1, -2e-7], N[(t$95$2 - z), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - y\\
t_2 := \log t - y\\
\mathbf{if}\;t\_1 \leq -3 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, t\_2\right)\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-7}:\\
\;\;\;\;t\_2 - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - z\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -3.00000000000000013e163Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around 0
Applied rewrites92.0%
if -3.00000000000000013e163 < (-.f64 (*.f64 x (log.f64 y)) y) < -1.9999999999999999e-7Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-log.f6488.3
Applied rewrites88.3%
if -1.9999999999999999e-7 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.7%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6498.9
Applied rewrites98.9%
Final simplification94.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* (log y) x) y)) (t_2 (fma (log y) x (log t))))
(if (<= t_1 -3e+163)
(- t_2 y)
(if (<= t_1 -2e-7) (- (- (log t) y) z) (- t_2 z)))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - y;
double t_2 = fma(log(y), x, log(t));
double tmp;
if (t_1 <= -3e+163) {
tmp = t_2 - y;
} else if (t_1 <= -2e-7) {
tmp = (log(t) - y) - z;
} else {
tmp = t_2 - z;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - y) t_2 = fma(log(y), x, log(t)) tmp = 0.0 if (t_1 <= -3e+163) tmp = Float64(t_2 - y); elseif (t_1 <= -2e-7) tmp = Float64(Float64(log(t) - y) - z); else tmp = Float64(t_2 - z); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -3e+163], N[(t$95$2 - y), $MachinePrecision], If[LessEqual[t$95$1, -2e-7], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], N[(t$95$2 - z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - y\\
t_2 := \mathsf{fma}\left(\log y, x, \log t\right)\\
\mathbf{if}\;t\_1 \leq -3 \cdot 10^{+163}:\\
\;\;\;\;t\_2 - y\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_2 - z\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -3.00000000000000013e163Initial program 99.9%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6492.0
Applied rewrites92.0%
if -3.00000000000000013e163 < (-.f64 (*.f64 x (log.f64 y)) y) < -1.9999999999999999e-7Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-log.f6488.3
Applied rewrites88.3%
if -1.9999999999999999e-7 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.7%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6498.9
Applied rewrites98.9%
Final simplification94.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (/ (* (log y) x) z) z (- z))))
(if (<= z -1.3e+75)
t_1
(if (<= z 8.4e+45) (- (fma (log y) x (log t)) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(((log(y) * x) / z), z, -z);
double tmp;
if (z <= -1.3e+75) {
tmp = t_1;
} else if (z <= 8.4e+45) {
tmp = fma(log(y), x, log(t)) - y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(Float64(log(y) * x) / z), z, Float64(-z)) tmp = 0.0 if (z <= -1.3e+75) tmp = t_1; elseif (z <= 8.4e+45) tmp = Float64(fma(log(y), x, log(t)) - y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision] * z + (-z)), $MachinePrecision]}, If[LessEqual[z, -1.3e+75], t$95$1, If[LessEqual[z, 8.4e+45], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{\log y \cdot x}{z}, z, -z\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.4 \cdot 10^{+45}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.29999999999999992e75 or 8.39999999999999979e45 < z Initial program 99.9%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6486.5
Applied rewrites86.5%
Taylor expanded in z around inf
Applied rewrites86.4%
Taylor expanded in x around inf
Applied rewrites86.5%
if -1.29999999999999992e75 < z < 8.39999999999999979e45Initial program 99.7%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6494.2
Applied rewrites94.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (/ (* (log y) x) z) z (- z)))) (if (<= x -1.7e+106) t_1 (if (<= x 1.75e+62) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(((log(y) * x) / z), z, -z);
double tmp;
if (x <= -1.7e+106) {
tmp = t_1;
} else if (x <= 1.75e+62) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(Float64(log(y) * x) / z), z, Float64(-z)) tmp = 0.0 if (x <= -1.7e+106) tmp = t_1; elseif (x <= 1.75e+62) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision] * z + (-z)), $MachinePrecision]}, If[LessEqual[x, -1.7e+106], t$95$1, If[LessEqual[x, 1.75e+62], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{\log y \cdot x}{z}, z, -z\right)\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+62}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.69999999999999997e106 or 1.74999999999999992e62 < x Initial program 99.6%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6484.6
Applied rewrites84.6%
Taylor expanded in z around inf
Applied rewrites68.3%
Taylor expanded in x around inf
Applied rewrites68.3%
if -1.69999999999999997e106 < x < 1.74999999999999992e62Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-log.f6497.9
Applied rewrites97.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (log y) x))) (if (<= x -9.2e+117) t_1 (if (<= x 2.65e+157) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -9.2e+117) {
tmp = t_1;
} else if (x <= 2.65e+157) {
tmp = (log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = log(y) * x
if (x <= (-9.2d+117)) then
tmp = t_1
else if (x <= 2.65d+157) then
tmp = (log(t) - y) - z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * x;
double tmp;
if (x <= -9.2e+117) {
tmp = t_1;
} else if (x <= 2.65e+157) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x tmp = 0 if x <= -9.2e+117: tmp = t_1 elif x <= 2.65e+157: tmp = (math.log(t) - y) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -9.2e+117) tmp = t_1; elseif (x <= 2.65e+157) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; tmp = 0.0; if (x <= -9.2e+117) tmp = t_1; elseif (x <= 2.65e+157) tmp = (log(t) - y) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -9.2e+117], t$95$1, If[LessEqual[x, 2.65e+157], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -9.2 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{+157}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9.19999999999999951e117 or 2.6499999999999999e157 < x Initial program 99.6%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6469.4
Applied rewrites69.4%
if -9.19999999999999951e117 < x < 2.6499999999999999e157Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lower-log.f6491.4
Applied rewrites91.4%
(FPCore (x y z t) :precision binary64 (if (<= y 9.5e+108) (- (log t) z) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9.5e+108) {
tmp = log(t) - 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 <= 9.5d+108) then
tmp = log(t) - 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 <= 9.5e+108) {
tmp = Math.log(t) - z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 9.5e+108: tmp = math.log(t) - z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 9.5e+108) tmp = Float64(log(t) - z); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 9.5e+108) tmp = log(t) - z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 9.5e+108], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.5 \cdot 10^{+108}:\\
\;\;\;\;\log t - z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if y < 9.50000000000000097e108Initial program 99.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-log.f6490.2
Applied rewrites90.2%
Taylor expanded in x around 0
Applied rewrites58.7%
if 9.50000000000000097e108 < y Initial program 99.8%
lift--.f64N/A
flip--N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites98.7%
lift--.f64N/A
lift-fma.f64N/A
associate--l+N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6471.2
Applied rewrites71.2%
(FPCore (x y z t) :precision binary64 (if (<= y 9.5e+108) (- z) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9.5e+108) {
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 <= 9.5d+108) 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 <= 9.5e+108) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 9.5e+108: tmp = -z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 9.5e+108) tmp = Float64(-z); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 9.5e+108) tmp = -z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 9.5e+108], (-z), (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.5 \cdot 10^{+108}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if y < 9.50000000000000097e108Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6444.9
Applied rewrites44.9%
if 9.50000000000000097e108 < y Initial program 99.8%
lift--.f64N/A
flip--N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites98.7%
lift--.f64N/A
lift-fma.f64N/A
associate--l+N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6471.2
Applied rewrites71.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.8%
lift--.f64N/A
flip--N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.1%
lift--.f64N/A
lift-fma.f64N/A
associate--l+N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.3%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6429.2
Applied rewrites29.2%
(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.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6435.0
Applied rewrites35.0%
Applied rewrites16.5%
Applied rewrites2.1%
herbie shell --seed 2024294
(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)))