
(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 (- z y)) (- y t))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (z - y)) / (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 / (z - y)) / (y - t))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + ((x / (z - y)) / (y - t));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 + ((x / (z - y)) / (y - t))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(x / Float64(z - y)) / Float64(y - t))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((x / (z - y)) / (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[(z - y), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 + \frac{\frac{x}{z - y}}{y - t}
\end{array}
Initial program 98.5%
sub-neg98.5%
distribute-frac-neg98.5%
*-lft-identity98.5%
associate-/r*99.2%
associate-*r/99.2%
metadata-eval99.2%
times-frac99.2%
neg-mul-199.2%
remove-double-neg99.2%
neg-mul-199.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-out99.2%
remove-double-neg99.2%
sub-neg99.2%
Simplified99.2%
Final simplification99.2%
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 t)))))
(if (<= y -5.2e+31)
t_1
(if (<= y 2.55e-17)
(- 1.0 (/ x (* z t)))
(if (or (<= y 7.6e+56) (not (<= y 2.4e+192)))
(+ 1.0 (/ x (* z y)))
t_1)))))assert(z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / (y * t));
double tmp;
if (y <= -5.2e+31) {
tmp = t_1;
} else if (y <= 2.55e-17) {
tmp = 1.0 - (x / (z * t));
} else if ((y <= 7.6e+56) || !(y <= 2.4e+192)) {
tmp = 1.0 + (x / (z * y));
} else {
tmp = t_1;
}
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 * t))
if (y <= (-5.2d+31)) then
tmp = t_1
else if (y <= 2.55d-17) then
tmp = 1.0d0 - (x / (z * t))
else if ((y <= 7.6d+56) .or. (.not. (y <= 2.4d+192))) then
tmp = 1.0d0 + (x / (z * y))
else
tmp = t_1
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 * t));
double tmp;
if (y <= -5.2e+31) {
tmp = t_1;
} else if (y <= 2.55e-17) {
tmp = 1.0 - (x / (z * t));
} else if ((y <= 7.6e+56) || !(y <= 2.4e+192)) {
tmp = 1.0 + (x / (z * y));
} else {
tmp = t_1;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): t_1 = 1.0 - (x / (y * t)) tmp = 0 if y <= -5.2e+31: tmp = t_1 elif y <= 2.55e-17: tmp = 1.0 - (x / (z * t)) elif (y <= 7.6e+56) or not (y <= 2.4e+192): tmp = 1.0 + (x / (z * y)) else: tmp = t_1 return tmp
z, t = sort([z, t]) function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(y * t))) tmp = 0.0 if (y <= -5.2e+31) tmp = t_1; elseif (y <= 2.55e-17) tmp = Float64(1.0 - Float64(x / Float64(z * t))); elseif ((y <= 7.6e+56) || !(y <= 2.4e+192)) tmp = Float64(1.0 + Float64(x / Float64(z * y))); else tmp = t_1; end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 1.0 - (x / (y * t));
tmp = 0.0;
if (y <= -5.2e+31)
tmp = t_1;
elseif (y <= 2.55e-17)
tmp = 1.0 - (x / (z * t));
elseif ((y <= 7.6e+56) || ~((y <= 2.4e+192)))
tmp = 1.0 + (x / (z * y));
else
tmp = t_1;
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[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.2e+31], t$95$1, If[LessEqual[y, 2.55e-17], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 7.6e+56], N[Not[LessEqual[y, 2.4e+192]], $MachinePrecision]], N[(1.0 + N[(x / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := 1 - \frac{x}{y \cdot t}\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+31}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{-17}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{+56} \lor \neg \left(y \leq 2.4 \cdot 10^{+192}\right):\\
\;\;\;\;1 + \frac{x}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -5.2e31 or 7.59999999999999991e56 < y < 2.3999999999999998e192Initial program 100.0%
Taylor expanded in z around 0 96.7%
Taylor expanded in y around 0 66.4%
associate-*r/66.4%
neg-mul-166.4%
Simplified66.4%
associate-/l/66.4%
expm1-log1p-u65.5%
expm1-udef65.5%
associate-/l/65.5%
add-sqr-sqrt41.4%
sqrt-unprod56.8%
sqr-neg56.8%
sqrt-unprod24.3%
add-sqr-sqrt65.8%
associate-/r*65.8%
Applied egg-rr65.8%
expm1-def65.8%
expm1-log1p66.6%
associate-/r*66.7%
Simplified66.7%
if -5.2e31 < y < 2.5500000000000001e-17Initial program 97.2%
Taylor expanded in y around 0 73.4%
if 2.5500000000000001e-17 < y < 7.59999999999999991e56 or 2.3999999999999998e192 < y Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
*-lft-identity100.0%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 79.0%
Taylor expanded in y around inf 70.5%
Final simplification70.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 -370000000.0) (not (<= y 2.75e-17))) (- 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 <= -370000000.0) || !(y <= 2.75e-17)) {
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 <= (-370000000.0d0)) .or. (.not. (y <= 2.75d-17))) 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 <= -370000000.0) || !(y <= 2.75e-17)) {
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 <= -370000000.0) or not (y <= 2.75e-17): 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 <= -370000000.0) || !(y <= 2.75e-17)) 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 <= -370000000.0) || ~((y <= 2.75e-17)))
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, -370000000.0], N[Not[LessEqual[y, 2.75e-17]], $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 -370000000 \lor \neg \left(y \leq 2.75 \cdot 10^{-17}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\end{array}
\end{array}
if y < -3.7e8 or 2.75e-17 < y Initial program 99.9%
Taylor expanded in y around inf 93.1%
unpow293.1%
Simplified93.1%
if -3.7e8 < y < 2.75e-17Initial program 97.1%
sub-neg97.1%
distribute-frac-neg97.1%
*-lft-identity97.1%
associate-/r*98.5%
associate-*r/98.5%
metadata-eval98.5%
times-frac98.5%
neg-mul-198.5%
remove-double-neg98.5%
neg-mul-198.5%
sub-neg98.5%
+-commutative98.5%
distribute-neg-out98.5%
remove-double-neg98.5%
sub-neg98.5%
Simplified98.5%
Taylor expanded in z around inf 81.8%
Final simplification87.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.18e-145) (not (<= y 1.6e-17))) (- 1.0 (/ x (* y (- y z)))) (+ 1.0 (/ (/ x z) (- y t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.18e-145) || !(y <= 1.6e-17)) {
tmp = 1.0 - (x / (y * (y - z)));
} 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.18d-145)) .or. (.not. (y <= 1.6d-17))) then
tmp = 1.0d0 - (x / (y * (y - z)))
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.18e-145) || !(y <= 1.6e-17)) {
tmp = 1.0 - (x / (y * (y - z)));
} 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.18e-145) or not (y <= 1.6e-17): tmp = 1.0 - (x / (y * (y - z))) 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.18e-145) || !(y <= 1.6e-17)) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); 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.18e-145) || ~((y <= 1.6e-17)))
tmp = 1.0 - (x / (y * (y - z)));
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.18e-145], N[Not[LessEqual[y, 1.6e-17]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - z), $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 -1.18 \cdot 10^{-145} \lor \neg \left(y \leq 1.6 \cdot 10^{-17}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\end{array}
\end{array}
if y < -1.18000000000000006e-145 or 1.6000000000000001e-17 < y Initial program 100.0%
Taylor expanded in t around 0 93.3%
if -1.18000000000000006e-145 < y < 1.6000000000000001e-17Initial program 96.3%
sub-neg96.3%
distribute-frac-neg96.3%
*-lft-identity96.3%
associate-/r*98.0%
associate-*r/98.0%
metadata-eval98.0%
times-frac98.0%
neg-mul-198.0%
remove-double-neg98.0%
neg-mul-198.0%
sub-neg98.0%
+-commutative98.0%
distribute-neg-out98.0%
remove-double-neg98.0%
sub-neg98.0%
Simplified98.0%
Taylor expanded in z around inf 81.9%
Final simplification88.7%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -2.6e-108) (+ 1.0 (/ (/ x z) (- y t))) (if (<= z 1.45e-61) (- 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 (z <= -2.6e-108) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.45e-61) {
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 (z <= (-2.6d-108)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 1.45d-61) 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 (z <= -2.6e-108) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.45e-61) {
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 z <= -2.6e-108: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 1.45e-61: 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 (z <= -2.6e-108) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 1.45e-61) 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 (z <= -2.6e-108)
tmp = 1.0 + ((x / z) / (y - t));
elseif (z <= 1.45e-61)
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[LessEqual[z, -2.6e-108], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e-61], 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}\;z \leq -2.6 \cdot 10^{-108}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-61}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\
\end{array}
\end{array}
if z < -2.59999999999999984e-108Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
*-lft-identity100.0%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 89.5%
if -2.59999999999999984e-108 < z < 1.45e-61Initial program 96.2%
Taylor expanded in z around 0 82.2%
if 1.45e-61 < z Initial program 99.9%
*-commutative99.9%
associate-/r*97.6%
Simplified97.6%
Taylor expanded in y around 0 79.5%
associate-*r/79.5%
neg-mul-179.5%
Simplified79.5%
associate-/l/81.8%
neg-mul-181.8%
times-frac79.5%
Applied egg-rr79.5%
Taylor expanded in y around 0 79.4%
associate-/l/79.4%
Simplified79.4%
Final simplification83.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 -9e-44) (not (<= y 1.15e-48))) (- 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 <= -9e-44) || !(y <= 1.15e-48)) {
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 <= (-9d-44)) .or. (.not. (y <= 1.15d-48))) 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 <= -9e-44) || !(y <= 1.15e-48)) {
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 <= -9e-44) or not (y <= 1.15e-48): 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 <= -9e-44) || !(y <= 1.15e-48)) 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 <= -9e-44) || ~((y <= 1.15e-48)))
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, -9e-44], N[Not[LessEqual[y, 1.15e-48]], $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 -9 \cdot 10^{-44} \lor \neg \left(y \leq 1.15 \cdot 10^{-48}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -8.9999999999999997e-44 or 1.15e-48 < y Initial program 100.0%
Taylor expanded in y around inf 89.9%
unpow289.9%
Simplified89.9%
if -8.9999999999999997e-44 < y < 1.15e-48Initial program 96.7%
Taylor expanded in y around 0 77.2%
Final simplification84.1%
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.95e-43) (not (<= y 6e-49))) (- 1.0 (/ x (* y y))) (- 1.0 (/ (/ x t) z))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.95e-43) || !(y <= 6e-49)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - ((x / t) / 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 <= (-1.95d-43)) .or. (.not. (y <= 6d-49))) then
tmp = 1.0d0 - (x / (y * y))
else
tmp = 1.0d0 - ((x / t) / 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 <= -1.95e-43) || !(y <= 6e-49)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - ((x / t) / z);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -1.95e-43) or not (y <= 6e-49): tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 - ((x / t) / z) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -1.95e-43) || !(y <= 6e-49)) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(1.0 - Float64(Float64(x / t) / z)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -1.95e-43) || ~((y <= 6e-49)))
tmp = 1.0 - (x / (y * y));
else
tmp = 1.0 - ((x / t) / 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, -1.95e-43], N[Not[LessEqual[y, 6e-49]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-43} \lor \neg \left(y \leq 6 \cdot 10^{-49}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if y < -1.95e-43 or 6e-49 < y Initial program 100.0%
Taylor expanded in y around inf 89.9%
unpow289.9%
Simplified89.9%
if -1.95e-43 < y < 6e-49Initial program 96.7%
Taylor expanded in y around 0 77.2%
associate-/r*76.5%
Simplified76.5%
Final simplification83.8%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 4.3e-169) (- 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 <= 4.3e-169) {
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 <= 4.3d-169) 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 <= 4.3e-169) {
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 <= 4.3e-169: 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 <= 4.3e-169) 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 <= 4.3e-169)
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, 4.3e-169], 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 4.3 \cdot 10^{-169}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < 4.29999999999999984e-169Initial program 98.7%
Taylor expanded in t around 0 71.3%
if 4.29999999999999984e-169 < t Initial program 98.1%
*-commutative98.1%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in y around 0 91.7%
associate-*r/91.7%
neg-mul-191.7%
Simplified91.7%
Final simplification79.5%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -1.7e-84) (+ 1.0 (/ x (* z y))) (- 1.0 (/ x (* y t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e-84) {
tmp = 1.0 + (x / (z * y));
} else {
tmp = 1.0 - (x / (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 <= (-1.7d-84)) then
tmp = 1.0d0 + (x / (z * y))
else
tmp = 1.0d0 - (x / (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 <= -1.7e-84) {
tmp = 1.0 + (x / (z * y));
} else {
tmp = 1.0 - (x / (y * t));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -1.7e-84: tmp = 1.0 + (x / (z * y)) else: tmp = 1.0 - (x / (y * t)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1.7e-84) tmp = Float64(1.0 + Float64(x / Float64(z * y))); else tmp = Float64(1.0 - Float64(x / 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 <= -1.7e-84)
tmp = 1.0 + (x / (z * y));
else
tmp = 1.0 - (x / (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[LessEqual[z, -1.7e-84], N[(1.0 + N[(x / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-84}:\\
\;\;\;\;1 + \frac{x}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot t}\\
\end{array}
\end{array}
if z < -1.7000000000000001e-84Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
*-lft-identity100.0%
associate-/r*100.0%
associate-*r/100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
remove-double-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 91.0%
Taylor expanded in y around inf 78.9%
if -1.7000000000000001e-84 < z Initial program 97.9%
Taylor expanded in z around 0 72.6%
Taylor expanded in y around 0 55.0%
associate-*r/55.0%
neg-mul-155.0%
Simplified55.0%
associate-/l/55.0%
expm1-log1p-u47.8%
expm1-udef47.7%
associate-/l/47.7%
add-sqr-sqrt24.3%
sqrt-unprod46.4%
sqr-neg46.4%
sqrt-unprod23.4%
add-sqr-sqrt43.9%
associate-/r*43.9%
Applied egg-rr43.9%
expm1-def43.9%
expm1-log1p46.0%
associate-/r*46.0%
Simplified46.0%
Final simplification54.6%
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 y))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (x / (z * y));
}
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 * y))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (x / (z * y));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 + (x / (z * y))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(x / Float64(z * y))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (x / (z * y));
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 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 + \frac{x}{z \cdot y}
\end{array}
Initial program 98.5%
sub-neg98.5%
distribute-frac-neg98.5%
*-lft-identity98.5%
associate-/r*99.2%
associate-*r/99.2%
metadata-eval99.2%
times-frac99.2%
neg-mul-199.2%
remove-double-neg99.2%
neg-mul-199.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-out99.2%
remove-double-neg99.2%
sub-neg99.2%
Simplified99.2%
Taylor expanded in z around inf 76.3%
Taylor expanded in y around inf 49.6%
Final simplification49.6%
herbie shell --seed 2023271
(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)))))