
(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 (- 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(Float64(x / 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[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{\frac{x}{y - z}}{y - t}
\end{array}
Initial program 98.1%
associate-/r*98.1%
Simplified98.1%
Final simplification98.1%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z -8.8e+15)
(- 1.0 (/ x (* z (- t y))))
(if (<= z -1.8e-168)
(- 1.0 (/ x (* y (- y z))))
(if (<= z 1.2e-244)
(- 1.0 (/ x (* y (- y t))))
(- 1.0 (/ x (* t (- z y))))))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.8e+15) {
tmp = 1.0 - (x / (z * (t - y)));
} else if (z <= -1.8e-168) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (z <= 1.2e-244) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - (x / (t * (z - 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 <= (-8.8d+15)) then
tmp = 1.0d0 - (x / (z * (t - y)))
else if (z <= (-1.8d-168)) then
tmp = 1.0d0 - (x / (y * (y - z)))
else if (z <= 1.2d-244) then
tmp = 1.0d0 - (x / (y * (y - t)))
else
tmp = 1.0d0 - (x / (t * (z - 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 <= -8.8e+15) {
tmp = 1.0 - (x / (z * (t - y)));
} else if (z <= -1.8e-168) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (z <= 1.2e-244) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -8.8e+15: tmp = 1.0 - (x / (z * (t - y))) elif z <= -1.8e-168: tmp = 1.0 - (x / (y * (y - z))) elif z <= 1.2e-244: tmp = 1.0 - (x / (y * (y - t))) else: tmp = 1.0 - (x / (t * (z - y))) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -8.8e+15) tmp = Float64(1.0 - Float64(x / Float64(z * Float64(t - y)))); elseif (z <= -1.8e-168) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); elseif (z <= 1.2e-244) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); else tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); 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+15)
tmp = 1.0 - (x / (z * (t - y)));
elseif (z <= -1.8e-168)
tmp = 1.0 - (x / (y * (y - z)));
elseif (z <= 1.2e-244)
tmp = 1.0 - (x / (y * (y - t)));
else
tmp = 1.0 - (x / (t * (z - 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[z, -8.8e+15], N[(1.0 - N[(x / N[(z * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.8e-168], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-244], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{+15}:\\
\;\;\;\;1 - \frac{x}{z \cdot \left(t - y\right)}\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-168}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-244}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if z < -8.8e15Initial program 100.0%
Taylor expanded in z around inf 98.4%
associate-*r*98.4%
mul-1-neg98.4%
Simplified98.4%
if -8.8e15 < z < -1.7999999999999999e-168Initial program 99.9%
Taylor expanded in t around 0 81.0%
if -1.7999999999999999e-168 < z < 1.20000000000000008e-244Initial program 90.8%
Taylor expanded in z around 0 86.0%
if 1.20000000000000008e-244 < z Initial program 99.2%
Taylor expanded in t around inf 86.6%
associate-*r*86.6%
mul-1-neg86.6%
Simplified86.6%
clear-num86.6%
div-inv86.6%
clear-num86.6%
distribute-lft-neg-out86.6%
distribute-rgt-neg-in86.6%
associate-/r*86.7%
sub-neg86.7%
+-commutative86.7%
distribute-neg-in86.7%
remove-double-neg86.7%
Applied egg-rr86.7%
*-lft-identity86.7%
associate-/l/86.6%
unsub-neg86.6%
Simplified86.6%
Final simplification88.0%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -3.2e-129) (not (<= y 4.5e-104))) (- 1.0 (/ x (* y (- y t)))) (- 1.0 (/ (/ x z) t))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.2e-129) || !(y <= 4.5e-104)) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - ((x / z) / 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 <= (-3.2d-129)) .or. (.not. (y <= 4.5d-104))) then
tmp = 1.0d0 - (x / (y * (y - t)))
else
tmp = 1.0d0 - ((x / z) / 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 <= -3.2e-129) || !(y <= 4.5e-104)) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - ((x / z) / t);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -3.2e-129) or not (y <= 4.5e-104): tmp = 1.0 - (x / (y * (y - t))) else: tmp = 1.0 - ((x / z) / t) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -3.2e-129) || !(y <= 4.5e-104)) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); else tmp = Float64(1.0 - Float64(Float64(x / z) / t)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -3.2e-129) || ~((y <= 4.5e-104)))
tmp = 1.0 - (x / (y * (y - t)));
else
tmp = 1.0 - ((x / z) / 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, -3.2e-129], N[Not[LessEqual[y, 4.5e-104]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-129} \lor \neg \left(y \leq 4.5 \cdot 10^{-104}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\
\end{array}
\end{array}
if y < -3.2000000000000003e-129 or 4.4999999999999997e-104 < y Initial program 100.0%
Taylor expanded in z around 0 94.2%
if -3.2000000000000003e-129 < y < 4.4999999999999997e-104Initial program 94.1%
Taylor expanded in t around inf 83.2%
associate-*r*83.2%
mul-1-neg83.2%
Simplified83.2%
clear-num83.2%
div-inv83.2%
clear-num83.2%
distribute-lft-neg-out83.2%
distribute-rgt-neg-in83.2%
associate-/r*85.6%
sub-neg85.6%
+-commutative85.6%
distribute-neg-in85.6%
remove-double-neg85.6%
Applied egg-rr85.6%
*-lft-identity85.6%
associate-/l/83.2%
unsub-neg83.2%
Simplified83.2%
Taylor expanded in z around inf 82.0%
associate-/l/80.8%
Simplified80.8%
Final simplification89.9%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= t -5.2e-127) (not (<= t 9e-27))) (- 1.0 (/ x (* t (- z y)))) (- 1.0 (/ x (* y (- y z))))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-127) || !(t <= 9e-27)) {
tmp = 1.0 - (x / (t * (z - y)));
} else {
tmp = 1.0 - (x / (y * (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.2d-127)) .or. (.not. (t <= 9d-27))) then
tmp = 1.0d0 - (x / (t * (z - y)))
else
tmp = 1.0d0 - (x / (y * (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.2e-127) || !(t <= 9e-27)) {
tmp = 1.0 - (x / (t * (z - y)));
} else {
tmp = 1.0 - (x / (y * (y - z)));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (t <= -5.2e-127) or not (t <= 9e-27): tmp = 1.0 - (x / (t * (z - y))) else: tmp = 1.0 - (x / (y * (y - z))) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((t <= -5.2e-127) || !(t <= 9e-27)) tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); else tmp = Float64(1.0 - Float64(x / Float64(y * 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.2e-127) || ~((t <= 9e-27)))
tmp = 1.0 - (x / (t * (z - y)));
else
tmp = 1.0 - (x / (y * (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[t, -5.2e-127], N[Not[LessEqual[t, 9e-27]], $MachinePrecision]], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-127} \lor \neg \left(t \leq 9 \cdot 10^{-27}\right):\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if t < -5.19999999999999982e-127 or 9.0000000000000003e-27 < t Initial program 100.0%
Taylor expanded in t around inf 95.7%
associate-*r*95.7%
mul-1-neg95.7%
Simplified95.7%
clear-num95.6%
div-inv95.6%
clear-num95.7%
distribute-lft-neg-out95.7%
distribute-rgt-neg-in95.7%
associate-/r*95.0%
sub-neg95.0%
+-commutative95.0%
distribute-neg-in95.0%
remove-double-neg95.0%
Applied egg-rr95.0%
*-lft-identity95.0%
associate-/l/95.7%
unsub-neg95.7%
Simplified95.7%
if -5.19999999999999982e-127 < t < 9.0000000000000003e-27Initial program 95.2%
Taylor expanded in t around 0 85.6%
Final simplification91.8%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -3e-43) (not (<= y 1e-98))) (- 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 <= -3e-43) || !(y <= 1e-98)) {
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 <= (-3d-43)) .or. (.not. (y <= 1d-98))) 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 <= -3e-43) || !(y <= 1e-98)) {
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 <= -3e-43) or not (y <= 1e-98): 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 <= -3e-43) || !(y <= 1e-98)) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); else tmp = Float64(1.0 - Float64(Float64(x / Float64(t - 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 <= -3e-43) || ~((y <= 1e-98)))
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, -3e-43], N[Not[LessEqual[y, 1e-98]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / N[(t - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{-43} \lor \neg \left(y \leq 10^{-98}\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.00000000000000003e-43 or 9.99999999999999939e-99 < y Initial program 100.0%
Taylor expanded in z around 0 95.7%
if -3.00000000000000003e-43 < y < 9.99999999999999939e-99Initial program 95.1%
associate-/r*96.0%
Simplified96.0%
Taylor expanded in y around 0 89.2%
mul-1-neg89.2%
Simplified89.2%
distribute-frac-neg89.2%
neg-sub089.2%
sub-neg89.2%
frac-2neg89.2%
associate-/l/89.2%
distribute-neg-frac89.2%
remove-double-neg89.2%
neg-mul-189.2%
metadata-eval89.2%
associate-*r*89.2%
*-commutative89.2%
metadata-eval89.2%
neg-mul-189.2%
neg-sub089.2%
sub-neg89.2%
+-commutative89.2%
associate--r+89.2%
neg-sub089.2%
remove-double-neg89.2%
Applied egg-rr89.2%
+-lft-identity89.2%
associate-/r*87.4%
Simplified87.4%
Final simplification92.5%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -2.95e-44) (not (<= y 7.8e-97))) (- 1.0 (/ x (* y (- y t)))) (+ 1.0 (/ (/ x z) (- y t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.95e-44) || !(y <= 7.8e-97)) {
tmp = 1.0 - (x / (y * (y - t)));
} 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 <= (-2.95d-44)) .or. (.not. (y <= 7.8d-97))) then
tmp = 1.0d0 - (x / (y * (y - t)))
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 <= -2.95e-44) || !(y <= 7.8e-97)) {
tmp = 1.0 - (x / (y * (y - t)));
} 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 <= -2.95e-44) or not (y <= 7.8e-97): tmp = 1.0 - (x / (y * (y - t))) 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 <= -2.95e-44) || !(y <= 7.8e-97)) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); 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 <= -2.95e-44) || ~((y <= 7.8e-97)))
tmp = 1.0 - (x / (y * (y - t)));
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, -2.95e-44], N[Not[LessEqual[y, 7.8e-97]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $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 -2.95 \cdot 10^{-44} \lor \neg \left(y \leq 7.8 \cdot 10^{-97}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\end{array}
\end{array}
if y < -2.95000000000000018e-44 or 7.7999999999999997e-97 < y Initial program 100.0%
Taylor expanded in z around 0 95.7%
if -2.95000000000000018e-44 < y < 7.7999999999999997e-97Initial program 95.1%
associate-/r*96.0%
Simplified96.0%
Taylor expanded in y around 0 89.2%
mul-1-neg89.2%
Simplified89.2%
Final simplification93.2%
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.9e-9) (not (<= y 90.0))) (- 1.0 (/ x (* y y))) (- 1.0 (/ x (* z t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.9e-9) || !(y <= 90.0)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - (x / (z * 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.9d-9)) .or. (.not. (y <= 90.0d0))) then
tmp = 1.0d0 - (x / (y * y))
else
tmp = 1.0d0 - (x / (z * 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.9e-9) || !(y <= 90.0)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -1.9e-9) or not (y <= 90.0): tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 - (x / (z * t)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -1.9e-9) || !(y <= 90.0)) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(1.0 - Float64(x / Float64(z * 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.9e-9) || ~((y <= 90.0)))
tmp = 1.0 - (x / (y * y));
else
tmp = 1.0 - (x / (z * 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.9e-9], N[Not[LessEqual[y, 90.0]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-9} \lor \neg \left(y \leq 90\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -1.90000000000000006e-9 or 90 < y Initial program 100.0%
clear-num100.0%
inv-pow100.0%
metadata-eval100.0%
sqr-pow87.6%
div-inv87.6%
associate-*l*79.8%
div-inv79.8%
metadata-eval79.8%
metadata-eval79.8%
div-inv79.8%
associate-*l*79.8%
div-inv79.8%
metadata-eval79.8%
metadata-eval79.8%
Applied egg-rr79.8%
pow-sqr100.0%
metadata-eval100.0%
unpow-1100.0%
Simplified100.0%
Taylor expanded in y around inf 94.4%
unpow294.4%
Simplified94.4%
if -1.90000000000000006e-9 < y < 90Initial program 96.2%
Taylor expanded in y around 0 76.4%
Final simplification85.5%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -3.4e-9) (+ 1.0 (/ -1.0 (/ (* y y) x))) (if (<= y 23500.0) (- 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.4e-9) {
tmp = 1.0 + (-1.0 / ((y * y) / x));
} else if (y <= 23500.0) {
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.4d-9)) then
tmp = 1.0d0 + ((-1.0d0) / ((y * y) / x))
else if (y <= 23500.0d0) 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.4e-9) {
tmp = 1.0 + (-1.0 / ((y * y) / x));
} else if (y <= 23500.0) {
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.4e-9: tmp = 1.0 + (-1.0 / ((y * y) / x)) elif y <= 23500.0: 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.4e-9) tmp = Float64(1.0 + Float64(-1.0 / Float64(Float64(y * y) / x))); elseif (y <= 23500.0) 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.4e-9)
tmp = 1.0 + (-1.0 / ((y * y) / x));
elseif (y <= 23500.0)
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.4e-9], N[(1.0 + N[(-1.0 / N[(N[(y * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 23500.0], 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.4 \cdot 10^{-9}:\\
\;\;\;\;1 + \frac{-1}{\frac{y \cdot y}{x}}\\
\mathbf{elif}\;y \leq 23500:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < -3.3999999999999998e-9Initial program 100.0%
clear-num100.0%
inv-pow100.0%
metadata-eval100.0%
sqr-pow85.3%
div-inv85.3%
associate-*l*76.5%
div-inv76.5%
metadata-eval76.5%
metadata-eval76.5%
div-inv76.5%
associate-*l*76.5%
div-inv76.5%
metadata-eval76.5%
metadata-eval76.5%
Applied egg-rr76.5%
pow-sqr100.0%
metadata-eval100.0%
unpow-1100.0%
Simplified100.0%
Taylor expanded in y around inf 93.8%
unpow293.8%
Simplified93.8%
if -3.3999999999999998e-9 < y < 23500Initial program 96.2%
Taylor expanded in y around 0 76.4%
if 23500 < y Initial program 100.0%
clear-num100.0%
inv-pow100.0%
metadata-eval100.0%
sqr-pow90.1%
div-inv90.1%
associate-*l*83.6%
div-inv83.6%
metadata-eval83.6%
metadata-eval83.6%
div-inv83.6%
associate-*l*83.6%
div-inv83.6%
metadata-eval83.6%
metadata-eval83.6%
Applied egg-rr83.6%
pow-sqr100.0%
metadata-eval100.0%
unpow-1100.0%
Simplified100.0%
Taylor expanded in y around inf 95.2%
unpow295.2%
Simplified95.2%
Final simplification85.5%
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.1%
Final simplification98.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 (* z t))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / (z * 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 / (z * t))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / (z * t));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - (x / (z * t))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(z * t))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / (z * 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[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{x}{z \cdot t}
\end{array}
Initial program 98.1%
Taylor expanded in y around 0 65.3%
Final simplification65.3%
herbie shell --seed 2023297
(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)))))