
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - 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 = 1.0d0 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - 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 = 1.0d0 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (/ (/ x (- y t)) (- z y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (y - t)) / (z - y));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 = 1.0d0 + ((x / (y - t)) / (z - y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + ((x / (y - t)) / (z - y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + ((x / (y - t)) / (z - y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(x / Float64(y - t)) / Float64(z - y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((x / (y - t)) / (z - y));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 + N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{\frac{x}{y - t}}{z - y}
\end{array}
Initial program 99.5%
*-un-lft-identity99.5%
times-frac99.2%
Applied egg-rr99.2%
associate-*l/99.2%
*-un-lft-identity99.2%
Applied egg-rr99.2%
Final simplification99.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= t -1.35e-81) (not (<= t 5.2e-121))) (+ 1.0 (/ x (* t (- y z)))) (+ 1.0 (/ x (* y (- z y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.35e-81) || !(t <= 5.2e-121)) {
tmp = 1.0 + (x / (t * (y - z)));
} else {
tmp = 1.0 + (x / (y * (z - y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 ((t <= (-1.35d-81)) .or. (.not. (t <= 5.2d-121))) then
tmp = 1.0d0 + (x / (t * (y - z)))
else
tmp = 1.0d0 + (x / (y * (z - y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.35e-81) || !(t <= 5.2e-121)) {
tmp = 1.0 + (x / (t * (y - z)));
} else {
tmp = 1.0 + (x / (y * (z - y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (t <= -1.35e-81) or not (t <= 5.2e-121): tmp = 1.0 + (x / (t * (y - z))) else: tmp = 1.0 + (x / (y * (z - y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((t <= -1.35e-81) || !(t <= 5.2e-121)) tmp = Float64(1.0 + Float64(x / Float64(t * Float64(y - z)))); else tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((t <= -1.35e-81) || ~((t <= 5.2e-121)))
tmp = 1.0 + (x / (t * (y - z)));
else
tmp = 1.0 + (x / (y * (z - y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.35e-81], N[Not[LessEqual[t, 5.2e-121]], $MachinePrecision]], N[(1.0 + N[(x / N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{-81} \lor \neg \left(t \leq 5.2 \cdot 10^{-121}\right):\\
\;\;\;\;1 + \frac{x}{t \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if t < -1.34999999999999995e-81 or 5.19999999999999972e-121 < t Initial program 99.9%
Taylor expanded in t around inf 93.6%
associate-*r/93.6%
neg-mul-193.6%
Simplified93.6%
if -1.34999999999999995e-81 < t < 5.19999999999999972e-121Initial program 98.6%
Taylor expanded in t around 0 90.7%
Final simplification92.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -4.8e-157) (+ 1.0 (/ x (* y (- z y)))) (if (<= y 1.3e-82) (/ (- z (/ x t)) z) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.8e-157) {
tmp = 1.0 + (x / (y * (z - y)));
} else if (y <= 1.3e-82) {
tmp = (z - (x / t)) / z;
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 <= (-4.8d-157)) then
tmp = 1.0d0 + (x / (y * (z - y)))
else if (y <= 1.3d-82) then
tmp = (z - (x / t)) / z
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.8e-157) {
tmp = 1.0 + (x / (y * (z - y)));
} else if (y <= 1.3e-82) {
tmp = (z - (x / t)) / z;
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -4.8e-157: tmp = 1.0 + (x / (y * (z - y))) elif y <= 1.3e-82: tmp = (z - (x / t)) / z else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -4.8e-157) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); elseif (y <= 1.3e-82) tmp = Float64(Float64(z - Float64(x / t)) / z); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -4.8e-157)
tmp = 1.0 + (x / (y * (z - y)));
elseif (y <= 1.3e-82)
tmp = (z - (x / t)) / z;
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -4.8e-157], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e-82], N[(N[(z - N[(x / t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-157}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-82}:\\
\;\;\;\;\frac{z - \frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.8e-157Initial program 99.9%
Taylor expanded in t around 0 85.9%
if -4.8e-157 < y < 1.3e-82Initial program 98.6%
Taylor expanded in y around 0 86.2%
Taylor expanded in z around 0 85.1%
if 1.3e-82 < y Initial program 100.0%
Taylor expanded in y around 0 59.8%
Taylor expanded in x around 0 95.4%
Final simplification88.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -1.05e-72) (+ 1.0 (/ x (* y (- t y)))) (if (<= y 1.05e-77) (/ (- z (/ x t)) z) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05e-72) {
tmp = 1.0 + (x / (y * (t - y)));
} else if (y <= 1.05e-77) {
tmp = (z - (x / t)) / z;
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 <= (-1.05d-72)) then
tmp = 1.0d0 + (x / (y * (t - y)))
else if (y <= 1.05d-77) then
tmp = (z - (x / t)) / z
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05e-72) {
tmp = 1.0 + (x / (y * (t - y)));
} else if (y <= 1.05e-77) {
tmp = (z - (x / t)) / z;
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -1.05e-72: tmp = 1.0 + (x / (y * (t - y))) elif y <= 1.05e-77: tmp = (z - (x / t)) / z else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -1.05e-72) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); elseif (y <= 1.05e-77) tmp = Float64(Float64(z - Float64(x / t)) / z); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -1.05e-72)
tmp = 1.0 + (x / (y * (t - y)));
elseif (y <= 1.05e-77)
tmp = (z - (x / t)) / z;
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -1.05e-72], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e-77], N[(N[(z - N[(x / t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-72}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-77}:\\
\;\;\;\;\frac{z - \frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.05e-72Initial program 99.9%
Taylor expanded in z around 0 89.1%
if -1.05e-72 < y < 1.05000000000000008e-77Initial program 98.7%
Taylor expanded in y around 0 83.8%
Taylor expanded in z around 0 82.8%
if 1.05000000000000008e-77 < y Initial program 100.0%
Taylor expanded in y around 0 59.8%
Taylor expanded in x around 0 95.4%
Final simplification89.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -3e-70) 1.0 (if (<= y 9e-81) (/ (- z (/ x t)) z) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3e-70) {
tmp = 1.0;
} else if (y <= 9e-81) {
tmp = (z - (x / t)) / z;
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 <= (-3d-70)) then
tmp = 1.0d0
else if (y <= 9d-81) then
tmp = (z - (x / t)) / z
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3e-70) {
tmp = 1.0;
} else if (y <= 9e-81) {
tmp = (z - (x / t)) / z;
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -3e-70: tmp = 1.0 elif y <= 9e-81: tmp = (z - (x / t)) / z else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -3e-70) tmp = 1.0; elseif (y <= 9e-81) tmp = Float64(Float64(z - Float64(x / t)) / z); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -3e-70)
tmp = 1.0;
elseif (y <= 9e-81)
tmp = (z - (x / t)) / z;
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -3e-70], 1.0, If[LessEqual[y, 9e-81], N[(N[(z - N[(x / t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{-70}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-81}:\\
\;\;\;\;\frac{z - \frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.0000000000000001e-70 or 9.000000000000001e-81 < y Initial program 100.0%
Taylor expanded in y around 0 53.4%
Taylor expanded in x around 0 92.8%
if -3.0000000000000001e-70 < y < 9.000000000000001e-81Initial program 98.8%
Taylor expanded in y around 0 82.3%
Taylor expanded in z around 0 81.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -5.3e-70) 1.0 (if (<= y 9e-76) (- 1.0 (/ x (* t z))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.3e-70) {
tmp = 1.0;
} else if (y <= 9e-76) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 <= (-5.3d-70)) then
tmp = 1.0d0
else if (y <= 9d-76) then
tmp = 1.0d0 - (x / (t * z))
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.3e-70) {
tmp = 1.0;
} else if (y <= 9e-76) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -5.3e-70: tmp = 1.0 elif y <= 9e-76: tmp = 1.0 - (x / (t * z)) else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -5.3e-70) tmp = 1.0; elseif (y <= 9e-76) tmp = Float64(1.0 - Float64(x / Float64(t * z))); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -5.3e-70)
tmp = 1.0;
elseif (y <= 9e-76)
tmp = 1.0 - (x / (t * z));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -5.3e-70], 1.0, If[LessEqual[y, 9e-76], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.3 \cdot 10^{-70}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-76}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.29999999999999983e-70 or 9.0000000000000001e-76 < y Initial program 100.0%
Taylor expanded in y around 0 53.4%
Taylor expanded in x around 0 92.8%
if -5.29999999999999983e-70 < y < 9.0000000000000001e-76Initial program 98.8%
Taylor expanded in y around 0 82.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 1.75e-100) (+ 1.0 (/ (/ x z) (- y t))) (+ 1.0 (/ x (* t (- y z))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.75e-100) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 + (x / (t * (y - z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 (t <= 1.75d-100) then
tmp = 1.0d0 + ((x / z) / (y - t))
else
tmp = 1.0d0 + (x / (t * (y - z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.75e-100) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 + (x / (t * (y - z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= 1.75e-100: tmp = 1.0 + ((x / z) / (y - t)) else: tmp = 1.0 + (x / (t * (y - z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 1.75e-100) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); else tmp = Float64(1.0 + Float64(x / Float64(t * Float64(y - z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= 1.75e-100)
tmp = 1.0 + ((x / z) / (y - t));
else
tmp = 1.0 + (x / (t * (y - z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, 1.75e-100], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.75 \cdot 10^{-100}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{t \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if t < 1.75e-100Initial program 99.4%
Taylor expanded in z around inf 84.9%
mul-1-neg84.9%
associate-/r*84.9%
distribute-neg-frac84.9%
Simplified84.9%
if 1.75e-100 < t Initial program 99.9%
Taylor expanded in t around inf 92.9%
associate-*r/92.9%
neg-mul-192.9%
Simplified92.9%
Final simplification87.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 8.6e-102) (+ 1.0 (/ x (* y z))) 1.0))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8.6e-102) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 (t <= 8.6d-102) then
tmp = 1.0d0 + (x / (y * z))
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8.6e-102) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= 8.6e-102: tmp = 1.0 + (x / (y * z)) else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 8.6e-102) tmp = Float64(1.0 + Float64(x / Float64(y * z))); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= 8.6e-102)
tmp = 1.0 + (x / (y * z));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, 8.6e-102], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8.6 \cdot 10^{-102}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < 8.5999999999999995e-102Initial program 99.4%
Taylor expanded in t around 0 76.6%
Taylor expanded in z around inf 65.8%
*-commutative65.8%
Simplified65.8%
if 8.5999999999999995e-102 < t Initial program 99.9%
Taylor expanded in y around 0 71.3%
Taylor expanded in x around 0 82.3%
Final simplification70.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (/ x (* (- y t) (- z y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - t) * (z - y)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 = 1.0d0 + (x / ((y - t) * (z - y)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - t) * (z - y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (x / ((y - t) * (z - y)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(x / Float64(Float64(y - t) * Float64(z - y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (x / ((y - t) * (z - y)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 + N[(x / N[(N[(y - t), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{x}{\left(y - t\right) \cdot \left(z - y\right)}
\end{array}
Initial program 99.5%
Final simplification99.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 = 1.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 1.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Initial program 99.5%
Taylor expanded in y around 0 63.3%
Taylor expanded in x around 0 78.3%
herbie shell --seed 2024106
(FPCore (x y z t)
:name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A"
:precision binary64
(- 1.0 (/ x (* (- y z) (- y t)))))