Average Error: 12.2 → 2.1
Time: 2.2s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.34319609672474334 \cdot 10^{-30}:\\ \;\;\;\;x \cdot \frac{y - z}{y}\\ \mathbf{elif}\;y \le -5.3503239613714197 \cdot 10^{-267}:\\ \;\;\;\;x - \frac{x \cdot z}{y}\\ \mathbf{elif}\;y \le 3.7743507851606562 \cdot 10^{-214}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{elif}\;y \le 4.317797565892611 \cdot 10^{-66}:\\ \;\;\;\;x - \frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{y}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
\mathbf{if}\;y \le -1.34319609672474334 \cdot 10^{-30}:\\
\;\;\;\;x \cdot \frac{y - z}{y}\\

\mathbf{elif}\;y \le -5.3503239613714197 \cdot 10^{-267}:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\

\mathbf{elif}\;y \le 3.7743507851606562 \cdot 10^{-214}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\

\mathbf{elif}\;y \le 4.317797565892611 \cdot 10^{-66}:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y - z}{y}\\

\end{array}
double code(double x, double y, double z) {
	return ((double) (((double) (x * ((double) (y - z)))) / y));
}
double code(double x, double y, double z) {
	double VAR;
	if ((y <= -1.3431960967247433e-30)) {
		VAR = ((double) (x * ((double) (((double) (y - z)) / y))));
	} else {
		double VAR_1;
		if ((y <= -5.35032396137142e-267)) {
			VAR_1 = ((double) (x - ((double) (((double) (x * z)) / y))));
		} else {
			double VAR_2;
			if ((y <= 3.774350785160656e-214)) {
				VAR_2 = ((double) (x / ((double) (y / ((double) (y - z))))));
			} else {
				double VAR_3;
				if ((y <= 4.3177975658926113e-66)) {
					VAR_3 = ((double) (x - ((double) (((double) (x * z)) / y))));
				} else {
					VAR_3 = ((double) (x * ((double) (((double) (y - z)) / y))));
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original12.2
Target3.4
Herbie2.1
\[\begin{array}{l} \mathbf{if}\;z \lt -2.060202331921739 \cdot 10^{104}:\\ \;\;\;\;x - \frac{z \cdot x}{y}\\ \mathbf{elif}\;z \lt 1.69397660138285259 \cdot 10^{213}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if y < -1.34319609672474334e-30 or 4.317797565892611e-66 < y

    1. Initial program 14.2

      \[\frac{x \cdot \left(y - z\right)}{y}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity14.2

      \[\leadsto \frac{x \cdot \left(y - z\right)}{\color{blue}{1 \cdot y}}\]
    4. Applied times-frac0.3

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y - z}{y}}\]
    5. Simplified0.3

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

    if -1.34319609672474334e-30 < y < -5.3503239613714197e-267 or 3.7743507851606562e-214 < y < 4.317797565892611e-66

    1. Initial program 6.7

      \[\frac{x \cdot \left(y - z\right)}{y}\]
    2. Using strategy rm
    3. Applied associate-/l*7.2

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{y - z}}}\]
    4. Taylor expanded around 0 3.0

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

    if -5.3503239613714197e-267 < y < 3.7743507851606562e-214

    1. Initial program 14.3

      \[\frac{x \cdot \left(y - z\right)}{y}\]
    2. Using strategy rm
    3. Applied associate-/l*14.4

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{y - z}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification2.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.34319609672474334 \cdot 10^{-30}:\\ \;\;\;\;x \cdot \frac{y - z}{y}\\ \mathbf{elif}\;y \le -5.3503239613714197 \cdot 10^{-267}:\\ \;\;\;\;x - \frac{x \cdot z}{y}\\ \mathbf{elif}\;y \le 3.7743507851606562 \cdot 10^{-214}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{elif}\;y \le 4.317797565892611 \cdot 10^{-66}:\\ \;\;\;\;x - \frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020161 
(FPCore (x y z)
  :name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
  :precision binary64

  :herbie-target
  (if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))

  (/ (* x (- y z)) y))