
(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.6%
clear-num99.5%
associate-/r/99.5%
Applied egg-rr99.5%
associate-*l/99.6%
*-un-lft-identity99.6%
*-commutative99.6%
associate-/r*99.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 (<= y -1.08e+30) (not (<= y 9.5e-107))) (+ 1.0 (/ x (* y (- t y)))) (+ 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 ((y <= -1.08e+30) || !(y <= 9.5e-107)) {
tmp = 1.0 + (x / (y * (t - y)));
} 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 ((y <= (-1.08d+30)) .or. (.not. (y <= 9.5d-107))) then
tmp = 1.0d0 + (x / (y * (t - y)))
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 ((y <= -1.08e+30) || !(y <= 9.5e-107)) {
tmp = 1.0 + (x / (y * (t - y)));
} 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 (y <= -1.08e+30) or not (y <= 9.5e-107): tmp = 1.0 + (x / (y * (t - y))) 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 ((y <= -1.08e+30) || !(y <= 9.5e-107)) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); 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 ((y <= -1.08e+30) || ~((y <= 9.5e-107)))
tmp = 1.0 + (x / (y * (t - y)));
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[Or[LessEqual[y, -1.08e+30], N[Not[LessEqual[y, 9.5e-107]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $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}\;y \leq -1.08 \cdot 10^{+30} \lor \neg \left(y \leq 9.5 \cdot 10^{-107}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{t \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if y < -1.08e30 or 9.4999999999999999e-107 < y Initial program 100.0%
Taylor expanded in z around 0 95.1%
if -1.08e30 < y < 9.4999999999999999e-107Initial program 99.1%
clear-num99.0%
associate-/r/99.0%
Applied egg-rr99.0%
Taylor expanded in t around inf 86.1%
mul-1-neg86.1%
associate-/r*86.6%
distribute-neg-frac286.6%
Simplified86.6%
Taylor expanded in x around 0 86.1%
Final simplification90.9%
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 -7.6e-81) 1.0 (if (<= y 2.5e-43) (+ 1.0 (/ x (* t (- y z)))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.6e-81) {
tmp = 1.0;
} else if (y <= 2.5e-43) {
tmp = 1.0 + (x / (t * (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 (y <= (-7.6d-81)) then
tmp = 1.0d0
else if (y <= 2.5d-43) then
tmp = 1.0d0 + (x / (t * (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 (y <= -7.6e-81) {
tmp = 1.0;
} else if (y <= 2.5e-43) {
tmp = 1.0 + (x / (t * (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 y <= -7.6e-81: tmp = 1.0 elif y <= 2.5e-43: tmp = 1.0 + (x / (t * (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 (y <= -7.6e-81) tmp = 1.0; elseif (y <= 2.5e-43) tmp = Float64(1.0 + Float64(x / Float64(t * 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 (y <= -7.6e-81)
tmp = 1.0;
elseif (y <= 2.5e-43)
tmp = 1.0 + (x / (t * (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[y, -7.6e-81], 1.0, If[LessEqual[y, 2.5e-43], N[(1.0 + N[(x / N[(t * N[(y - z), $MachinePrecision]), $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 -7.6 \cdot 10^{-81}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-43}:\\
\;\;\;\;1 + \frac{x}{t \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.5999999999999997e-81 or 2.50000000000000009e-43 < y Initial program 100.0%
Taylor expanded in y around 0 51.9%
Taylor expanded in x around 0 93.5%
if -7.5999999999999997e-81 < y < 2.50000000000000009e-43Initial program 99.0%
clear-num98.9%
associate-/r/99.0%
Applied egg-rr99.0%
Taylor expanded in t around inf 84.4%
mul-1-neg84.4%
associate-/r*85.0%
distribute-neg-frac285.0%
Simplified85.0%
Taylor expanded in x around 0 84.4%
Final simplification89.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z -5.2e-76)
(- 1.0 (/ (/ x z) (- t y)))
(if (<= z 7.7e-162)
(+ 1.0 (/ x (* y (- t y))))
(+ 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 (z <= -5.2e-76) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 7.7e-162) {
tmp = 1.0 + (x / (y * (t - y)));
} 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 (z <= (-5.2d-76)) then
tmp = 1.0d0 - ((x / z) / (t - y))
else if (z <= 7.7d-162) then
tmp = 1.0d0 + (x / (y * (t - y)))
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 (z <= -5.2e-76) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 7.7e-162) {
tmp = 1.0 + (x / (y * (t - y)));
} 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 z <= -5.2e-76: tmp = 1.0 - ((x / z) / (t - y)) elif z <= 7.7e-162: tmp = 1.0 + (x / (y * (t - y))) 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 (z <= -5.2e-76) tmp = Float64(1.0 - Float64(Float64(x / z) / Float64(t - y))); elseif (z <= 7.7e-162) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); 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 (z <= -5.2e-76)
tmp = 1.0 - ((x / z) / (t - y));
elseif (z <= 7.7e-162)
tmp = 1.0 + (x / (y * (t - y)));
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[z, -5.2e-76], N[(1.0 - N[(N[(x / z), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.7e-162], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $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}\;z \leq -5.2 \cdot 10^{-76}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\
\mathbf{elif}\;z \leq 7.7 \cdot 10^{-162}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{t \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if z < -5.1999999999999999e-76Initial program 100.0%
Taylor expanded in z around inf 92.1%
mul-1-neg92.1%
associate-/r*92.1%
distribute-neg-frac92.1%
Simplified92.1%
if -5.1999999999999999e-76 < z < 7.70000000000000047e-162Initial program 98.5%
Taylor expanded in z around 0 88.7%
if 7.70000000000000047e-162 < z Initial program 100.0%
clear-num99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in t around inf 78.4%
mul-1-neg78.4%
associate-/r*78.3%
distribute-neg-frac278.3%
Simplified78.3%
Taylor expanded in x around 0 78.4%
Final simplification85.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z -6.2e-74)
(- 1.0 (/ (/ x z) (- t y)))
(if (<= z 3.2e-156)
(+ 1.0 (/ x (* y (- t y))))
(+ 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 (z <= -6.2e-74) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 3.2e-156) {
tmp = 1.0 + (x / (y * (t - y)));
} 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 (z <= (-6.2d-74)) then
tmp = 1.0d0 - ((x / z) / (t - y))
else if (z <= 3.2d-156) then
tmp = 1.0d0 + (x / (y * (t - y)))
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 (z <= -6.2e-74) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 3.2e-156) {
tmp = 1.0 + (x / (y * (t - y)));
} 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 z <= -6.2e-74: tmp = 1.0 - ((x / z) / (t - y)) elif z <= 3.2e-156: tmp = 1.0 + (x / (y * (t - y))) 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 (z <= -6.2e-74) tmp = Float64(1.0 - Float64(Float64(x / z) / Float64(t - y))); elseif (z <= 3.2e-156) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); else tmp = Float64(1.0 + Float64(Float64(x / 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 (z <= -6.2e-74)
tmp = 1.0 - ((x / z) / (t - y));
elseif (z <= 3.2e-156)
tmp = 1.0 + (x / (y * (t - y)));
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[z, -6.2e-74], N[(1.0 - N[(N[(x / z), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e-156], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{-74}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-156}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -6.2000000000000003e-74Initial program 100.0%
Taylor expanded in z around inf 92.0%
mul-1-neg92.0%
associate-/r*92.0%
distribute-neg-frac92.0%
Simplified92.0%
if -6.2000000000000003e-74 < z < 3.19999999999999982e-156Initial program 98.5%
Taylor expanded in z around 0 89.0%
if 3.19999999999999982e-156 < z Initial program 100.0%
clear-num99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in t around inf 78.2%
mul-1-neg78.2%
associate-/r*78.1%
distribute-neg-frac278.1%
Simplified78.1%
Final simplification85.6%
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 -7e-128) 1.0 (if (<= y 8.2e-107) (- 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 <= -7e-128) {
tmp = 1.0;
} else if (y <= 8.2e-107) {
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 <= (-7d-128)) then
tmp = 1.0d0
else if (y <= 8.2d-107) 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 <= -7e-128) {
tmp = 1.0;
} else if (y <= 8.2e-107) {
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 <= -7e-128: tmp = 1.0 elif y <= 8.2e-107: 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 <= -7e-128) tmp = 1.0; elseif (y <= 8.2e-107) 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 <= -7e-128)
tmp = 1.0;
elseif (y <= 8.2e-107)
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, -7e-128], 1.0, If[LessEqual[y, 8.2e-107], 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 -7 \cdot 10^{-128}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-107}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6.99999999999999999e-128 or 8.1999999999999998e-107 < y Initial program 100.0%
Taylor expanded in y around 0 51.2%
Taylor expanded in x around 0 89.6%
if -6.99999999999999999e-128 < y < 8.1999999999999998e-107Initial program 98.8%
Taylor expanded in y around 0 80.6%
Final simplification86.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 -6.6e-128) 1.0 (if (<= y 7e-107) (/ (- 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 <= -6.6e-128) {
tmp = 1.0;
} else if (y <= 7e-107) {
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 <= (-6.6d-128)) then
tmp = 1.0d0
else if (y <= 7d-107) 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 <= -6.6e-128) {
tmp = 1.0;
} else if (y <= 7e-107) {
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 <= -6.6e-128: tmp = 1.0 elif y <= 7e-107: 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 <= -6.6e-128) tmp = 1.0; elseif (y <= 7e-107) 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 <= -6.6e-128)
tmp = 1.0;
elseif (y <= 7e-107)
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, -6.6e-128], 1.0, If[LessEqual[y, 7e-107], 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 -6.6 \cdot 10^{-128}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-107}:\\
\;\;\;\;\frac{z - \frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6.6e-128 or 6.99999999999999971e-107 < y Initial program 100.0%
Taylor expanded in y around 0 51.2%
Taylor expanded in x around 0 89.6%
if -6.6e-128 < y < 6.99999999999999971e-107Initial program 98.8%
Taylor expanded in y around 0 80.6%
Taylor expanded in z around 0 80.5%
Final simplification86.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 (<= t 1.25e-97) (+ 1.0 (/ x (* y (- z y)))) (+ 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.25e-97) {
tmp = 1.0 + (x / (y * (z - y)));
} 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.25d-97) then
tmp = 1.0d0 + (x / (y * (z - y)))
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.25e-97) {
tmp = 1.0 + (x / (y * (z - y)));
} 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.25e-97: tmp = 1.0 + (x / (y * (z - y))) 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.25e-97) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); 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.25e-97)
tmp = 1.0 + (x / (y * (z - y)));
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.25e-97], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $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.25 \cdot 10^{-97}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{t \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if t < 1.2499999999999999e-97Initial program 99.3%
Taylor expanded in t around 0 79.1%
if 1.2499999999999999e-97 < t Initial program 100.0%
clear-num99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in t around inf 94.0%
mul-1-neg94.0%
associate-/r*94.0%
distribute-neg-frac294.0%
Simplified94.0%
Taylor expanded in x around 0 94.0%
Final simplification84.8%
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.6%
Final simplification99.6%
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.6%
Taylor expanded in y around 0 61.8%
Taylor expanded in x around 0 76.8%
Final simplification76.8%
herbie shell --seed 2024076
(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)))))