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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 4.8 |
|---|---|
| Target | 4.4 |
| Herbie | 1.4 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -inf.0 or 9.02394299792352489e270 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 48.2
Applied add-cube-cbrt_binary6448.5
Applied associate-*l*_binary6448.5
Taylor expanded in z around 0 1.1
Simplified1.1
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 9.02394299792352489e270Initial program 1.4
Applied add-cube-cbrt_binary642.4
Applied associate-*l*_binary642.4
Applied add-cube-cbrt_binary642.5
Applied *-un-lft-identity_binary642.5
Applied *-un-lft-identity_binary642.5
Applied times-frac_binary642.5
Applied prod-diff_binary642.5
Applied distribute-lft-in_binary642.5
Applied distribute-lft-in_binary642.5
Simplified1.4
Simplified1.4
Final simplification1.4
herbie shell --seed 2022131
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:herbie-target
(if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))