
(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) (+ 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.8%
+-commutative99.8%
associate--l-99.8%
associate-+r-99.8%
+-commutative99.8%
associate--l+99.8%
fma-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.45e+32) (not (<= z 1.25e+76))) (- (log t) (+ y z)) (- (+ (log t) (* x (log y))) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.45e+32) || !(z <= 1.25e+76)) {
tmp = log(t) - (y + z);
} else {
tmp = (log(t) + (x * log(y))) - 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 <= (-2.45d+32)) .or. (.not. (z <= 1.25d+76))) then
tmp = log(t) - (y + z)
else
tmp = (log(t) + (x * log(y))) - y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.45e+32) || !(z <= 1.25e+76)) {
tmp = Math.log(t) - (y + z);
} else {
tmp = (Math.log(t) + (x * Math.log(y))) - y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.45e+32) or not (z <= 1.25e+76): tmp = math.log(t) - (y + z) else: tmp = (math.log(t) + (x * math.log(y))) - y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.45e+32) || !(z <= 1.25e+76)) tmp = Float64(log(t) - Float64(y + z)); else tmp = Float64(Float64(log(t) + Float64(x * log(y))) - y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.45e+32) || ~((z <= 1.25e+76))) tmp = log(t) - (y + z); else tmp = (log(t) + (x * log(y))) - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.45e+32], N[Not[LessEqual[z, 1.25e+76]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.45 \cdot 10^{+32} \lor \neg \left(z \leq 1.25 \cdot 10^{+76}\right):\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log t + x \cdot \log y\right) - y\\
\end{array}
\end{array}
if z < -2.4500000000000001e32 or 1.24999999999999998e76 < z Initial program 99.9%
Taylor expanded in x around 0 83.5%
if -2.4500000000000001e32 < z < 1.24999999999999998e76Initial program 99.8%
Taylor expanded in z around 0 98.0%
Final simplification93.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (log t) (* x (log y)))))
(if (<= x -7.8e+66)
(- t_1 z)
(if (<= x 2e+40) (- (log t) (+ y z)) (- t_1 y)))))
double code(double x, double y, double z, double t) {
double t_1 = log(t) + (x * log(y));
double tmp;
if (x <= -7.8e+66) {
tmp = t_1 - z;
} else if (x <= 2e+40) {
tmp = log(t) - (y + z);
} else {
tmp = t_1 - 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) :: t_1
real(8) :: tmp
t_1 = log(t) + (x * log(y))
if (x <= (-7.8d+66)) then
tmp = t_1 - z
else if (x <= 2d+40) then
tmp = log(t) - (y + z)
else
tmp = t_1 - y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(t) + (x * Math.log(y));
double tmp;
if (x <= -7.8e+66) {
tmp = t_1 - z;
} else if (x <= 2e+40) {
tmp = Math.log(t) - (y + z);
} else {
tmp = t_1 - y;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(t) + (x * math.log(y)) tmp = 0 if x <= -7.8e+66: tmp = t_1 - z elif x <= 2e+40: tmp = math.log(t) - (y + z) else: tmp = t_1 - y return tmp
function code(x, y, z, t) t_1 = Float64(log(t) + Float64(x * log(y))) tmp = 0.0 if (x <= -7.8e+66) tmp = Float64(t_1 - z); elseif (x <= 2e+40) tmp = Float64(log(t) - Float64(y + z)); else tmp = Float64(t_1 - y); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(t) + (x * log(y)); tmp = 0.0; if (x <= -7.8e+66) tmp = t_1 - z; elseif (x <= 2e+40) tmp = log(t) - (y + z); else tmp = t_1 - y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.8e+66], N[(t$95$1 - z), $MachinePrecision], If[LessEqual[x, 2e+40], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t + x \cdot \log y\\
\mathbf{if}\;x \leq -7.8 \cdot 10^{+66}:\\
\;\;\;\;t_1 - z\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+40}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 - y\\
\end{array}
\end{array}
if x < -7.8000000000000007e66Initial program 99.6%
Taylor expanded in y around 0 89.8%
if -7.8000000000000007e66 < x < 2.00000000000000006e40Initial program 100.0%
Taylor expanded in x around 0 98.5%
if 2.00000000000000006e40 < x Initial program 99.6%
Taylor expanded in z around 0 88.6%
Final simplification94.4%
(FPCore (x y z t) :precision binary64 (+ (log t) (- (- (* x (log y)) y) z)))
double code(double x, double y, double z, double t) {
return log(t) + (((x * log(y)) - y) - z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = log(t) + (((x * log(y)) - y) - z)
end function
public static double code(double x, double y, double z, double t) {
return Math.log(t) + (((x * Math.log(y)) - y) - z);
}
def code(x, y, z, t): return math.log(t) + (((x * math.log(y)) - y) - z)
function code(x, y, z, t) return Float64(log(t) + Float64(Float64(Float64(x * log(y)) - y) - z)) end
function tmp = code(x, y, z, t) tmp = log(t) + (((x * log(y)) - y) - z); end
code[x_, y_, z_, t_] := N[(N[Log[t], $MachinePrecision] + N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log t + \left(\left(x \cdot \log y - y\right) - z\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -8.5e+115)
t_1
(if (<= x -1.85e+83)
(- z)
(if (<= x -2.4e+62)
t_1
(if (<= x -8.5e-306)
(- y)
(if (<= x 1.4e-261) (- z) (if (<= x 7.4e+71) (- y) t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -8.5e+115) {
tmp = t_1;
} else if (x <= -1.85e+83) {
tmp = -z;
} else if (x <= -2.4e+62) {
tmp = t_1;
} else if (x <= -8.5e-306) {
tmp = -y;
} else if (x <= 1.4e-261) {
tmp = -z;
} else if (x <= 7.4e+71) {
tmp = -y;
} 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 <= (-8.5d+115)) then
tmp = t_1
else if (x <= (-1.85d+83)) then
tmp = -z
else if (x <= (-2.4d+62)) then
tmp = t_1
else if (x <= (-8.5d-306)) then
tmp = -y
else if (x <= 1.4d-261) then
tmp = -z
else if (x <= 7.4d+71) then
tmp = -y
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 <= -8.5e+115) {
tmp = t_1;
} else if (x <= -1.85e+83) {
tmp = -z;
} else if (x <= -2.4e+62) {
tmp = t_1;
} else if (x <= -8.5e-306) {
tmp = -y;
} else if (x <= 1.4e-261) {
tmp = -z;
} else if (x <= 7.4e+71) {
tmp = -y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -8.5e+115: tmp = t_1 elif x <= -1.85e+83: tmp = -z elif x <= -2.4e+62: tmp = t_1 elif x <= -8.5e-306: tmp = -y elif x <= 1.4e-261: tmp = -z elif x <= 7.4e+71: tmp = -y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -8.5e+115) tmp = t_1; elseif (x <= -1.85e+83) tmp = Float64(-z); elseif (x <= -2.4e+62) tmp = t_1; elseif (x <= -8.5e-306) tmp = Float64(-y); elseif (x <= 1.4e-261) tmp = Float64(-z); elseif (x <= 7.4e+71) tmp = Float64(-y); 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 <= -8.5e+115) tmp = t_1; elseif (x <= -1.85e+83) tmp = -z; elseif (x <= -2.4e+62) tmp = t_1; elseif (x <= -8.5e-306) tmp = -y; elseif (x <= 1.4e-261) tmp = -z; elseif (x <= 7.4e+71) tmp = -y; 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, -8.5e+115], t$95$1, If[LessEqual[x, -1.85e+83], (-z), If[LessEqual[x, -2.4e+62], t$95$1, If[LessEqual[x, -8.5e-306], (-y), If[LessEqual[x, 1.4e-261], (-z), If[LessEqual[x, 7.4e+71], (-y), t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{+115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{+83}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{+62}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{-306}:\\
\;\;\;\;-y\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-261}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{+71}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -8.50000000000000057e115 or -1.8500000000000001e83 < x < -2.4e62 or 7.4e71 < x Initial program 99.6%
associate--l-99.6%
associate-+l-99.6%
*-commutative99.6%
add-cube-cbrt98.5%
associate-*l*98.6%
fma-neg98.6%
pow298.6%
Applied egg-rr98.6%
Taylor expanded in x around inf 76.5%
pow-base-176.5%
*-lft-identity76.5%
Simplified76.5%
if -8.50000000000000057e115 < x < -1.8500000000000001e83 or -8.5000000000000002e-306 < x < 1.40000000000000005e-261Initial program 99.9%
Taylor expanded in z around inf 73.2%
neg-mul-173.2%
Simplified73.2%
if -2.4e62 < x < -8.5000000000000002e-306 or 1.40000000000000005e-261 < x < 7.4e71Initial program 100.0%
Taylor expanded in y around inf 45.3%
neg-mul-145.3%
Simplified45.3%
Final simplification59.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (log t) y)) (t_2 (* x (log y))))
(if (<= x -1.3e+116)
t_2
(if (<= x -1.4e+83)
(- z)
(if (<= x -1.6e+62)
t_2
(if (<= x -5.3e-306)
t_1
(if (<= x 1.5e-262) (- z) (if (<= x 9.5e+70) t_1 t_2))))))))
double code(double x, double y, double z, double t) {
double t_1 = log(t) - y;
double t_2 = x * log(y);
double tmp;
if (x <= -1.3e+116) {
tmp = t_2;
} else if (x <= -1.4e+83) {
tmp = -z;
} else if (x <= -1.6e+62) {
tmp = t_2;
} else if (x <= -5.3e-306) {
tmp = t_1;
} else if (x <= 1.5e-262) {
tmp = -z;
} else if (x <= 9.5e+70) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = log(t) - y
t_2 = x * log(y)
if (x <= (-1.3d+116)) then
tmp = t_2
else if (x <= (-1.4d+83)) then
tmp = -z
else if (x <= (-1.6d+62)) then
tmp = t_2
else if (x <= (-5.3d-306)) then
tmp = t_1
else if (x <= 1.5d-262) then
tmp = -z
else if (x <= 9.5d+70) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(t) - y;
double t_2 = x * Math.log(y);
double tmp;
if (x <= -1.3e+116) {
tmp = t_2;
} else if (x <= -1.4e+83) {
tmp = -z;
} else if (x <= -1.6e+62) {
tmp = t_2;
} else if (x <= -5.3e-306) {
tmp = t_1;
} else if (x <= 1.5e-262) {
tmp = -z;
} else if (x <= 9.5e+70) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(t) - y t_2 = x * math.log(y) tmp = 0 if x <= -1.3e+116: tmp = t_2 elif x <= -1.4e+83: tmp = -z elif x <= -1.6e+62: tmp = t_2 elif x <= -5.3e-306: tmp = t_1 elif x <= 1.5e-262: tmp = -z elif x <= 9.5e+70: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(log(t) - y) t_2 = Float64(x * log(y)) tmp = 0.0 if (x <= -1.3e+116) tmp = t_2; elseif (x <= -1.4e+83) tmp = Float64(-z); elseif (x <= -1.6e+62) tmp = t_2; elseif (x <= -5.3e-306) tmp = t_1; elseif (x <= 1.5e-262) tmp = Float64(-z); elseif (x <= 9.5e+70) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(t) - y; t_2 = x * log(y); tmp = 0.0; if (x <= -1.3e+116) tmp = t_2; elseif (x <= -1.4e+83) tmp = -z; elseif (x <= -1.6e+62) tmp = t_2; elseif (x <= -5.3e-306) tmp = t_1; elseif (x <= 1.5e-262) tmp = -z; elseif (x <= 9.5e+70) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.3e+116], t$95$2, If[LessEqual[x, -1.4e+83], (-z), If[LessEqual[x, -1.6e+62], t$95$2, If[LessEqual[x, -5.3e-306], t$95$1, If[LessEqual[x, 1.5e-262], (-z), If[LessEqual[x, 9.5e+70], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t - y\\
t_2 := x \cdot \log y\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{+116}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{+83}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{+62}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -5.3 \cdot 10^{-306}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-262}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+70}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -1.29999999999999993e116 or -1.4e83 < x < -1.59999999999999992e62 or 9.5000000000000002e70 < x Initial program 99.6%
associate--l-99.6%
associate-+l-99.6%
*-commutative99.6%
add-cube-cbrt98.5%
associate-*l*98.6%
fma-neg98.6%
pow298.6%
Applied egg-rr98.6%
Taylor expanded in x around inf 76.5%
pow-base-176.5%
*-lft-identity76.5%
Simplified76.5%
if -1.29999999999999993e116 < x < -1.4e83 or -5.2999999999999998e-306 < x < 1.50000000000000009e-262Initial program 99.9%
Taylor expanded in z around inf 73.2%
neg-mul-173.2%
Simplified73.2%
if -1.59999999999999992e62 < x < -5.2999999999999998e-306 or 1.50000000000000009e-262 < x < 9.5000000000000002e70Initial program 100.0%
Taylor expanded in z around 0 74.7%
Taylor expanded in x around 0 71.8%
Final simplification73.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (log t) y)) (t_2 (* x (log y))))
(if (<= x -8.2e+115)
t_2
(if (<= x -1.85e+83)
(- z)
(if (<= x -3.7e+62)
t_2
(if (<= x -6.5e-306)
t_1
(if (<= x 7e-258) (- (log t) z) (if (<= x 1.1e+71) t_1 t_2))))))))
double code(double x, double y, double z, double t) {
double t_1 = log(t) - y;
double t_2 = x * log(y);
double tmp;
if (x <= -8.2e+115) {
tmp = t_2;
} else if (x <= -1.85e+83) {
tmp = -z;
} else if (x <= -3.7e+62) {
tmp = t_2;
} else if (x <= -6.5e-306) {
tmp = t_1;
} else if (x <= 7e-258) {
tmp = log(t) - z;
} else if (x <= 1.1e+71) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = log(t) - y
t_2 = x * log(y)
if (x <= (-8.2d+115)) then
tmp = t_2
else if (x <= (-1.85d+83)) then
tmp = -z
else if (x <= (-3.7d+62)) then
tmp = t_2
else if (x <= (-6.5d-306)) then
tmp = t_1
else if (x <= 7d-258) then
tmp = log(t) - z
else if (x <= 1.1d+71) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(t) - y;
double t_2 = x * Math.log(y);
double tmp;
if (x <= -8.2e+115) {
tmp = t_2;
} else if (x <= -1.85e+83) {
tmp = -z;
} else if (x <= -3.7e+62) {
tmp = t_2;
} else if (x <= -6.5e-306) {
tmp = t_1;
} else if (x <= 7e-258) {
tmp = Math.log(t) - z;
} else if (x <= 1.1e+71) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(t) - y t_2 = x * math.log(y) tmp = 0 if x <= -8.2e+115: tmp = t_2 elif x <= -1.85e+83: tmp = -z elif x <= -3.7e+62: tmp = t_2 elif x <= -6.5e-306: tmp = t_1 elif x <= 7e-258: tmp = math.log(t) - z elif x <= 1.1e+71: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(log(t) - y) t_2 = Float64(x * log(y)) tmp = 0.0 if (x <= -8.2e+115) tmp = t_2; elseif (x <= -1.85e+83) tmp = Float64(-z); elseif (x <= -3.7e+62) tmp = t_2; elseif (x <= -6.5e-306) tmp = t_1; elseif (x <= 7e-258) tmp = Float64(log(t) - z); elseif (x <= 1.1e+71) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(t) - y; t_2 = x * log(y); tmp = 0.0; if (x <= -8.2e+115) tmp = t_2; elseif (x <= -1.85e+83) tmp = -z; elseif (x <= -3.7e+62) tmp = t_2; elseif (x <= -6.5e-306) tmp = t_1; elseif (x <= 7e-258) tmp = log(t) - z; elseif (x <= 1.1e+71) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.2e+115], t$95$2, If[LessEqual[x, -1.85e+83], (-z), If[LessEqual[x, -3.7e+62], t$95$2, If[LessEqual[x, -6.5e-306], t$95$1, If[LessEqual[x, 7e-258], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 1.1e+71], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t - y\\
t_2 := x \cdot \log y\\
\mathbf{if}\;x \leq -8.2 \cdot 10^{+115}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{+83}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{+62}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-306}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-258}:\\
\;\;\;\;\log t - z\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+71}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -8.19999999999999925e115 or -1.8500000000000001e83 < x < -3.70000000000000014e62 or 1.09999999999999997e71 < x Initial program 99.6%
associate--l-99.6%
associate-+l-99.6%
*-commutative99.6%
add-cube-cbrt98.5%
associate-*l*98.6%
fma-neg98.6%
pow298.6%
Applied egg-rr98.6%
Taylor expanded in x around inf 76.5%
pow-base-176.5%
*-lft-identity76.5%
Simplified76.5%
if -8.19999999999999925e115 < x < -1.8500000000000001e83Initial program 99.8%
Taylor expanded in z around inf 67.8%
neg-mul-167.8%
Simplified67.8%
if -3.70000000000000014e62 < x < -6.5000000000000004e-306 or 7.00000000000000003e-258 < x < 1.09999999999999997e71Initial program 100.0%
Taylor expanded in z around 0 74.7%
Taylor expanded in x around 0 71.8%
if -6.5000000000000004e-306 < x < 7.00000000000000003e-258Initial program 100.0%
+-commutative100.0%
associate--l-100.0%
associate-+r-100.0%
+-commutative100.0%
associate--l+100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 83.4%
Taylor expanded in x around 0 83.4%
Final simplification73.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.5e+125) (not (<= x 4.2e+135))) (* x (log y)) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.5e+125) || !(x <= 4.2e+135)) {
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 <= (-2.5d+125)) .or. (.not. (x <= 4.2d+135))) 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 <= -2.5e+125) || !(x <= 4.2e+135)) {
tmp = x * Math.log(y);
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.5e+125) or not (x <= 4.2e+135): 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 <= -2.5e+125) || !(x <= 4.2e+135)) 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 <= -2.5e+125) || ~((x <= 4.2e+135))) tmp = x * log(y); else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.5e+125], N[Not[LessEqual[x, 4.2e+135]], $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 -2.5 \cdot 10^{+125} \lor \neg \left(x \leq 4.2 \cdot 10^{+135}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -2.49999999999999981e125 or 4.20000000000000019e135 < x Initial program 99.6%
associate--l-99.6%
associate-+l-99.6%
*-commutative99.6%
add-cube-cbrt98.4%
associate-*l*98.4%
fma-neg98.4%
pow298.4%
Applied egg-rr98.4%
Taylor expanded in x around inf 82.5%
pow-base-182.5%
*-lft-identity82.5%
Simplified82.5%
if -2.49999999999999981e125 < x < 4.20000000000000019e135Initial program 100.0%
Taylor expanded in x around 0 91.8%
Final simplification88.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9.2e+127) (not (<= x 4.3e+36))) (- (* x (log y)) y) (- (log t) (+ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.2e+127) || !(x <= 4.3e+36)) {
tmp = (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 <= (-9.2d+127)) .or. (.not. (x <= 4.3d+36))) then
tmp = (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 <= -9.2e+127) || !(x <= 4.3e+36)) {
tmp = (x * Math.log(y)) - y;
} else {
tmp = Math.log(t) - (y + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9.2e+127) or not (x <= 4.3e+36): tmp = (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 <= -9.2e+127) || !(x <= 4.3e+36)) tmp = 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 <= -9.2e+127) || ~((x <= 4.3e+36))) tmp = (x * log(y)) - y; else tmp = log(t) - (y + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9.2e+127], N[Not[LessEqual[x, 4.3e+36]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(y + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.2 \cdot 10^{+127} \lor \neg \left(x \leq 4.3 \cdot 10^{+36}\right):\\
\;\;\;\;x \cdot \log y - y\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(y + z\right)\\
\end{array}
\end{array}
if x < -9.2000000000000007e127 or 4.30000000000000005e36 < x Initial program 99.6%
Taylor expanded in z around 0 87.1%
Taylor expanded in x around inf 87.1%
if -9.2000000000000007e127 < x < 4.30000000000000005e36Initial program 100.0%
Taylor expanded in x around 0 95.6%
Final simplification92.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.7e+34)
(- z)
(if (<= z -9.6e-24)
(- y)
(if (<= z -1.52e-254) (log t) (if (<= z 7.8e+74) (- y) (- z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.7e+34) {
tmp = -z;
} else if (z <= -9.6e-24) {
tmp = -y;
} else if (z <= -1.52e-254) {
tmp = log(t);
} else if (z <= 7.8e+74) {
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 <= (-2.7d+34)) then
tmp = -z
else if (z <= (-9.6d-24)) then
tmp = -y
else if (z <= (-1.52d-254)) then
tmp = log(t)
else if (z <= 7.8d+74) 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 <= -2.7e+34) {
tmp = -z;
} else if (z <= -9.6e-24) {
tmp = -y;
} else if (z <= -1.52e-254) {
tmp = Math.log(t);
} else if (z <= 7.8e+74) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.7e+34: tmp = -z elif z <= -9.6e-24: tmp = -y elif z <= -1.52e-254: tmp = math.log(t) elif z <= 7.8e+74: tmp = -y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.7e+34) tmp = Float64(-z); elseif (z <= -9.6e-24) tmp = Float64(-y); elseif (z <= -1.52e-254) tmp = log(t); elseif (z <= 7.8e+74) tmp = Float64(-y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.7e+34) tmp = -z; elseif (z <= -9.6e-24) tmp = -y; elseif (z <= -1.52e-254) tmp = log(t); elseif (z <= 7.8e+74) tmp = -y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.7e+34], (-z), If[LessEqual[z, -9.6e-24], (-y), If[LessEqual[z, -1.52e-254], N[Log[t], $MachinePrecision], If[LessEqual[z, 7.8e+74], (-y), (-z)]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+34}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq -9.6 \cdot 10^{-24}:\\
\;\;\;\;-y\\
\mathbf{elif}\;z \leq -1.52 \cdot 10^{-254}:\\
\;\;\;\;\log t\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+74}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -2.7e34 or 7.80000000000000015e74 < z Initial program 99.9%
Taylor expanded in z around inf 64.7%
neg-mul-164.7%
Simplified64.7%
if -2.7e34 < z < -9.5999999999999993e-24 or -1.52e-254 < z < 7.80000000000000015e74Initial program 99.8%
Taylor expanded in y around inf 39.3%
neg-mul-139.3%
Simplified39.3%
if -9.5999999999999993e-24 < z < -1.52e-254Initial program 99.8%
+-commutative99.8%
associate--l-99.8%
associate-+r-99.8%
+-commutative99.8%
associate--l+99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in y around 0 76.2%
Taylor expanded in z around 0 76.2%
Taylor expanded in x around 0 38.4%
Final simplification48.1%
(FPCore (x y z t) :precision binary64 (if (<= z -9.8e+34) (- z) (if (<= z 5e+74) (- y) (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9.8e+34) {
tmp = -z;
} else if (z <= 5e+74) {
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 <= (-9.8d+34)) then
tmp = -z
else if (z <= 5d+74) 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 <= -9.8e+34) {
tmp = -z;
} else if (z <= 5e+74) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9.8e+34: tmp = -z elif z <= 5e+74: tmp = -y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9.8e+34) tmp = Float64(-z); elseif (z <= 5e+74) tmp = Float64(-y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -9.8e+34) tmp = -z; elseif (z <= 5e+74) tmp = -y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9.8e+34], (-z), If[LessEqual[z, 5e+74], (-y), (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.8 \cdot 10^{+34}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+74}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -9.8000000000000005e34 or 4.99999999999999963e74 < z Initial program 99.9%
Taylor expanded in z around inf 64.7%
neg-mul-164.7%
Simplified64.7%
if -9.8000000000000005e34 < z < 4.99999999999999963e74Initial program 99.8%
Taylor expanded in y around inf 35.8%
neg-mul-135.8%
Simplified35.8%
Final simplification46.0%
(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%
Taylor expanded in y around inf 30.1%
neg-mul-130.1%
Simplified30.1%
Final simplification30.1%
herbie shell --seed 2023238
(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)))