
(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 12 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 (if (<= z -1e-13) (- 1.0 (/ x (* (- y z) (- y t)))) (+ 1.0 (/ (* x (/ -1.0 (- y t))) (- y z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e-13) {
tmp = 1.0 - (x / ((y - z) * (y - t)));
} else {
tmp = 1.0 + ((x * (-1.0 / (y - 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 <= (-1d-13)) then
tmp = 1.0d0 - (x / ((y - z) * (y - t)))
else
tmp = 1.0d0 + ((x * ((-1.0d0) / (y - 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 <= -1e-13) {
tmp = 1.0 - (x / ((y - z) * (y - t)));
} else {
tmp = 1.0 + ((x * (-1.0 / (y - t))) / (y - z));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -1e-13: tmp = 1.0 - (x / ((y - z) * (y - t))) else: tmp = 1.0 + ((x * (-1.0 / (y - 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 <= -1e-13) tmp = Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))); else tmp = Float64(1.0 + Float64(Float64(x * Float64(-1.0 / Float64(y - 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 <= -1e-13)
tmp = 1.0 - (x / ((y - z) * (y - t)));
else
tmp = 1.0 + ((x * (-1.0 / (y - 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, -1e-13], N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x * N[(-1.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $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 -1 \cdot 10^{-13}:\\
\;\;\;\;1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x \cdot \frac{-1}{y - t}}{y - z}\\
\end{array}
\end{array}
if z < -1e-13Initial program 100.0%
if -1e-13 < z Initial program 97.2%
clear-num97.2%
associate-/r/97.2%
*-commutative97.2%
associate-/r*97.2%
Applied egg-rr97.2%
frac-2neg97.2%
associate-*l/98.8%
distribute-neg-frac98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Final simplification99.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ 1.0 (/ x (* z y)))))
(if (<= t 6e-60)
t_1
(if (<= t 2.05e-40) (/ x (* z (- t))) (if (<= t 1.65e-22) t_1 1.0)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 + (x / (z * y));
double tmp;
if (t <= 6e-60) {
tmp = t_1;
} else if (t <= 2.05e-40) {
tmp = x / (z * -t);
} else if (t <= 1.65e-22) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = 1.0d0 + (x / (z * y))
if (t <= 6d-60) then
tmp = t_1
else if (t <= 2.05d-40) then
tmp = x / (z * -t)
else if (t <= 1.65d-22) then
tmp = t_1
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 t_1 = 1.0 + (x / (z * y));
double tmp;
if (t <= 6e-60) {
tmp = t_1;
} else if (t <= 2.05e-40) {
tmp = x / (z * -t);
} else if (t <= 1.65e-22) {
tmp = t_1;
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 + (x / (z * y)) tmp = 0 if t <= 6e-60: tmp = t_1 elif t <= 2.05e-40: tmp = x / (z * -t) elif t <= 1.65e-22: tmp = t_1 else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 + Float64(x / Float64(z * y))) tmp = 0.0 if (t <= 6e-60) tmp = t_1; elseif (t <= 2.05e-40) tmp = Float64(x / Float64(z * Float64(-t))); elseif (t <= 1.65e-22) tmp = t_1; 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)
t_1 = 1.0 + (x / (z * y));
tmp = 0.0;
if (t <= 6e-60)
tmp = t_1;
elseif (t <= 2.05e-40)
tmp = x / (z * -t);
elseif (t <= 1.65e-22)
tmp = t_1;
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_] := Block[{t$95$1 = N[(1.0 + N[(x / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 6e-60], t$95$1, If[LessEqual[t, 2.05e-40], N[(x / N[(z * (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.65e-22], t$95$1, 1.0]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 1 + \frac{x}{z \cdot y}\\
\mathbf{if}\;t \leq 6 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.05 \cdot 10^{-40}:\\
\;\;\;\;\frac{x}{z \cdot \left(-t\right)}\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < 6.00000000000000038e-60 or 2.04999999999999981e-40 < t < 1.65e-22Initial program 97.2%
Taylor expanded in z around inf 79.8%
+-commutative79.8%
associate-/r*79.9%
Simplified79.9%
Taylor expanded in y around inf 61.7%
*-commutative61.7%
Simplified61.7%
if 6.00000000000000038e-60 < t < 2.04999999999999981e-40Initial program 99.6%
Taylor expanded in x around inf 60.1%
mul-1-neg60.1%
associate-/l/60.1%
distribute-frac-neg60.1%
distribute-neg-frac260.1%
Simplified60.1%
Taylor expanded in y around 0 27.7%
associate-*r/27.7%
neg-mul-127.7%
*-commutative27.7%
Simplified27.7%
if 1.65e-22 < t Initial program 100.0%
Taylor expanded in x around 0 85.7%
Final simplification68.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 (<= z -2.35e-206)
(- 1.0 (/ (/ x z) (- t y)))
(if (<= z 1.5e-303)
(- 1.0 (/ x (* y (- 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 (z <= -2.35e-206) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 1.5e-303) {
tmp = 1.0 - (x / (y * (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 (z <= (-2.35d-206)) then
tmp = 1.0d0 - ((x / z) / (t - y))
else if (z <= 1.5d-303) then
tmp = 1.0d0 - (x / (y * (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 (z <= -2.35e-206) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 1.5e-303) {
tmp = 1.0 - (x / (y * (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 z <= -2.35e-206: tmp = 1.0 - ((x / z) / (t - y)) elif z <= 1.5e-303: tmp = 1.0 - (x / (y * (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 (z <= -2.35e-206) tmp = Float64(1.0 - Float64(Float64(x / z) / Float64(t - y))); elseif (z <= 1.5e-303) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); 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 <= -2.35e-206)
tmp = 1.0 - ((x / z) / (t - y));
elseif (z <= 1.5e-303)
tmp = 1.0 - (x / (y * (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[z, -2.35e-206], N[(1.0 - N[(N[(x / z), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e-303], N[(1.0 - N[(x / N[(y * N[(y - t), $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 -2.35 \cdot 10^{-206}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-303}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -2.3499999999999999e-206Initial program 99.9%
Taylor expanded in z around inf 91.6%
+-commutative91.6%
associate-/r*88.4%
Simplified88.4%
if -2.3499999999999999e-206 < z < 1.50000000000000014e-303Initial program 89.6%
Taylor expanded in z around 0 89.6%
if 1.50000000000000014e-303 < z Initial program 97.5%
Taylor expanded in t around inf 81.9%
+-commutative81.9%
associate-/r*82.8%
Simplified82.8%
Final simplification85.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 (<= z -2.35e-206)
(- 1.0 (/ (/ x z) (- t y)))
(if (<= z 1.5e-303)
(+ 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 <= -2.35e-206) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 1.5e-303) {
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 <= (-2.35d-206)) then
tmp = 1.0d0 - ((x / z) / (t - y))
else if (z <= 1.5d-303) 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 <= -2.35e-206) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 1.5e-303) {
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 <= -2.35e-206: tmp = 1.0 - ((x / z) / (t - y)) elif z <= 1.5e-303: 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 <= -2.35e-206) tmp = Float64(1.0 - Float64(Float64(x / z) / Float64(t - y))); elseif (z <= 1.5e-303) tmp = Float64(1.0 + Float64(Float64(x / 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 <= -2.35e-206)
tmp = 1.0 - ((x / z) / (t - y));
elseif (z <= 1.5e-303)
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, -2.35e-206], N[(1.0 - N[(N[(x / z), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e-303], N[(1.0 + N[(N[(x / y), $MachinePrecision] / N[(t - y), $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 -2.35 \cdot 10^{-206}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-303}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{t - y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -2.3499999999999999e-206Initial program 99.9%
Taylor expanded in z around inf 91.6%
+-commutative91.6%
associate-/r*88.4%
Simplified88.4%
if -2.3499999999999999e-206 < z < 1.50000000000000014e-303Initial program 89.6%
Taylor expanded in z around 0 89.6%
associate-/r*99.7%
Simplified99.7%
if 1.50000000000000014e-303 < z Initial program 97.5%
Taylor expanded in t around inf 81.9%
+-commutative81.9%
associate-/r*82.8%
Simplified82.8%
Final simplification86.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 -2.35e-206)
(+ 1.0 (* x (/ -1.0 (* z (- t y)))))
(if (<= z 1.5e-303)
(+ 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 <= -2.35e-206) {
tmp = 1.0 + (x * (-1.0 / (z * (t - y))));
} else if (z <= 1.5e-303) {
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 <= (-2.35d-206)) then
tmp = 1.0d0 + (x * ((-1.0d0) / (z * (t - y))))
else if (z <= 1.5d-303) 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 <= -2.35e-206) {
tmp = 1.0 + (x * (-1.0 / (z * (t - y))));
} else if (z <= 1.5e-303) {
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 <= -2.35e-206: tmp = 1.0 + (x * (-1.0 / (z * (t - y)))) elif z <= 1.5e-303: 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 <= -2.35e-206) tmp = Float64(1.0 + Float64(x * Float64(-1.0 / Float64(z * Float64(t - y))))); elseif (z <= 1.5e-303) tmp = Float64(1.0 + Float64(Float64(x / 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 <= -2.35e-206)
tmp = 1.0 + (x * (-1.0 / (z * (t - y))));
elseif (z <= 1.5e-303)
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, -2.35e-206], N[(1.0 + N[(x * N[(-1.0 / N[(z * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e-303], N[(1.0 + N[(N[(x / y), $MachinePrecision] / N[(t - y), $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 -2.35 \cdot 10^{-206}:\\
\;\;\;\;1 + x \cdot \frac{-1}{z \cdot \left(t - y\right)}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-303}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{t - y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -2.3499999999999999e-206Initial program 99.9%
clear-num99.9%
associate-/r/99.9%
*-commutative99.9%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 91.6%
if -2.3499999999999999e-206 < z < 1.50000000000000014e-303Initial program 89.6%
Taylor expanded in z around 0 89.6%
associate-/r*99.7%
Simplified99.7%
if 1.50000000000000014e-303 < z Initial program 97.5%
Taylor expanded in t around inf 81.9%
+-commutative81.9%
associate-/r*82.8%
Simplified82.8%
Final simplification87.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 -1.15e-114) 1.0 (if (<= y 2e-162) (- 1.0 (/ x (* z t))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.15e-114) {
tmp = 1.0;
} else if (y <= 2e-162) {
tmp = 1.0 - (x / (z * t));
} 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.15d-114)) then
tmp = 1.0d0
else if (y <= 2d-162) then
tmp = 1.0d0 - (x / (z * t))
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.15e-114) {
tmp = 1.0;
} else if (y <= 2e-162) {
tmp = 1.0 - (x / (z * t));
} 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.15e-114: tmp = 1.0 elif y <= 2e-162: tmp = 1.0 - (x / (z * t)) 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.15e-114) tmp = 1.0; elseif (y <= 2e-162) tmp = Float64(1.0 - Float64(x / Float64(z * t))); 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.15e-114)
tmp = 1.0;
elseif (y <= 2e-162)
tmp = 1.0 - (x / (z * t));
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.15e-114], 1.0, If[LessEqual[y, 2e-162], N[(1.0 - N[(x / N[(z * t), $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 -1.15 \cdot 10^{-114}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-162}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.15e-114 or 1.99999999999999991e-162 < y Initial program 99.9%
Taylor expanded in x around 0 86.5%
if -1.15e-114 < y < 1.99999999999999991e-162Initial program 93.7%
Taylor expanded in y around 0 77.7%
Final simplification83.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 -5.4e-181) 1.0 (if (<= y 1.5e-245) (/ x (* z (- t))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.4e-181) {
tmp = 1.0;
} else if (y <= 1.5e-245) {
tmp = x / (z * -t);
} 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.4d-181)) then
tmp = 1.0d0
else if (y <= 1.5d-245) then
tmp = x / (z * -t)
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.4e-181) {
tmp = 1.0;
} else if (y <= 1.5e-245) {
tmp = x / (z * -t);
} 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.4e-181: tmp = 1.0 elif y <= 1.5e-245: tmp = x / (z * -t) 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.4e-181) tmp = 1.0; elseif (y <= 1.5e-245) tmp = Float64(x / Float64(z * Float64(-t))); 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.4e-181)
tmp = 1.0;
elseif (y <= 1.5e-245)
tmp = x / (z * -t);
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.4e-181], 1.0, If[LessEqual[y, 1.5e-245], N[(x / N[(z * (-t)), $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.4 \cdot 10^{-181}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-245}:\\
\;\;\;\;\frac{x}{z \cdot \left(-t\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.3999999999999999e-181 or 1.5000000000000001e-245 < y Initial program 99.5%
Taylor expanded in x around 0 79.9%
if -5.3999999999999999e-181 < y < 1.5000000000000001e-245Initial program 90.9%
Taylor expanded in x around inf 60.8%
mul-1-neg60.8%
associate-/l/65.3%
distribute-frac-neg65.3%
distribute-neg-frac265.3%
Simplified65.3%
Taylor expanded in y around 0 55.1%
associate-*r/55.1%
neg-mul-155.1%
*-commutative55.1%
Simplified55.1%
Final simplification75.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 (<= t 6.2e-169) (+ 1.0 (/ x (* 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 <= 6.2e-169) {
tmp = 1.0 + (x / (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 <= 6.2d-169) then
tmp = 1.0d0 + (x / (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 <= 6.2e-169) {
tmp = 1.0 + (x / (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 <= 6.2e-169: tmp = 1.0 + (x / (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 <= 6.2e-169) tmp = Float64(1.0 + Float64(x / Float64(z * 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 (t <= 6.2e-169)
tmp = 1.0 + (x / (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, 6.2e-169], N[(1.0 + N[(x / N[(z * y), $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}\;t \leq 6.2 \cdot 10^{-169}:\\
\;\;\;\;1 + \frac{x}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < 6.2000000000000004e-169Initial program 97.4%
Taylor expanded in z around inf 79.2%
+-commutative79.2%
associate-/r*78.7%
Simplified78.7%
Taylor expanded in y around inf 60.5%
*-commutative60.5%
Simplified60.5%
if 6.2000000000000004e-169 < t Initial program 99.0%
Taylor expanded in t around inf 90.6%
+-commutative90.6%
associate-/r*90.6%
Simplified90.6%
Final simplification72.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 (<= z -1.25e-158) (- 1.0 (/ (/ x z) (- 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 <= -1.25e-158) {
tmp = 1.0 - ((x / z) / (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 <= (-1.25d-158)) then
tmp = 1.0d0 - ((x / z) / (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 <= -1.25e-158) {
tmp = 1.0 - ((x / z) / (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 <= -1.25e-158: tmp = 1.0 - ((x / z) / (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 <= -1.25e-158) tmp = Float64(1.0 - Float64(Float64(x / z) / 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 <= -1.25e-158)
tmp = 1.0 - ((x / z) / (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, -1.25e-158], N[(1.0 - N[(N[(x / z), $MachinePrecision] / N[(t - y), $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 -1.25 \cdot 10^{-158}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -1.24999999999999993e-158Initial program 100.0%
Taylor expanded in z around inf 93.9%
+-commutative93.9%
associate-/r*92.1%
Simplified92.1%
if -1.24999999999999993e-158 < z Initial program 96.7%
Taylor expanded in t around inf 79.9%
+-commutative79.9%
associate-/r*81.3%
Simplified81.3%
Final simplification85.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 (<= t 6.2e-169) (+ 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 <= 6.2e-169) {
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 <= 6.2d-169) 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 <= 6.2e-169) {
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 <= 6.2e-169: 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 <= 6.2e-169) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - 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 (t <= 6.2e-169)
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, 6.2e-169], N[(1.0 + N[(x / N[(y * N[(z - 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}\;t \leq 6.2 \cdot 10^{-169}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < 6.2000000000000004e-169Initial program 97.4%
Taylor expanded in t around 0 73.6%
if 6.2000000000000004e-169 < t Initial program 99.0%
Taylor expanded in t around inf 90.6%
+-commutative90.6%
associate-/r*90.6%
Simplified90.6%
Final simplification80.3%
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 z) (- y t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
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 - z) * (y - t)))
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) * (y - t)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / ((y - z) * (y - t)));
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 - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
Initial program 98.1%
Final simplification98.1%
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 98.1%
Taylor expanded in x around 0 72.1%
Final simplification72.1%
herbie shell --seed 2024067
(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)))))