Average Error: 7.5 → 3.6
Time: 4.4s
Precision: 64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.862397195409269 \cdot 10^{-252} \lor \neg \left(x \le 1.3799272751964713 \cdot 10^{-126}\right):\\ \;\;\;\;\left(\frac{y}{t \cdot z - x} \cdot \frac{z}{x + 1} + \frac{1}{x + 1} \cdot x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y \cdot z}{\left(x + 1\right) \cdot \left(t \cdot z - x\right)} + \frac{1}{x + 1} \cdot x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\\ \end{array}\]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
\mathbf{if}\;x \le -1.862397195409269 \cdot 10^{-252} \lor \neg \left(x \le 1.3799272751964713 \cdot 10^{-126}\right):\\
\;\;\;\;\left(\frac{y}{t \cdot z - x} \cdot \frac{z}{x + 1} + \frac{1}{x + 1} \cdot x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{y \cdot z}{\left(x + 1\right) \cdot \left(t \cdot z - x\right)} + \frac{1}{x + 1} \cdot x\right) - \frac{\frac{x}{t \cdot z - x}}{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 (((x <= -1.862397195409269e-252) || !(x <= 1.3799272751964713e-126))) {
		temp = ((((y / ((t * z) - x)) * (z / (x + 1.0))) + ((1.0 / (x + 1.0)) * x)) - ((x / ((t * z) - x)) / (x + 1.0)));
	} else {
		temp = ((((y * z) / ((x + 1.0) * ((t * z) - x))) + ((1.0 / (x + 1.0)) * x)) - ((x / ((t * z) - x)) / (x + 1.0)));
	}
	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.5
Target0.4
Herbie3.6
\[\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -1.862397195409269e-252 or 1.3799272751964713e-126 < x

    1. Initial program 7.5

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

      \[\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-7.5

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

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

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

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

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

      \[\leadsto \frac{1}{x + 1} \cdot \color{blue}{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right)} - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    11. Using strategy rm
    12. Applied fma-udef3.2

      \[\leadsto \frac{1}{x + 1} \cdot \color{blue}{\left(\frac{y}{t \cdot z - x} \cdot z + x\right)} - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    13. Applied distribute-lft-in3.2

      \[\leadsto \color{blue}{\left(\frac{1}{x + 1} \cdot \left(\frac{y}{t \cdot z - x} \cdot z\right) + \frac{1}{x + 1} \cdot x\right)} - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    14. Simplified3.2

      \[\leadsto \left(\color{blue}{\frac{\frac{y}{t \cdot z - x} \cdot z}{x + 1}} + \frac{1}{x + 1} \cdot x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    15. Using strategy rm
    16. Applied *-un-lft-identity3.2

      \[\leadsto \left(\frac{\frac{y}{t \cdot z - x} \cdot z}{\color{blue}{1 \cdot \left(x + 1\right)}} + \frac{1}{x + 1} \cdot x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    17. Applied times-frac2.7

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

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

    if -1.862397195409269e-252 < x < 1.3799272751964713e-126

    1. Initial program 7.8

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

      \[\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-7.8

      \[\leadsto \frac{\color{blue}{\left(x + \frac{y \cdot z}{t \cdot z - x}\right) - \frac{x}{t \cdot z - x}}}{x + 1}\]
    5. Applied div-sub7.8

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

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

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

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

      \[\leadsto \frac{1}{x + 1} \cdot \color{blue}{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right)} - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    11. Using strategy rm
    12. Applied fma-udef13.1

      \[\leadsto \frac{1}{x + 1} \cdot \color{blue}{\left(\frac{y}{t \cdot z - x} \cdot z + x\right)} - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    13. Applied distribute-lft-in13.1

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

      \[\leadsto \left(\color{blue}{\frac{\frac{y}{t \cdot z - x} \cdot z}{x + 1}} + \frac{1}{x + 1} \cdot x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    15. Using strategy rm
    16. Applied associate-*l/7.8

      \[\leadsto \left(\frac{\color{blue}{\frac{y \cdot z}{t \cdot z - x}}}{x + 1} + \frac{1}{x + 1} \cdot x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    17. Applied associate-/l/7.8

      \[\leadsto \left(\color{blue}{\frac{y \cdot z}{\left(x + 1\right) \cdot \left(t \cdot z - x\right)}} + \frac{1}{x + 1} \cdot x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.862397195409269 \cdot 10^{-252} \lor \neg \left(x \le 1.3799272751964713 \cdot 10^{-126}\right):\\ \;\;\;\;\left(\frac{y}{t \cdot z - x} \cdot \frac{z}{x + 1} + \frac{1}{x + 1} \cdot x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y \cdot z}{\left(x + 1\right) \cdot \left(t \cdot z - x\right)} + \frac{1}{x + 1} \cdot x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\\ \end{array}\]

Reproduce

herbie shell --seed 2020056 +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)))