
(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 7 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 (- z y)) (- y t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (z - y)) / (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 / (z - y)) / (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 / (z - y)) / (y - t));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + ((x / (z - y)) / (y - t))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(x / Float64(z - y)) / 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 / (z - y)) / (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[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{\frac{x}{z - y}}{y - t}
\end{array}
Initial program 97.7%
sub-neg97.7%
neg-mul-197.7%
*-commutative97.7%
*-commutative97.7%
associate-/r*98.8%
associate-*r/98.8%
metadata-eval98.8%
times-frac98.8%
*-lft-identity98.8%
neg-mul-198.8%
sub-neg98.8%
+-commutative98.8%
distribute-neg-out98.8%
remove-double-neg98.8%
sub-neg98.8%
Simplified98.8%
Final simplification98.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 -8.4e-25) 1.0 (if (<= y 1.12e-92) (+ 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 <= -8.4e-25) {
tmp = 1.0;
} else if (y <= 1.12e-92) {
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 <= (-8.4d-25)) then
tmp = 1.0d0
else if (y <= 1.12d-92) 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 <= -8.4e-25) {
tmp = 1.0;
} else if (y <= 1.12e-92) {
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 <= -8.4e-25: tmp = 1.0 elif y <= 1.12e-92: 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 <= -8.4e-25) tmp = 1.0; elseif (y <= 1.12e-92) 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 <= -8.4e-25)
tmp = 1.0;
elseif (y <= 1.12e-92)
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, -8.4e-25], 1.0, If[LessEqual[y, 1.12e-92], 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 -8.4 \cdot 10^{-25}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{-92}:\\
\;\;\;\;1 + \frac{x}{t \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -8.40000000000000009e-25 or 1.11999999999999999e-92 < y Initial program 100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
*-commutative100.0%
associate-/r*100.0%
associate-*r/100.0%
metadata-eval100.0%
times-frac100.0%
*-lft-identity100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 87.8%
if -8.40000000000000009e-25 < y < 1.11999999999999999e-92Initial program 94.2%
Taylor expanded in t around inf 81.1%
Final simplification85.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 (<= t -2e-211) (+ 1.0 (/ (/ x z) (- y t))) (if (<= t 6.8e-6) (- 1.0 (/ x (* y (- y z)))) (+ 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 <= -2e-211) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 6.8e-6) {
tmp = 1.0 - (x / (y * (y - z)));
} 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 <= (-2d-211)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (t <= 6.8d-6) then
tmp = 1.0d0 - (x / (y * (y - z)))
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 <= -2e-211) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 6.8e-6) {
tmp = 1.0 - (x / (y * (y - z)));
} 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 <= -2e-211: tmp = 1.0 + ((x / z) / (y - t)) elif t <= 6.8e-6: tmp = 1.0 - (x / (y * (y - z))) 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 <= -2e-211) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (t <= 6.8e-6) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); 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 <= -2e-211)
tmp = 1.0 + ((x / z) / (y - t));
elseif (t <= 6.8e-6)
tmp = 1.0 - (x / (y * (y - z)));
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, -2e-211], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.8e-6], N[(1.0 - N[(x / N[(y * N[(y - z), $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 -2 \cdot 10^{-211}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{-6}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{t \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if t < -2.00000000000000017e-211Initial program 97.6%
sub-neg97.6%
neg-mul-197.6%
*-commutative97.6%
*-commutative97.6%
associate-/r*97.6%
associate-*r/97.6%
metadata-eval97.6%
times-frac97.6%
*-lft-identity97.6%
neg-mul-197.6%
sub-neg97.6%
+-commutative97.6%
distribute-neg-out97.6%
remove-double-neg97.6%
sub-neg97.6%
Simplified97.6%
Taylor expanded in z around inf 79.4%
+-commutative79.4%
associate-/r*78.6%
Simplified78.6%
if -2.00000000000000017e-211 < t < 6.80000000000000012e-6Initial program 96.4%
Taylor expanded in t around 0 88.2%
if 6.80000000000000012e-6 < t Initial program 99.9%
Taylor expanded in t around inf 99.9%
Final simplification86.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 (<= t -2.1e-211) (+ 1.0 (/ (/ x z) (- y t))) (if (<= t 6.8e-6) (- 1.0 (/ x (* y (- y z)))) (- 1.0 (/ (/ x t) (- z y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.1e-211) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 6.8e-6) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 - ((x / t) / (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 <= (-2.1d-211)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (t <= 6.8d-6) then
tmp = 1.0d0 - (x / (y * (y - z)))
else
tmp = 1.0d0 - ((x / t) / (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 <= -2.1e-211) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 6.8e-6) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 - ((x / t) / (z - y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= -2.1e-211: tmp = 1.0 + ((x / z) / (y - t)) elif t <= 6.8e-6: tmp = 1.0 - (x / (y * (y - z))) else: tmp = 1.0 - ((x / t) / (z - y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -2.1e-211) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (t <= 6.8e-6) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); else tmp = Float64(1.0 - Float64(Float64(x / t) / 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 <= -2.1e-211)
tmp = 1.0 + ((x / z) / (y - t));
elseif (t <= 6.8e-6)
tmp = 1.0 - (x / (y * (y - z)));
else
tmp = 1.0 - ((x / t) / (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[LessEqual[t, -2.1e-211], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.8e-6], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{-211}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{-6}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\
\end{array}
\end{array}
if t < -2.10000000000000008e-211Initial program 97.6%
sub-neg97.6%
neg-mul-197.6%
*-commutative97.6%
*-commutative97.6%
associate-/r*97.6%
associate-*r/97.6%
metadata-eval97.6%
times-frac97.6%
*-lft-identity97.6%
neg-mul-197.6%
sub-neg97.6%
+-commutative97.6%
distribute-neg-out97.6%
remove-double-neg97.6%
sub-neg97.6%
Simplified97.6%
Taylor expanded in z around inf 79.4%
+-commutative79.4%
associate-/r*78.6%
Simplified78.6%
if -2.10000000000000008e-211 < t < 6.80000000000000012e-6Initial program 96.4%
Taylor expanded in t around 0 88.2%
if 6.80000000000000012e-6 < t Initial program 99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
*-commutative99.9%
associate-/r*100.0%
associate-*r/100.0%
metadata-eval100.0%
times-frac100.0%
*-lft-identity100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in t around inf 99.9%
mul-1-neg99.9%
unsub-neg99.9%
associate-/r*100.0%
Simplified100.0%
Final simplification86.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 (<= z -4.5e-80)
(+ 1.0 (/ x (* z (- y t))))
(if (<= z 1.08e-162)
(- 1.0 (/ (/ x y) (- y t)))
(- 1.0 (/ (/ x t) (- z y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e-80) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 1.08e-162) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = 1.0 - ((x / t) / (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 (z <= (-4.5d-80)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (z <= 1.08d-162) then
tmp = 1.0d0 - ((x / y) / (y - t))
else
tmp = 1.0d0 - ((x / t) / (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 (z <= -4.5e-80) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 1.08e-162) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = 1.0 - ((x / t) / (z - y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -4.5e-80: tmp = 1.0 + (x / (z * (y - t))) elif z <= 1.08e-162: tmp = 1.0 - ((x / y) / (y - t)) else: tmp = 1.0 - ((x / t) / (z - y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e-80) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (z <= 1.08e-162) tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - t))); else tmp = Float64(1.0 - Float64(Float64(x / t) / 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 (z <= -4.5e-80)
tmp = 1.0 + (x / (z * (y - t)));
elseif (z <= 1.08e-162)
tmp = 1.0 - ((x / y) / (y - t));
else
tmp = 1.0 - ((x / t) / (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[LessEqual[z, -4.5e-80], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.08e-162], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{-80}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{-162}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\
\end{array}
\end{array}
if z < -4.5000000000000003e-80Initial program 99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
*-commutative99.9%
associate-/r*98.7%
associate-*r/98.7%
metadata-eval98.7%
times-frac98.7%
*-lft-identity98.7%
neg-mul-198.7%
sub-neg98.7%
+-commutative98.7%
distribute-neg-out98.7%
remove-double-neg98.7%
sub-neg98.7%
Simplified98.7%
Taylor expanded in z around inf 95.0%
+-commutative95.0%
*-commutative95.0%
Simplified95.0%
if -4.5000000000000003e-80 < z < 1.08000000000000006e-162Initial program 93.8%
sub-neg93.8%
neg-mul-193.8%
*-commutative93.8%
*-commutative93.8%
associate-/r*98.9%
associate-*r/98.9%
metadata-eval98.9%
times-frac98.9%
*-lft-identity98.9%
neg-mul-198.9%
sub-neg98.9%
+-commutative98.9%
distribute-neg-out98.9%
remove-double-neg98.9%
sub-neg98.9%
Simplified98.9%
+-commutative98.9%
div-inv98.9%
fma-def98.9%
Applied egg-rr98.9%
Taylor expanded in z around 0 87.2%
mul-1-neg87.2%
*-commutative87.2%
sub-neg87.2%
*-commutative87.2%
associate-/r*90.3%
Simplified90.3%
if 1.08000000000000006e-162 < z Initial program 99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
*-commutative99.9%
associate-/r*98.8%
associate-*r/98.8%
metadata-eval98.8%
times-frac98.8%
*-lft-identity98.8%
neg-mul-198.8%
sub-neg98.8%
+-commutative98.8%
distribute-neg-out98.8%
remove-double-neg98.8%
sub-neg98.8%
Simplified98.8%
Taylor expanded in t around inf 74.4%
mul-1-neg74.4%
unsub-neg74.4%
associate-/r*74.3%
Simplified74.3%
Final simplification86.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 (<= y -3e-89) 1.0 (if (<= y 6.3e-93) (- 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 <= -3e-89) {
tmp = 1.0;
} else if (y <= 6.3e-93) {
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 <= (-3d-89)) then
tmp = 1.0d0
else if (y <= 6.3d-93) 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 <= -3e-89) {
tmp = 1.0;
} else if (y <= 6.3e-93) {
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 <= -3e-89: tmp = 1.0 elif y <= 6.3e-93: 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 <= -3e-89) tmp = 1.0; elseif (y <= 6.3e-93) 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 <= -3e-89)
tmp = 1.0;
elseif (y <= 6.3e-93)
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, -3e-89], 1.0, If[LessEqual[y, 6.3e-93], 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 -3 \cdot 10^{-89}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.3 \cdot 10^{-93}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.9999999999999999e-89 or 6.30000000000000028e-93 < y Initial program 99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
*-commutative99.9%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
*-lft-identity99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in x around 0 86.2%
if -2.9999999999999999e-89 < y < 6.30000000000000028e-93Initial program 93.5%
sub-neg93.5%
neg-mul-193.5%
*-commutative93.5%
*-commutative93.5%
associate-/r*96.7%
associate-*r/96.7%
metadata-eval96.7%
times-frac96.7%
*-lft-identity96.7%
neg-mul-196.7%
sub-neg96.7%
+-commutative96.7%
distribute-neg-out96.7%
remove-double-neg96.7%
sub-neg96.7%
Simplified96.7%
Taylor expanded in y around 0 80.8%
mul-1-neg80.8%
sub-neg80.8%
Simplified80.8%
Final simplification84.4%
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 97.7%
sub-neg97.7%
neg-mul-197.7%
*-commutative97.7%
*-commutative97.7%
associate-/r*98.8%
associate-*r/98.8%
metadata-eval98.8%
times-frac98.8%
*-lft-identity98.8%
neg-mul-198.8%
sub-neg98.8%
+-commutative98.8%
distribute-neg-out98.8%
remove-double-neg98.8%
sub-neg98.8%
Simplified98.8%
Taylor expanded in x around 0 76.1%
Final simplification76.1%
herbie shell --seed 2024020
(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)))))