
(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: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 5e+31) (+ 1.0 (/ (/ x (- z 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 (t <= 5e+31) {
tmp = 1.0 + ((x / (z - 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 (t <= 5d+31) then
tmp = 1.0d0 + ((x / (z - 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 (t <= 5e+31) {
tmp = 1.0 + ((x / (z - 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 t <= 5e+31: tmp = 1.0 + ((x / (z - 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 (t <= 5e+31) tmp = Float64(1.0 + Float64(Float64(x / Float64(z - 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 (t <= 5e+31)
tmp = 1.0 + ((x / (z - 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[LessEqual[t, 5e+31], N[(1.0 + N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(y - t), $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 5 \cdot 10^{+31}:\\
\;\;\;\;1 + \frac{\frac{x}{z - y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < 5.00000000000000027e31Initial program 99.8%
sub-neg99.8%
distribute-frac-neg99.8%
*-lft-identity99.8%
associate-/r*99.4%
associate-*r/99.4%
metadata-eval99.4%
times-frac99.4%
neg-mul-199.4%
remove-double-neg99.4%
neg-mul-199.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-out99.4%
remove-double-neg99.4%
sub-neg99.4%
Simplified99.4%
if 5.00000000000000027e31 < t Initial program 100.0%
*-commutative100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
associate-*r/100.0%
neg-mul-1100.0%
Simplified100.0%
Final simplification99.6%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -1.56e+37) (not (<= y 1.9e-29))) (- 1.0 (/ x (* y y))) (+ 1.0 (/ (/ x z) (- y t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.56e+37) || !(y <= 1.9e-29)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 + ((x / z) / (y - t));
}
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 <= (-1.56d+37)) .or. (.not. (y <= 1.9d-29))) then
tmp = 1.0d0 - (x / (y * y))
else
tmp = 1.0d0 + ((x / z) / (y - t))
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 <= -1.56e+37) || !(y <= 1.9e-29)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 + ((x / z) / (y - t));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -1.56e+37) or not (y <= 1.9e-29): tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 + ((x / z) / (y - t)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -1.56e+37) || !(y <= 1.9e-29)) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -1.56e+37) || ~((y <= 1.9e-29)))
tmp = 1.0 - (x / (y * y));
else
tmp = 1.0 + ((x / z) / (y - t));
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, -1.56e+37], N[Not[LessEqual[y, 1.9e-29]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.56 \cdot 10^{+37} \lor \neg \left(y \leq 1.9 \cdot 10^{-29}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\end{array}
\end{array}
if y < -1.56000000000000008e37 or 1.89999999999999988e-29 < y Initial program 100.0%
Taylor expanded in y around inf 95.8%
unpow295.8%
Simplified95.8%
if -1.56000000000000008e37 < y < 1.89999999999999988e-29Initial program 99.7%
sub-neg99.7%
distribute-frac-neg99.7%
*-lft-identity99.7%
associate-/r*96.7%
associate-*r/96.7%
metadata-eval96.7%
times-frac96.7%
neg-mul-196.7%
remove-double-neg96.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 z around inf 83.4%
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 (or (<= z -8.8e-32) (not (<= z 3.3e-161))) (+ 1.0 (/ (/ x z) (- y t))) (- 1.0 (/ x (* y (- y t))))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.8e-32) || !(z <= 3.3e-161)) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
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 ((z <= (-8.8d-32)) .or. (.not. (z <= 3.3d-161))) then
tmp = 1.0d0 + ((x / z) / (y - t))
else
tmp = 1.0d0 - (x / (y * (y - t)))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.8e-32) || !(z <= 3.3e-161)) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (z <= -8.8e-32) or not (z <= 3.3e-161): tmp = 1.0 + ((x / z) / (y - t)) else: tmp = 1.0 - (x / (y * (y - t))) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((z <= -8.8e-32) || !(z <= 3.3e-161)) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); else tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((z <= -8.8e-32) || ~((z <= 3.3e-161)))
tmp = 1.0 + ((x / z) / (y - t));
else
tmp = 1.0 - (x / (y * (y - t)));
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[z, -8.8e-32], N[Not[LessEqual[z, 3.3e-161]], $MachinePrecision]], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{-32} \lor \neg \left(z \leq 3.3 \cdot 10^{-161}\right):\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if z < -8.7999999999999999e-32 or 3.2999999999999998e-161 < z Initial program 99.8%
sub-neg99.8%
distribute-frac-neg99.8%
*-lft-identity99.8%
associate-/r*99.4%
associate-*r/99.4%
metadata-eval99.4%
times-frac99.4%
neg-mul-199.4%
remove-double-neg99.4%
neg-mul-199.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-out99.4%
remove-double-neg99.4%
sub-neg99.4%
Simplified99.4%
Taylor expanded in z around inf 94.3%
if -8.7999999999999999e-32 < z < 3.2999999999999998e-161Initial program 99.9%
Taylor expanded in z around 0 93.7%
Final simplification94.1%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= z -9.4e-32) (not (<= z 1.8e-157))) (+ 1.0 (/ (/ x z) (- y t))) (- 1.0 (/ (/ x (- y t)) y))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.4e-32) || !(z <= 1.8e-157)) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 - ((x / (y - t)) / y);
}
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 ((z <= (-9.4d-32)) .or. (.not. (z <= 1.8d-157))) then
tmp = 1.0d0 + ((x / z) / (y - t))
else
tmp = 1.0d0 - ((x / (y - t)) / y)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.4e-32) || !(z <= 1.8e-157)) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 - ((x / (y - t)) / y);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (z <= -9.4e-32) or not (z <= 1.8e-157): tmp = 1.0 + ((x / z) / (y - t)) else: tmp = 1.0 - ((x / (y - t)) / y) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((z <= -9.4e-32) || !(z <= 1.8e-157)) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); else tmp = Float64(1.0 - Float64(Float64(x / Float64(y - t)) / y)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((z <= -9.4e-32) || ~((z <= 1.8e-157)))
tmp = 1.0 + ((x / z) / (y - t));
else
tmp = 1.0 - ((x / (y - t)) / y);
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[z, -9.4e-32], N[Not[LessEqual[z, 1.8e-157]], $MachinePrecision]], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.4 \cdot 10^{-32} \lor \neg \left(z \leq 1.8 \cdot 10^{-157}\right):\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y - t}}{y}\\
\end{array}
\end{array}
if z < -9.40000000000000039e-32 or 1.8e-157 < z Initial program 99.8%
sub-neg99.8%
distribute-frac-neg99.8%
*-lft-identity99.8%
associate-/r*99.4%
associate-*r/99.4%
metadata-eval99.4%
times-frac99.4%
neg-mul-199.4%
remove-double-neg99.4%
neg-mul-199.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-out99.4%
remove-double-neg99.4%
sub-neg99.4%
Simplified99.4%
Taylor expanded in z around inf 94.3%
if -9.40000000000000039e-32 < z < 1.8e-157Initial program 99.9%
Taylor expanded in z around 0 93.7%
*-un-lft-identity93.7%
times-frac93.6%
Applied egg-rr93.6%
associate-*l/93.7%
*-lft-identity93.7%
Simplified93.7%
Final simplification94.1%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y -5.4e+36)
(- 1.0 (/ x (* y y)))
(if (<= y 1.22e-19)
(+ 1.0 (/ (/ x z) (- y t)))
(+ 1.0 (/ -1.0 (/ (* y y) x))))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.4e+36) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 1.22e-19) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 + (-1.0 / ((y * y) / x));
}
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 <= (-5.4d+36)) then
tmp = 1.0d0 - (x / (y * y))
else if (y <= 1.22d-19) then
tmp = 1.0d0 + ((x / z) / (y - t))
else
tmp = 1.0d0 + ((-1.0d0) / ((y * y) / x))
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 <= -5.4e+36) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 1.22e-19) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0 + (-1.0 / ((y * y) / x));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -5.4e+36: tmp = 1.0 - (x / (y * y)) elif y <= 1.22e-19: tmp = 1.0 + ((x / z) / (y - t)) else: tmp = 1.0 + (-1.0 / ((y * y) / x)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -5.4e+36) tmp = Float64(1.0 - Float64(x / Float64(y * y))); elseif (y <= 1.22e-19) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); else tmp = Float64(1.0 + Float64(-1.0 / Float64(Float64(y * y) / x))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -5.4e+36)
tmp = 1.0 - (x / (y * y));
elseif (y <= 1.22e-19)
tmp = 1.0 + ((x / z) / (y - t));
else
tmp = 1.0 + (-1.0 / ((y * y) / x));
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, -5.4e+36], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.22e-19], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / N[(N[(y * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{+36}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{elif}\;y \leq 1.22 \cdot 10^{-19}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{\frac{y \cdot y}{x}}\\
\end{array}
\end{array}
if y < -5.4000000000000002e36Initial program 100.0%
Taylor expanded in y around inf 97.2%
unpow297.2%
Simplified97.2%
if -5.4000000000000002e36 < y < 1.2200000000000001e-19Initial program 99.7%
sub-neg99.7%
distribute-frac-neg99.7%
*-lft-identity99.7%
associate-/r*96.7%
associate-*r/96.7%
metadata-eval96.7%
times-frac96.7%
neg-mul-196.7%
remove-double-neg96.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 z around inf 83.4%
if 1.2200000000000001e-19 < y Initial program 99.9%
associate-/l/98.5%
clear-num98.5%
inv-pow98.5%
div-inv98.5%
clear-num99.4%
Applied egg-rr99.4%
unpow-199.4%
Simplified99.4%
Taylor expanded in y around inf 94.4%
unpow294.4%
Simplified94.4%
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 (<= t -5.8e-78) (+ 1.0 (/ (/ x z) (- y t))) (if (<= t 3e-109) (- 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 <= -5.8e-78) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 3e-109) {
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 <= (-5.8d-78)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (t <= 3d-109) 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 <= -5.8e-78) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 3e-109) {
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 <= -5.8e-78: tmp = 1.0 + ((x / z) / (y - t)) elif t <= 3e-109: 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 <= -5.8e-78) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (t <= 3e-109) tmp = Float64(1.0 - Float64(x / Float64(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 <= -5.8e-78)
tmp = 1.0 + ((x / z) / (y - t));
elseif (t <= 3e-109)
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, -5.8e-78], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3e-109], N[(1.0 - N[(x / N[(y * N[(y - z), $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}\;t \leq -5.8 \cdot 10^{-78}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-109}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -5.8000000000000001e-78Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
*-lft-identity99.9%
associate-/r*98.7%
associate-*r/98.7%
metadata-eval98.7%
times-frac98.7%
neg-mul-198.7%
remove-double-neg98.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 82.6%
if -5.8000000000000001e-78 < t < 3.00000000000000021e-109Initial program 99.9%
Taylor expanded in t around 0 95.7%
if 3.00000000000000021e-109 < t Initial program 99.7%
*-commutative99.7%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in y around 0 98.4%
associate-*r/98.4%
neg-mul-198.4%
Simplified98.4%
Final simplification92.6%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -6.2e-149) 1.0 (if (<= y 7.2e-104) (- 1.0 (/ x (* z t))) 1.0)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.2e-149) {
tmp = 1.0;
} else if (y <= 7.2e-104) {
tmp = 1.0 - (x / (z * t));
} 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 <= (-6.2d-149)) then
tmp = 1.0d0
else if (y <= 7.2d-104) then
tmp = 1.0d0 - (x / (z * t))
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 <= -6.2e-149) {
tmp = 1.0;
} else if (y <= 7.2e-104) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -6.2e-149: tmp = 1.0 elif y <= 7.2e-104: tmp = 1.0 - (x / (z * t)) else: tmp = 1.0 return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -6.2e-149) tmp = 1.0; elseif (y <= 7.2e-104) tmp = Float64(1.0 - Float64(x / Float64(z * t))); 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 <= -6.2e-149)
tmp = 1.0;
elseif (y <= 7.2e-104)
tmp = 1.0 - (x / (z * t));
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, -6.2e-149], 1.0, If[LessEqual[y, 7.2e-104], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-149}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-104}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6.19999999999999974e-149 or 7.1999999999999996e-104 < y Initial program 100.0%
Taylor expanded in y around 0 54.3%
Taylor expanded in x around 0 86.5%
if -6.19999999999999974e-149 < y < 7.1999999999999996e-104Initial program 99.5%
Taylor expanded in y around 0 90.0%
Final simplification87.4%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -3.3e-146) 1.0 (if (<= y 2.8e-35) (- 1.0 (/ x (* z t))) (- 1.0 (/ x (* y y))))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.3e-146) {
tmp = 1.0;
} else if (y <= 2.8e-35) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0 - (x / (y * y));
}
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 <= (-3.3d-146)) then
tmp = 1.0d0
else if (y <= 2.8d-35) then
tmp = 1.0d0 - (x / (z * t))
else
tmp = 1.0d0 - (x / (y * y))
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 <= -3.3e-146) {
tmp = 1.0;
} else if (y <= 2.8e-35) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0 - (x / (y * y));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -3.3e-146: tmp = 1.0 elif y <= 2.8e-35: tmp = 1.0 - (x / (z * t)) else: tmp = 1.0 - (x / (y * y)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -3.3e-146) tmp = 1.0; elseif (y <= 2.8e-35) tmp = Float64(1.0 - Float64(x / Float64(z * t))); else tmp = Float64(1.0 - Float64(x / Float64(y * y))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -3.3e-146)
tmp = 1.0;
elseif (y <= 2.8e-35)
tmp = 1.0 - (x / (z * t));
else
tmp = 1.0 - (x / (y * y));
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, -3.3e-146], 1.0, If[LessEqual[y, 2.8e-35], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-146}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-35}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < -3.3e-146Initial program 100.0%
Taylor expanded in y around 0 56.7%
Taylor expanded in x around 0 87.0%
if -3.3e-146 < y < 2.8e-35Initial program 99.6%
Taylor expanded in y around 0 86.4%
if 2.8e-35 < y Initial program 99.9%
Taylor expanded in y around inf 94.3%
unpow294.3%
Simplified94.3%
Final simplification88.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 z) (- y t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
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 - z) * (y - t)))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / ((y - z) * (y - t)));
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 - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
Initial program 99.8%
Final simplification99.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 99.8%
Taylor expanded in y around 0 63.2%
Taylor expanded in x around 0 81.0%
Final simplification81.0%
herbie shell --seed 2023275
(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)))))