Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H

?

Percentage Accurate: 95.5% → 97.8%
Time: 8.5s
Precision: binary64
Cost: 968

?

\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
\[\begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-55}:\\ \;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-188}:\\ \;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}{z}\\ \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
(FPCore (x y z t)
 :precision binary64
 (if (<= y -5e-55)
   (+ x (/ (- y (/ t y)) (* z -3.0)))
   (if (<= y 1.05e-188)
     (+ x (/ (/ (* t 0.3333333333333333) z) y))
     (+ x (/ (* 0.3333333333333333 (- (/ t y) y)) z)))))
double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -5e-55) {
		tmp = x + ((y - (t / y)) / (z * -3.0));
	} else if (y <= 1.05e-188) {
		tmp = x + (((t * 0.3333333333333333) / z) / y);
	} else {
		tmp = x + ((0.3333333333333333 * ((t / y) - y)) / z);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= (-5d-55)) then
        tmp = x + ((y - (t / y)) / (z * (-3.0d0)))
    else if (y <= 1.05d-188) then
        tmp = x + (((t * 0.3333333333333333d0) / z) / y)
    else
        tmp = x + ((0.3333333333333333d0 * ((t / y) - y)) / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -5e-55) {
		tmp = x + ((y - (t / y)) / (z * -3.0));
	} else if (y <= 1.05e-188) {
		tmp = x + (((t * 0.3333333333333333) / z) / y);
	} else {
		tmp = x + ((0.3333333333333333 * ((t / y) - y)) / z);
	}
	return tmp;
}
def code(x, y, z, t):
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
def code(x, y, z, t):
	tmp = 0
	if y <= -5e-55:
		tmp = x + ((y - (t / y)) / (z * -3.0))
	elif y <= 1.05e-188:
		tmp = x + (((t * 0.3333333333333333) / z) / y)
	else:
		tmp = x + ((0.3333333333333333 * ((t / y) - y)) / z)
	return tmp
function code(x, y, z, t)
	return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y)))
end
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -5e-55)
		tmp = Float64(x + Float64(Float64(y - Float64(t / y)) / Float64(z * -3.0)));
	elseif (y <= 1.05e-188)
		tmp = Float64(x + Float64(Float64(Float64(t * 0.3333333333333333) / z) / y));
	else
		tmp = Float64(x + Float64(Float64(0.3333333333333333 * Float64(Float64(t / y) - y)) / z));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -5e-55)
		tmp = x + ((y - (t / y)) / (z * -3.0));
	elseif (y <= 1.05e-188)
		tmp = x + (((t * 0.3333333333333333) / z) / y);
	else
		tmp = x + ((0.3333333333333333 * ((t / y) - y)) / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := If[LessEqual[y, -5e-55], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e-188], N[(x + N[(N[(N[(t * 0.3333333333333333), $MachinePrecision] / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(0.3333333333333333 * N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-55}:\\
\;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\

\mathbf{elif}\;y \leq 1.05 \cdot 10^{-188}:\\
\;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}{z}\\


\end{array}

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.

Herbie found 13 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

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.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original95.5%
Target96.2%
Herbie97.8%
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y} \]

Derivation?

  1. Split input into 3 regimes
  2. if y < -5.0000000000000002e-55

    1. Initial program 95.9%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Simplified99.7%

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
      Step-by-step derivation

      [Start]95.9%

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

      associate-+l- [=>]95.9%

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

      sub-neg [=>]95.9%

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

      sub-neg [=>]95.9%

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

      distribute-neg-in [=>]95.9%

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

      unsub-neg [=>]95.9%

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

      neg-mul-1 [=>]95.9%

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

      associate-*r/ [=>]95.9%

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

      associate-*l/ [<=]95.7%

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

      distribute-neg-frac [=>]95.7%

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

      neg-mul-1 [=>]95.7%

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

      times-frac [=>]97.0%

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

      distribute-lft-out-- [=>]99.7%

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

      *-commutative [=>]99.7%

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

      associate-/r* [=>]99.7%

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

      metadata-eval [=>]99.7%

      \[ x + \frac{\color{blue}{-0.3333333333333333}}{z} \cdot \left(y - \frac{t}{y}\right) \]
    3. Applied egg-rr99.7%

      \[\leadsto x + \color{blue}{{\left(\frac{z}{-0.3333333333333333}\right)}^{-1}} \cdot \left(y - \frac{t}{y}\right) \]
      Step-by-step derivation

      [Start]99.7%

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

      clear-num [=>]99.7%

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

      inv-pow [=>]99.7%

      \[ x + \color{blue}{{\left(\frac{z}{-0.3333333333333333}\right)}^{-1}} \cdot \left(y - \frac{t}{y}\right) \]
    4. Simplified99.7%

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

      [Start]99.7%

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

      unpow-1 [=>]99.7%

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

      \[\leadsto x + \color{blue}{\frac{y - \frac{t}{y}}{z \cdot -3}} \]
      Step-by-step derivation

      [Start]99.7%

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

      associate-*l/ [=>]99.7%

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

      *-un-lft-identity [<=]99.7%

      \[ x + \frac{\color{blue}{y - \frac{t}{y}}}{\frac{z}{-0.3333333333333333}} \]

      div-inv [=>]99.8%

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

      metadata-eval [=>]99.8%

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

    if -5.0000000000000002e-55 < y < 1.05e-188

    1. Initial program 93.1%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Simplified83.4%

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
      Step-by-step derivation

      [Start]93.1%

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

      associate-+l- [=>]93.1%

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

      sub-neg [=>]93.1%

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

      sub-neg [=>]93.1%

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

      distribute-neg-in [=>]93.1%

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

      unsub-neg [=>]93.1%

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

      neg-mul-1 [=>]93.1%

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

      associate-*r/ [=>]93.1%

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

      associate-*l/ [<=]93.1%

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

      distribute-neg-frac [=>]93.1%

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

      neg-mul-1 [=>]93.1%

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

      times-frac [=>]83.5%

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

      distribute-lft-out-- [=>]83.5%

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

      *-commutative [=>]83.5%

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

      associate-/r* [=>]83.4%

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

      metadata-eval [=>]83.4%

      \[ x + \frac{\color{blue}{-0.3333333333333333}}{z} \cdot \left(y - \frac{t}{y}\right) \]
    3. Taylor expanded in y around 0 93.0%

      \[\leadsto x + \color{blue}{0.3333333333333333 \cdot \frac{t}{y \cdot z}} \]
    4. Simplified83.4%

      \[\leadsto x + \color{blue}{\frac{t}{y} \cdot \frac{0.3333333333333333}{z}} \]
      Step-by-step derivation

      [Start]93.0%

      \[ x + 0.3333333333333333 \cdot \frac{t}{y \cdot z} \]

      *-commutative [=>]93.0%

      \[ x + \color{blue}{\frac{t}{y \cdot z} \cdot 0.3333333333333333} \]

      associate-*l/ [=>]93.0%

      \[ x + \color{blue}{\frac{t \cdot 0.3333333333333333}{y \cdot z}} \]

      times-frac [=>]83.4%

      \[ x + \color{blue}{\frac{t}{y} \cdot \frac{0.3333333333333333}{z}} \]
    5. Applied egg-rr98.9%

      \[\leadsto x + \color{blue}{\frac{t \cdot \frac{0.3333333333333333}{z}}{y}} \]
      Step-by-step derivation

      [Start]83.4%

      \[ x + \frac{t}{y} \cdot \frac{0.3333333333333333}{z} \]

      associate-*l/ [=>]98.9%

      \[ x + \color{blue}{\frac{t \cdot \frac{0.3333333333333333}{z}}{y}} \]
    6. Applied egg-rr99.0%

      \[\leadsto x + \frac{\color{blue}{\frac{t \cdot 0.3333333333333333}{z}}}{y} \]
      Step-by-step derivation

      [Start]98.9%

      \[ x + \frac{t \cdot \frac{0.3333333333333333}{z}}{y} \]

      associate-*r/ [=>]99.0%

      \[ x + \frac{\color{blue}{\frac{t \cdot 0.3333333333333333}{z}}}{y} \]

    if 1.05e-188 < y

    1. Initial program 97.8%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Simplified99.7%

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
      Step-by-step derivation

      [Start]97.8%

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

      associate-+l- [=>]97.8%

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

      sub-neg [=>]97.8%

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

      sub-neg [=>]97.8%

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

      distribute-neg-in [=>]97.8%

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

      unsub-neg [=>]97.8%

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

      neg-mul-1 [=>]97.8%

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

      associate-*r/ [=>]97.8%

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

      associate-*l/ [<=]97.7%

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

      distribute-neg-frac [=>]97.7%

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

      neg-mul-1 [=>]97.7%

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

      times-frac [=>]99.6%

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

      distribute-lft-out-- [=>]99.7%

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

      *-commutative [=>]99.7%

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

      associate-/r* [=>]99.7%

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

      metadata-eval [=>]99.7%

      \[ x + \frac{\color{blue}{-0.3333333333333333}}{z} \cdot \left(y - \frac{t}{y}\right) \]
    3. Taylor expanded in y around 0 97.8%

      \[\leadsto x + \color{blue}{\left(-0.3333333333333333 \cdot \frac{y}{z} + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\right)} \]
    4. Simplified99.8%

      \[\leadsto x + \color{blue}{\frac{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}{z}} \]
      Step-by-step derivation

      [Start]97.8%

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

      +-commutative [=>]97.8%

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

      metadata-eval [<=]97.8%

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

      cancel-sign-sub-inv [<=]97.8%

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

      associate-/r* [=>]99.7%

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

      associate-*r/ [=>]99.8%

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

      associate-*r/ [=>]99.8%

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

      div-sub [<=]99.8%

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

      distribute-lft-out-- [=>]99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-55}:\\ \;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-188}:\\ \;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}{z}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy97.8%
Cost968
\[\begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-55}:\\ \;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-188}:\\ \;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}{z}\\ \end{array} \]
Alternative 2
Accuracy97.4%
Cost1988
\[\begin{array}{l} t_1 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;t_1 + \frac{t}{y \cdot \left(z \cdot 3\right)} \leq 10^{+282}:\\ \;\;\;\;t_1 + \frac{\frac{t}{z \cdot 3}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\ \end{array} \]
Alternative 3
Accuracy97.5%
Cost1988
\[\begin{array}{l} t_1 := \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\ \mathbf{if}\;t_1 \leq 10^{+282}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\ \end{array} \]
Alternative 4
Accuracy98.0%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-54} \lor \neg \left(y \leq 1.5 \cdot 10^{-148}\right):\\ \;\;\;\;x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\ \end{array} \]
Alternative 5
Accuracy97.8%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq -2.4 \cdot 10^{-54} \lor \neg \left(y \leq 5.8 \cdot 10^{-189}\right):\\ \;\;\;\;x + \frac{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\ \end{array} \]
Alternative 6
Accuracy89.3%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -4.1 \cdot 10^{+39} \lor \neg \left(y \leq 9.5 \cdot 10^{+22}\right):\\ \;\;\;\;x + \frac{\frac{y}{-3}}{z}\\ \mathbf{else}:\\ \;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\ \end{array} \]
Alternative 7
Accuracy89.4%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -2.85 \cdot 10^{+41} \lor \neg \left(y \leq 3.4 \cdot 10^{+22}\right):\\ \;\;\;\;x + \frac{\frac{y}{-3}}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{t}{3 \cdot \left(y \cdot z\right)}\\ \end{array} \]
Alternative 8
Accuracy92.1%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{+40} \lor \neg \left(y \leq 7000000000\right):\\ \;\;\;\;x + \frac{\frac{y}{-3}}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.3333333333333333 \cdot \frac{t}{z}}{y}\\ \end{array} \]
Alternative 9
Accuracy92.0%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -2.7 \cdot 10^{+39} \lor \neg \left(y \leq 20000\right):\\ \;\;\;\;x + \frac{\frac{y}{-3}}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\ \end{array} \]
Alternative 10
Accuracy65.1%
Cost448
\[x + y \cdot \frac{-0.3333333333333333}{z} \]
Alternative 11
Accuracy65.1%
Cost448
\[x + \frac{y}{z \cdot -3} \]
Alternative 12
Accuracy65.1%
Cost448
\[x + \frac{\frac{y}{-3}}{z} \]
Alternative 13
Accuracy30.6%
Cost64
\[x \]

Reproduce?

herbie shell --seed 2023171 
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, H"
  :precision binary64

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

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