(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) (- t z))))
(if (<= t_1 (- INFINITY))
(/ (/ 1.0 (/ (- t z) x)) (- y z))
(if (<= t_1 1.1254432931568516e+262)
(/ x (- (fma t y (* z z)) (* z (+ y t))))
(/ (/ x (- y z)) (- t z))))))double code(double x, double y, double z, double t) {
return x / ((y - z) * (t - z));
}
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (1.0 / ((t - z) / x)) / (y - z);
} else if (t_1 <= 1.1254432931568516e+262) {
tmp = x / (fma(t, y, (z * z)) - (z * (y + t)));
} else {
tmp = (x / (y - z)) / (t - z);
}
return tmp;
}
function code(x, y, z, t) return Float64(x / Float64(Float64(y - z) * Float64(t - z))) end
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * Float64(t - z)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(1.0 / Float64(Float64(t - z) / x)) / Float64(y - z)); elseif (t_1 <= 1.1254432931568516e+262) tmp = Float64(x / Float64(fma(t, y, Float64(z * z)) - Float64(z * Float64(y + t)))); else tmp = Float64(Float64(x / Float64(y - z)) / Float64(t - z)); end return tmp end
code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(1.0 / N[(N[(t - z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.1254432931568516e+262], N[(x / N[(N[(t * y + N[(z * z), $MachinePrecision]), $MachinePrecision] - N[(z * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]]]]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{\frac{1}{\frac{t - z}{x}}}{y - z}\\
\mathbf{elif}\;t_1 \leq 1.1254432931568516 \cdot 10^{+262}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(t, y, z \cdot z\right) - z \cdot \left(y + t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 7.5 |
|---|---|
| Target | 8.5 |
| Herbie | 0.7 |
if (*.f64 (-.f64 y z) (-.f64 t z)) < -inf.0Initial program 19.2
Applied *-un-lft-identity_binary6419.2
Applied times-frac_binary640.1
Applied clear-num_binary640.1
Applied associate-*l/_binary640.1
if -inf.0 < (*.f64 (-.f64 y z) (-.f64 t z)) < 1.1254432931568516e262Initial program 1.3
Taylor expanded in x around inf 1.3
Simplified1.3
if 1.1254432931568516e262 < (*.f64 (-.f64 y z) (-.f64 t z)) Initial program 14.4
Applied associate-/r*_binary640.1
Final simplification0.7
herbie shell --seed 2022131
(FPCore (x y z t)
:name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"
:precision binary64
:herbie-target
(if (< (/ x (* (- y z) (- t z))) 0.0) (/ (/ x (- y z)) (- t z)) (* x (/ 1.0 (* (- y z) (- t z)))))
(/ x (* (- y z) (- t z))))