Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, B

Percentage Accurate: 100.0% → 100.0%
Time: 3.5s
Alternatives: 7
Speedup: 1.2×

Specification

?
\[\begin{array}{l} \\ \left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))
double code(double x, double y, double z, double t) {
	return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
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 = (((1.0d0 / 8.0d0) * x) - ((y * z) / 2.0d0)) + t
end function
public static double code(double x, double y, double z, double t) {
	return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
def code(x, y, z, t):
	return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(1.0 / 8.0) * x) - Float64(Float64(y * z) / 2.0)) + t)
end
function tmp = code(x, y, z, t)
	tmp = (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / 8.0), $MachinePrecision] * x), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}

\\
\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t
\end{array}

Sampling outcomes in binary64 precision:

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 7 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.

Initial Program: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))
double code(double x, double y, double z, double t) {
	return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
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 = (((1.0d0 / 8.0d0) * x) - ((y * z) / 2.0d0)) + t
end function
public static double code(double x, double y, double z, double t) {
	return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
def code(x, y, z, t):
	return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(1.0 / 8.0) * x) - Float64(Float64(y * z) / 2.0)) + t)
end
function tmp = code(x, y, z, t)
	tmp = (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / 8.0), $MachinePrecision] * x), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}

\\
\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t
\end{array}

Alternative 1: 100.0% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t \end{array} \]
(FPCore (x y z t) :precision binary64 (+ (- (* 0.125 x) (* (/ y 2.0) z)) t))
double code(double x, double y, double z, double t) {
	return ((0.125 * x) - ((y / 2.0) * z)) + t;
}
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 = ((0.125d0 * x) - ((y / 2.0d0) * z)) + t
end function
public static double code(double x, double y, double z, double t) {
	return ((0.125 * x) - ((y / 2.0) * z)) + t;
}
def code(x, y, z, t):
	return ((0.125 * x) - ((y / 2.0) * z)) + t
function code(x, y, z, t)
	return Float64(Float64(Float64(0.125 * x) - Float64(Float64(y / 2.0) * z)) + t)
end
function tmp = code(x, y, z, t)
	tmp = ((0.125 * x) - ((y / 2.0) * z)) + t;
end
code[x_, y_, z_, t_] := N[(N[(N[(0.125 * x), $MachinePrecision] - N[(N[(y / 2.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}

\\
\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t
\end{array}
Derivation
  1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
    2. +-commutative100.0%

      \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
    3. neg-sub0100.0%

      \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
    4. associate-+l-100.0%

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

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

      \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
    7. associate--r+100.0%

      \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
    8. neg-sub0100.0%

      \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
    9. distribute-rgt-neg-in100.0%

      \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
    10. distribute-rgt-neg-in100.0%

      \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
    11. metadata-eval100.0%

      \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
    12. remove-double-neg100.0%

      \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
    13. associate-*l/100.0%

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

    \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
  4. Final simplification100.0%

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

Alternative 2: 55.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y \cdot z\right) \cdot -0.5\\ \mathbf{if}\;y \cdot z \leq -2.5 \cdot 10^{+127}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \cdot z \leq -6.8 \cdot 10^{-84}:\\ \;\;\;\;0.125 \cdot x\\ \mathbf{elif}\;y \cdot z \leq -1.36 \cdot 10^{-266}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \cdot z \leq 0:\\ \;\;\;\;0.125 \cdot x\\ \mathbf{elif}\;y \cdot z \leq 1.1 \cdot 10^{-29}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (* y z) -0.5)))
   (if (<= (* y z) -2.5e+127)
     t_1
     (if (<= (* y z) -6.8e-84)
       (* 0.125 x)
       (if (<= (* y z) -1.36e-266)
         t
         (if (<= (* y z) 0.0) (* 0.125 x) (if (<= (* y z) 1.1e-29) t t_1)))))))
double code(double x, double y, double z, double t) {
	double t_1 = (y * z) * -0.5;
	double tmp;
	if ((y * z) <= -2.5e+127) {
		tmp = t_1;
	} else if ((y * z) <= -6.8e-84) {
		tmp = 0.125 * x;
	} else if ((y * z) <= -1.36e-266) {
		tmp = t;
	} else if ((y * z) <= 0.0) {
		tmp = 0.125 * x;
	} else if ((y * z) <= 1.1e-29) {
		tmp = t;
	} else {
		tmp = t_1;
	}
	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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (y * z) * (-0.5d0)
    if ((y * z) <= (-2.5d+127)) then
        tmp = t_1
    else if ((y * z) <= (-6.8d-84)) then
        tmp = 0.125d0 * x
    else if ((y * z) <= (-1.36d-266)) then
        tmp = t
    else if ((y * z) <= 0.0d0) then
        tmp = 0.125d0 * x
    else if ((y * z) <= 1.1d-29) then
        tmp = t
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (y * z) * -0.5;
	double tmp;
	if ((y * z) <= -2.5e+127) {
		tmp = t_1;
	} else if ((y * z) <= -6.8e-84) {
		tmp = 0.125 * x;
	} else if ((y * z) <= -1.36e-266) {
		tmp = t;
	} else if ((y * z) <= 0.0) {
		tmp = 0.125 * x;
	} else if ((y * z) <= 1.1e-29) {
		tmp = t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (y * z) * -0.5
	tmp = 0
	if (y * z) <= -2.5e+127:
		tmp = t_1
	elif (y * z) <= -6.8e-84:
		tmp = 0.125 * x
	elif (y * z) <= -1.36e-266:
		tmp = t
	elif (y * z) <= 0.0:
		tmp = 0.125 * x
	elif (y * z) <= 1.1e-29:
		tmp = t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(y * z) * -0.5)
	tmp = 0.0
	if (Float64(y * z) <= -2.5e+127)
		tmp = t_1;
	elseif (Float64(y * z) <= -6.8e-84)
		tmp = Float64(0.125 * x);
	elseif (Float64(y * z) <= -1.36e-266)
		tmp = t;
	elseif (Float64(y * z) <= 0.0)
		tmp = Float64(0.125 * x);
	elseif (Float64(y * z) <= 1.1e-29)
		tmp = t;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (y * z) * -0.5;
	tmp = 0.0;
	if ((y * z) <= -2.5e+127)
		tmp = t_1;
	elseif ((y * z) <= -6.8e-84)
		tmp = 0.125 * x;
	elseif ((y * z) <= -1.36e-266)
		tmp = t;
	elseif ((y * z) <= 0.0)
		tmp = 0.125 * x;
	elseif ((y * z) <= 1.1e-29)
		tmp = t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[N[(y * z), $MachinePrecision], -2.5e+127], t$95$1, If[LessEqual[N[(y * z), $MachinePrecision], -6.8e-84], N[(0.125 * x), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], -1.36e-266], t, If[LessEqual[N[(y * z), $MachinePrecision], 0.0], N[(0.125 * x), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 1.1e-29], t, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(y \cdot z\right) \cdot -0.5\\
\mathbf{if}\;y \cdot z \leq -2.5 \cdot 10^{+127}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \cdot z \leq -6.8 \cdot 10^{-84}:\\
\;\;\;\;0.125 \cdot x\\

\mathbf{elif}\;y \cdot z \leq -1.36 \cdot 10^{-266}:\\
\;\;\;\;t\\

\mathbf{elif}\;y \cdot z \leq 0:\\
\;\;\;\;0.125 \cdot x\\

\mathbf{elif}\;y \cdot z \leq 1.1 \cdot 10^{-29}:\\
\;\;\;\;t\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 y z) < -2.5000000000000002e127 or 1.09999999999999995e-29 < (*.f64 y z)

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
      3. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
      4. associate-+l-100.0%

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

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

        \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
      7. associate--r+100.0%

        \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
      8. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      9. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
      10. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      11. metadata-eval100.0%

        \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
      12. remove-double-neg100.0%

        \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
      13. associate-*l/100.0%

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

      \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
    4. Taylor expanded in y around inf 73.5%

      \[\leadsto \color{blue}{-0.5 \cdot \left(y \cdot z\right)} \]
    5. Step-by-step derivation
      1. *-commutative73.5%

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot -0.5} \]
    6. Simplified73.5%

      \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot -0.5} \]

    if -2.5000000000000002e127 < (*.f64 y z) < -6.80000000000000042e-84 or -1.36000000000000008e-266 < (*.f64 y z) < -0.0

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
      3. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
      4. associate-+l-100.0%

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

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

        \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
      7. associate--r+100.0%

        \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
      8. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      9. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
      10. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      11. metadata-eval100.0%

        \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
      12. remove-double-neg100.0%

        \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
      13. associate-*l/100.0%

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

      \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
    4. Taylor expanded in x around inf 55.9%

      \[\leadsto \color{blue}{0.125 \cdot x} \]

    if -6.80000000000000042e-84 < (*.f64 y z) < -1.36000000000000008e-266 or -0.0 < (*.f64 y z) < 1.09999999999999995e-29

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
      3. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
      4. associate-+l-100.0%

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

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

        \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
      7. associate--r+100.0%

        \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
      8. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      9. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
      10. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      11. metadata-eval100.0%

        \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
      12. remove-double-neg100.0%

        \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
      13. associate-*l/100.0%

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

      \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
    4. Taylor expanded in t around inf 58.0%

      \[\leadsto \color{blue}{t} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification63.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq -2.5 \cdot 10^{+127}:\\ \;\;\;\;\left(y \cdot z\right) \cdot -0.5\\ \mathbf{elif}\;y \cdot z \leq -6.8 \cdot 10^{-84}:\\ \;\;\;\;0.125 \cdot x\\ \mathbf{elif}\;y \cdot z \leq -1.36 \cdot 10^{-266}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \cdot z \leq 0:\\ \;\;\;\;0.125 \cdot x\\ \mathbf{elif}\;y \cdot z \leq 1.1 \cdot 10^{-29}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot z\right) \cdot -0.5\\ \end{array} \]

Alternative 3: 87.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \cdot z \leq -1.75 \cdot 10^{+127} \lor \neg \left(y \cdot z \leq 1.7 \cdot 10^{+87}\right):\\ \;\;\;\;t - 0.5 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;0.125 \cdot x + t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (* y z) -1.75e+127) (not (<= (* y z) 1.7e+87)))
   (- t (* 0.5 (* y z)))
   (+ (* 0.125 x) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((y * z) <= -1.75e+127) || !((y * z) <= 1.7e+87)) {
		tmp = t - (0.5 * (y * z));
	} else {
		tmp = (0.125 * x) + t;
	}
	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
    real(8) :: tmp
    if (((y * z) <= (-1.75d+127)) .or. (.not. ((y * z) <= 1.7d+87))) then
        tmp = t - (0.5d0 * (y * z))
    else
        tmp = (0.125d0 * x) + t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((y * z) <= -1.75e+127) || !((y * z) <= 1.7e+87)) {
		tmp = t - (0.5 * (y * z));
	} else {
		tmp = (0.125 * x) + t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((y * z) <= -1.75e+127) or not ((y * z) <= 1.7e+87):
		tmp = t - (0.5 * (y * z))
	else:
		tmp = (0.125 * x) + t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(y * z) <= -1.75e+127) || !(Float64(y * z) <= 1.7e+87))
		tmp = Float64(t - Float64(0.5 * Float64(y * z)));
	else
		tmp = Float64(Float64(0.125 * x) + t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((y * z) <= -1.75e+127) || ~(((y * z) <= 1.7e+87)))
		tmp = t - (0.5 * (y * z));
	else
		tmp = (0.125 * x) + t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y * z), $MachinePrecision], -1.75e+127], N[Not[LessEqual[N[(y * z), $MachinePrecision], 1.7e+87]], $MachinePrecision]], N[(t - N[(0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.125 * x), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -1.75 \cdot 10^{+127} \lor \neg \left(y \cdot z \leq 1.7 \cdot 10^{+87}\right):\\
\;\;\;\;t - 0.5 \cdot \left(y \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;0.125 \cdot x + t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y z) < -1.74999999999999989e127 or 1.7000000000000001e87 < (*.f64 y z)

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
      3. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
      4. associate-+l-100.0%

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

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

        \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
      7. associate--r+100.0%

        \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
      8. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      9. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
      10. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      11. metadata-eval100.0%

        \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
      12. remove-double-neg100.0%

        \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
      13. associate-*l/100.0%

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

      \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
    4. Taylor expanded in x around 0 92.5%

      \[\leadsto \color{blue}{t - 0.5 \cdot \left(y \cdot z\right)} \]

    if -1.74999999999999989e127 < (*.f64 y z) < 1.7000000000000001e87

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
      3. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
      4. associate-+l-100.0%

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

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

        \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
      7. associate--r+100.0%

        \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
      8. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      9. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
      10. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      11. metadata-eval100.0%

        \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
      12. remove-double-neg100.0%

        \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
      13. associate-*l/100.0%

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

      \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
    4. Taylor expanded in y around 0 85.8%

      \[\leadsto \color{blue}{0.125 \cdot x + t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq -1.75 \cdot 10^{+127} \lor \neg \left(y \cdot z \leq 1.7 \cdot 10^{+87}\right):\\ \;\;\;\;t - 0.5 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;0.125 \cdot x + t\\ \end{array} \]

Alternative 4: 84.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \cdot z \leq -2.5 \cdot 10^{+158} \lor \neg \left(y \cdot z \leq 1.05 \cdot 10^{+128}\right):\\ \;\;\;\;\left(y \cdot z\right) \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;0.125 \cdot x + t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (* y z) -2.5e+158) (not (<= (* y z) 1.05e+128)))
   (* (* y z) -0.5)
   (+ (* 0.125 x) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((y * z) <= -2.5e+158) || !((y * z) <= 1.05e+128)) {
		tmp = (y * z) * -0.5;
	} else {
		tmp = (0.125 * x) + t;
	}
	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
    real(8) :: tmp
    if (((y * z) <= (-2.5d+158)) .or. (.not. ((y * z) <= 1.05d+128))) then
        tmp = (y * z) * (-0.5d0)
    else
        tmp = (0.125d0 * x) + t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((y * z) <= -2.5e+158) || !((y * z) <= 1.05e+128)) {
		tmp = (y * z) * -0.5;
	} else {
		tmp = (0.125 * x) + t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((y * z) <= -2.5e+158) or not ((y * z) <= 1.05e+128):
		tmp = (y * z) * -0.5
	else:
		tmp = (0.125 * x) + t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(y * z) <= -2.5e+158) || !(Float64(y * z) <= 1.05e+128))
		tmp = Float64(Float64(y * z) * -0.5);
	else
		tmp = Float64(Float64(0.125 * x) + t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((y * z) <= -2.5e+158) || ~(((y * z) <= 1.05e+128)))
		tmp = (y * z) * -0.5;
	else
		tmp = (0.125 * x) + t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y * z), $MachinePrecision], -2.5e+158], N[Not[LessEqual[N[(y * z), $MachinePrecision], 1.05e+128]], $MachinePrecision]], N[(N[(y * z), $MachinePrecision] * -0.5), $MachinePrecision], N[(N[(0.125 * x), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -2.5 \cdot 10^{+158} \lor \neg \left(y \cdot z \leq 1.05 \cdot 10^{+128}\right):\\
\;\;\;\;\left(y \cdot z\right) \cdot -0.5\\

\mathbf{else}:\\
\;\;\;\;0.125 \cdot x + t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y z) < -2.4999999999999998e158 or 1.05e128 < (*.f64 y z)

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
      3. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
      4. associate-+l-100.0%

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

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

        \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
      7. associate--r+100.0%

        \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
      8. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      9. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
      10. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      11. metadata-eval100.0%

        \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
      12. remove-double-neg100.0%

        \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
      13. associate-*l/100.0%

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

      \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
    4. Taylor expanded in y around inf 90.5%

      \[\leadsto \color{blue}{-0.5 \cdot \left(y \cdot z\right)} \]
    5. Step-by-step derivation
      1. *-commutative90.5%

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot -0.5} \]
    6. Simplified90.5%

      \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot -0.5} \]

    if -2.4999999999999998e158 < (*.f64 y z) < 1.05e128

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
      3. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
      4. associate-+l-100.0%

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

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

        \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
      7. associate--r+100.0%

        \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
      8. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      9. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
      10. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      11. metadata-eval100.0%

        \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
      12. remove-double-neg100.0%

        \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
      13. associate-*l/100.0%

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

      \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
    4. Taylor expanded in y around 0 83.5%

      \[\leadsto \color{blue}{0.125 \cdot x + t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification85.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq -2.5 \cdot 10^{+158} \lor \neg \left(y \cdot z \leq 1.05 \cdot 10^{+128}\right):\\ \;\;\;\;\left(y \cdot z\right) \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;0.125 \cdot x + t\\ \end{array} \]

Alternative 5: 85.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 0.5 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;t \leq -0.011 \lor \neg \left(t \leq 2.7 \cdot 10^{+92}\right):\\ \;\;\;\;t - t_1\\ \mathbf{else}:\\ \;\;\;\;0.125 \cdot x - t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 0.5 (* y z))))
   (if (or (<= t -0.011) (not (<= t 2.7e+92))) (- t t_1) (- (* 0.125 x) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = 0.5 * (y * z);
	double tmp;
	if ((t <= -0.011) || !(t <= 2.7e+92)) {
		tmp = t - t_1;
	} else {
		tmp = (0.125 * x) - t_1;
	}
	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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = 0.5d0 * (y * z)
    if ((t <= (-0.011d0)) .or. (.not. (t <= 2.7d+92))) then
        tmp = t - t_1
    else
        tmp = (0.125d0 * x) - t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = 0.5 * (y * z);
	double tmp;
	if ((t <= -0.011) || !(t <= 2.7e+92)) {
		tmp = t - t_1;
	} else {
		tmp = (0.125 * x) - t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 0.5 * (y * z)
	tmp = 0
	if (t <= -0.011) or not (t <= 2.7e+92):
		tmp = t - t_1
	else:
		tmp = (0.125 * x) - t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(0.5 * Float64(y * z))
	tmp = 0.0
	if ((t <= -0.011) || !(t <= 2.7e+92))
		tmp = Float64(t - t_1);
	else
		tmp = Float64(Float64(0.125 * x) - t_1);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 0.5 * (y * z);
	tmp = 0.0;
	if ((t <= -0.011) || ~((t <= 2.7e+92)))
		tmp = t - t_1;
	else
		tmp = (0.125 * x) - t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -0.011], N[Not[LessEqual[t, 2.7e+92]], $MachinePrecision]], N[(t - t$95$1), $MachinePrecision], N[(N[(0.125 * x), $MachinePrecision] - t$95$1), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 0.5 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;t \leq -0.011 \lor \neg \left(t \leq 2.7 \cdot 10^{+92}\right):\\
\;\;\;\;t - t_1\\

\mathbf{else}:\\
\;\;\;\;0.125 \cdot x - t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -0.010999999999999999 or 2.6999999999999999e92 < t

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
      3. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
      4. associate-+l-100.0%

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

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

        \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
      7. associate--r+100.0%

        \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
      8. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      9. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
      10. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      11. metadata-eval100.0%

        \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
      12. remove-double-neg100.0%

        \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
      13. associate-*l/100.0%

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

      \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
    4. Taylor expanded in x around 0 89.3%

      \[\leadsto \color{blue}{t - 0.5 \cdot \left(y \cdot z\right)} \]

    if -0.010999999999999999 < t < 2.6999999999999999e92

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
      3. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
      4. associate-+l-100.0%

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

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

        \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
      7. associate--r+100.0%

        \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
      8. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      9. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
      10. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      11. metadata-eval100.0%

        \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
      12. remove-double-neg100.0%

        \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
      13. associate-*l/100.0%

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

      \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
    4. Taylor expanded in t around 0 91.9%

      \[\leadsto \color{blue}{0.125 \cdot x - 0.5 \cdot \left(y \cdot z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -0.011 \lor \neg \left(t \leq 2.7 \cdot 10^{+92}\right):\\ \;\;\;\;t - 0.5 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;0.125 \cdot x - 0.5 \cdot \left(y \cdot z\right)\\ \end{array} \]

Alternative 6: 50.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.3 \cdot 10^{+103}:\\ \;\;\;\;0.125 \cdot x\\ \mathbf{elif}\;x \leq 8.8 \cdot 10^{+95}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;0.125 \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -3.3e+103) (* 0.125 x) (if (<= x 8.8e+95) t (* 0.125 x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -3.3e+103) {
		tmp = 0.125 * x;
	} else if (x <= 8.8e+95) {
		tmp = t;
	} else {
		tmp = 0.125 * x;
	}
	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
    real(8) :: tmp
    if (x <= (-3.3d+103)) then
        tmp = 0.125d0 * x
    else if (x <= 8.8d+95) then
        tmp = t
    else
        tmp = 0.125d0 * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -3.3e+103) {
		tmp = 0.125 * x;
	} else if (x <= 8.8e+95) {
		tmp = t;
	} else {
		tmp = 0.125 * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -3.3e+103:
		tmp = 0.125 * x
	elif x <= 8.8e+95:
		tmp = t
	else:
		tmp = 0.125 * x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -3.3e+103)
		tmp = Float64(0.125 * x);
	elseif (x <= 8.8e+95)
		tmp = t;
	else
		tmp = Float64(0.125 * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= -3.3e+103)
		tmp = 0.125 * x;
	elseif (x <= 8.8e+95)
		tmp = t;
	else
		tmp = 0.125 * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.3e+103], N[(0.125 * x), $MachinePrecision], If[LessEqual[x, 8.8e+95], t, N[(0.125 * x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{+103}:\\
\;\;\;\;0.125 \cdot x\\

\mathbf{elif}\;x \leq 8.8 \cdot 10^{+95}:\\
\;\;\;\;t\\

\mathbf{else}:\\
\;\;\;\;0.125 \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.30000000000000009e103 or 8.7999999999999996e95 < x

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
      3. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
      4. associate-+l-100.0%

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

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

        \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
      7. associate--r+100.0%

        \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
      8. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      9. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
      10. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      11. metadata-eval100.0%

        \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
      12. remove-double-neg100.0%

        \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
      13. associate-*l/100.0%

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

      \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
    4. Taylor expanded in x around inf 67.6%

      \[\leadsto \color{blue}{0.125 \cdot x} \]

    if -3.30000000000000009e103 < x < 8.7999999999999996e95

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
      3. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
      4. associate-+l-100.0%

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

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

        \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
      7. associate--r+100.0%

        \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
      8. neg-sub0100.0%

        \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      9. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
      10. distribute-rgt-neg-in100.0%

        \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
      11. metadata-eval100.0%

        \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
      12. remove-double-neg100.0%

        \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
      13. associate-*l/100.0%

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

      \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
    4. Taylor expanded in t around inf 47.7%

      \[\leadsto \color{blue}{t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification55.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.3 \cdot 10^{+103}:\\ \;\;\;\;0.125 \cdot x\\ \mathbf{elif}\;x \leq 8.8 \cdot 10^{+95}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;0.125 \cdot x\\ \end{array} \]

Alternative 7: 33.7% accurate, 13.0× speedup?

\[\begin{array}{l} \\ t \end{array} \]
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
	return t;
}
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 = t
end function
public static double code(double x, double y, double z, double t) {
	return t;
}
def code(x, y, z, t):
	return t
function code(x, y, z, t)
	return t
end
function tmp = code(x, y, z, t)
	tmp = t;
end
code[x_, y_, z_, t_] := t
\begin{array}{l}

\\
t
\end{array}
Derivation
  1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(\frac{1}{8} \cdot x + \left(-\frac{y \cdot z}{2}\right)\right)} + t \]
    2. +-commutative100.0%

      \[\leadsto \color{blue}{\left(\left(-\frac{y \cdot z}{2}\right) + \frac{1}{8} \cdot x\right)} + t \]
    3. neg-sub0100.0%

      \[\leadsto \left(\color{blue}{\left(0 - \frac{y \cdot z}{2}\right)} + \frac{1}{8} \cdot x\right) + t \]
    4. associate-+l-100.0%

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

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

      \[\leadsto \left(0 - \color{blue}{\left(\left(-\frac{1}{8} \cdot x\right) + \frac{y \cdot z}{2}\right)}\right) + t \]
    7. associate--r+100.0%

      \[\leadsto \color{blue}{\left(\left(0 - \left(-\frac{1}{8} \cdot x\right)\right) - \frac{y \cdot z}{2}\right)} + t \]
    8. neg-sub0100.0%

      \[\leadsto \left(\color{blue}{\left(-\left(-\frac{1}{8} \cdot x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
    9. distribute-rgt-neg-in100.0%

      \[\leadsto \left(\left(-\color{blue}{\frac{1}{8} \cdot \left(-x\right)}\right) - \frac{y \cdot z}{2}\right) + t \]
    10. distribute-rgt-neg-in100.0%

      \[\leadsto \left(\color{blue}{\frac{1}{8} \cdot \left(-\left(-x\right)\right)} - \frac{y \cdot z}{2}\right) + t \]
    11. metadata-eval100.0%

      \[\leadsto \left(\color{blue}{0.125} \cdot \left(-\left(-x\right)\right) - \frac{y \cdot z}{2}\right) + t \]
    12. remove-double-neg100.0%

      \[\leadsto \left(0.125 \cdot \color{blue}{x} - \frac{y \cdot z}{2}\right) + t \]
    13. associate-*l/100.0%

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

    \[\leadsto \color{blue}{\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t} \]
  4. Taylor expanded in t around inf 34.1%

    \[\leadsto \color{blue}{t} \]
  5. Final simplification34.1%

    \[\leadsto t \]

Developer target: 100.0% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \left(\frac{x}{8} + t\right) - \frac{z}{2} \cdot y \end{array} \]
(FPCore (x y z t) :precision binary64 (- (+ (/ x 8.0) t) (* (/ z 2.0) y)))
double code(double x, double y, double z, double t) {
	return ((x / 8.0) + t) - ((z / 2.0) * y);
}
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 / 8.0d0) + t) - ((z / 2.0d0) * y)
end function
public static double code(double x, double y, double z, double t) {
	return ((x / 8.0) + t) - ((z / 2.0) * y);
}
def code(x, y, z, t):
	return ((x / 8.0) + t) - ((z / 2.0) * y)
function code(x, y, z, t)
	return Float64(Float64(Float64(x / 8.0) + t) - Float64(Float64(z / 2.0) * y))
end
function tmp = code(x, y, z, t)
	tmp = ((x / 8.0) + t) - ((z / 2.0) * y);
end
code[x_, y_, z_, t_] := N[(N[(N[(x / 8.0), $MachinePrecision] + t), $MachinePrecision] - N[(N[(z / 2.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\frac{x}{8} + t\right) - \frac{z}{2} \cdot y
\end{array}

Reproduce

?
herbie shell --seed 2023229 
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:quartForm  from diagrams-solve-0.1, B"
  :precision binary64

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

  (+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))