
(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 11 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 z)) (- t y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (y - z)) / (t - 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 - z)) / (t - 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 - z)) / (t - y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + ((x / (y - z)) / (t - 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 - z)) / Float64(t - y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((x / (y - z)) / (t - 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 - z), $MachinePrecision]), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{\frac{x}{y - z}}{t - y}
\end{array}
Initial program 99.0%
Taylor expanded in x around 0 99.0%
associate-/l/98.5%
metadata-eval98.5%
cancel-sign-sub-inv98.5%
*-lft-identity98.5%
Simplified98.5%
Final simplification98.5%
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 t) (- y z)))))
(if (<= t -2.45e-147)
t_1
(if (<= t 9.2e-124)
(/ (+ z (/ x y)) z)
(if (<= t 1.75e+49) (- 1.0 (/ (/ x y) (- y t))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 + ((x / t) / (y - z));
double tmp;
if (t <= -2.45e-147) {
tmp = t_1;
} else if (t <= 9.2e-124) {
tmp = (z + (x / y)) / z;
} else if (t <= 1.75e+49) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = t_1;
}
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 / t) / (y - z))
if (t <= (-2.45d-147)) then
tmp = t_1
else if (t <= 9.2d-124) then
tmp = (z + (x / y)) / z
else if (t <= 1.75d+49) then
tmp = 1.0d0 - ((x / y) / (y - t))
else
tmp = t_1
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 / t) / (y - z));
double tmp;
if (t <= -2.45e-147) {
tmp = t_1;
} else if (t <= 9.2e-124) {
tmp = (z + (x / y)) / z;
} else if (t <= 1.75e+49) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 + ((x / t) / (y - z)) tmp = 0 if t <= -2.45e-147: tmp = t_1 elif t <= 9.2e-124: tmp = (z + (x / y)) / z elif t <= 1.75e+49: tmp = 1.0 - ((x / y) / (y - t)) else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))) tmp = 0.0 if (t <= -2.45e-147) tmp = t_1; elseif (t <= 9.2e-124) tmp = Float64(Float64(z + Float64(x / y)) / z); elseif (t <= 1.75e+49) tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - t))); else tmp = t_1; 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 / t) / (y - z));
tmp = 0.0;
if (t <= -2.45e-147)
tmp = t_1;
elseif (t <= 9.2e-124)
tmp = (z + (x / y)) / z;
elseif (t <= 1.75e+49)
tmp = 1.0 - ((x / y) / (y - t));
else
tmp = t_1;
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[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.45e-147], t$95$1, If[LessEqual[t, 9.2e-124], N[(N[(z + N[(x / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 1.75e+49], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 1 + \frac{\frac{x}{t}}{y - z}\\
\mathbf{if}\;t \leq -2.45 \cdot 10^{-147}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 9.2 \cdot 10^{-124}:\\
\;\;\;\;\frac{z + \frac{x}{y}}{z}\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{+49}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.45000000000000002e-147 or 1.74999999999999987e49 < t Initial program 99.5%
Taylor expanded in t around inf 94.7%
associate-/r*95.1%
Simplified95.1%
if -2.45000000000000002e-147 < t < 9.20000000000000048e-124Initial program 97.5%
Taylor expanded in z around inf 81.5%
associate-/r*83.1%
Simplified83.1%
Taylor expanded in y around inf 73.7%
Taylor expanded in z around 0 75.3%
if 9.20000000000000048e-124 < t < 1.74999999999999987e49Initial program 99.9%
Taylor expanded in z around 0 86.0%
sub-neg86.0%
associate-/r*86.1%
distribute-neg-frac286.1%
neg-sub086.1%
sub-neg86.1%
+-commutative86.1%
associate--r+86.1%
neg-sub086.1%
remove-double-neg86.1%
Simplified86.1%
Final simplification87.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 -5000000.0)
1.0
(if (<= y -5.4e-121)
(/ (+ z (/ x y)) z)
(if (<= y 6.2e-103) (- 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 <= -5000000.0) {
tmp = 1.0;
} else if (y <= -5.4e-121) {
tmp = (z + (x / y)) / z;
} else if (y <= 6.2e-103) {
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 <= (-5000000.0d0)) then
tmp = 1.0d0
else if (y <= (-5.4d-121)) then
tmp = (z + (x / y)) / z
else if (y <= 6.2d-103) 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 <= -5000000.0) {
tmp = 1.0;
} else if (y <= -5.4e-121) {
tmp = (z + (x / y)) / z;
} else if (y <= 6.2e-103) {
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 <= -5000000.0: tmp = 1.0 elif y <= -5.4e-121: tmp = (z + (x / y)) / z elif y <= 6.2e-103: 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 <= -5000000.0) tmp = 1.0; elseif (y <= -5.4e-121) tmp = Float64(Float64(z + Float64(x / y)) / z); elseif (y <= 6.2e-103) 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 <= -5000000.0)
tmp = 1.0;
elseif (y <= -5.4e-121)
tmp = (z + (x / y)) / z;
elseif (y <= 6.2e-103)
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, -5000000.0], 1.0, If[LessEqual[y, -5.4e-121], N[(N[(z + N[(x / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 6.2e-103], 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 -5000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{-121}:\\
\;\;\;\;\frac{z + \frac{x}{y}}{z}\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-103}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5e6 or 6.2000000000000003e-103 < y Initial program 100.0%
Taylor expanded in x around 0 89.9%
if -5e6 < y < -5.4000000000000004e-121Initial program 99.8%
Taylor expanded in z around inf 72.7%
associate-/r*72.7%
Simplified72.7%
Taylor expanded in y around inf 64.9%
Taylor expanded in z around 0 65.2%
if -5.4000000000000004e-121 < y < 6.2000000000000003e-103Initial program 96.4%
Taylor expanded in y around 0 81.0%
Final simplification85.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 -5500000.0)
1.0
(if (<= y -5.8e-121)
(+ 1.0 (/ x (* y z)))
(if (<= y 1.4e-102) (- 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 <= -5500000.0) {
tmp = 1.0;
} else if (y <= -5.8e-121) {
tmp = 1.0 + (x / (y * z));
} else if (y <= 1.4e-102) {
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 <= (-5500000.0d0)) then
tmp = 1.0d0
else if (y <= (-5.8d-121)) then
tmp = 1.0d0 + (x / (y * z))
else if (y <= 1.4d-102) 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 <= -5500000.0) {
tmp = 1.0;
} else if (y <= -5.8e-121) {
tmp = 1.0 + (x / (y * z));
} else if (y <= 1.4e-102) {
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 <= -5500000.0: tmp = 1.0 elif y <= -5.8e-121: tmp = 1.0 + (x / (y * z)) elif y <= 1.4e-102: 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 <= -5500000.0) tmp = 1.0; elseif (y <= -5.8e-121) tmp = Float64(1.0 + Float64(x / Float64(y * z))); elseif (y <= 1.4e-102) 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 <= -5500000.0)
tmp = 1.0;
elseif (y <= -5.8e-121)
tmp = 1.0 + (x / (y * z));
elseif (y <= 1.4e-102)
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, -5500000.0], 1.0, If[LessEqual[y, -5.8e-121], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e-102], 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 -5500000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-121}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-102}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.5e6 or 1.40000000000000006e-102 < y Initial program 100.0%
Taylor expanded in x around 0 89.9%
if -5.5e6 < y < -5.8e-121Initial program 99.8%
Taylor expanded in z around inf 72.7%
associate-/r*72.7%
Simplified72.7%
Taylor expanded in y around inf 64.9%
if -5.8e-121 < y < 1.40000000000000006e-102Initial program 96.4%
Taylor expanded in y around 0 81.0%
Final simplification85.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 (<= z -6.3e-30)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 3.6e-273)
(+ 1.0 (/ -1.0 (/ y (/ x (- 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 <= -6.3e-30) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 3.6e-273) {
tmp = 1.0 + (-1.0 / (y / (x / (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 <= (-6.3d-30)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 3.6d-273) then
tmp = 1.0d0 + ((-1.0d0) / (y / (x / (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 <= -6.3e-30) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 3.6e-273) {
tmp = 1.0 + (-1.0 / (y / (x / (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 <= -6.3e-30: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 3.6e-273: tmp = 1.0 + (-1.0 / (y / (x / (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 <= -6.3e-30) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 3.6e-273) tmp = Float64(1.0 + Float64(-1.0 / Float64(y / Float64(x / 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 <= -6.3e-30)
tmp = 1.0 + ((x / z) / (y - t));
elseif (z <= 3.6e-273)
tmp = 1.0 + (-1.0 / (y / (x / (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, -6.3e-30], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e-273], N[(1.0 + N[(-1.0 / N[(y / N[(x / N[(y - t), $MachinePrecision]), $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.3 \cdot 10^{-30}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-273}:\\
\;\;\;\;1 + \frac{-1}{\frac{y}{\frac{x}{y - t}}}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -6.29999999999999982e-30Initial program 99.9%
Taylor expanded in z around inf 98.0%
associate-/r*98.0%
Simplified98.0%
if -6.29999999999999982e-30 < z < 3.59999999999999993e-273Initial program 97.7%
*-un-lft-identity97.7%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.9%
*-un-lft-identity99.9%
clear-num99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 90.2%
if 3.59999999999999993e-273 < z Initial program 99.2%
Taylor expanded in t around inf 82.5%
associate-/r*82.6%
Simplified82.6%
Final simplification88.1%
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.5e-145) (not (<= t 3.8e-97))) (+ 1.0 (/ (/ x t) (- y z))) (/ (+ z (/ x y)) z)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.5e-145) || !(t <= 3.8e-97)) {
tmp = 1.0 + ((x / t) / (y - z));
} else {
tmp = (z + (x / 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.5d-145)) .or. (.not. (t <= 3.8d-97))) then
tmp = 1.0d0 + ((x / t) / (y - z))
else
tmp = (z + (x / 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.5e-145) || !(t <= 3.8e-97)) {
tmp = 1.0 + ((x / t) / (y - z));
} else {
tmp = (z + (x / y)) / z;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (t <= -1.5e-145) or not (t <= 3.8e-97): tmp = 1.0 + ((x / t) / (y - z)) else: tmp = (z + (x / 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.5e-145) || !(t <= 3.8e-97)) tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); else tmp = Float64(Float64(z + Float64(x / 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.5e-145) || ~((t <= 3.8e-97)))
tmp = 1.0 + ((x / t) / (y - z));
else
tmp = (z + (x / 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[t, -1.5e-145], N[Not[LessEqual[t, 3.8e-97]], $MachinePrecision]], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + N[(x / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{-145} \lor \neg \left(t \leq 3.8 \cdot 10^{-97}\right):\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{z + \frac{x}{y}}{z}\\
\end{array}
\end{array}
if t < -1.49999999999999996e-145 or 3.8000000000000001e-97 < t Initial program 99.6%
Taylor expanded in t around inf 91.3%
associate-/r*91.6%
Simplified91.6%
if -1.49999999999999996e-145 < t < 3.8000000000000001e-97Initial program 97.6%
Taylor expanded in z around inf 81.0%
associate-/r*82.6%
Simplified82.6%
Taylor expanded in y around inf 73.5%
Taylor expanded in z around 0 75.1%
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 (<= z -7.2e-30)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 3.6e-273)
(- 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 <= -7.2e-30) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 3.6e-273) {
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 <= (-7.2d-30)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 3.6d-273) 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 <= -7.2e-30) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 3.6e-273) {
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 <= -7.2e-30: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 3.6e-273: 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 <= -7.2e-30) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 3.6e-273) tmp = Float64(1.0 - Float64(Float64(x / 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 <= -7.2e-30)
tmp = 1.0 + ((x / z) / (y - t));
elseif (z <= 3.6e-273)
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, -7.2e-30], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e-273], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - t), $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 -7.2 \cdot 10^{-30}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-273}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -7.2000000000000006e-30Initial program 99.9%
Taylor expanded in z around inf 98.0%
associate-/r*98.0%
Simplified98.0%
if -7.2000000000000006e-30 < z < 3.59999999999999993e-273Initial program 97.7%
Taylor expanded in z around 0 89.3%
sub-neg89.3%
associate-/r*89.6%
distribute-neg-frac289.6%
neg-sub089.6%
sub-neg89.6%
+-commutative89.6%
associate--r+89.6%
neg-sub089.6%
remove-double-neg89.6%
Simplified89.6%
if 3.59999999999999993e-273 < z Initial program 99.2%
Taylor expanded in t around inf 82.5%
associate-/r*82.6%
Simplified82.6%
Final simplification88.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 (<= t -6e-97) 1.0 (if (<= t 2.6e-95) (+ 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 <= -6e-97) {
tmp = 1.0;
} else if (t <= 2.6e-95) {
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 <= (-6d-97)) then
tmp = 1.0d0
else if (t <= 2.6d-95) 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 <= -6e-97) {
tmp = 1.0;
} else if (t <= 2.6e-95) {
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 <= -6e-97: tmp = 1.0 elif t <= 2.6e-95: 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 <= -6e-97) tmp = 1.0; elseif (t <= 2.6e-95) 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 <= -6e-97)
tmp = 1.0;
elseif (t <= 2.6e-95)
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, -6e-97], 1.0, If[LessEqual[t, 2.6e-95], 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 -6 \cdot 10^{-97}:\\
\;\;\;\;1\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{-95}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -6.00000000000000048e-97 or 2.60000000000000001e-95 < t Initial program 99.9%
Taylor expanded in x around 0 79.0%
if -6.00000000000000048e-97 < t < 2.60000000000000001e-95Initial program 97.2%
Taylor expanded in z around inf 80.2%
associate-/r*81.7%
Simplified81.7%
Taylor expanded in y around inf 71.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 (<= x 4.9e+249) 1.0 (/ (- x) (* z t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4.9e+249) {
tmp = 1.0;
} else {
tmp = -x / (z * t);
}
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 (x <= 4.9d+249) then
tmp = 1.0d0
else
tmp = -x / (z * t)
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 (x <= 4.9e+249) {
tmp = 1.0;
} else {
tmp = -x / (z * t);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 4.9e+249: tmp = 1.0 else: tmp = -x / (z * t) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 4.9e+249) tmp = 1.0; else tmp = Float64(Float64(-x) / Float64(z * t)); 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 (x <= 4.9e+249)
tmp = 1.0;
else
tmp = -x / (z * t);
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[x, 4.9e+249], 1.0, N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.9 \cdot 10^{+249}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\end{array}
\end{array}
if x < 4.8999999999999996e249Initial program 98.9%
Taylor expanded in x around 0 77.5%
if 4.8999999999999996e249 < x Initial program 99.7%
Taylor expanded in t around inf 70.3%
associate-/r*70.1%
Simplified70.1%
Taylor expanded in x around inf 60.6%
Taylor expanded in y around 0 64.4%
associate-*r/64.4%
neg-mul-164.4%
Simplified64.4%
Final simplification76.9%
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) (- t y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - z) * (t - 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 - z) * (t - 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 - z) * (t - y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (x / ((y - z) * (t - 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 - z) * Float64(t - y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (x / ((y - z) * (t - 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 - z), $MachinePrecision] * N[(t - y), $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(t - y\right)}
\end{array}
Initial program 99.0%
Final simplification99.0%
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.0%
Taylor expanded in x around 0 74.9%
herbie shell --seed 2024186
(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)))))