
(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 x (log y) (- (log t) (+ z y))))
double code(double x, double y, double z, double t) {
return fma(x, log(y), (log(t) - (z + y)));
}
function code(x, y, z, t) return fma(x, log(y), Float64(log(t) - Float64(z + y))) end
code[x_, y_, z_, t_] := N[(x * N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] - N[(z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \log y, \log t - \left(z + y\right)\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
associate--l-99.8%
associate-+r-99.8%
+-commutative99.8%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -310.0) (not (<= x 2.2e+67))) (- (+ (log t) (* x (log y))) y) (- (log t) (+ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -310.0) || !(x <= 2.2e+67)) {
tmp = (log(t) + (x * log(y))) - y;
} else {
tmp = log(t) - (z + y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-310.0d0)) .or. (.not. (x <= 2.2d+67))) then
tmp = (log(t) + (x * log(y))) - y
else
tmp = log(t) - (z + y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -310.0) || !(x <= 2.2e+67)) {
tmp = (Math.log(t) + (x * Math.log(y))) - y;
} else {
tmp = Math.log(t) - (z + y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -310.0) or not (x <= 2.2e+67): tmp = (math.log(t) + (x * math.log(y))) - y else: tmp = math.log(t) - (z + y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -310.0) || !(x <= 2.2e+67)) tmp = Float64(Float64(log(t) + Float64(x * log(y))) - y); else tmp = Float64(log(t) - Float64(z + y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -310.0) || ~((x <= 2.2e+67))) tmp = (log(t) + (x * log(y))) - y; else tmp = log(t) - (z + y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -310.0], N[Not[LessEqual[x, 2.2e+67]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(z + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -310 \lor \neg \left(x \leq 2.2 \cdot 10^{+67}\right):\\
\;\;\;\;\left(\log t + x \cdot \log y\right) - y\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(z + y\right)\\
\end{array}
\end{array}
if x < -310 or 2.2e67 < x Initial program 99.7%
Taylor expanded in z around 0 87.7%
if -310 < x < 2.2e67Initial program 100.0%
Taylor expanded in x around 0 97.1%
Final simplification92.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (log t) (* x (log y)))))
(if (<= x -0.28)
(- t_1 y)
(if (<= x 1.42e+116) (- (log t) (+ z y)) (- t_1 z)))))
double code(double x, double y, double z, double t) {
double t_1 = log(t) + (x * log(y));
double tmp;
if (x <= -0.28) {
tmp = t_1 - y;
} else if (x <= 1.42e+116) {
tmp = log(t) - (z + y);
} else {
tmp = t_1 - z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = log(t) + (x * log(y))
if (x <= (-0.28d0)) then
tmp = t_1 - y
else if (x <= 1.42d+116) then
tmp = log(t) - (z + y)
else
tmp = t_1 - z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(t) + (x * Math.log(y));
double tmp;
if (x <= -0.28) {
tmp = t_1 - y;
} else if (x <= 1.42e+116) {
tmp = Math.log(t) - (z + y);
} else {
tmp = t_1 - z;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(t) + (x * math.log(y)) tmp = 0 if x <= -0.28: tmp = t_1 - y elif x <= 1.42e+116: tmp = math.log(t) - (z + y) else: tmp = t_1 - z return tmp
function code(x, y, z, t) t_1 = Float64(log(t) + Float64(x * log(y))) tmp = 0.0 if (x <= -0.28) tmp = Float64(t_1 - y); elseif (x <= 1.42e+116) tmp = Float64(log(t) - Float64(z + y)); else tmp = Float64(t_1 - z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(t) + (x * log(y)); tmp = 0.0; if (x <= -0.28) tmp = t_1 - y; elseif (x <= 1.42e+116) tmp = log(t) - (z + y); else tmp = t_1 - z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -0.28], N[(t$95$1 - y), $MachinePrecision], If[LessEqual[x, 1.42e+116], N[(N[Log[t], $MachinePrecision] - N[(z + y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t + x \cdot \log y\\
\mathbf{if}\;x \leq -0.28:\\
\;\;\;\;t_1 - y\\
\mathbf{elif}\;x \leq 1.42 \cdot 10^{+116}:\\
\;\;\;\;\log t - \left(z + y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 - z\\
\end{array}
\end{array}
if x < -0.28000000000000003Initial program 99.7%
Taylor expanded in z around 0 89.0%
if -0.28000000000000003 < x < 1.4199999999999999e116Initial program 100.0%
Taylor expanded in x around 0 96.0%
if 1.4199999999999999e116 < x Initial program 99.7%
Taylor expanded in y around 0 92.4%
Final simplification93.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -22000.0) (not (<= x 2.7e+118))) (+ (log t) (* x (log y))) (- (log t) (+ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -22000.0) || !(x <= 2.7e+118)) {
tmp = log(t) + (x * log(y));
} else {
tmp = log(t) - (z + y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-22000.0d0)) .or. (.not. (x <= 2.7d+118))) then
tmp = log(t) + (x * log(y))
else
tmp = log(t) - (z + y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -22000.0) || !(x <= 2.7e+118)) {
tmp = Math.log(t) + (x * Math.log(y));
} else {
tmp = Math.log(t) - (z + y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -22000.0) or not (x <= 2.7e+118): tmp = math.log(t) + (x * math.log(y)) else: tmp = math.log(t) - (z + y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -22000.0) || !(x <= 2.7e+118)) tmp = Float64(log(t) + Float64(x * log(y))); else tmp = Float64(log(t) - Float64(z + y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -22000.0) || ~((x <= 2.7e+118))) tmp = log(t) + (x * log(y)); else tmp = log(t) - (z + y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -22000.0], N[Not[LessEqual[x, 2.7e+118]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(z + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -22000 \lor \neg \left(x \leq 2.7 \cdot 10^{+118}\right):\\
\;\;\;\;\log t + x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(z + y\right)\\
\end{array}
\end{array}
if x < -22000 or 2.7e118 < x Initial program 99.7%
Taylor expanded in z around 0 87.7%
Taylor expanded in y around 0 77.8%
if -22000 < x < 2.7e118Initial program 100.0%
Taylor expanded in x around 0 96.0%
Final simplification88.5%
(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 (+ (- (* x (log y)) y) (- (log t) z)))
double code(double x, double y, double z, double t) {
return ((x * log(y)) - y) + (log(t) - 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 = ((x * log(y)) - y) + (log(t) - z)
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) - y) + (Math.log(t) - z);
}
def code(x, y, z, t): return ((x * math.log(y)) - y) + (math.log(t) - z)
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) - y) + Float64(log(t) - z)) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) - y) + (log(t) - z); end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y - y\right) + \left(\log t - z\right)
\end{array}
Initial program 99.8%
associate-+l-99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -7.5e-5)
t_1
(if (<= x 44.0)
(- y)
(if (<= x 2.85e+76) (- z) (if (<= x 1.42e+116) (- y) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -7.5e-5) {
tmp = t_1;
} else if (x <= 44.0) {
tmp = -y;
} else if (x <= 2.85e+76) {
tmp = -z;
} else if (x <= 1.42e+116) {
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 <= (-7.5d-5)) then
tmp = t_1
else if (x <= 44.0d0) then
tmp = -y
else if (x <= 2.85d+76) then
tmp = -z
else if (x <= 1.42d+116) 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 <= -7.5e-5) {
tmp = t_1;
} else if (x <= 44.0) {
tmp = -y;
} else if (x <= 2.85e+76) {
tmp = -z;
} else if (x <= 1.42e+116) {
tmp = -y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -7.5e-5: tmp = t_1 elif x <= 44.0: tmp = -y elif x <= 2.85e+76: tmp = -z elif x <= 1.42e+116: 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 <= -7.5e-5) tmp = t_1; elseif (x <= 44.0) tmp = Float64(-y); elseif (x <= 2.85e+76) tmp = Float64(-z); elseif (x <= 1.42e+116) 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 <= -7.5e-5) tmp = t_1; elseif (x <= 44.0) tmp = -y; elseif (x <= 2.85e+76) tmp = -z; elseif (x <= 1.42e+116) 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, -7.5e-5], t$95$1, If[LessEqual[x, 44.0], (-y), If[LessEqual[x, 2.85e+76], (-z), If[LessEqual[x, 1.42e+116], (-y), t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 44:\\
\;\;\;\;-y\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{+76}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 1.42 \cdot 10^{+116}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -7.49999999999999934e-5 or 1.4199999999999999e116 < x Initial program 99.7%
associate-+l-99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 77.0%
if -7.49999999999999934e-5 < x < 44 or 2.85000000000000002e76 < x < 1.4199999999999999e116Initial program 100.0%
associate-+l-100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 48.8%
mul-1-neg48.8%
Simplified48.8%
if 44 < x < 2.85000000000000002e76Initial program 99.9%
associate-+l-99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 56.9%
neg-mul-156.9%
Simplified56.9%
Final simplification61.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- (log t) y)))
(if (<= x -7.5e-5)
t_1
(if (<= x 90.0)
t_2
(if (<= x 4.2e+76) (- z) (if (<= x 1.42e+116) 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) - y;
double tmp;
if (x <= -7.5e-5) {
tmp = t_1;
} else if (x <= 90.0) {
tmp = t_2;
} else if (x <= 4.2e+76) {
tmp = -z;
} else if (x <= 1.42e+116) {
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) - y
if (x <= (-7.5d-5)) then
tmp = t_1
else if (x <= 90.0d0) then
tmp = t_2
else if (x <= 4.2d+76) then
tmp = -z
else if (x <= 1.42d+116) 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) - y;
double tmp;
if (x <= -7.5e-5) {
tmp = t_1;
} else if (x <= 90.0) {
tmp = t_2;
} else if (x <= 4.2e+76) {
tmp = -z;
} else if (x <= 1.42e+116) {
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) - y tmp = 0 if x <= -7.5e-5: tmp = t_1 elif x <= 90.0: tmp = t_2 elif x <= 4.2e+76: tmp = -z elif x <= 1.42e+116: 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) - y) tmp = 0.0 if (x <= -7.5e-5) tmp = t_1; elseif (x <= 90.0) tmp = t_2; elseif (x <= 4.2e+76) tmp = Float64(-z); elseif (x <= 1.42e+116) 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) - y; tmp = 0.0; if (x <= -7.5e-5) tmp = t_1; elseif (x <= 90.0) tmp = t_2; elseif (x <= 4.2e+76) tmp = -z; elseif (x <= 1.42e+116) 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] - y), $MachinePrecision]}, If[LessEqual[x, -7.5e-5], t$95$1, If[LessEqual[x, 90.0], t$95$2, If[LessEqual[x, 4.2e+76], (-z), If[LessEqual[x, 1.42e+116], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \log t - y\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 90:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+76}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 1.42 \cdot 10^{+116}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -7.49999999999999934e-5 or 1.4199999999999999e116 < x Initial program 99.7%
associate-+l-99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 77.0%
if -7.49999999999999934e-5 < x < 90 or 4.20000000000000013e76 < x < 1.4199999999999999e116Initial program 100.0%
Taylor expanded in y around inf 75.3%
neg-mul-175.3%
Simplified75.3%
Taylor expanded in y around 0 75.3%
+-commutative75.3%
mul-1-neg75.3%
sub-neg75.3%
Simplified75.3%
if 90 < x < 4.20000000000000013e76Initial program 99.9%
associate-+l-99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 56.9%
neg-mul-156.9%
Simplified56.9%
Final simplification74.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- (log t) y)))
(if (<= x -7.5e-5)
t_1
(if (<= x 1.5e-7)
t_2
(if (<= x 4.6e+77) (- (log t) z) (if (<= x 3.2e+116) 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) - y;
double tmp;
if (x <= -7.5e-5) {
tmp = t_1;
} else if (x <= 1.5e-7) {
tmp = t_2;
} else if (x <= 4.6e+77) {
tmp = log(t) - z;
} else if (x <= 3.2e+116) {
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) - y
if (x <= (-7.5d-5)) then
tmp = t_1
else if (x <= 1.5d-7) then
tmp = t_2
else if (x <= 4.6d+77) then
tmp = log(t) - z
else if (x <= 3.2d+116) 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) - y;
double tmp;
if (x <= -7.5e-5) {
tmp = t_1;
} else if (x <= 1.5e-7) {
tmp = t_2;
} else if (x <= 4.6e+77) {
tmp = Math.log(t) - z;
} else if (x <= 3.2e+116) {
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) - y tmp = 0 if x <= -7.5e-5: tmp = t_1 elif x <= 1.5e-7: tmp = t_2 elif x <= 4.6e+77: tmp = math.log(t) - z elif x <= 3.2e+116: 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) - y) tmp = 0.0 if (x <= -7.5e-5) tmp = t_1; elseif (x <= 1.5e-7) tmp = t_2; elseif (x <= 4.6e+77) tmp = Float64(log(t) - z); elseif (x <= 3.2e+116) 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) - y; tmp = 0.0; if (x <= -7.5e-5) tmp = t_1; elseif (x <= 1.5e-7) tmp = t_2; elseif (x <= 4.6e+77) tmp = log(t) - z; elseif (x <= 3.2e+116) 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] - y), $MachinePrecision]}, If[LessEqual[x, -7.5e-5], t$95$1, If[LessEqual[x, 1.5e-7], t$95$2, If[LessEqual[x, 4.6e+77], N[(N[Log[t], $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 3.2e+116], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \log t - y\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-7}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+77}:\\
\;\;\;\;\log t - z\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+116}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -7.49999999999999934e-5 or 3.2e116 < x Initial program 99.7%
associate-+l-99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 77.0%
if -7.49999999999999934e-5 < x < 1.4999999999999999e-7 or 4.5999999999999999e77 < x < 3.2e116Initial program 100.0%
Taylor expanded in y around inf 75.8%
neg-mul-175.8%
Simplified75.8%
Taylor expanded in y around 0 75.8%
+-commutative75.8%
mul-1-neg75.8%
sub-neg75.8%
Simplified75.8%
if 1.4999999999999999e-7 < x < 4.5999999999999999e77Initial program 99.8%
Taylor expanded in z around inf 56.2%
neg-mul-156.2%
Simplified56.2%
Final simplification74.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -22000.0) (not (<= x 2.25e+116))) (* x (log y)) (- (log t) (+ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -22000.0) || !(x <= 2.25e+116)) {
tmp = x * log(y);
} else {
tmp = log(t) - (z + y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-22000.0d0)) .or. (.not. (x <= 2.25d+116))) then
tmp = x * log(y)
else
tmp = log(t) - (z + y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -22000.0) || !(x <= 2.25e+116)) {
tmp = x * Math.log(y);
} else {
tmp = Math.log(t) - (z + y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -22000.0) or not (x <= 2.25e+116): tmp = x * math.log(y) else: tmp = math.log(t) - (z + y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -22000.0) || !(x <= 2.25e+116)) tmp = Float64(x * log(y)); else tmp = Float64(log(t) - Float64(z + y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -22000.0) || ~((x <= 2.25e+116))) tmp = x * log(y); else tmp = log(t) - (z + y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -22000.0], N[Not[LessEqual[x, 2.25e+116]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] - N[(z + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -22000 \lor \neg \left(x \leq 2.25 \cdot 10^{+116}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\log t - \left(z + y\right)\\
\end{array}
\end{array}
if x < -22000 or 2.25000000000000008e116 < x Initial program 99.7%
associate-+l-99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 77.7%
if -22000 < x < 2.25000000000000008e116Initial program 100.0%
Taylor expanded in x around 0 96.0%
Final simplification88.4%
(FPCore (x y z t) :precision binary64 (if (<= y 2.8e-90) (log t) (if (<= y 7.6e+16) (- z) (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.8e-90) {
tmp = log(t);
} else if (y <= 7.6e+16) {
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 <= 2.8d-90) then
tmp = log(t)
else if (y <= 7.6d+16) 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 <= 2.8e-90) {
tmp = Math.log(t);
} else if (y <= 7.6e+16) {
tmp = -z;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.8e-90: tmp = math.log(t) elif y <= 7.6e+16: tmp = -z else: tmp = -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.8e-90) tmp = log(t); elseif (y <= 7.6e+16) tmp = Float64(-z); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2.8e-90) tmp = log(t); elseif (y <= 7.6e+16) tmp = -z; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.8e-90], N[Log[t], $MachinePrecision], If[LessEqual[y, 7.6e+16], (-z), (-y)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.8 \cdot 10^{-90}:\\
\;\;\;\;\log t\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{+16}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if y < 2.7999999999999999e-90Initial program 99.8%
Taylor expanded in y around inf 34.3%
neg-mul-134.3%
Simplified34.3%
Taylor expanded in y around 0 34.3%
if 2.7999999999999999e-90 < y < 7.6e16Initial program 99.8%
associate-+l-99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 34.1%
neg-mul-134.1%
Simplified34.1%
if 7.6e16 < y Initial program 99.9%
associate-+l-99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 60.6%
mul-1-neg60.6%
Simplified60.6%
Final simplification47.2%
(FPCore (x y z t) :precision binary64 (if (<= z -230.0) (- z) (if (<= z 3.4e+135) (- y) (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -230.0) {
tmp = -z;
} else if (z <= 3.4e+135) {
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 <= (-230.0d0)) then
tmp = -z
else if (z <= 3.4d+135) 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 <= -230.0) {
tmp = -z;
} else if (z <= 3.4e+135) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -230.0: tmp = -z elif z <= 3.4e+135: tmp = -y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -230.0) tmp = Float64(-z); elseif (z <= 3.4e+135) tmp = Float64(-y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -230.0) tmp = -z; elseif (z <= 3.4e+135) tmp = -y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -230.0], (-z), If[LessEqual[z, 3.4e+135], (-y), (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -230:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+135}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -230 or 3.4000000000000001e135 < z Initial program 99.9%
associate-+l-99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 55.3%
neg-mul-155.3%
Simplified55.3%
if -230 < z < 3.4000000000000001e135Initial program 99.8%
associate-+l-99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 40.7%
mul-1-neg40.7%
Simplified40.7%
Final simplification45.7%
(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%
associate-+l-99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 31.7%
mul-1-neg31.7%
Simplified31.7%
Final simplification31.7%
herbie shell --seed 2023200
(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)))