Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3

Percentage Accurate: 89.2% → 99.5%
Time: 5.1s
Alternatives: 11
Speedup: TODO×

Specification

?
\[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]

Your Program's Arguments

Results

Enter valid numbers for all inputs

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Target

Original89.2%
Target99.5%
Herbie99.5%
\[\begin{array}{l} \mathbf{if}\;x < -2.71483106713436 \cdot 10^{-162}:\\ \;\;\;\;\left(1 + y\right) \cdot \frac{x}{z} - x\\ \mathbf{elif}\;x < 3.874108816439546 \cdot 10^{-197}:\\ \;\;\;\;\left(x \cdot \left(\left(y - z\right) + 1\right)\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + y\right) \cdot \frac{x}{z} - x\\ \end{array} \]

Alternative 1?

\[\begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+65} \lor \neg \left(z \leq 72\right):\\ \;\;\;\;x \cdot \frac{y}{z} - x\\ \mathbf{else}:\\ \;\;\;\;\left(\left(y - z\right) + 1\right) \cdot \frac{x}{z}\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if z < -5.4999999999999996e65 or 72 < z

    1. Initial program 77.3%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. +-commutative77.3%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. sub-neg77.3%

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(\left(1 + \left(-z\right)\right) + y\right)}}{z} \]
      5. unsub-neg77.3%

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(1 - z\right)} + y\right)}{z} \]
      6. associate-+l-77.3%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 - \left(z - y\right)\right)}}{z} \]
      7. distribute-lft-out--77.3%

        \[\leadsto \frac{\color{blue}{x \cdot 1 - x \cdot \left(z - y\right)}}{z} \]
      8. *-rgt-identity77.3%

        \[\leadsto \frac{\color{blue}{x} - x \cdot \left(z - y\right)}{z} \]
      9. distribute-rgt-out--76.1%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x - y \cdot x\right)}}{z} \]
      10. sub-neg76.1%

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

        \[\leadsto \frac{x - \color{blue}{\left(\left(-y \cdot x\right) + z \cdot x\right)}}{z} \]
      12. associate--r+76.1%

        \[\leadsto \frac{\color{blue}{\left(x - \left(-y \cdot x\right)\right) - z \cdot x}}{z} \]
      13. div-sub76.0%

        \[\leadsto \color{blue}{\frac{x - \left(-y \cdot x\right)}{z} - \frac{z \cdot x}{z}} \]
    3. Simplified92.7%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x} \]
    4. Taylor expanded in y around inf 92.7%

      \[\leadsto \color{blue}{\frac{y \cdot x}{z}} - x \]
    5. Step-by-step derivation
      1. associate-/l*95.7%

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} - x \]
    6. Simplified95.7%

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} - x \]
    7. Taylor expanded in y around 0 92.7%

      \[\leadsto \color{blue}{\frac{y \cdot x}{z} + -1 \cdot x} \]
    8. Step-by-step derivation
      1. neg-mul-192.7%

        \[\leadsto \frac{y \cdot x}{z} + \color{blue}{\left(-x\right)} \]
      2. sub-neg92.7%

        \[\leadsto \color{blue}{\frac{y \cdot x}{z} - x} \]
      3. associate-*l/100.0%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot x} - x \]
      4. *-commutative100.0%

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} - x \]
    9. Simplified100.0%

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

    if -5.4999999999999996e65 < z < 72

    1. Initial program 99.3%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*92.7%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    3. Simplified92.7%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    4. Step-by-step derivation
      1. associate-/r/99.9%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(\left(y - z\right) + 1\right)} \]
    5. Applied egg-rr99.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+65} \lor \neg \left(z \leq 72\right):\\ \;\;\;\;x \cdot \frac{y}{z} - x\\ \mathbf{else}:\\ \;\;\;\;\left(\left(y - z\right) + 1\right) \cdot \frac{x}{z}\\ \end{array} \]

Alternative 2?

\[\begin{array}{l} t_0 := \left(y - z\right) + 1\\ \mathbf{if}\;\frac{x \cdot t_0}{z} \leq -\infty:\\ \;\;\;\;\frac{x}{\frac{z}{t_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x (+.f64 (-.f64 y z) 1)) z) < -inf.0

    1. Initial program 67.0%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    3. Simplified100.0%

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

    if -inf.0 < (/.f64 (*.f64 x (+.f64 (-.f64 y z) 1)) z)

    1. Initial program 94.1%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. +-commutative94.1%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. sub-neg94.1%

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(\left(1 + \left(-z\right)\right) + y\right)}}{z} \]
      5. unsub-neg94.1%

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(1 - z\right)} + y\right)}{z} \]
      6. associate-+l-94.1%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 - \left(z - y\right)\right)}}{z} \]
      7. distribute-lft-out--94.1%

        \[\leadsto \frac{\color{blue}{x \cdot 1 - x \cdot \left(z - y\right)}}{z} \]
      8. *-rgt-identity94.1%

        \[\leadsto \frac{\color{blue}{x} - x \cdot \left(z - y\right)}{z} \]
      9. distribute-rgt-out--94.0%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x - y \cdot x\right)}}{z} \]
      10. sub-neg94.0%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x + \left(-y \cdot x\right)\right)}}{z} \]
      11. +-commutative94.0%

        \[\leadsto \frac{x - \color{blue}{\left(\left(-y \cdot x\right) + z \cdot x\right)}}{z} \]
      12. associate--r+94.0%

        \[\leadsto \frac{\color{blue}{\left(x - \left(-y \cdot x\right)\right) - z \cdot x}}{z} \]
      13. div-sub94.0%

        \[\leadsto \color{blue}{\frac{x - \left(-y \cdot x\right)}{z} - \frac{z \cdot x}{z}} \]
    3. Simplified98.6%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \leq -\infty:\\ \;\;\;\;\frac{x}{\frac{z}{\left(y - z\right) + 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x\\ \end{array} \]

Alternative 3?

\[\begin{array}{l} t_0 := \left(y - z\right) + 1\\ \mathbf{if}\;\frac{x \cdot t_0}{z} \leq 5 \cdot 10^{+161}:\\ \;\;\;\;\frac{x}{\frac{z}{t_0}}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \frac{x}{z}\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x (+.f64 (-.f64 y z) 1)) z) < 4.9999999999999997e161

    1. Initial program 92.4%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*98.0%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    3. Simplified98.0%

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

    if 4.9999999999999997e161 < (/.f64 (*.f64 x (+.f64 (-.f64 y z) 1)) z)

    1. Initial program 78.9%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*88.9%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    3. Simplified88.9%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    4. Step-by-step derivation
      1. associate-/r/99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \leq 5 \cdot 10^{+161}:\\ \;\;\;\;\frac{x}{\frac{z}{\left(y - z\right) + 1}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(y - z\right) + 1\right) \cdot \frac{x}{z}\\ \end{array} \]

Alternative 4?

\[\begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ \mathbf{if}\;z \leq -0.95:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-102}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-167}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-176}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{-44}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{+19}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]
Derivation
  1. Split input into 3 regimes
  2. if z < -0.94999999999999996 or 1.15e19 < z

    1. Initial program 76.5%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    4. Taylor expanded in z around inf 82.9%

      \[\leadsto \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. neg-mul-182.9%

        \[\leadsto \color{blue}{-x} \]
    6. Simplified82.9%

      \[\leadsto \color{blue}{-x} \]

    if -0.94999999999999996 < z < -2.50000000000000013e-102 or -1.64999999999999998e-167 < z < 1.90000000000000006e-176 or 1.7499999999999999e-44 < z < 1.15e19

    1. Initial program 99.9%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*90.4%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    3. Simplified90.4%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    4. Taylor expanded in y around inf 57.9%

      \[\leadsto \frac{x}{\color{blue}{\frac{z}{y}}} \]
    5. Step-by-step derivation
      1. associate-/r/71.3%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    6. Applied egg-rr71.3%

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

    if -2.50000000000000013e-102 < z < -1.64999999999999998e-167 or 1.90000000000000006e-176 < z < 1.7499999999999999e-44

    1. Initial program 100.0%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*97.8%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    3. Simplified97.8%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    4. Taylor expanded in z around 0 97.8%

      \[\leadsto \frac{x}{\color{blue}{\frac{z}{1 + y}}} \]
    5. Taylor expanded in y around 0 79.4%

      \[\leadsto \color{blue}{\frac{x}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification77.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.95:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-167}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-176}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{-44}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{+19}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 5?

\[\begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;x \cdot \frac{y}{z} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} - x\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if y < -1 or 1 < y

    1. Initial program 90.4%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. +-commutative90.4%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. sub-neg90.4%

        \[\leadsto \frac{x \cdot \left(1 + \color{blue}{\left(y + \left(-z\right)\right)}\right)}{z} \]
      3. +-commutative90.4%

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(\left(1 + \left(-z\right)\right) + y\right)}}{z} \]
      5. unsub-neg90.4%

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(1 - z\right)} + y\right)}{z} \]
      6. associate-+l-90.4%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 - \left(z - y\right)\right)}}{z} \]
      7. distribute-lft-out--90.4%

        \[\leadsto \frac{\color{blue}{x \cdot 1 - x \cdot \left(z - y\right)}}{z} \]
      8. *-rgt-identity90.4%

        \[\leadsto \frac{\color{blue}{x} - x \cdot \left(z - y\right)}{z} \]
      9. distribute-rgt-out--89.2%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x - y \cdot x\right)}}{z} \]
      10. sub-neg89.2%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x + \left(-y \cdot x\right)\right)}}{z} \]
      11. +-commutative89.2%

        \[\leadsto \frac{x - \color{blue}{\left(\left(-y \cdot x\right) + z \cdot x\right)}}{z} \]
      12. associate--r+89.2%

        \[\leadsto \frac{\color{blue}{\left(x - \left(-y \cdot x\right)\right) - z \cdot x}}{z} \]
      13. div-sub89.2%

        \[\leadsto \color{blue}{\frac{x - \left(-y \cdot x\right)}{z} - \frac{z \cdot x}{z}} \]
    3. Simplified92.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x} \]
    4. Taylor expanded in y around inf 91.9%

      \[\leadsto \color{blue}{\frac{y \cdot x}{z}} - x \]
    5. Step-by-step derivation
      1. associate-/l*95.7%

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} - x \]
    6. Simplified95.7%

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} - x \]
    7. Taylor expanded in y around 0 91.9%

      \[\leadsto \color{blue}{\frac{y \cdot x}{z} + -1 \cdot x} \]
    8. Step-by-step derivation
      1. neg-mul-191.9%

        \[\leadsto \frac{y \cdot x}{z} + \color{blue}{\left(-x\right)} \]
      2. sub-neg91.9%

        \[\leadsto \color{blue}{\frac{y \cdot x}{z} - x} \]
      3. associate-*l/91.3%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot x} - x \]
      4. *-commutative91.3%

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} - x \]
    9. Simplified91.3%

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

    if -1 < y < 1

    1. Initial program 88.4%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. +-commutative88.4%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. sub-neg88.4%

        \[\leadsto \frac{x \cdot \left(1 + \color{blue}{\left(y + \left(-z\right)\right)}\right)}{z} \]
      3. +-commutative88.4%

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(\left(1 + \left(-z\right)\right) + y\right)}}{z} \]
      5. unsub-neg88.4%

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(1 - z\right)} + y\right)}{z} \]
      6. associate-+l-88.4%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 - \left(z - y\right)\right)}}{z} \]
      7. distribute-lft-out--88.4%

        \[\leadsto \frac{\color{blue}{x \cdot 1 - x \cdot \left(z - y\right)}}{z} \]
      8. *-rgt-identity88.4%

        \[\leadsto \frac{\color{blue}{x} - x \cdot \left(z - y\right)}{z} \]
      9. distribute-rgt-out--88.4%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x - y \cdot x\right)}}{z} \]
      10. sub-neg88.4%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x + \left(-y \cdot x\right)\right)}}{z} \]
      11. +-commutative88.4%

        \[\leadsto \frac{x - \color{blue}{\left(\left(-y \cdot x\right) + z \cdot x\right)}}{z} \]
      12. associate--r+88.4%

        \[\leadsto \frac{\color{blue}{\left(x - \left(-y \cdot x\right)\right) - z \cdot x}}{z} \]
      13. div-sub88.3%

        \[\leadsto \color{blue}{\frac{x - \left(-y \cdot x\right)}{z} - \frac{z \cdot x}{z}} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x} \]
    4. Taylor expanded in y around 0 99.0%

      \[\leadsto \color{blue}{\frac{x}{z}} - x \]
  3. Recombined 2 regimes into one program.
  4. Final simplification95.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;x \cdot \frac{y}{z} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} - x\\ \end{array} \]

Alternative 6?

\[\begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;\frac{y}{\frac{z}{x}} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} - x\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if y < -1 or 1 < y

    1. Initial program 90.4%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. +-commutative90.4%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. sub-neg90.4%

        \[\leadsto \frac{x \cdot \left(1 + \color{blue}{\left(y + \left(-z\right)\right)}\right)}{z} \]
      3. +-commutative90.4%

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(\left(1 + \left(-z\right)\right) + y\right)}}{z} \]
      5. unsub-neg90.4%

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(1 - z\right)} + y\right)}{z} \]
      6. associate-+l-90.4%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 - \left(z - y\right)\right)}}{z} \]
      7. distribute-lft-out--90.4%

        \[\leadsto \frac{\color{blue}{x \cdot 1 - x \cdot \left(z - y\right)}}{z} \]
      8. *-rgt-identity90.4%

        \[\leadsto \frac{\color{blue}{x} - x \cdot \left(z - y\right)}{z} \]
      9. distribute-rgt-out--89.2%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x - y \cdot x\right)}}{z} \]
      10. sub-neg89.2%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x + \left(-y \cdot x\right)\right)}}{z} \]
      11. +-commutative89.2%

        \[\leadsto \frac{x - \color{blue}{\left(\left(-y \cdot x\right) + z \cdot x\right)}}{z} \]
      12. associate--r+89.2%

        \[\leadsto \frac{\color{blue}{\left(x - \left(-y \cdot x\right)\right) - z \cdot x}}{z} \]
      13. div-sub89.2%

        \[\leadsto \color{blue}{\frac{x - \left(-y \cdot x\right)}{z} - \frac{z \cdot x}{z}} \]
    3. Simplified92.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x} \]
    4. Taylor expanded in y around inf 91.9%

      \[\leadsto \color{blue}{\frac{y \cdot x}{z}} - x \]
    5. Step-by-step derivation
      1. associate-/l*95.7%

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} - x \]
    6. Simplified95.7%

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

    if -1 < y < 1

    1. Initial program 88.4%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. +-commutative88.4%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. sub-neg88.4%

        \[\leadsto \frac{x \cdot \left(1 + \color{blue}{\left(y + \left(-z\right)\right)}\right)}{z} \]
      3. +-commutative88.4%

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(\left(1 + \left(-z\right)\right) + y\right)}}{z} \]
      5. unsub-neg88.4%

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(1 - z\right)} + y\right)}{z} \]
      6. associate-+l-88.4%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 - \left(z - y\right)\right)}}{z} \]
      7. distribute-lft-out--88.4%

        \[\leadsto \frac{\color{blue}{x \cdot 1 - x \cdot \left(z - y\right)}}{z} \]
      8. *-rgt-identity88.4%

        \[\leadsto \frac{\color{blue}{x} - x \cdot \left(z - y\right)}{z} \]
      9. distribute-rgt-out--88.4%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x - y \cdot x\right)}}{z} \]
      10. sub-neg88.4%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x + \left(-y \cdot x\right)\right)}}{z} \]
      11. +-commutative88.4%

        \[\leadsto \frac{x - \color{blue}{\left(\left(-y \cdot x\right) + z \cdot x\right)}}{z} \]
      12. associate--r+88.4%

        \[\leadsto \frac{\color{blue}{\left(x - \left(-y \cdot x\right)\right) - z \cdot x}}{z} \]
      13. div-sub88.3%

        \[\leadsto \color{blue}{\frac{x - \left(-y \cdot x\right)}{z} - \frac{z \cdot x}{z}} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x} \]
    4. Taylor expanded in y around 0 99.0%

      \[\leadsto \color{blue}{\frac{x}{z}} - x \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;\frac{y}{\frac{z}{x}} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} - x\\ \end{array} \]

Alternative 7?

\[\begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;\frac{x \cdot y}{z} - x\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z}{x}} - x\\ \end{array} \]
Derivation
  1. Split input into 3 regimes
  2. if y < -1

    1. Initial program 92.6%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. +-commutative92.6%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. sub-neg92.6%

        \[\leadsto \frac{x \cdot \left(1 + \color{blue}{\left(y + \left(-z\right)\right)}\right)}{z} \]
      3. +-commutative92.6%

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(\left(1 + \left(-z\right)\right) + y\right)}}{z} \]
      5. unsub-neg92.6%

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(1 - z\right)} + y\right)}{z} \]
      6. associate-+l-92.6%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 - \left(z - y\right)\right)}}{z} \]
      7. distribute-lft-out--92.6%

        \[\leadsto \frac{\color{blue}{x \cdot 1 - x \cdot \left(z - y\right)}}{z} \]
      8. *-rgt-identity92.6%

        \[\leadsto \frac{\color{blue}{x} - x \cdot \left(z - y\right)}{z} \]
      9. distribute-rgt-out--90.7%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x - y \cdot x\right)}}{z} \]
      10. sub-neg90.7%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x + \left(-y \cdot x\right)\right)}}{z} \]
      11. +-commutative90.7%

        \[\leadsto \frac{x - \color{blue}{\left(\left(-y \cdot x\right) + z \cdot x\right)}}{z} \]
      12. associate--r+90.7%

        \[\leadsto \frac{\color{blue}{\left(x - \left(-y \cdot x\right)\right) - z \cdot x}}{z} \]
      13. div-sub90.6%

        \[\leadsto \color{blue}{\frac{x - \left(-y \cdot x\right)}{z} - \frac{z \cdot x}{z}} \]
    3. Simplified95.5%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x} \]
    4. Taylor expanded in y around inf 95.3%

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

    if -1 < y < 1

    1. Initial program 88.4%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. +-commutative88.4%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. sub-neg88.4%

        \[\leadsto \frac{x \cdot \left(1 + \color{blue}{\left(y + \left(-z\right)\right)}\right)}{z} \]
      3. +-commutative88.4%

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(\left(1 + \left(-z\right)\right) + y\right)}}{z} \]
      5. unsub-neg88.4%

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(1 - z\right)} + y\right)}{z} \]
      6. associate-+l-88.4%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 - \left(z - y\right)\right)}}{z} \]
      7. distribute-lft-out--88.4%

        \[\leadsto \frac{\color{blue}{x \cdot 1 - x \cdot \left(z - y\right)}}{z} \]
      8. *-rgt-identity88.4%

        \[\leadsto \frac{\color{blue}{x} - x \cdot \left(z - y\right)}{z} \]
      9. distribute-rgt-out--88.4%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x - y \cdot x\right)}}{z} \]
      10. sub-neg88.4%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x + \left(-y \cdot x\right)\right)}}{z} \]
      11. +-commutative88.4%

        \[\leadsto \frac{x - \color{blue}{\left(\left(-y \cdot x\right) + z \cdot x\right)}}{z} \]
      12. associate--r+88.4%

        \[\leadsto \frac{\color{blue}{\left(x - \left(-y \cdot x\right)\right) - z \cdot x}}{z} \]
      13. div-sub88.3%

        \[\leadsto \color{blue}{\frac{x - \left(-y \cdot x\right)}{z} - \frac{z \cdot x}{z}} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x} \]
    4. Taylor expanded in y around 0 99.0%

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

    if 1 < y

    1. Initial program 87.9%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. +-commutative87.9%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. sub-neg87.9%

        \[\leadsto \frac{x \cdot \left(1 + \color{blue}{\left(y + \left(-z\right)\right)}\right)}{z} \]
      3. +-commutative87.9%

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(\left(1 + \left(-z\right)\right) + y\right)}}{z} \]
      5. unsub-neg87.9%

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(1 - z\right)} + y\right)}{z} \]
      6. associate-+l-87.9%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 - \left(z - y\right)\right)}}{z} \]
      7. distribute-lft-out--87.9%

        \[\leadsto \frac{\color{blue}{x \cdot 1 - x \cdot \left(z - y\right)}}{z} \]
      8. *-rgt-identity87.9%

        \[\leadsto \frac{\color{blue}{x} - x \cdot \left(z - y\right)}{z} \]
      9. distribute-rgt-out--87.5%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x - y \cdot x\right)}}{z} \]
      10. sub-neg87.5%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x + \left(-y \cdot x\right)\right)}}{z} \]
      11. +-commutative87.5%

        \[\leadsto \frac{x - \color{blue}{\left(\left(-y \cdot x\right) + z \cdot x\right)}}{z} \]
      12. associate--r+87.5%

        \[\leadsto \frac{\color{blue}{\left(x - \left(-y \cdot x\right)\right) - z \cdot x}}{z} \]
      13. div-sub87.5%

        \[\leadsto \color{blue}{\frac{x - \left(-y \cdot x\right)}{z} - \frac{z \cdot x}{z}} \]
    3. Simplified88.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x} \]
    4. Taylor expanded in y around inf 88.0%

      \[\leadsto \color{blue}{\frac{y \cdot x}{z}} - x \]
    5. Step-by-step derivation
      1. associate-/l*96.4%

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} - x \]
    6. Simplified96.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;\frac{x \cdot y}{z} - x\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z}{x}} - x\\ \end{array} \]

Alternative 8?

\[\begin{array}{l} \mathbf{if}\;y \leq -1800000000 \lor \neg \left(y \leq 5 \cdot 10^{+19}\right):\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} - x\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if y < -1.8e9 or 5e19 < y

    1. Initial program 90.1%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*91.0%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    3. Simplified91.0%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    4. Taylor expanded in y around inf 69.3%

      \[\leadsto \frac{x}{\color{blue}{\frac{z}{y}}} \]
    5. Step-by-step derivation
      1. associate-/r/74.5%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    6. Applied egg-rr74.5%

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

    if -1.8e9 < y < 5e19

    1. Initial program 88.7%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. +-commutative88.7%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. sub-neg88.7%

        \[\leadsto \frac{x \cdot \left(1 + \color{blue}{\left(y + \left(-z\right)\right)}\right)}{z} \]
      3. +-commutative88.7%

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

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

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(1 - z\right)} + y\right)}{z} \]
      6. associate-+l-88.7%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 - \left(z - y\right)\right)}}{z} \]
      7. distribute-lft-out--88.7%

        \[\leadsto \frac{\color{blue}{x \cdot 1 - x \cdot \left(z - y\right)}}{z} \]
      8. *-rgt-identity88.7%

        \[\leadsto \frac{\color{blue}{x} - x \cdot \left(z - y\right)}{z} \]
      9. distribute-rgt-out--88.7%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x - y \cdot x\right)}}{z} \]
      10. sub-neg88.7%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x + \left(-y \cdot x\right)\right)}}{z} \]
      11. +-commutative88.7%

        \[\leadsto \frac{x - \color{blue}{\left(\left(-y \cdot x\right) + z \cdot x\right)}}{z} \]
      12. associate--r+88.7%

        \[\leadsto \frac{\color{blue}{\left(x - \left(-y \cdot x\right)\right) - z \cdot x}}{z} \]
      13. div-sub88.7%

        \[\leadsto \color{blue}{\frac{x - \left(-y \cdot x\right)}{z} - \frac{z \cdot x}{z}} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x} \]
    4. Taylor expanded in y around 0 99.0%

      \[\leadsto \color{blue}{\frac{x}{z}} - x \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1800000000 \lor \neg \left(y \leq 5 \cdot 10^{+19}\right):\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} - x\\ \end{array} \]

Alternative 9?

\[\begin{array}{l} \mathbf{if}\;y \leq -13500000000:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+20}:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \]
Derivation
  1. Split input into 3 regimes
  2. if y < -1.35e10

    1. Initial program 92.6%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Taylor expanded in y around inf 77.0%

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

    if -1.35e10 < y < 2.6e20

    1. Initial program 88.7%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. +-commutative88.7%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. sub-neg88.7%

        \[\leadsto \frac{x \cdot \left(1 + \color{blue}{\left(y + \left(-z\right)\right)}\right)}{z} \]
      3. +-commutative88.7%

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

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

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(1 - z\right)} + y\right)}{z} \]
      6. associate-+l-88.7%

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 - \left(z - y\right)\right)}}{z} \]
      7. distribute-lft-out--88.7%

        \[\leadsto \frac{\color{blue}{x \cdot 1 - x \cdot \left(z - y\right)}}{z} \]
      8. *-rgt-identity88.7%

        \[\leadsto \frac{\color{blue}{x} - x \cdot \left(z - y\right)}{z} \]
      9. distribute-rgt-out--88.7%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x - y \cdot x\right)}}{z} \]
      10. sub-neg88.7%

        \[\leadsto \frac{x - \color{blue}{\left(z \cdot x + \left(-y \cdot x\right)\right)}}{z} \]
      11. +-commutative88.7%

        \[\leadsto \frac{x - \color{blue}{\left(\left(-y \cdot x\right) + z \cdot x\right)}}{z} \]
      12. associate--r+88.7%

        \[\leadsto \frac{\color{blue}{\left(x - \left(-y \cdot x\right)\right) - z \cdot x}}{z} \]
      13. div-sub88.7%

        \[\leadsto \color{blue}{\frac{x - \left(-y \cdot x\right)}{z} - \frac{z \cdot x}{z}} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, x\right)}{z} - x} \]
    4. Taylor expanded in y around 0 99.0%

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

    if 2.6e20 < y

    1. Initial program 87.0%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*90.8%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    3. Simplified90.8%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    4. Taylor expanded in y around inf 68.3%

      \[\leadsto \frac{x}{\color{blue}{\frac{z}{y}}} \]
    5. Step-by-step derivation
      1. associate-/r/73.6%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    6. Applied egg-rr73.6%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -13500000000:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+20}:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \]

Alternative 10?

\[\begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if z < -1 or 1 < z

    1. Initial program 77.5%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    4. Taylor expanded in z around inf 80.3%

      \[\leadsto \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. neg-mul-180.3%

        \[\leadsto \color{blue}{-x} \]
    6. Simplified80.3%

      \[\leadsto \color{blue}{-x} \]

    if -1 < z < 1

    1. Initial program 99.9%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*92.4%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    3. Simplified92.4%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
    4. Taylor expanded in z around 0 91.8%

      \[\leadsto \frac{x}{\color{blue}{\frac{z}{1 + y}}} \]
    5. Taylor expanded in y around 0 55.1%

      \[\leadsto \color{blue}{\frac{x}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 11?

\[-x \]
Derivation
  1. Initial program 89.3%

    \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
  2. Step-by-step derivation
    1. associate-/l*96.0%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
  3. Simplified96.0%

    \[\leadsto \color{blue}{\frac{x}{\frac{z}{\left(y - z\right) + 1}}} \]
  4. Taylor expanded in z around inf 39.6%

    \[\leadsto \color{blue}{-1 \cdot x} \]
  5. Step-by-step derivation
    1. neg-mul-139.6%

      \[\leadsto \color{blue}{-x} \]
  6. Simplified39.6%

    \[\leadsto \color{blue}{-x} \]
  7. Final simplification39.6%

    \[\leadsto -x \]

Reproduce

?
herbie shell --seed 2023166 
(FPCore (x y z)
  :name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
  :precision binary64

  :herbie-target
  (if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))

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