
(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}
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- z y) (- t y)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((z - y) * (t - y)));
}
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) * (t - y)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((z - y) * (t - y)));
}
def code(x, y, z, t): return 1.0 - (x / ((z - y) * (t - y)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(z - y) * Float64(t - y)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((z - y) * (t - y))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(z - y), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(z - y\right) \cdot \left(t - y\right)}
\end{array}
Initial program 99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.25e+34) (not (<= y 2.6e+88))) (- 1.0 (/ x (* y y))) (+ 1.0 (/ x (* z (- y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.25e+34) || !(y <= 2.6e+88)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 + (x / (z * (y - t)));
}
return tmp;
}
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.25d+34)) .or. (.not. (y <= 2.6d+88))) then
tmp = 1.0d0 - (x / (y * y))
else
tmp = 1.0d0 + (x / (z * (y - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.25e+34) || !(y <= 2.6e+88)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 + (x / (z * (y - t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.25e+34) or not (y <= 2.6e+88): tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 + (x / (z * (y - t))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.25e+34) || !(y <= 2.6e+88)) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.25e+34) || ~((y <= 2.6e+88))) tmp = 1.0 - (x / (y * y)); else tmp = 1.0 + (x / (z * (y - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.25e+34], N[Not[LessEqual[y, 2.6e+88]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+34} \lor \neg \left(y \leq 2.6 \cdot 10^{+88}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if y < -1.25e34 or 2.6000000000000001e88 < y Initial program 100.0%
Taylor expanded in y around inf 99.2%
unpow299.2%
Simplified99.2%
if -1.25e34 < y < 2.6000000000000001e88Initial program 98.6%
sub-neg98.6%
distribute-frac-neg98.6%
*-lft-identity98.6%
associate-/r*98.6%
associate-*r/98.6%
metadata-eval98.6%
times-frac98.6%
neg-mul-198.6%
remove-double-neg98.6%
neg-mul-198.6%
sub-neg98.6%
+-commutative98.6%
distribute-neg-out98.6%
remove-double-neg98.6%
sub-neg98.6%
Simplified98.6%
Taylor expanded in z around inf 82.9%
*-commutative82.9%
Simplified82.9%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.25e-72) (not (<= z 1.05e-109))) (+ 1.0 (/ x (* z (- y t)))) (- 1.0 (/ x (* y (- y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.25e-72) || !(z <= 1.05e-109)) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
return tmp;
}
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.25d-72)) .or. (.not. (z <= 1.05d-109))) then
tmp = 1.0d0 + (x / (z * (y - t)))
else
tmp = 1.0d0 - (x / (y * (y - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.25e-72) || !(z <= 1.05e-109)) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.25e-72) or not (z <= 1.05e-109): tmp = 1.0 + (x / (z * (y - t))) else: tmp = 1.0 - (x / (y * (y - t))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.25e-72) || !(z <= 1.05e-109)) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); else tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.25e-72) || ~((z <= 1.05e-109))) tmp = 1.0 + (x / (z * (y - t))); else tmp = 1.0 - (x / (y * (y - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.25e-72], N[Not[LessEqual[z, 1.05e-109]], $MachinePrecision]], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{-72} \lor \neg \left(z \leq 1.05 \cdot 10^{-109}\right):\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if z < -2.25e-72 or 1.04999999999999998e-109 < z Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
*-lft-identity100.0%
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.5%
*-commutative94.5%
Simplified94.5%
if -2.25e-72 < z < 1.04999999999999998e-109Initial program 97.4%
Taylor expanded in z around 0 91.9%
Final simplification93.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e-72) (not (<= z 1.05e-109))) (+ 1.0 (/ x (* z (- y t)))) (- 1.0 (/ (/ x y) (- y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-72) || !(z <= 1.05e-109)) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 - ((x / y) / (y - t));
}
return tmp;
}
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 <= (-9d-72)) .or. (.not. (z <= 1.05d-109))) then
tmp = 1.0d0 + (x / (z * (y - t)))
else
tmp = 1.0d0 - ((x / y) / (y - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-72) || !(z <= 1.05e-109)) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 - ((x / y) / (y - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e-72) or not (z <= 1.05e-109): tmp = 1.0 + (x / (z * (y - t))) else: tmp = 1.0 - ((x / y) / (y - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e-72) || !(z <= 1.05e-109)) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); else tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9e-72) || ~((z <= 1.05e-109))) tmp = 1.0 + (x / (z * (y - t))); else tmp = 1.0 - ((x / y) / (y - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e-72], N[Not[LessEqual[z, 1.05e-109]], $MachinePrecision]], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-72} \lor \neg \left(z \leq 1.05 \cdot 10^{-109}\right):\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\
\end{array}
\end{array}
if z < -9e-72 or 1.04999999999999998e-109 < z Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
*-lft-identity100.0%
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.5%
*-commutative94.5%
Simplified94.5%
if -9e-72 < z < 1.04999999999999998e-109Initial program 97.4%
Taylor expanded in z around 0 91.9%
associate-/r*93.7%
Simplified93.7%
Final simplification94.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.26e-72)
(+ 1.0 (/ x (* z (- y t))))
(if (<= z 1.85e-178)
(- 1.0 (/ (/ x y) (- y t)))
(+ 1.0 (/ x (* (- y z) t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.26e-72) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 1.85e-178) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = 1.0 + (x / ((y - z) * t));
}
return tmp;
}
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.26d-72)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (z <= 1.85d-178) then
tmp = 1.0d0 - ((x / y) / (y - t))
else
tmp = 1.0d0 + (x / ((y - z) * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.26e-72) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 1.85e-178) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = 1.0 + (x / ((y - z) * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.26e-72: tmp = 1.0 + (x / (z * (y - t))) elif z <= 1.85e-178: tmp = 1.0 - ((x / y) / (y - t)) else: tmp = 1.0 + (x / ((y - z) * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.26e-72) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (z <= 1.85e-178) tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - t))); else tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.26e-72) tmp = 1.0 + (x / (z * (y - t))); elseif (z <= 1.85e-178) tmp = 1.0 - ((x / y) / (y - t)); else tmp = 1.0 + (x / ((y - z) * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.26e-72], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e-178], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.26 \cdot 10^{-72}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-178}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\
\end{array}
\end{array}
if z < -1.25999999999999991e-72Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
*-lft-identity100.0%
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 96.5%
*-commutative96.5%
Simplified96.5%
if -1.25999999999999991e-72 < z < 1.85000000000000002e-178Initial program 96.9%
Taylor expanded in z around 0 90.4%
associate-/r*92.5%
Simplified92.5%
if 1.85000000000000002e-178 < z Initial program 100.0%
Taylor expanded in t around inf 82.3%
associate-*r/82.3%
neg-mul-182.3%
Simplified82.3%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.5e-45) (not (<= y 7.8e+33))) (- 1.0 (/ x (* y y))) (- 1.0 (/ x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.5e-45) || !(y <= 7.8e+33)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
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 <= (-4.5d-45)) .or. (.not. (y <= 7.8d+33))) then
tmp = 1.0d0 - (x / (y * y))
else
tmp = 1.0d0 - (x / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.5e-45) || !(y <= 7.8e+33)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.5e-45) or not (y <= 7.8e+33): tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 - (x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.5e-45) || !(y <= 7.8e+33)) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(1.0 - Float64(x / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.5e-45) || ~((y <= 7.8e+33))) tmp = 1.0 - (x / (y * y)); else tmp = 1.0 - (x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.5e-45], N[Not[LessEqual[y, 7.8e+33]], $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}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-45} \lor \neg \left(y \leq 7.8 \cdot 10^{+33}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -4.4999999999999999e-45 or 7.8000000000000004e33 < y Initial program 100.0%
Taylor expanded in y around inf 92.9%
unpow292.9%
Simplified92.9%
if -4.4999999999999999e-45 < y < 7.8000000000000004e33Initial program 98.2%
Taylor expanded in y around 0 77.8%
Final simplification86.4%
(FPCore (x y z t) :precision binary64 (if (<= y -5.8e-99) (+ 1.0 (/ (/ x y) z)) (if (<= y 2.25e-34) (- 1.0 (/ x (* z t))) (+ 1.0 (/ x (* y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.8e-99) {
tmp = 1.0 + ((x / y) / z);
} else if (y <= 2.25e-34) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0 + (x / (y * z));
}
return tmp;
}
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.8d-99)) then
tmp = 1.0d0 + ((x / y) / z)
else if (y <= 2.25d-34) then
tmp = 1.0d0 - (x / (z * t))
else
tmp = 1.0d0 + (x / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.8e-99) {
tmp = 1.0 + ((x / y) / z);
} else if (y <= 2.25e-34) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0 + (x / (y * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.8e-99: tmp = 1.0 + ((x / y) / z) elif y <= 2.25e-34: tmp = 1.0 - (x / (z * t)) else: tmp = 1.0 + (x / (y * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.8e-99) tmp = Float64(1.0 + Float64(Float64(x / y) / z)); elseif (y <= 2.25e-34) tmp = Float64(1.0 - Float64(x / Float64(z * t))); else tmp = Float64(1.0 + Float64(x / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5.8e-99) tmp = 1.0 + ((x / y) / z); elseif (y <= 2.25e-34) tmp = 1.0 - (x / (z * t)); else tmp = 1.0 + (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.8e-99], N[(1.0 + N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.25e-34], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{-99}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{z}\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{-34}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < -5.79999999999999971e-99Initial 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 73.2%
*-commutative73.2%
Simplified73.2%
Taylor expanded in y around inf 68.0%
associate-/r*68.0%
Simplified68.0%
if -5.79999999999999971e-99 < y < 2.25000000000000021e-34Initial program 97.8%
Taylor expanded in y around 0 81.0%
if 2.25000000000000021e-34 < y Initial 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 80.9%
*-commutative80.9%
Simplified80.9%
Taylor expanded in y around inf 78.5%
*-commutative78.5%
Simplified78.5%
Final simplification75.6%
(FPCore (x y z t) :precision binary64 (+ 1.0 (/ (/ x (- z y)) (- y t))))
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (z - y)) / (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 / (z - y)) / (y - t))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 + ((x / (z - y)) / (y - t));
}
def code(x, y, z, t): return 1.0 + ((x / (z - y)) / (y - t))
function code(x, y, z, t) return Float64(1.0 + Float64(Float64(x / Float64(z - y)) / Float64(y - t))) end
function tmp = code(x, y, z, t) tmp = 1.0 + ((x / (z - y)) / (y - t)); end
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}
\\
1 + \frac{\frac{x}{z - y}}{y - t}
\end{array}
Initial program 99.2%
sub-neg99.2%
distribute-frac-neg99.2%
*-lft-identity99.2%
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%
(FPCore (x y z t) :precision binary64 (+ 1.0 (/ x (* y z))))
double code(double x, double y, double z, double t) {
return 1.0 + (x / (y * z));
}
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))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 + (x / (y * z));
}
def code(x, y, z, t): return 1.0 + (x / (y * z))
function code(x, y, z, t) return Float64(1.0 + Float64(x / Float64(y * z))) end
function tmp = code(x, y, z, t) tmp = 1.0 + (x / (y * z)); end
code[x_, y_, z_, t_] := N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{x}{y \cdot z}
\end{array}
Initial program 99.2%
sub-neg99.2%
distribute-frac-neg99.2%
*-lft-identity99.2%
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 79.9%
*-commutative79.9%
Simplified79.9%
Taylor expanded in y around inf 61.5%
*-commutative61.5%
Simplified61.5%
Final simplification61.5%
herbie shell --seed 2023279
(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)))))