
(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 (if (<= (* (- y z) (- y t)) 2e-119) (+ 1.0 (/ (/ x (- y t)) (- z y))) (+ 1.0 (/ x (* (- y z) (- t y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) * (y - t)) <= 2e-119) {
tmp = 1.0 + ((x / (y - t)) / (z - y));
} else {
tmp = 1.0 + (x / ((y - z) * (t - 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 (((y - z) * (y - t)) <= 2d-119) then
tmp = 1.0d0 + ((x / (y - t)) / (z - y))
else
tmp = 1.0d0 + (x / ((y - z) * (t - 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 (((y - z) * (y - t)) <= 2e-119) {
tmp = 1.0 + ((x / (y - t)) / (z - y));
} else {
tmp = 1.0 + (x / ((y - z) * (t - y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if ((y - z) * (y - t)) <= 2e-119: tmp = 1.0 + ((x / (y - t)) / (z - y)) else: tmp = 1.0 + (x / ((y - z) * (t - y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(y - z) * Float64(y - t)) <= 2e-119) tmp = Float64(1.0 + Float64(Float64(x / Float64(y - t)) / Float64(z - y))); else tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * Float64(t - 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 (((y - z) * (y - t)) <= 2e-119)
tmp = 1.0 + ((x / (y - t)) / (z - y));
else
tmp = 1.0 + (x / ((y - z) * (t - 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[N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision], 2e-119], N[(1.0 + N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(y - z\right) \cdot \left(y - t\right) \leq 2 \cdot 10^{-119}:\\
\;\;\;\;1 + \frac{\frac{x}{y - t}}{z - y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}\\
\end{array}
\end{array}
if (*.f64 (-.f64 y z) (-.f64 y t)) < 2.00000000000000003e-119Initial program 94.1%
clear-num94.1%
inv-pow94.1%
associate-/l*98.8%
Applied egg-rr98.8%
Taylor expanded in x around 0 94.1%
associate-/r*98.0%
Simplified98.0%
if 2.00000000000000003e-119 < (*.f64 (-.f64 y z) (-.f64 y t)) Initial program 99.9%
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 (<= z -1.55e-46) (not (<= z 3.2e-67))) (+ 1.0 (/ x (* z (- y t)))) (+ 1.0 (/ (/ x (- t y)) y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.55e-46) || !(z <= 3.2e-67)) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 + ((x / (t - y)) / 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 <= (-1.55d-46)) .or. (.not. (z <= 3.2d-67))) then
tmp = 1.0d0 + (x / (z * (y - t)))
else
tmp = 1.0d0 + ((x / (t - y)) / 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 <= -1.55e-46) || !(z <= 3.2e-67)) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 + ((x / (t - y)) / y);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (z <= -1.55e-46) or not (z <= 3.2e-67): tmp = 1.0 + (x / (z * (y - t))) else: tmp = 1.0 + ((x / (t - y)) / y) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((z <= -1.55e-46) || !(z <= 3.2e-67)) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); else tmp = Float64(1.0 + Float64(Float64(x / Float64(t - y)) / 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 <= -1.55e-46) || ~((z <= 3.2e-67)))
tmp = 1.0 + (x / (z * (y - t)));
else
tmp = 1.0 + ((x / (t - y)) / y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.55e-46], N[Not[LessEqual[z, 3.2e-67]], $MachinePrecision]], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / N[(t - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-46} \lor \neg \left(z \leq 3.2 \cdot 10^{-67}\right):\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t - y}}{y}\\
\end{array}
\end{array}
if z < -1.55e-46 or 3.20000000000000021e-67 < z Initial program 99.9%
Taylor expanded in z around inf 96.6%
associate-*r/96.6%
neg-mul-196.6%
*-commutative96.6%
Simplified96.6%
if -1.55e-46 < z < 3.20000000000000021e-67Initial program 93.8%
*-un-lft-identity93.8%
times-frac99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 85.2%
associate-*l/85.2%
*-un-lft-identity85.2%
Applied egg-rr85.2%
Final simplification92.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 (or (<= y -1.8e-142) (not (<= y 5.5e-130))) (+ 1.0 (/ x (* y (- t y)))) (+ 1.0 (/ -1.0 (* t (/ z x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.8e-142) || !(y <= 5.5e-130)) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 + (-1.0 / (t * (z / x)));
}
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.8d-142)) .or. (.not. (y <= 5.5d-130))) then
tmp = 1.0d0 + (x / (y * (t - y)))
else
tmp = 1.0d0 + ((-1.0d0) / (t * (z / x)))
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.8e-142) || !(y <= 5.5e-130)) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 + (-1.0 / (t * (z / x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (y <= -1.8e-142) or not (y <= 5.5e-130): tmp = 1.0 + (x / (y * (t - y))) else: tmp = 1.0 + (-1.0 / (t * (z / x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -1.8e-142) || !(y <= 5.5e-130)) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); else tmp = Float64(1.0 + Float64(-1.0 / Float64(t * Float64(z / x)))); 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.8e-142) || ~((y <= 5.5e-130)))
tmp = 1.0 + (x / (y * (t - y)));
else
tmp = 1.0 + (-1.0 / (t * (z / x)));
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.8e-142], N[Not[LessEqual[y, 5.5e-130]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / N[(t * N[(z / x), $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.8 \cdot 10^{-142} \lor \neg \left(y \leq 5.5 \cdot 10^{-130}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{t \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if y < -1.8e-142 or 5.50000000000000007e-130 < y Initial program 99.9%
Taylor expanded in z around 0 84.7%
if -1.8e-142 < y < 5.50000000000000007e-130Initial program 93.0%
Taylor expanded in y around 0 81.4%
clear-num81.4%
inv-pow81.4%
*-commutative81.4%
Applied egg-rr81.4%
unpow-181.4%
*-commutative81.4%
associate-/l*81.8%
Simplified81.8%
Final simplification83.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= t -8.6e-266)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= t 6.2e-37)
(+ 1.0 (/ (/ x (- z y)) 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 <= -8.6e-266) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 6.2e-37) {
tmp = 1.0 + ((x / (z - y)) / 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 <= (-8.6d-266)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (t <= 6.2d-37) then
tmp = 1.0d0 + ((x / (z - y)) / 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 <= -8.6e-266) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 6.2e-37) {
tmp = 1.0 + ((x / (z - y)) / 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 <= -8.6e-266: tmp = 1.0 + ((x / z) / (y - t)) elif t <= 6.2e-37: tmp = 1.0 + ((x / (z - y)) / 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 <= -8.6e-266) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (t <= 6.2e-37) tmp = Float64(1.0 + Float64(Float64(x / Float64(z - y)) / 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 <= -8.6e-266)
tmp = 1.0 + ((x / z) / (y - t));
elseif (t <= 6.2e-37)
tmp = 1.0 + ((x / (z - y)) / 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, -8.6e-266], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.2e-37], N[(1.0 + N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / y), $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 -8.6 \cdot 10^{-266}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-37}:\\
\;\;\;\;1 + \frac{\frac{x}{z - y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -8.60000000000000056e-266Initial program 97.5%
Taylor expanded in z around inf 79.5%
mul-1-neg79.5%
associate-/r*79.7%
distribute-neg-frac79.7%
Simplified79.7%
if -8.60000000000000056e-266 < t < 6.19999999999999987e-37Initial program 95.6%
clear-num95.5%
inv-pow95.5%
associate-/l*98.4%
Applied egg-rr98.4%
Taylor expanded in x around 0 95.6%
associate-/r*98.4%
Simplified98.4%
Taylor expanded in t around 0 86.9%
associate-/l/88.3%
Simplified88.3%
if 6.19999999999999987e-37 < t Initial program 99.8%
clear-num99.9%
inv-pow99.9%
associate-/l*99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 99.8%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in y around 0 98.6%
associate-*r/98.6%
mul-1-neg98.6%
Simplified98.6%
Final simplification87.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 -1.6e-46)
(+ 1.0 (/ x (* z (- y t))))
(if (<= z 3.5e-72)
(+ 1.0 (/ (/ x (- t y)) y))
(+ 1.0 (/ (/ x z) (- y t))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e-46) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 3.5e-72) {
tmp = 1.0 + ((x / (t - y)) / y);
} else {
tmp = 1.0 + ((x / z) / (y - 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 (z <= (-1.6d-46)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (z <= 3.5d-72) then
tmp = 1.0d0 + ((x / (t - y)) / y)
else
tmp = 1.0d0 + ((x / z) / (y - 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 (z <= -1.6e-46) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 3.5e-72) {
tmp = 1.0 + ((x / (t - y)) / y);
} else {
tmp = 1.0 + ((x / z) / (y - t));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -1.6e-46: tmp = 1.0 + (x / (z * (y - t))) elif z <= 3.5e-72: tmp = 1.0 + ((x / (t - y)) / y) else: tmp = 1.0 + ((x / z) / (y - t)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1.6e-46) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (z <= 3.5e-72) tmp = Float64(1.0 + Float64(Float64(x / Float64(t - y)) / y)); else tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - 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 (z <= -1.6e-46)
tmp = 1.0 + (x / (z * (y - t)));
elseif (z <= 3.5e-72)
tmp = 1.0 + ((x / (t - y)) / y);
else
tmp = 1.0 + ((x / z) / (y - 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[z, -1.6e-46], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-72], N[(1.0 + N[(N[(x / N[(t - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-46}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-72}:\\
\;\;\;\;1 + \frac{\frac{x}{t - y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\end{array}
\end{array}
if z < -1.6e-46Initial program 99.9%
Taylor expanded in z around inf 97.8%
associate-*r/97.8%
neg-mul-197.8%
*-commutative97.8%
Simplified97.8%
if -1.6e-46 < z < 3.5e-72Initial program 93.8%
*-un-lft-identity93.8%
times-frac99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 85.2%
associate-*l/85.2%
*-un-lft-identity85.2%
Applied egg-rr85.2%
if 3.5e-72 < z Initial program 99.9%
Taylor expanded in z around inf 95.6%
mul-1-neg95.6%
associate-/r*95.6%
distribute-neg-frac95.6%
Simplified95.6%
Final simplification92.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 -1.24e-142)
(+ 1.0 (/ x (* y (- t y))))
(if (<= y 7e-112)
(+ 1.0 (/ -1.0 (* t (/ z x))))
(- 1.0 (/ x (* y (- y z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.24e-142) {
tmp = 1.0 + (x / (y * (t - y)));
} else if (y <= 7e-112) {
tmp = 1.0 + (-1.0 / (t * (z / x)));
} else {
tmp = 1.0 - (x / (y * (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.24d-142)) then
tmp = 1.0d0 + (x / (y * (t - y)))
else if (y <= 7d-112) then
tmp = 1.0d0 + ((-1.0d0) / (t * (z / x)))
else
tmp = 1.0d0 - (x / (y * (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.24e-142) {
tmp = 1.0 + (x / (y * (t - y)));
} else if (y <= 7e-112) {
tmp = 1.0 + (-1.0 / (t * (z / x)));
} else {
tmp = 1.0 - (x / (y * (y - z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -1.24e-142: tmp = 1.0 + (x / (y * (t - y))) elif y <= 7e-112: tmp = 1.0 + (-1.0 / (t * (z / x))) else: tmp = 1.0 - (x / (y * (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.24e-142) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); elseif (y <= 7e-112) tmp = Float64(1.0 + Float64(-1.0 / Float64(t * Float64(z / x)))); else tmp = Float64(1.0 - Float64(x / Float64(y * 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.24e-142)
tmp = 1.0 + (x / (y * (t - y)));
elseif (y <= 7e-112)
tmp = 1.0 + (-1.0 / (t * (z / x)));
else
tmp = 1.0 - (x / (y * (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[y, -1.24e-142], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e-112], N[(1.0 + N[(-1.0 / N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * 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.24 \cdot 10^{-142}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-112}:\\
\;\;\;\;1 + \frac{-1}{t \cdot \frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if y < -1.24000000000000003e-142Initial program 99.9%
Taylor expanded in z around 0 83.6%
if -1.24000000000000003e-142 < y < 6.99999999999999988e-112Initial program 93.2%
Taylor expanded in y around 0 81.0%
clear-num81.0%
inv-pow81.0%
*-commutative81.0%
Applied egg-rr81.0%
unpow-181.0%
*-commutative81.0%
associate-/l*81.3%
Simplified81.3%
if 6.99999999999999988e-112 < y Initial program 99.9%
Taylor expanded in t around 0 89.1%
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 (if (<= y -2.4e-153) 1.0 (if (<= y 1.5e-134) (+ 1.0 (/ -1.0 (* t (/ z x)))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.4e-153) {
tmp = 1.0;
} else if (y <= 1.5e-134) {
tmp = 1.0 + (-1.0 / (t * (z / x)));
} 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 <= (-2.4d-153)) then
tmp = 1.0d0
else if (y <= 1.5d-134) then
tmp = 1.0d0 + ((-1.0d0) / (t * (z / x)))
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 <= -2.4e-153) {
tmp = 1.0;
} else if (y <= 1.5e-134) {
tmp = 1.0 + (-1.0 / (t * (z / x)));
} 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 <= -2.4e-153: tmp = 1.0 elif y <= 1.5e-134: tmp = 1.0 + (-1.0 / (t * (z / x))) 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 <= -2.4e-153) tmp = 1.0; elseif (y <= 1.5e-134) tmp = Float64(1.0 + Float64(-1.0 / Float64(t * Float64(z / x)))); 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 <= -2.4e-153)
tmp = 1.0;
elseif (y <= 1.5e-134)
tmp = 1.0 + (-1.0 / (t * (z / x)));
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, -2.4e-153], 1.0, If[LessEqual[y, 1.5e-134], N[(1.0 + N[(-1.0 / N[(t * N[(z / x), $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 -2.4 \cdot 10^{-153}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-134}:\\
\;\;\;\;1 + \frac{-1}{t \cdot \frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.4000000000000002e-153 or 1.5e-134 < y Initial program 99.9%
Taylor expanded in y around 0 49.1%
*-un-lft-identity49.1%
times-frac49.1%
frac-2neg49.1%
metadata-eval49.1%
add-sqr-sqrt25.2%
sqrt-unprod48.8%
sqr-neg48.8%
sqrt-unprod23.9%
add-sqr-sqrt48.5%
Applied egg-rr48.5%
associate-*l/48.5%
associate-*r/48.5%
neg-mul-148.5%
Simplified48.5%
Taylor expanded in x around 0 80.1%
if -2.4000000000000002e-153 < y < 1.5e-134Initial program 92.3%
Taylor expanded in y around 0 82.2%
clear-num82.2%
inv-pow82.2%
*-commutative82.2%
Applied egg-rr82.2%
unpow-182.2%
*-commutative82.2%
associate-/l*82.6%
Simplified82.6%
Final simplification80.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 -2.4e-153) 1.0 (if (<= y 4.6e-135) (- 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 <= -2.4e-153) {
tmp = 1.0;
} else if (y <= 4.6e-135) {
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 <= (-2.4d-153)) then
tmp = 1.0d0
else if (y <= 4.6d-135) 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 <= -2.4e-153) {
tmp = 1.0;
} else if (y <= 4.6e-135) {
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 <= -2.4e-153: tmp = 1.0 elif y <= 4.6e-135: 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 <= -2.4e-153) tmp = 1.0; elseif (y <= 4.6e-135) 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 <= -2.4e-153)
tmp = 1.0;
elseif (y <= 4.6e-135)
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, -2.4e-153], 1.0, If[LessEqual[y, 4.6e-135], 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 -2.4 \cdot 10^{-153}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{-135}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.4000000000000002e-153 or 4.5999999999999998e-135 < y Initial program 99.9%
Taylor expanded in y around 0 49.1%
*-un-lft-identity49.1%
times-frac49.1%
frac-2neg49.1%
metadata-eval49.1%
add-sqr-sqrt25.2%
sqrt-unprod48.8%
sqr-neg48.8%
sqrt-unprod23.9%
add-sqr-sqrt48.5%
Applied egg-rr48.5%
associate-*l/48.5%
associate-*r/48.5%
neg-mul-148.5%
Simplified48.5%
Taylor expanded in x around 0 80.1%
if -2.4000000000000002e-153 < y < 4.5999999999999998e-135Initial program 92.3%
Taylor expanded in y around 0 82.2%
Final simplification80.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (/ x (* (- y 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 97.7%
Final simplification97.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
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%
Taylor expanded in y around 0 58.9%
*-un-lft-identity58.9%
times-frac58.6%
frac-2neg58.6%
metadata-eval58.6%
add-sqr-sqrt30.2%
sqrt-unprod51.1%
sqr-neg51.1%
sqrt-unprod22.1%
add-sqr-sqrt47.3%
Applied egg-rr47.3%
associate-*l/47.3%
associate-*r/47.3%
neg-mul-147.3%
Simplified47.3%
Taylor expanded in x around 0 70.3%
herbie shell --seed 2024087
(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)))))