
(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) (- (- y) z)) (log t)))
double code(double x, double y, double z, double t) {
return fma(x, log(y), (-y - z)) + log(t);
}
function code(x, y, z, t) return Float64(fma(x, log(y), Float64(Float64(-y) - z)) + log(t)) end
code[x_, y_, z_, t_] := N[(N[(x * N[Log[y], $MachinePrecision] + N[((-y) - z), $MachinePrecision]), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \log y, \left(-y\right) - z\right) + \log t
\end{array}
Initial program 99.9%
sub-neg99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (fma x (log y) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
return fma(x, log(y), (log(t) - (y + z)));
}
function code(x, y, z, t) return fma(x, log(y), Float64(log(t) - Float64(y + z))) end
code[x_, y_, z_, t_] := N[(x * N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \log y, \log t - \left(y + z\right)\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 99.9%
associate--l+99.9%
+-commutative99.9%
+-commutative99.9%
associate--r-99.9%
fma-neg99.9%
+-commutative99.9%
associate-+r-99.9%
associate-+r-99.9%
+-commutative99.9%
sub-neg99.9%
log-rec99.9%
distribute-neg-in99.9%
+-commutative99.9%
log-rec99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.8e+62) (not (<= x 2.5e+105))) (+ (log t) (- (* x (log y)) y)) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.8e+62) || !(x <= 2.5e+105)) {
tmp = log(t) + ((x * log(y)) - y);
} 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 <= (-5.8d+62)) .or. (.not. (x <= 2.5d+105))) then
tmp = log(t) + ((x * log(y)) - y)
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 <= -5.8e+62) || !(x <= 2.5e+105)) {
tmp = Math.log(t) + ((x * Math.log(y)) - y);
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.8e+62) or not (x <= 2.5e+105): tmp = math.log(t) + ((x * math.log(y)) - y) else: tmp = math.log(t) - (y + z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.8e+62) || !(x <= 2.5e+105)) tmp = Float64(log(t) + Float64(Float64(x * log(y)) - y)); else tmp = Float64(log(t) - Float64(y + z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.8e+62) || ~((x <= 2.5e+105))) tmp = log(t) + ((x * log(y)) - y); else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.8e+62], N[Not[LessEqual[x, 2.5e+105]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+62} \lor \neg \left(x \leq 2.5 \cdot 10^{+105}\right):\\
\;\;\;\;\log t + \left(x \cdot \log y - y\right)\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -5.79999999999999968e62 or 2.50000000000000023e105 < x Initial program 99.7%
Taylor expanded in z around 0 86.4%
associate--l+86.4%
+-commutative86.4%
Simplified86.4%
if -5.79999999999999968e62 < x < 2.50000000000000023e105Initial program 100.0%
Taylor expanded in x around 0 94.0%
Final simplification91.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -5.5e+63)
(+ (log t) (- t_1 y))
(if (<= x 8.6e+24) (- (log t) (+ y z)) (- (+ (log t) t_1) z)))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -5.5e+63) {
tmp = log(t) + (t_1 - y);
} else if (x <= 8.6e+24) {
tmp = log(t) - (y + z);
} else {
tmp = (log(t) + 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) :: tmp
t_1 = x * log(y)
if (x <= (-5.5d+63)) then
tmp = log(t) + (t_1 - y)
else if (x <= 8.6d+24) then
tmp = log(t) - (y + z)
else
tmp = (log(t) + 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 tmp;
if (x <= -5.5e+63) {
tmp = Math.log(t) + (t_1 - y);
} else if (x <= 8.6e+24) {
tmp = Math.log(t) - (y + z);
} else {
tmp = (Math.log(t) + t_1) - z;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -5.5e+63: tmp = math.log(t) + (t_1 - y) elif x <= 8.6e+24: tmp = math.log(t) - (y + z) else: tmp = (math.log(t) + t_1) - z return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -5.5e+63) tmp = Float64(log(t) + Float64(t_1 - y)); elseif (x <= 8.6e+24) tmp = Float64(log(t) - Float64(y + z)); else tmp = Float64(Float64(log(t) + t_1) - z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (x <= -5.5e+63) tmp = log(t) + (t_1 - y); elseif (x <= 8.6e+24) tmp = log(t) - (y + z); else tmp = (log(t) + t_1) - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.5e+63], N[(N[Log[t], $MachinePrecision] + N[(t$95$1 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.6e+24], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] + t$95$1), $MachinePrecision] - z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -5.5 \cdot 10^{+63}:\\
\;\;\;\;\log t + \left(t_1 - y\right)\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{+24}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log t + t_1\right) - z\\
\end{array}
\end{array}
if x < -5.50000000000000004e63Initial program 99.8%
Taylor expanded in z around 0 86.8%
associate--l+86.8%
+-commutative86.8%
Simplified86.8%
if -5.50000000000000004e63 < x < 8.59999999999999975e24Initial program 100.0%
Taylor expanded in x around 0 97.9%
if 8.59999999999999975e24 < x Initial program 99.7%
Taylor expanded in y around 0 86.0%
Final simplification92.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))))
(if (<= x -8e+39)
t_1
(if (<= x -3.7e-37)
(- z)
(if (<= x -4e-146)
(log t)
(if (<= x 1.35e-153)
(- z)
(if (<= x 2.6e-49) (- y) (if (<= x 1.1e+131) (- z) t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -8e+39) {
tmp = t_1;
} else if (x <= -3.7e-37) {
tmp = -z;
} else if (x <= -4e-146) {
tmp = log(t);
} else if (x <= 1.35e-153) {
tmp = -z;
} else if (x <= 2.6e-49) {
tmp = -y;
} else if (x <= 1.1e+131) {
tmp = -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)
if (x <= (-8d+39)) then
tmp = t_1
else if (x <= (-3.7d-37)) then
tmp = -z
else if (x <= (-4d-146)) then
tmp = log(t)
else if (x <= 1.35d-153) then
tmp = -z
else if (x <= 2.6d-49) then
tmp = -y
else if (x <= 1.1d+131) then
tmp = -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);
double tmp;
if (x <= -8e+39) {
tmp = t_1;
} else if (x <= -3.7e-37) {
tmp = -z;
} else if (x <= -4e-146) {
tmp = Math.log(t);
} else if (x <= 1.35e-153) {
tmp = -z;
} else if (x <= 2.6e-49) {
tmp = -y;
} else if (x <= 1.1e+131) {
tmp = -z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -8e+39: tmp = t_1 elif x <= -3.7e-37: tmp = -z elif x <= -4e-146: tmp = math.log(t) elif x <= 1.35e-153: tmp = -z elif x <= 2.6e-49: tmp = -y elif x <= 1.1e+131: tmp = -z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -8e+39) tmp = t_1; elseif (x <= -3.7e-37) tmp = Float64(-z); elseif (x <= -4e-146) tmp = log(t); elseif (x <= 1.35e-153) tmp = Float64(-z); elseif (x <= 2.6e-49) tmp = Float64(-y); elseif (x <= 1.1e+131) tmp = Float64(-z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (x <= -8e+39) tmp = t_1; elseif (x <= -3.7e-37) tmp = -z; elseif (x <= -4e-146) tmp = log(t); elseif (x <= 1.35e-153) tmp = -z; elseif (x <= 2.6e-49) tmp = -y; elseif (x <= 1.1e+131) tmp = -z; 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]}, If[LessEqual[x, -8e+39], t$95$1, If[LessEqual[x, -3.7e-37], (-z), If[LessEqual[x, -4e-146], N[Log[t], $MachinePrecision], If[LessEqual[x, 1.35e-153], (-z), If[LessEqual[x, 2.6e-49], (-y), If[LessEqual[x, 1.1e+131], (-z), t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -8 \cdot 10^{+39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-37}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-146}:\\
\;\;\;\;\log t\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-153}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-49}:\\
\;\;\;\;-y\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+131}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -7.99999999999999952e39 or 1.0999999999999999e131 < x Initial program 99.7%
Taylor expanded in x around 0 99.7%
associate--l+99.7%
+-commutative99.7%
+-commutative99.7%
associate--r-99.7%
fma-neg99.8%
+-commutative99.8%
associate-+r-99.8%
associate-+r-99.8%
+-commutative99.8%
sub-neg99.8%
log-rec99.8%
distribute-neg-in99.8%
+-commutative99.8%
log-rec99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in x around inf 72.3%
if -7.99999999999999952e39 < x < -3.7e-37 or -4.0000000000000001e-146 < x < 1.35000000000000005e-153 or 2.59999999999999995e-49 < x < 1.0999999999999999e131Initial program 99.9%
Taylor expanded in x around 0 99.9%
associate--l+99.9%
+-commutative99.9%
+-commutative99.9%
associate--r-99.9%
fma-neg99.9%
+-commutative99.9%
associate-+r-99.9%
associate-+r-99.9%
+-commutative99.9%
sub-neg99.9%
log-rec99.9%
distribute-neg-in99.9%
+-commutative99.9%
log-rec99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 50.6%
neg-mul-150.6%
Simplified50.6%
if -3.7e-37 < x < -4.0000000000000001e-146Initial program 100.0%
Taylor expanded in z around 0 77.4%
remove-double-neg77.4%
log-rec77.4%
mul-1-neg77.4%
mul-1-neg77.4%
log-rec77.4%
remove-double-neg77.4%
log-pow77.4%
log-prod77.4%
Simplified77.4%
add-log-exp47.2%
diff-log47.2%
Applied egg-rr47.2%
Taylor expanded in x around 0 47.2%
Taylor expanded in y around 0 46.5%
if 1.35000000000000005e-153 < x < 2.59999999999999995e-49Initial program 100.0%
Taylor expanded in x around 0 100.0%
associate--l+100.0%
+-commutative100.0%
+-commutative100.0%
associate--r-100.0%
fma-neg100.0%
+-commutative100.0%
associate-+r-100.0%
associate-+r-100.0%
+-commutative100.0%
sub-neg100.0%
log-rec100.0%
distribute-neg-in100.0%
+-commutative100.0%
log-rec100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 70.1%
neg-mul-170.1%
Simplified70.1%
Final simplification59.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- (log t) z)))
(if (<= x -1.7e+40)
t_1
(if (<= x 1.9e-155)
t_2
(if (<= x 4.3e-49) (- (log t) y) (if (<= x 1.1e+131) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double t_2 = log(t) - z;
double tmp;
if (x <= -1.7e+40) {
tmp = t_1;
} else if (x <= 1.9e-155) {
tmp = t_2;
} else if (x <= 4.3e-49) {
tmp = log(t) - y;
} else if (x <= 1.1e+131) {
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 = log(t) - z
if (x <= (-1.7d+40)) then
tmp = t_1
else if (x <= 1.9d-155) then
tmp = t_2
else if (x <= 4.3d-49) then
tmp = log(t) - y
else if (x <= 1.1d+131) 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 = Math.log(t) - z;
double tmp;
if (x <= -1.7e+40) {
tmp = t_1;
} else if (x <= 1.9e-155) {
tmp = t_2;
} else if (x <= 4.3e-49) {
tmp = Math.log(t) - y;
} else if (x <= 1.1e+131) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) t_2 = math.log(t) - z tmp = 0 if x <= -1.7e+40: tmp = t_1 elif x <= 1.9e-155: tmp = t_2 elif x <= 4.3e-49: tmp = math.log(t) - y elif x <= 1.1e+131: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) t_2 = Float64(log(t) - z) tmp = 0.0 if (x <= -1.7e+40) tmp = t_1; elseif (x <= 1.9e-155) tmp = t_2; elseif (x <= 4.3e-49) tmp = Float64(log(t) - y); elseif (x <= 1.1e+131) 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 = log(t) - z; tmp = 0.0; if (x <= -1.7e+40) tmp = t_1; elseif (x <= 1.9e-155) tmp = t_2; elseif (x <= 4.3e-49) tmp = log(t) - y; elseif (x <= 1.1e+131) 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[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[x, -1.7e+40], t$95$1, If[LessEqual[x, 1.9e-155], t$95$2, If[LessEqual[x, 4.3e-49], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 1.1e+131], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \log t - z\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{+40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-155}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-49}:\\
\;\;\;\;\log t - y\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+131}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.69999999999999994e40 or 1.0999999999999999e131 < x Initial program 99.7%
Taylor expanded in x around 0 99.7%
associate--l+99.7%
+-commutative99.7%
+-commutative99.7%
associate--r-99.7%
fma-neg99.8%
+-commutative99.8%
associate-+r-99.8%
associate-+r-99.8%
+-commutative99.8%
sub-neg99.8%
log-rec99.8%
distribute-neg-in99.8%
+-commutative99.8%
log-rec99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in x around inf 72.3%
if -1.69999999999999994e40 < x < 1.8999999999999999e-155 or 4.30000000000000016e-49 < x < 1.0999999999999999e131Initial program 99.9%
Taylor expanded in z around inf 63.7%
neg-mul-163.7%
Simplified63.7%
if 1.8999999999999999e-155 < x < 4.30000000000000016e-49Initial program 100.0%
Taylor expanded in z around 0 93.4%
remove-double-neg93.4%
log-rec93.4%
mul-1-neg93.4%
mul-1-neg93.4%
log-rec93.4%
remove-double-neg93.4%
log-pow93.4%
log-prod93.4%
Simplified93.4%
Taylor expanded in x around 0 93.4%
Final simplification68.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -2.3e+68)
t_1
(if (<= x 2.35e-49) (- (log t) y) (if (<= x 1.15e+131) (- z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -2.3e+68) {
tmp = t_1;
} else if (x <= 2.35e-49) {
tmp = log(t) - y;
} else if (x <= 1.15e+131) {
tmp = -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)
if (x <= (-2.3d+68)) then
tmp = t_1
else if (x <= 2.35d-49) then
tmp = log(t) - y
else if (x <= 1.15d+131) then
tmp = -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);
double tmp;
if (x <= -2.3e+68) {
tmp = t_1;
} else if (x <= 2.35e-49) {
tmp = Math.log(t) - y;
} else if (x <= 1.15e+131) {
tmp = -z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -2.3e+68: tmp = t_1 elif x <= 2.35e-49: tmp = math.log(t) - y elif x <= 1.15e+131: tmp = -z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -2.3e+68) tmp = t_1; elseif (x <= 2.35e-49) tmp = Float64(log(t) - y); elseif (x <= 1.15e+131) tmp = Float64(-z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (x <= -2.3e+68) tmp = t_1; elseif (x <= 2.35e-49) tmp = log(t) - y; elseif (x <= 1.15e+131) tmp = -z; 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]}, If[LessEqual[x, -2.3e+68], t$95$1, If[LessEqual[x, 2.35e-49], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 1.15e+131], (-z), t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -2.3 \cdot 10^{+68}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.35 \cdot 10^{-49}:\\
\;\;\;\;\log t - y\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+131}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.3e68 or 1.14999999999999996e131 < x Initial program 99.7%
Taylor expanded in x around 0 99.7%
associate--l+99.7%
+-commutative99.7%
+-commutative99.7%
associate--r-99.7%
fma-neg99.8%
+-commutative99.8%
associate-+r-99.8%
associate-+r-99.8%
+-commutative99.8%
sub-neg99.8%
log-rec99.8%
distribute-neg-in99.8%
+-commutative99.8%
log-rec99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in x around inf 75.0%
if -2.3e68 < x < 2.35000000000000011e-49Initial program 100.0%
Taylor expanded in z around 0 60.7%
remove-double-neg60.7%
log-rec60.7%
mul-1-neg60.7%
mul-1-neg60.7%
log-rec60.7%
remove-double-neg60.7%
log-pow57.4%
log-prod57.4%
Simplified57.4%
Taylor expanded in x around 0 60.0%
if 2.35000000000000011e-49 < x < 1.14999999999999996e131Initial program 99.9%
Taylor expanded in x around 0 99.8%
associate--l+99.9%
+-commutative99.9%
+-commutative99.9%
associate--r-99.8%
fma-neg99.8%
+-commutative99.8%
associate-+r-99.8%
associate-+r-99.8%
+-commutative99.8%
sub-neg99.8%
log-rec99.8%
distribute-neg-in99.8%
+-commutative99.8%
log-rec99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in z around inf 50.3%
neg-mul-150.3%
Simplified50.3%
Final simplification63.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5e+69) (not (<= x 4.6e+134))) (* x (log y)) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5e+69) || !(x <= 4.6e+134)) {
tmp = x * log(y);
} 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 <= (-5d+69)) .or. (.not. (x <= 4.6d+134))) then
tmp = x * log(y)
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 <= -5e+69) || !(x <= 4.6e+134)) {
tmp = x * Math.log(y);
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5e+69) or not (x <= 4.6e+134): tmp = x * math.log(y) else: tmp = math.log(t) - (y + z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5e+69) || !(x <= 4.6e+134)) tmp = Float64(x * log(y)); else tmp = Float64(log(t) - Float64(y + z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5e+69) || ~((x <= 4.6e+134))) tmp = x * log(y); else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5e+69], N[Not[LessEqual[x, 4.6e+134]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+69} \lor \neg \left(x \leq 4.6 \cdot 10^{+134}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -5.00000000000000036e69 or 4.5999999999999996e134 < x Initial program 99.7%
Taylor expanded in x around 0 99.7%
associate--l+99.7%
+-commutative99.7%
+-commutative99.7%
associate--r-99.7%
fma-neg99.8%
+-commutative99.8%
associate-+r-99.8%
associate-+r-99.8%
+-commutative99.8%
sub-neg99.8%
log-rec99.8%
distribute-neg-in99.8%
+-commutative99.8%
log-rec99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in x around inf 75.0%
if -5.00000000000000036e69 < x < 4.5999999999999996e134Initial program 100.0%
Taylor expanded in x around 0 93.6%
Final simplification87.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.1e-30)
(- z)
(if (<= z 2.7e-275)
(- y)
(if (<= z 1.45e-153) (log t) (if (<= z 3.25e+78) (- y) (- z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.1e-30) {
tmp = -z;
} else if (z <= 2.7e-275) {
tmp = -y;
} else if (z <= 1.45e-153) {
tmp = log(t);
} else if (z <= 3.25e+78) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.1d-30)) then
tmp = -z
else if (z <= 2.7d-275) then
tmp = -y
else if (z <= 1.45d-153) then
tmp = log(t)
else if (z <= 3.25d+78) then
tmp = -y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.1e-30) {
tmp = -z;
} else if (z <= 2.7e-275) {
tmp = -y;
} else if (z <= 1.45e-153) {
tmp = Math.log(t);
} else if (z <= 3.25e+78) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.1e-30: tmp = -z elif z <= 2.7e-275: tmp = -y elif z <= 1.45e-153: tmp = math.log(t) elif z <= 3.25e+78: tmp = -y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.1e-30) tmp = Float64(-z); elseif (z <= 2.7e-275) tmp = Float64(-y); elseif (z <= 1.45e-153) tmp = log(t); elseif (z <= 3.25e+78) tmp = Float64(-y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.1e-30) tmp = -z; elseif (z <= 2.7e-275) tmp = -y; elseif (z <= 1.45e-153) tmp = log(t); elseif (z <= 3.25e+78) tmp = -y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.1e-30], (-z), If[LessEqual[z, 2.7e-275], (-y), If[LessEqual[z, 1.45e-153], N[Log[t], $MachinePrecision], If[LessEqual[z, 3.25e+78], (-y), (-z)]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{-30}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-275}:\\
\;\;\;\;-y\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-153}:\\
\;\;\;\;\log t\\
\mathbf{elif}\;z \leq 3.25 \cdot 10^{+78}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -1.09999999999999992e-30 or 3.25000000000000018e78 < z Initial program 99.9%
Taylor expanded in x around 0 99.9%
associate--l+99.9%
+-commutative99.9%
+-commutative99.9%
associate--r-99.9%
fma-neg100.0%
+-commutative100.0%
associate-+r-100.0%
associate-+r-100.0%
+-commutative100.0%
sub-neg100.0%
log-rec100.0%
distribute-neg-in100.0%
+-commutative100.0%
log-rec100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 63.0%
neg-mul-163.0%
Simplified63.0%
if -1.09999999999999992e-30 < z < 2.69999999999999993e-275 or 1.45000000000000001e-153 < z < 3.25000000000000018e78Initial program 99.8%
Taylor expanded in x around 0 99.8%
associate--l+99.8%
+-commutative99.8%
+-commutative99.8%
associate--r-99.8%
fma-neg99.8%
+-commutative99.8%
associate-+r-99.8%
associate-+r-99.8%
+-commutative99.8%
sub-neg99.8%
log-rec99.8%
distribute-neg-in99.8%
+-commutative99.8%
log-rec99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in y around inf 40.7%
neg-mul-140.7%
Simplified40.7%
if 2.69999999999999993e-275 < z < 1.45000000000000001e-153Initial program 99.8%
Taylor expanded in z around 0 99.8%
remove-double-neg99.8%
log-rec99.8%
mul-1-neg99.8%
mul-1-neg99.8%
log-rec99.8%
remove-double-neg99.8%
log-pow49.9%
log-prod49.9%
Simplified49.9%
add-log-exp49.7%
diff-log49.8%
Applied egg-rr49.8%
Taylor expanded in x around 0 48.9%
Taylor expanded in y around 0 44.9%
Final simplification51.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.1e-30) (not (<= z 9.5e+78))) (- z) (- y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.1e-30) || !(z <= 9.5e+78)) {
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.1d-30)) .or. (.not. (z <= 9.5d+78))) 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.1e-30) || !(z <= 9.5e+78)) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.1e-30) or not (z <= 9.5e+78): tmp = -z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.1e-30) || !(z <= 9.5e+78)) 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.1e-30) || ~((z <= 9.5e+78))) tmp = -z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.1e-30], N[Not[LessEqual[z, 9.5e+78]], $MachinePrecision]], (-z), (-y)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{-30} \lor \neg \left(z \leq 9.5 \cdot 10^{+78}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if z < -1.09999999999999992e-30 or 9.5000000000000006e78 < z Initial program 99.9%
Taylor expanded in x around 0 99.9%
associate--l+99.9%
+-commutative99.9%
+-commutative99.9%
associate--r-99.9%
fma-neg100.0%
+-commutative100.0%
associate-+r-100.0%
associate-+r-100.0%
+-commutative100.0%
sub-neg100.0%
log-rec100.0%
distribute-neg-in100.0%
+-commutative100.0%
log-rec100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 63.0%
neg-mul-163.0%
Simplified63.0%
if -1.09999999999999992e-30 < z < 9.5000000000000006e78Initial program 99.8%
Taylor expanded in x around 0 99.8%
associate--l+99.8%
+-commutative99.8%
+-commutative99.8%
associate--r-99.8%
fma-neg99.8%
+-commutative99.8%
associate-+r-99.8%
associate-+r-99.8%
+-commutative99.8%
sub-neg99.8%
log-rec99.8%
distribute-neg-in99.8%
+-commutative99.8%
log-rec99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in y around inf 37.5%
neg-mul-137.5%
Simplified37.5%
Final simplification49.3%
(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%
Taylor expanded in x around 0 99.9%
associate--l+99.9%
+-commutative99.9%
+-commutative99.9%
associate--r-99.9%
fma-neg99.9%
+-commutative99.9%
associate-+r-99.9%
associate-+r-99.9%
+-commutative99.9%
sub-neg99.9%
log-rec99.9%
distribute-neg-in99.9%
+-commutative99.9%
log-rec99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in y around inf 26.8%
neg-mul-126.8%
Simplified26.8%
Final simplification26.8%
herbie shell --seed 2023308
(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)))