
(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: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (/ -1.0 (* (/ (- y t) x) (- y z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (-1.0 / (((y - t) / x) * (y - z)));
}
NOTE: 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 + ((-1.0d0) / (((y - t) / x) * (y - z)))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (-1.0 / (((y - t) / x) * (y - z)));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 + (-1.0 / (((y - t) / x) * (y - z)))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(-1.0 / Float64(Float64(Float64(y - t) / x) * Float64(y - z)))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (-1.0 / (((y - t) / x) * (y - z)));
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 + N[(-1.0 / N[(N[(N[(y - t), $MachinePrecision] / x), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 + \frac{-1}{\frac{y - t}{x} \cdot \left(y - z\right)}
\end{array}
Initial program 98.8%
clear-num98.8%
inv-pow98.8%
*-commutative98.8%
associate-/l*98.8%
Applied egg-rr98.8%
unpow-198.8%
associate-/r/98.8%
Simplified98.8%
Final simplification98.8%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= t -3.7e-85)
(- 1.0 (/ x (* t z)))
(if (<= t 1.35e-58)
(- 1.0 (/ (/ x y) (- y z)))
(if (<= t 5.5e-26)
(/ (/ (- x) (- y z)) (- y t))
(if (<= t 350.0)
(+ 1.0 (/ -1.0 (/ (* y (- y t)) x)))
(+ 1.0 (/ (/ x t) (- y z))))))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.7e-85) {
tmp = 1.0 - (x / (t * z));
} else if (t <= 1.35e-58) {
tmp = 1.0 - ((x / y) / (y - z));
} else if (t <= 5.5e-26) {
tmp = (-x / (y - z)) / (y - t);
} else if (t <= 350.0) {
tmp = 1.0 + (-1.0 / ((y * (y - t)) / x));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
NOTE: 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 <= (-3.7d-85)) then
tmp = 1.0d0 - (x / (t * z))
else if (t <= 1.35d-58) then
tmp = 1.0d0 - ((x / y) / (y - z))
else if (t <= 5.5d-26) then
tmp = (-x / (y - z)) / (y - t)
else if (t <= 350.0d0) then
tmp = 1.0d0 + ((-1.0d0) / ((y * (y - t)) / x))
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.7e-85) {
tmp = 1.0 - (x / (t * z));
} else if (t <= 1.35e-58) {
tmp = 1.0 - ((x / y) / (y - z));
} else if (t <= 5.5e-26) {
tmp = (-x / (y - z)) / (y - t);
} else if (t <= 350.0) {
tmp = 1.0 + (-1.0 / ((y * (y - t)) / x));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if t <= -3.7e-85: tmp = 1.0 - (x / (t * z)) elif t <= 1.35e-58: tmp = 1.0 - ((x / y) / (y - z)) elif t <= 5.5e-26: tmp = (-x / (y - z)) / (y - t) elif t <= 350.0: tmp = 1.0 + (-1.0 / ((y * (y - t)) / x)) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -3.7e-85) tmp = Float64(1.0 - Float64(x / Float64(t * z))); elseif (t <= 1.35e-58) tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - z))); elseif (t <= 5.5e-26) tmp = Float64(Float64(Float64(-x) / Float64(y - z)) / Float64(y - t)); elseif (t <= 350.0) tmp = Float64(1.0 + Float64(-1.0 / Float64(Float64(y * Float64(y - t)) / x))); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= -3.7e-85)
tmp = 1.0 - (x / (t * z));
elseif (t <= 1.35e-58)
tmp = 1.0 - ((x / y) / (y - z));
elseif (t <= 5.5e-26)
tmp = (-x / (y - z)) / (y - t);
elseif (t <= 350.0)
tmp = 1.0 + (-1.0 / ((y * (y - t)) / x));
else
tmp = 1.0 + ((x / t) / (y - z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, -3.7e-85], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.35e-58], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.5e-26], N[(N[((-x) / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 350.0], N[(1.0 + N[(-1.0 / N[(N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.7 \cdot 10^{-85}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{-58}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - z}\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-26}:\\
\;\;\;\;\frac{\frac{-x}{y - z}}{y - t}\\
\mathbf{elif}\;t \leq 350:\\
\;\;\;\;1 + \frac{-1}{\frac{y \cdot \left(y - t\right)}{x}}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -3.69999999999999983e-85Initial program 99.9%
Taylor expanded in y around 0 72.3%
if -3.69999999999999983e-85 < t < 1.3499999999999999e-58Initial program 97.0%
Taylor expanded in t around 0 85.2%
associate-/r*87.1%
Simplified87.1%
if 1.3499999999999999e-58 < t < 5.5000000000000005e-26Initial program 100.0%
Taylor expanded in x around inf 80.8%
associate-*r/80.8%
neg-mul-180.8%
*-commutative80.8%
associate-/r*80.5%
Simplified80.5%
if 5.5000000000000005e-26 < t < 350Initial program 99.8%
clear-num100.0%
inv-pow100.0%
*-commutative100.0%
associate-/l*100.0%
Applied egg-rr100.0%
unpow-1100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
if 350 < t Initial program 99.9%
Taylor expanded in t around inf 98.4%
+-commutative98.4%
associate-/r*98.4%
Simplified98.4%
Final simplification85.0%
NOTE: 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 y) (- y z)))))
(if (<= t -1.05e-84)
(- 1.0 (/ x (* t z)))
(if (<= t 1.35e-58)
t_1
(if (<= t 5.6e-44)
(/ (/ (- x) (- y z)) (- y t))
(if (<= t 215.0) t_1 (+ 1.0 (/ (/ x t) (- y z)))))))))assert(z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - ((x / y) / (y - z));
double tmp;
if (t <= -1.05e-84) {
tmp = 1.0 - (x / (t * z));
} else if (t <= 1.35e-58) {
tmp = t_1;
} else if (t <= 5.6e-44) {
tmp = (-x / (y - z)) / (y - t);
} else if (t <= 215.0) {
tmp = t_1;
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
NOTE: 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 / y) / (y - z))
if (t <= (-1.05d-84)) then
tmp = 1.0d0 - (x / (t * z))
else if (t <= 1.35d-58) then
tmp = t_1
else if (t <= 5.6d-44) then
tmp = (-x / (y - z)) / (y - t)
else if (t <= 215.0d0) then
tmp = t_1
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - ((x / y) / (y - z));
double tmp;
if (t <= -1.05e-84) {
tmp = 1.0 - (x / (t * z));
} else if (t <= 1.35e-58) {
tmp = t_1;
} else if (t <= 5.6e-44) {
tmp = (-x / (y - z)) / (y - t);
} else if (t <= 215.0) {
tmp = t_1;
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): t_1 = 1.0 - ((x / y) / (y - z)) tmp = 0 if t <= -1.05e-84: tmp = 1.0 - (x / (t * z)) elif t <= 1.35e-58: tmp = t_1 elif t <= 5.6e-44: tmp = (-x / (y - z)) / (y - t) elif t <= 215.0: tmp = t_1 else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) t_1 = Float64(1.0 - Float64(Float64(x / y) / Float64(y - z))) tmp = 0.0 if (t <= -1.05e-84) tmp = Float64(1.0 - Float64(x / Float64(t * z))); elseif (t <= 1.35e-58) tmp = t_1; elseif (t <= 5.6e-44) tmp = Float64(Float64(Float64(-x) / Float64(y - z)) / Float64(y - t)); elseif (t <= 215.0) tmp = t_1; else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 1.0 - ((x / y) / (y - z));
tmp = 0.0;
if (t <= -1.05e-84)
tmp = 1.0 - (x / (t * z));
elseif (t <= 1.35e-58)
tmp = t_1;
elseif (t <= 5.6e-44)
tmp = (-x / (y - z)) / (y - t);
elseif (t <= 215.0)
tmp = t_1;
else
tmp = 1.0 + ((x / t) / (y - z));
end
tmp_2 = tmp;
end
NOTE: 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 / y), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.05e-84], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.35e-58], t$95$1, If[LessEqual[t, 5.6e-44], N[(N[((-x) / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 215.0], t$95$1, N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{x}{y}}{y - z}\\
\mathbf{if}\;t \leq -1.05 \cdot 10^{-84}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{-58}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 5.6 \cdot 10^{-44}:\\
\;\;\;\;\frac{\frac{-x}{y - z}}{y - t}\\
\mathbf{elif}\;t \leq 215:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -1.04999999999999999e-84Initial program 99.9%
Taylor expanded in y around 0 72.3%
if -1.04999999999999999e-84 < t < 1.3499999999999999e-58 or 5.6e-44 < t < 215Initial program 97.2%
Taylor expanded in t around 0 85.4%
associate-/r*87.1%
Simplified87.1%
if 1.3499999999999999e-58 < t < 5.6e-44Initial program 100.0%
Taylor expanded in x around inf 76.0%
associate-*r/76.0%
neg-mul-176.0%
*-commutative76.0%
associate-/r*75.6%
Simplified75.6%
if 215 < t Initial program 99.9%
Taylor expanded in t around inf 98.4%
+-commutative98.4%
associate-/r*98.4%
Simplified98.4%
Final simplification84.6%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y -2.5e-22)
1.0
(if (<= y -4e-103)
(+ 1.0 (/ x (* y t)))
(if (<= y 2e-39) (- 1.0 (/ x (* t z))) 1.0))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.5e-22) {
tmp = 1.0;
} else if (y <= -4e-103) {
tmp = 1.0 + (x / (y * t));
} else if (y <= 2e-39) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: 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.5d-22)) then
tmp = 1.0d0
else if (y <= (-4d-103)) then
tmp = 1.0d0 + (x / (y * t))
else if (y <= 2d-39) then
tmp = 1.0d0 - (x / (t * z))
else
tmp = 1.0d0
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.5e-22) {
tmp = 1.0;
} else if (y <= -4e-103) {
tmp = 1.0 + (x / (y * t));
} else if (y <= 2e-39) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -2.5e-22: tmp = 1.0 elif y <= -4e-103: tmp = 1.0 + (x / (y * t)) elif y <= 2e-39: tmp = 1.0 - (x / (t * z)) else: tmp = 1.0 return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -2.5e-22) tmp = 1.0; elseif (y <= -4e-103) tmp = Float64(1.0 + Float64(x / Float64(y * t))); elseif (y <= 2e-39) tmp = Float64(1.0 - Float64(x / Float64(t * z))); else tmp = 1.0; end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -2.5e-22)
tmp = 1.0;
elseif (y <= -4e-103)
tmp = 1.0 + (x / (y * t));
elseif (y <= 2e-39)
tmp = 1.0 - (x / (t * z));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -2.5e-22], 1.0, If[LessEqual[y, -4e-103], N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e-39], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{-22}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-103}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-39}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.49999999999999977e-22 or 1.99999999999999986e-39 < y Initial program 100.0%
Taylor expanded in x around 0 92.0%
if -2.49999999999999977e-22 < y < -3.99999999999999983e-103Initial program 100.0%
Taylor expanded in t around inf 77.7%
+-commutative77.7%
associate-/r*77.5%
Simplified77.5%
Taylor expanded in y around inf 70.0%
if -3.99999999999999983e-103 < y < 1.99999999999999986e-39Initial program 97.0%
Taylor expanded in y around 0 78.2%
Final simplification85.3%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y -1650.0)
(- 1.0 (/ x (* y y)))
(if (<= y -2.1e-103)
(+ 1.0 (/ x (* y t)))
(if (<= y 1.95e-39) (- 1.0 (/ x (* t z))) 1.0))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1650.0) {
tmp = 1.0 - (x / (y * y));
} else if (y <= -2.1e-103) {
tmp = 1.0 + (x / (y * t));
} else if (y <= 1.95e-39) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: 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 <= (-1650.0d0)) then
tmp = 1.0d0 - (x / (y * y))
else if (y <= (-2.1d-103)) then
tmp = 1.0d0 + (x / (y * t))
else if (y <= 1.95d-39) then
tmp = 1.0d0 - (x / (t * z))
else
tmp = 1.0d0
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1650.0) {
tmp = 1.0 - (x / (y * y));
} else if (y <= -2.1e-103) {
tmp = 1.0 + (x / (y * t));
} else if (y <= 1.95e-39) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -1650.0: tmp = 1.0 - (x / (y * y)) elif y <= -2.1e-103: tmp = 1.0 + (x / (y * t)) elif y <= 1.95e-39: tmp = 1.0 - (x / (t * z)) else: tmp = 1.0 return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -1650.0) tmp = Float64(1.0 - Float64(x / Float64(y * y))); elseif (y <= -2.1e-103) tmp = Float64(1.0 + Float64(x / Float64(y * t))); elseif (y <= 1.95e-39) tmp = Float64(1.0 - Float64(x / Float64(t * z))); else tmp = 1.0; end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -1650.0)
tmp = 1.0 - (x / (y * y));
elseif (y <= -2.1e-103)
tmp = 1.0 + (x / (y * t));
elseif (y <= 1.95e-39)
tmp = 1.0 - (x / (t * z));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -1650.0], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.1e-103], N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.95e-39], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1650:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-103}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{-39}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1650Initial program 100.0%
Taylor expanded in y around inf 93.8%
unpow293.8%
Simplified93.8%
if -1650 < y < -2.10000000000000005e-103Initial program 100.0%
Taylor expanded in t around inf 81.6%
+-commutative81.6%
associate-/r*81.5%
Simplified81.5%
Taylor expanded in y around inf 69.9%
if -2.10000000000000005e-103 < y < 1.95000000000000015e-39Initial program 97.0%
Taylor expanded in y around 0 78.2%
if 1.95000000000000015e-39 < y Initial program 100.0%
Taylor expanded in x around 0 93.4%
Final simplification85.9%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -36000000000.0) (not (<= y 3.5e-37))) (- 1.0 (/ x (* y (- y t)))) (+ 1.0 (/ (/ x t) (- y z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -36000000000.0) || !(y <= 3.5e-37)) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
NOTE: 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 <= (-36000000000.0d0)) .or. (.not. (y <= 3.5d-37))) then
tmp = 1.0d0 - (x / (y * (y - t)))
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -36000000000.0) || !(y <= 3.5e-37)) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -36000000000.0) or not (y <= 3.5e-37): tmp = 1.0 - (x / (y * (y - t))) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -36000000000.0) || !(y <= 3.5e-37)) 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
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -36000000000.0) || ~((y <= 3.5e-37)))
tmp = 1.0 - (x / (y * (y - t)));
else
tmp = 1.0 + ((x / t) / (y - z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -36000000000.0], N[Not[LessEqual[y, 3.5e-37]], $MachinePrecision]], 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}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -36000000000 \lor \neg \left(y \leq 3.5 \cdot 10^{-37}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if y < -3.6e10 or 3.5000000000000001e-37 < y Initial program 100.0%
Taylor expanded in z around 0 95.9%
if -3.6e10 < y < 3.5000000000000001e-37Initial program 97.5%
Taylor expanded in t around inf 85.4%
+-commutative85.4%
associate-/r*83.7%
Simplified83.7%
Final simplification90.1%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -49000000000000.0) (- 1.0 (/ x (* y y))) (if (<= y 2.35e-39) (+ 1.0 (/ (/ x t) (- y z))) 1.0)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -49000000000000.0) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 2.35e-39) {
tmp = 1.0 + ((x / t) / (y - z));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: 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 <= (-49000000000000.0d0)) then
tmp = 1.0d0 - (x / (y * y))
else if (y <= 2.35d-39) then
tmp = 1.0d0 + ((x / t) / (y - z))
else
tmp = 1.0d0
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -49000000000000.0) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 2.35e-39) {
tmp = 1.0 + ((x / t) / (y - z));
} else {
tmp = 1.0;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -49000000000000.0: tmp = 1.0 - (x / (y * y)) elif y <= 2.35e-39: tmp = 1.0 + ((x / t) / (y - z)) else: tmp = 1.0 return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -49000000000000.0) tmp = Float64(1.0 - Float64(x / Float64(y * y))); elseif (y <= 2.35e-39) tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); else tmp = 1.0; end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -49000000000000.0)
tmp = 1.0 - (x / (y * y));
elseif (y <= 2.35e-39)
tmp = 1.0 + ((x / t) / (y - z));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -49000000000000.0], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.35e-39], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -49000000000000:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{-39}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.9e13Initial program 100.0%
Taylor expanded in y around inf 93.7%
unpow293.7%
Simplified93.7%
if -4.9e13 < y < 2.3500000000000001e-39Initial program 97.5%
Taylor expanded in t around inf 85.1%
+-commutative85.1%
associate-/r*83.5%
Simplified83.5%
if 2.3500000000000001e-39 < y Initial program 100.0%
Taylor expanded in x around 0 93.4%
Final simplification88.9%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t -1.1e-84) (- 1.0 (/ x (* t z))) (if (<= t 820.0) (- 1.0 (/ (/ x y) (- y z))) (+ 1.0 (/ (/ x t) (- y z))))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.1e-84) {
tmp = 1.0 - (x / (t * z));
} else if (t <= 820.0) {
tmp = 1.0 - ((x / y) / (y - z));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
NOTE: 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.1d-84)) then
tmp = 1.0d0 - (x / (t * z))
else if (t <= 820.0d0) then
tmp = 1.0d0 - ((x / y) / (y - z))
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.1e-84) {
tmp = 1.0 - (x / (t * z));
} else if (t <= 820.0) {
tmp = 1.0 - ((x / y) / (y - z));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if t <= -1.1e-84: tmp = 1.0 - (x / (t * z)) elif t <= 820.0: tmp = 1.0 - ((x / y) / (y - z)) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -1.1e-84) tmp = Float64(1.0 - Float64(x / Float64(t * z))); elseif (t <= 820.0) tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - z))); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= -1.1e-84)
tmp = 1.0 - (x / (t * z));
elseif (t <= 820.0)
tmp = 1.0 - ((x / y) / (y - z));
else
tmp = 1.0 + ((x / t) / (y - z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, -1.1e-84], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 820.0], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-84}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{elif}\;t \leq 820:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - z}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -1.0999999999999999e-84Initial program 99.9%
Taylor expanded in y around 0 72.3%
if -1.0999999999999999e-84 < t < 820Initial program 97.3%
Taylor expanded in t around 0 83.4%
associate-/r*85.0%
Simplified85.0%
if 820 < t Initial program 99.9%
Taylor expanded in t around inf 98.4%
+-commutative98.4%
associate-/r*98.4%
Simplified98.4%
Final simplification83.9%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t -3.1e-87) 1.0 (if (<= t 9.6e-197) (+ 1.0 (/ x (* y z))) 1.0)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.1e-87) {
tmp = 1.0;
} else if (t <= 9.6e-197) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: 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 <= (-3.1d-87)) then
tmp = 1.0d0
else if (t <= 9.6d-197) then
tmp = 1.0d0 + (x / (y * z))
else
tmp = 1.0d0
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.1e-87) {
tmp = 1.0;
} else if (t <= 9.6e-197) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if t <= -3.1e-87: tmp = 1.0 elif t <= 9.6e-197: tmp = 1.0 + (x / (y * z)) else: tmp = 1.0 return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -3.1e-87) tmp = 1.0; elseif (t <= 9.6e-197) tmp = Float64(1.0 + Float64(x / Float64(y * z))); else tmp = 1.0; end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= -3.1e-87)
tmp = 1.0;
elseif (t <= 9.6e-197)
tmp = 1.0 + (x / (y * z));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, -3.1e-87], 1.0, If[LessEqual[t, 9.6e-197], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{-87}:\\
\;\;\;\;1\\
\mathbf{elif}\;t \leq 9.6 \cdot 10^{-197}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -3.09999999999999998e-87 or 9.6000000000000003e-197 < t Initial program 99.9%
Taylor expanded in x around 0 81.3%
if -3.09999999999999998e-87 < t < 9.6000000000000003e-197Initial program 95.8%
Taylor expanded in t around 0 86.2%
associate-/r*88.9%
Simplified88.9%
Taylor expanded in z around inf 69.5%
Final simplification78.1%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y t) (- y z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - t) * (y - z)));
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - (x / ((y - t) * (y - z)))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - t) * (y - z)));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - (x / ((y - t) * (y - z)))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - t) * Float64(y - z)))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / ((y - t) * (y - z)));
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{x}{\left(y - t\right) \cdot \left(y - z\right)}
\end{array}
Initial program 98.8%
Final simplification98.8%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (/ (/ x (- y t)) (- y z))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - ((x / (y - t)) / (y - z));
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - ((x / (y - t)) / (y - z))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - ((x / (y - t)) / (y - z));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - ((x / (y - t)) / (y - z))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(Float64(x / Float64(y - t)) / Float64(y - z))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - ((x / (y - t)) / (y - z));
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{\frac{x}{y - t}}{y - z}
\end{array}
Initial program 98.8%
associate-/l/98.8%
Simplified98.8%
Final simplification98.8%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0;
}
NOTE: 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 z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0
z, t = sort([z, t]) function code(x, y, z, t) return 1.0 end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1
\end{array}
Initial program 98.8%
Taylor expanded in x around 0 75.8%
Final simplification75.8%
herbie shell --seed 2023196
(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)))))