Average Error: 7.4 → 3.3
Time: 4.9s
Precision: 64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;z \le -0.11637323540242528:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right) - \frac{1}{\sqrt[3]{t \cdot z - x} \cdot \sqrt[3]{t \cdot z - x}} \cdot \frac{x}{\sqrt[3]{t \cdot z - x}}}{x + 1}\\ \mathbf{elif}\;z \le 6.17993228896471188 \cdot 10^{40}:\\ \;\;\;\;\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{t \cdot z - x}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array}\]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
\mathbf{if}\;z \le -0.11637323540242528:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right) - \frac{1}{\sqrt[3]{t \cdot z - x} \cdot \sqrt[3]{t \cdot z - x}} \cdot \frac{x}{\sqrt[3]{t \cdot z - x}}}{x + 1}\\

\mathbf{elif}\;z \le 6.17993228896471188 \cdot 10^{40}:\\
\;\;\;\;\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{t \cdot z - x}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

\end{array}
double code(double x, double y, double z, double t) {
	return ((x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0));
}
double code(double x, double y, double z, double t) {
	double temp;
	if ((z <= -0.11637323540242528)) {
		temp = ((fma((y / ((t * z) - x)), z, x) - ((1.0 / (cbrt(((t * z) - x)) * cbrt(((t * z) - x)))) * (x / cbrt(((t * z) - x))))) / (x + 1.0));
	} else {
		double temp_1;
		if ((z <= 6.179932288964712e+40)) {
			temp_1 = (1.0 / ((x + 1.0) / (x + (((y * z) - x) / ((t * z) - x)))));
		} else {
			temp_1 = ((x + (y / t)) / (x + 1.0));
		}
		temp = temp_1;
	}
	return temp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.4
Target0.3
Herbie3.3
\[\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -0.11637323540242528

    1. Initial program 15.6

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Using strategy rm
    3. Applied div-sub15.6

      \[\leadsto \frac{x + \color{blue}{\left(\frac{y \cdot z}{t \cdot z - x} - \frac{x}{t \cdot z - x}\right)}}{x + 1}\]
    4. Applied associate-+r-15.6

      \[\leadsto \frac{\color{blue}{\left(x + \frac{y \cdot z}{t \cdot z - x}\right) - \frac{x}{t \cdot z - x}}}{x + 1}\]
    5. Simplified5.7

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right)} - \frac{x}{t \cdot z - x}}{x + 1}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt5.7

      \[\leadsto \frac{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right) - \frac{x}{\color{blue}{\left(\sqrt[3]{t \cdot z - x} \cdot \sqrt[3]{t \cdot z - x}\right) \cdot \sqrt[3]{t \cdot z - x}}}}{x + 1}\]
    8. Applied *-un-lft-identity5.7

      \[\leadsto \frac{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right) - \frac{\color{blue}{1 \cdot x}}{\left(\sqrt[3]{t \cdot z - x} \cdot \sqrt[3]{t \cdot z - x}\right) \cdot \sqrt[3]{t \cdot z - x}}}{x + 1}\]
    9. Applied times-frac5.7

      \[\leadsto \frac{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right) - \color{blue}{\frac{1}{\sqrt[3]{t \cdot z - x} \cdot \sqrt[3]{t \cdot z - x}} \cdot \frac{x}{\sqrt[3]{t \cdot z - x}}}}{x + 1}\]

    if -0.11637323540242528 < z < 6.179932288964712e+40

    1. Initial program 0.2

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Using strategy rm
    3. Applied clear-num0.3

      \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{t \cdot z - x}}}}\]

    if 6.179932288964712e+40 < z

    1. Initial program 16.7

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Taylor expanded around inf 8.5

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -0.11637323540242528:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right) - \frac{1}{\sqrt[3]{t \cdot z - x} \cdot \sqrt[3]{t \cdot z - x}} \cdot \frac{x}{\sqrt[3]{t \cdot z - x}}}{x + 1}\\ \mathbf{elif}\;z \le 6.17993228896471188 \cdot 10^{40}:\\ \;\;\;\;\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{t \cdot z - x}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array}\]

Reproduce

herbie shell --seed 2020049 +o rules:numerics
(FPCore (x y z t)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :herbie-target
  (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1))

  (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1)))