
(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 9 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 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.6%
associate-/l/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 (or (<= y -4e-133) (not (<= y 6e-69))) (- 1.0 (/ x (* y (- y z)))) (- 1.0 (/ (/ x t) z))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4e-133) || !(y <= 6e-69)) {
tmp = 1.0 - (x / (y * (y - z)));
} 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 <= (-4d-133)) .or. (.not. (y <= 6d-69))) then
tmp = 1.0d0 - (x / (y * (y - z)))
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 <= -4e-133) || !(y <= 6e-69)) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 - ((x / t) / z);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -4e-133) or not (y <= 6e-69): tmp = 1.0 - (x / (y * (y - z))) 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 <= -4e-133) || !(y <= 6e-69)) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); 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 <= -4e-133) || ~((y <= 6e-69)))
tmp = 1.0 - (x / (y * (y - z)));
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, -4e-133], N[Not[LessEqual[y, 6e-69]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $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 -4 \cdot 10^{-133} \lor \neg \left(y \leq 6 \cdot 10^{-69}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if y < -4.0000000000000003e-133 or 5.99999999999999978e-69 < y Initial program 100.0%
Taylor expanded in t around 0 89.7%
if -4.0000000000000003e-133 < y < 5.99999999999999978e-69Initial program 96.5%
Taylor expanded in y around 0 79.7%
associate-/r*80.7%
Simplified80.7%
Final simplification86.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.42e-29) (not (<= y 9e-34))) (- 1.0 (/ x (* y t))) (- 1.0 (/ x (* t z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.42e-29) || !(y <= 9e-34)) {
tmp = 1.0 - (x / (y * t));
} 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.42d-29)) .or. (.not. (y <= 9d-34))) then
tmp = 1.0d0 - (x / (y * t))
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.42e-29) || !(y <= 9e-34)) {
tmp = 1.0 - (x / (y * t));
} 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.42e-29) or not (y <= 9e-34): tmp = 1.0 - (x / (y * t)) 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.42e-29) || !(y <= 9e-34)) tmp = Float64(1.0 - Float64(x / Float64(y * t))); else tmp = Float64(1.0 - Float64(x / Float64(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.42e-29) || ~((y <= 9e-34)))
tmp = 1.0 - (x / (y * t));
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.42e-29], N[Not[LessEqual[y, 9e-34]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.42 \cdot 10^{-29} \lor \neg \left(y \leq 9 \cdot 10^{-34}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -1.4200000000000001e-29 or 9.00000000000000085e-34 < y Initial program 100.0%
Taylor expanded in z around 0 96.2%
associate-/l/96.2%
Simplified96.2%
Taylor expanded in y around 0 75.3%
associate-*r/75.3%
neg-mul-175.3%
Simplified75.3%
expm1-log1p-u73.4%
expm1-udef73.4%
add-sqr-sqrt42.6%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod30.8%
add-sqr-sqrt73.0%
*-commutative73.0%
Applied egg-rr73.0%
expm1-def73.0%
expm1-log1p73.5%
Simplified73.5%
if -1.4200000000000001e-29 < y < 9.00000000000000085e-34Initial program 97.3%
Taylor expanded in y around 0 76.0%
Final simplification74.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 -1.6e-40) (not (<= y 7.2e-15))) (- 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.6e-40) || !(y <= 7.2e-15)) {
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.6d-40)) .or. (.not. (y <= 7.2d-15))) 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.6e-40) || !(y <= 7.2e-15)) {
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.6e-40) or not (y <= 7.2e-15): 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.6e-40) || !(y <= 7.2e-15)) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(1.0 - Float64(x / Float64(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.6e-40) || ~((y <= 7.2e-15)))
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.6e-40], N[Not[LessEqual[y, 7.2e-15]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{-40} \lor \neg \left(y \leq 7.2 \cdot 10^{-15}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -1.60000000000000001e-40 or 7.2000000000000002e-15 < y Initial program 100.0%
Taylor expanded in y around inf 91.6%
unpow291.6%
Simplified91.6%
if -1.60000000000000001e-40 < y < 7.2000000000000002e-15Initial program 97.3%
Taylor expanded in y around 0 75.2%
Final simplification83.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 -9.6e-40) (not (<= y 3.4e-15))) (- 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 <= -9.6e-40) || !(y <= 3.4e-15)) {
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 <= (-9.6d-40)) .or. (.not. (y <= 3.4d-15))) 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 <= -9.6e-40) || !(y <= 3.4e-15)) {
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 <= -9.6e-40) or not (y <= 3.4e-15): 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 <= -9.6e-40) || !(y <= 3.4e-15)) 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 <= -9.6e-40) || ~((y <= 3.4e-15)))
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, -9.6e-40], N[Not[LessEqual[y, 3.4e-15]], $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 -9.6 \cdot 10^{-40} \lor \neg \left(y \leq 3.4 \cdot 10^{-15}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if y < -9.59999999999999965e-40 or 3.4e-15 < y Initial program 100.0%
Taylor expanded in y around inf 91.6%
unpow291.6%
Simplified91.6%
if -9.59999999999999965e-40 < y < 3.4e-15Initial program 97.3%
Taylor expanded in y around 0 75.2%
associate-/r*76.0%
Simplified76.0%
Final simplification83.6%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -1.8e-40) (- 1.0 (/ (/ x y) y)) (if (<= y 9.5e-13) (- 1.0 (/ (/ x t) z)) (- 1.0 (/ x (* y y))))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.8e-40) {
tmp = 1.0 - ((x / y) / y);
} else if (y <= 9.5e-13) {
tmp = 1.0 - ((x / t) / z);
} 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 <= (-1.8d-40)) then
tmp = 1.0d0 - ((x / y) / y)
else if (y <= 9.5d-13) then
tmp = 1.0d0 - ((x / t) / z)
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 <= -1.8e-40) {
tmp = 1.0 - ((x / y) / y);
} else if (y <= 9.5e-13) {
tmp = 1.0 - ((x / t) / z);
} else {
tmp = 1.0 - (x / (y * y));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -1.8e-40: tmp = 1.0 - ((x / y) / y) elif y <= 9.5e-13: tmp = 1.0 - ((x / t) / z) 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 <= -1.8e-40) tmp = Float64(1.0 - Float64(Float64(x / y) / y)); elseif (y <= 9.5e-13) tmp = Float64(1.0 - Float64(Float64(x / t) / z)); 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 <= -1.8e-40)
tmp = 1.0 - ((x / y) / y);
elseif (y <= 9.5e-13)
tmp = 1.0 - ((x / t) / z);
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, -1.8e-40], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e-13], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $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 -1.8 \cdot 10^{-40}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-13}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < -1.8e-40Initial program 100.0%
Taylor expanded in y around inf 92.4%
unpow292.4%
associate-/r*92.5%
Simplified92.5%
if -1.8e-40 < y < 9.49999999999999991e-13Initial program 97.3%
Taylor expanded in y around 0 75.2%
associate-/r*76.0%
Simplified76.0%
if 9.49999999999999991e-13 < y Initial program 100.0%
Taylor expanded in y around inf 90.8%
unpow290.8%
Simplified90.8%
Final simplification83.6%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 2.3e-112) (- 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 <= 2.3e-112) {
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 <= 2.3d-112) 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 <= 2.3e-112) {
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 <= 2.3e-112: 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 <= 2.3e-112) 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 <= 2.3e-112)
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, 2.3e-112], 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 2.3 \cdot 10^{-112}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < 2.29999999999999991e-112Initial program 97.9%
Taylor expanded in t around 0 71.8%
if 2.29999999999999991e-112 < t Initial program 100.0%
Taylor expanded in t around inf 98.3%
mul-1-neg98.3%
distribute-frac-neg98.3%
associate-/r*98.3%
Simplified98.3%
Final simplification80.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 (* (- 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.6%
Final simplification98.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 (* y t))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / (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 * t))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / (y * t));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - (x / (y * t))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(y * t))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / (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[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{x}{y \cdot t}
\end{array}
Initial program 98.6%
Taylor expanded in z around 0 71.2%
associate-/l/72.2%
Simplified72.2%
Taylor expanded in y around 0 58.5%
associate-*r/58.5%
neg-mul-158.5%
Simplified58.5%
expm1-log1p-u54.2%
expm1-udef54.2%
add-sqr-sqrt27.7%
sqrt-unprod53.8%
sqr-neg53.8%
sqrt-unprod28.3%
add-sqr-sqrt54.7%
*-commutative54.7%
Applied egg-rr54.7%
expm1-def54.7%
expm1-log1p56.6%
Simplified56.6%
Final simplification56.6%
herbie shell --seed 2023228
(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)))))