
(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 (* (- 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 (if (<= y -2.2e+40) 1.0 (if (<= y 5.8e-23) (+ 1.0 (/ (/ x z) (- y t))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.2e+40) {
tmp = 1.0;
} else if (y <= 5.8e-23) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0;
}
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 <= (-2.2d+40)) then
tmp = 1.0d0
else if (y <= 5.8d-23) then
tmp = 1.0d0 + ((x / z) / (y - t))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.2e+40) {
tmp = 1.0;
} else if (y <= 5.8e-23) {
tmp = 1.0 + ((x / z) / (y - t));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.2e+40: tmp = 1.0 elif y <= 5.8e-23: tmp = 1.0 + ((x / z) / (y - t)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.2e+40) tmp = 1.0; elseif (y <= 5.8e-23) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.2e+40) tmp = 1.0; elseif (y <= 5.8e-23) tmp = 1.0 + ((x / z) / (y - t)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.2e+40], 1.0, If[LessEqual[y, 5.8e-23], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+40}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-23}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= z -1.2e-118) (+ 1.0 (/ (/ x z) (- y t))) (if (<= z 7.5e-36) (- 1.0 (/ x (* y (- y t)))) (- 1.0 (/ x (* z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e-118) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 7.5e-36) {
tmp = 1.0 - (x / (y * (y - t)));
} 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 (z <= (-1.2d-118)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 7.5d-36) then
tmp = 1.0d0 - (x / (y * (y - t)))
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 (z <= -1.2e-118) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 7.5e-36) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.2e-118: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 7.5e-36: tmp = 1.0 - (x / (y * (y - t))) else: tmp = 1.0 - (x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.2e-118) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 7.5e-36) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); 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 (z <= -1.2e-118) tmp = 1.0 + ((x / z) / (y - t)); elseif (z <= 7.5e-36) tmp = 1.0 - (x / (y * (y - t))); else tmp = 1.0 - (x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e-118], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e-36], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-118}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-36}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
(FPCore (x y z t)
:precision binary64
(if (<= z -1.45e-118)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 6.6e-79)
(- 1.0 (/ x (* y (- y t))))
(- 1.0 (/ (/ x t) (- z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e-118) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 6.6e-79) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - ((x / t) / (z - y));
}
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.45d-118)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 6.6d-79) then
tmp = 1.0d0 - (x / (y * (y - t)))
else
tmp = 1.0d0 - ((x / t) / (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e-118) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 6.6e-79) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - ((x / t) / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.45e-118: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 6.6e-79: tmp = 1.0 - (x / (y * (y - t))) else: tmp = 1.0 - ((x / t) / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.45e-118) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 6.6e-79) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); else tmp = Float64(1.0 - Float64(Float64(x / t) / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.45e-118) tmp = 1.0 + ((x / z) / (y - t)); elseif (z <= 6.6e-79) tmp = 1.0 - (x / (y * (y - t))); else tmp = 1.0 - ((x / t) / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.45e-118], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.6e-79], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-118}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-79}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\
\end{array}
\end{array}
(FPCore (x y z t)
:precision binary64
(if (<= z -1.35e-119)
(+ 1.0 (/ 1.0 (/ (* z (- y t)) x)))
(if (<= z 4.8e-79)
(- 1.0 (/ x (* y (- y t))))
(- 1.0 (/ (/ x t) (- z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.35e-119) {
tmp = 1.0 + (1.0 / ((z * (y - t)) / x));
} else if (z <= 4.8e-79) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - ((x / t) / (z - y));
}
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.35d-119)) then
tmp = 1.0d0 + (1.0d0 / ((z * (y - t)) / x))
else if (z <= 4.8d-79) then
tmp = 1.0d0 - (x / (y * (y - t)))
else
tmp = 1.0d0 - ((x / t) / (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.35e-119) {
tmp = 1.0 + (1.0 / ((z * (y - t)) / x));
} else if (z <= 4.8e-79) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - ((x / t) / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.35e-119: tmp = 1.0 + (1.0 / ((z * (y - t)) / x)) elif z <= 4.8e-79: tmp = 1.0 - (x / (y * (y - t))) else: tmp = 1.0 - ((x / t) / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.35e-119) tmp = Float64(1.0 + Float64(1.0 / Float64(Float64(z * Float64(y - t)) / x))); elseif (z <= 4.8e-79) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); else tmp = Float64(1.0 - Float64(Float64(x / t) / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.35e-119) tmp = 1.0 + (1.0 / ((z * (y - t)) / x)); elseif (z <= 4.8e-79) tmp = 1.0 - (x / (y * (y - t))); else tmp = 1.0 - ((x / t) / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.35e-119], N[(1.0 + N[(1.0 / N[(N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e-79], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{-119}:\\
\;\;\;\;1 + \frac{1}{\frac{z \cdot \left(y - t\right)}{x}}\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-79}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\
\end{array}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= t -8.8e-29) 1.0 (if (<= t 2.3e-208) (+ 1.0 (/ x (* y z))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.8e-29) {
tmp = 1.0;
} else if (t <= 2.3e-208) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0;
}
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 (t <= (-8.8d-29)) then
tmp = 1.0d0
else if (t <= 2.3d-208) then
tmp = 1.0d0 + (x / (y * z))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.8e-29) {
tmp = 1.0;
} else if (t <= 2.3e-208) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8.8e-29: tmp = 1.0 elif t <= 2.3e-208: tmp = 1.0 + (x / (y * z)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8.8e-29) tmp = 1.0; elseif (t <= 2.3e-208) tmp = Float64(1.0 + Float64(x / Float64(y * z))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -8.8e-29) tmp = 1.0; elseif (t <= 2.3e-208) tmp = 1.0 + (x / (y * z)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8.8e-29], 1.0, If[LessEqual[t, 2.3e-208], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{-29}:\\
\;\;\;\;1\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{-208}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= y -3.2e-27) 1.0 (if (<= y 4.8e-23) (- 1.0 (/ x (* z t))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.2e-27) {
tmp = 1.0;
} else if (y <= 4.8e-23) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
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 <= (-3.2d-27)) then
tmp = 1.0d0
else if (y <= 4.8d-23) then
tmp = 1.0d0 - (x / (z * t))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.2e-27) {
tmp = 1.0;
} else if (y <= 4.8e-23) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.2e-27: tmp = 1.0 elif y <= 4.8e-23: tmp = 1.0 - (x / (z * t)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.2e-27) tmp = 1.0; elseif (y <= 4.8e-23) tmp = Float64(1.0 - Float64(x / Float64(z * t))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.2e-27) tmp = 1.0; elseif (y <= 4.8e-23) tmp = 1.0 - (x / (z * t)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.2e-27], 1.0, If[LessEqual[y, 4.8e-23], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-27}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-23}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(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}
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
herbie shell --seed 2023350
(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)))))