Average Error: 3.9 → 2.8
Time: 8.1s
Precision: binary64
\[\frac{x}{x + y \cdot e^{2 \cdot \left(\frac{z \cdot \sqrt{t + a}}{t} - \left(b - c\right) \cdot \left(\left(a + \frac{5}{6}\right) - \frac{2}{t \cdot 3}\right)\right)}} \]
\[\begin{array}{l} t_1 := \sqrt{t + a}\\ t_2 := \left(b - c\right) \cdot \left(\frac{0.6666666666666666}{t} + \left(-0.8333333333333334 - a\right)\right)\\ t_3 := \frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\left(\mathsf{fma}\left(z, \frac{t_1}{t}, t_2\right)\right)}, x\right)}\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{+110}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 10^{-202}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{t_2}, x\right)}\\ \mathbf{elif}\;z \leq 10^{+209}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\left(\mathsf{fma}\left(0.6666666666666666, \frac{b}{t}, \mathsf{fma}\left(\frac{z}{t}, t_1, b \cdot \left(-0.8333333333333334 - a\right)\right)\right)\right)}, x\right)}\\ \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (/
  x
  (+
   x
   (*
    y
    (exp
     (*
      2.0
      (-
       (/ (* z (sqrt (+ t a))) t)
       (* (- b c) (- (+ a (/ 5.0 6.0)) (/ 2.0 (* t 3.0)))))))))))
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (sqrt (+ t a)))
        (t_2
         (* (- b c) (+ (/ 0.6666666666666666 t) (- -0.8333333333333334 a))))
        (t_3 (/ x (fma y (pow (exp 2.0) (fma z (/ t_1 t) t_2)) x))))
   (if (<= z -1.35e+110)
     t_3
     (if (<= z 1e-202)
       (/ x (fma y (pow (exp 2.0) t_2) x))
       (if (<= z 1e+209)
         t_3
         (/
          x
          (fma
           y
           (pow
            (exp 2.0)
            (fma
             0.6666666666666666
             (/ b t)
             (fma (/ z t) t_1 (* b (- -0.8333333333333334 a)))))
           x)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return x / (x + (y * exp((2.0 * (((z * sqrt((t + a))) / t) - ((b - c) * ((a + (5.0 / 6.0)) - (2.0 / (t * 3.0)))))))));
}
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = sqrt((t + a));
	double t_2 = (b - c) * ((0.6666666666666666 / t) + (-0.8333333333333334 - a));
	double t_3 = x / fma(y, pow(exp(2.0), fma(z, (t_1 / t), t_2)), x);
	double tmp;
	if (z <= -1.35e+110) {
		tmp = t_3;
	} else if (z <= 1e-202) {
		tmp = x / fma(y, pow(exp(2.0), t_2), x);
	} else if (z <= 1e+209) {
		tmp = t_3;
	} else {
		tmp = x / fma(y, pow(exp(2.0), fma(0.6666666666666666, (b / t), fma((z / t), t_1, (b * (-0.8333333333333334 - a))))), x);
	}
	return tmp;
}
function code(x, y, z, t, a, b, c)
	return Float64(x / Float64(x + Float64(y * exp(Float64(2.0 * Float64(Float64(Float64(z * sqrt(Float64(t + a))) / t) - Float64(Float64(b - c) * Float64(Float64(a + Float64(5.0 / 6.0)) - Float64(2.0 / Float64(t * 3.0))))))))))
end
function code(x, y, z, t, a, b, c)
	t_1 = sqrt(Float64(t + a))
	t_2 = Float64(Float64(b - c) * Float64(Float64(0.6666666666666666 / t) + Float64(-0.8333333333333334 - a)))
	t_3 = Float64(x / fma(y, (exp(2.0) ^ fma(z, Float64(t_1 / t), t_2)), x))
	tmp = 0.0
	if (z <= -1.35e+110)
		tmp = t_3;
	elseif (z <= 1e-202)
		tmp = Float64(x / fma(y, (exp(2.0) ^ t_2), x));
	elseif (z <= 1e+209)
		tmp = t_3;
	else
		tmp = Float64(x / fma(y, (exp(2.0) ^ fma(0.6666666666666666, Float64(b / t), fma(Float64(z / t), t_1, Float64(b * Float64(-0.8333333333333334 - a))))), x));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(x / N[(x + N[(y * N[Exp[N[(2.0 * N[(N[(N[(z * N[Sqrt[N[(t + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] - N[(N[(b - c), $MachinePrecision] * N[(N[(a + N[(5.0 / 6.0), $MachinePrecision]), $MachinePrecision] - N[(2.0 / N[(t * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[Sqrt[N[(t + a), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - c), $MachinePrecision] * N[(N[(0.6666666666666666 / t), $MachinePrecision] + N[(-0.8333333333333334 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x / N[(y * N[Power[N[Exp[2.0], $MachinePrecision], N[(z * N[(t$95$1 / t), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.35e+110], t$95$3, If[LessEqual[z, 1e-202], N[(x / N[(y * N[Power[N[Exp[2.0], $MachinePrecision], t$95$2], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+209], t$95$3, N[(x / N[(y * N[Power[N[Exp[2.0], $MachinePrecision], N[(0.6666666666666666 * N[(b / t), $MachinePrecision] + N[(N[(z / t), $MachinePrecision] * t$95$1 + N[(b * N[(-0.8333333333333334 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]]]]]]
\frac{x}{x + y \cdot e^{2 \cdot \left(\frac{z \cdot \sqrt{t + a}}{t} - \left(b - c\right) \cdot \left(\left(a + \frac{5}{6}\right) - \frac{2}{t \cdot 3}\right)\right)}}
\begin{array}{l}
t_1 := \sqrt{t + a}\\
t_2 := \left(b - c\right) \cdot \left(\frac{0.6666666666666666}{t} + \left(-0.8333333333333334 - a\right)\right)\\
t_3 := \frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\left(\mathsf{fma}\left(z, \frac{t_1}{t}, t_2\right)\right)}, x\right)}\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+110}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 10^{-202}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{t_2}, x\right)}\\

\mathbf{elif}\;z \leq 10^{+209}:\\
\;\;\;\;t_3\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\left(\mathsf{fma}\left(0.6666666666666666, \frac{b}{t}, \mathsf{fma}\left(\frac{z}{t}, t_1, b \cdot \left(-0.8333333333333334 - a\right)\right)\right)\right)}, x\right)}\\


\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Target

Original3.9
Target2.9
Herbie2.8
\[\begin{array}{l} \mathbf{if}\;t < -2.118326644891581 \cdot 10^{-50}:\\ \;\;\;\;\frac{x}{x + y \cdot e^{2 \cdot \left(\left(a \cdot c + 0.8333333333333334 \cdot c\right) - a \cdot b\right)}}\\ \mathbf{elif}\;t < 5.196588770651547 \cdot 10^{-123}:\\ \;\;\;\;\frac{x}{x + y \cdot e^{2 \cdot \frac{\left(z \cdot \sqrt{t + a}\right) \cdot \left(\left(3 \cdot t\right) \cdot \left(a - \frac{5}{6}\right)\right) - \left(\left(\frac{5}{6} + a\right) \cdot \left(3 \cdot t\right) - 2\right) \cdot \left(\left(a - \frac{5}{6}\right) \cdot \left(\left(b - c\right) \cdot t\right)\right)}{\left(\left(t \cdot t\right) \cdot 3\right) \cdot \left(a - \frac{5}{6}\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y \cdot e^{2 \cdot \left(\frac{z \cdot \sqrt{t + a}}{t} - \left(b - c\right) \cdot \left(\left(a + \frac{5}{6}\right) - \frac{2}{t \cdot 3}\right)\right)}}\\ \end{array} \]

Derivation

  1. Split input into 3 regimes
  2. if z < -1.35000000000000005e110 or 1e-202 < z < 1.0000000000000001e209

    1. Initial program 4.8

      \[\frac{x}{x + y \cdot e^{2 \cdot \left(\frac{z \cdot \sqrt{t + a}}{t} - \left(b - c\right) \cdot \left(\left(a + \frac{5}{6}\right) - \frac{2}{t \cdot 3}\right)\right)}} \]
    2. Simplified2.1

      \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\left(\mathsf{fma}\left(z, \frac{\sqrt{t + a}}{t}, \left(b - c\right) \cdot \left(\frac{0.6666666666666666}{t} - \left(a + 0.8333333333333334\right)\right)\right)\right)}, x\right)}} \]

    if -1.35000000000000005e110 < z < 1e-202

    1. Initial program 0.7

      \[\frac{x}{x + y \cdot e^{2 \cdot \left(\frac{z \cdot \sqrt{t + a}}{t} - \left(b - c\right) \cdot \left(\left(a + \frac{5}{6}\right) - \frac{2}{t \cdot 3}\right)\right)}} \]
    2. Simplified1.7

      \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\left(\mathsf{fma}\left(z, \frac{\sqrt{t + a}}{t}, \left(b - c\right) \cdot \left(\frac{0.6666666666666666}{t} - \left(a + 0.8333333333333334\right)\right)\right)\right)}, x\right)}} \]
    3. Taylor expanded in z around 0 6.3

      \[\leadsto \frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\color{blue}{\left(\left(0.8333333333333334 \cdot c + \left(c \cdot a + 0.6666666666666666 \cdot \frac{b}{t}\right)\right) - \left(a \cdot b + \left(0.8333333333333334 \cdot b + 0.6666666666666666 \cdot \frac{c}{t}\right)\right)\right)}}, x\right)} \]
    4. Simplified6.1

      \[\leadsto \frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\color{blue}{\left(\mathsf{fma}\left(0.8333333333333334, c, \mathsf{fma}\left(c, a, 0.6666666666666666 \cdot \frac{b}{t}\right)\right) - \mathsf{fma}\left(b, 0.8333333333333334 + a, 0.6666666666666666 \cdot \frac{c}{t}\right)\right)}}, x\right)} \]
    5. Taylor expanded in c around 0 6.3

      \[\leadsto \frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\color{blue}{\left(\left(0.8333333333333334 \cdot c + \left(c \cdot a + 0.6666666666666666 \cdot \frac{b}{t}\right)\right) - \left(a \cdot b + \left(0.8333333333333334 \cdot b + 0.6666666666666666 \cdot \frac{c}{t}\right)\right)\right)}}, x\right)} \]
    6. Simplified2.2

      \[\leadsto \frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\color{blue}{\left(\left(\frac{0.6666666666666666}{t} + \left(-0.8333333333333334 - a\right)\right) \cdot \left(b - c\right)\right)}}, x\right)} \]

    if 1.0000000000000001e209 < z

    1. Initial program 14.6

      \[\frac{x}{x + y \cdot e^{2 \cdot \left(\frac{z \cdot \sqrt{t + a}}{t} - \left(b - c\right) \cdot \left(\left(a + \frac{5}{6}\right) - \frac{2}{t \cdot 3}\right)\right)}} \]
    2. Simplified5.0

      \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\left(\mathsf{fma}\left(z, \frac{\sqrt{t + a}}{t}, \left(b - c\right) \cdot \left(\frac{0.6666666666666666}{t} - \left(a + 0.8333333333333334\right)\right)\right)\right)}, x\right)}} \]
    3. Taylor expanded in c around 0 11.5

      \[\leadsto \frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\color{blue}{\left(\left(0.6666666666666666 \cdot \frac{b}{t} + \frac{z}{t} \cdot \sqrt{a + t}\right) - \left(a \cdot b + 0.8333333333333334 \cdot b\right)\right)}}, x\right)} \]
    4. Simplified10.8

      \[\leadsto \frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\color{blue}{\left(\mathsf{fma}\left(0.6666666666666666, \frac{b}{t}, \mathsf{fma}\left(\frac{z}{t}, \sqrt{a + t}, b \cdot \left(-0.8333333333333334 - a\right)\right)\right)\right)}}, x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification2.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{+110}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\left(\mathsf{fma}\left(z, \frac{\sqrt{t + a}}{t}, \left(b - c\right) \cdot \left(\frac{0.6666666666666666}{t} + \left(-0.8333333333333334 - a\right)\right)\right)\right)}, x\right)}\\ \mathbf{elif}\;z \leq 10^{-202}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\left(\left(b - c\right) \cdot \left(\frac{0.6666666666666666}{t} + \left(-0.8333333333333334 - a\right)\right)\right)}, x\right)}\\ \mathbf{elif}\;z \leq 10^{+209}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\left(\mathsf{fma}\left(z, \frac{\sqrt{t + a}}{t}, \left(b - c\right) \cdot \left(\frac{0.6666666666666666}{t} + \left(-0.8333333333333334 - a\right)\right)\right)\right)}, x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(y, {\left(e^{2}\right)}^{\left(\mathsf{fma}\left(0.6666666666666666, \frac{b}{t}, \mathsf{fma}\left(\frac{z}{t}, \sqrt{t + a}, b \cdot \left(-0.8333333333333334 - a\right)\right)\right)\right)}, x\right)}\\ \end{array} \]

Reproduce

herbie shell --seed 2022166 
(FPCore (x y z t a b c)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, I"
  :precision binary64

  :herbie-target
  (if (< t -2.118326644891581e-50) (/ x (+ x (* y (exp (* 2.0 (- (+ (* a c) (* 0.8333333333333334 c)) (* a b))))))) (if (< t 5.196588770651547e-123) (/ x (+ x (* y (exp (* 2.0 (/ (- (* (* z (sqrt (+ t a))) (* (* 3.0 t) (- a (/ 5.0 6.0)))) (* (- (* (+ (/ 5.0 6.0) a) (* 3.0 t)) 2.0) (* (- a (/ 5.0 6.0)) (* (- b c) t)))) (* (* (* t t) 3.0) (- a (/ 5.0 6.0))))))))) (/ x (+ x (* y (exp (* 2.0 (- (/ (* z (sqrt (+ t a))) t) (* (- b c) (- (+ a (/ 5.0 6.0)) (/ 2.0 (* t 3.0))))))))))))

  (/ x (+ x (* y (exp (* 2.0 (- (/ (* z (sqrt (+ t a))) t) (* (- b c) (- (+ a (/ 5.0 6.0)) (/ 2.0 (* t 3.0)))))))))))