Language.Haskell.HsColour.ColourHighlight:unbase from hscolour-1.23

Percentage Accurate: 99.9% → 99.9%
Time: 6.5s
Alternatives: 6
Speedup: 1.0×

Specification

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

\\
\left(x \cdot y + z\right) \cdot y + 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 6 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: 99.9% accurate, 1.0× speedup?

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

\\
\left(x \cdot y + z\right) \cdot y + t
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

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

\\
t + y \cdot \left(z + x \cdot y\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(x \cdot y + z\right) \cdot y + t \]
  2. Add Preprocessing
  3. Final simplification99.9%

    \[\leadsto t + y \cdot \left(z + x \cdot y\right) \]
  4. Add Preprocessing

Alternative 2: 89.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(z + x \cdot y\right)\\ \mathbf{if}\;y \leq -2 \cdot 10^{+35}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 9.6 \cdot 10^{-31}:\\ \;\;\;\;t + y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (+ z (* x y)))))
   (if (<= y -2e+35) t_1 (if (<= y 9.6e-31) (+ t (* y z)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (z + (x * y));
	double tmp;
	if (y <= -2e+35) {
		tmp = t_1;
	} else if (y <= 9.6e-31) {
		tmp = t + (y * z);
	} 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 + (x * y))
    if (y <= (-2d+35)) then
        tmp = t_1
    else if (y <= 9.6d-31) then
        tmp = t + (y * z)
    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 + (x * y));
	double tmp;
	if (y <= -2e+35) {
		tmp = t_1;
	} else if (y <= 9.6e-31) {
		tmp = t + (y * z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (z + (x * y))
	tmp = 0
	if y <= -2e+35:
		tmp = t_1
	elif y <= 9.6e-31:
		tmp = t + (y * z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(z + Float64(x * y)))
	tmp = 0.0
	if (y <= -2e+35)
		tmp = t_1;
	elseif (y <= 9.6e-31)
		tmp = Float64(t + Float64(y * z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (z + (x * y));
	tmp = 0.0;
	if (y <= -2e+35)
		tmp = t_1;
	elseif (y <= 9.6e-31)
		tmp = t + (y * z);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e+35], t$95$1, If[LessEqual[y, 9.6e-31], N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot \left(z + x \cdot y\right)\\
\mathbf{if}\;y \leq -2 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 9.6 \cdot 10^{-31}:\\
\;\;\;\;t + y \cdot z\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.9999999999999999e35 or 9.6000000000000001e-31 < y

    1. Initial program 99.9%

      \[\left(x \cdot y + z\right) \cdot y + t \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{{y}^{2} \cdot \left(x + \frac{z}{y}\right)} \]
    4. Step-by-step derivation
      1. distribute-rgt-inN/A

        \[\leadsto x \cdot {y}^{2} + \color{blue}{\frac{z}{y} \cdot {y}^{2}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{z}{y} \cdot {y}^{2} + \color{blue}{x \cdot {y}^{2}} \]
      3. unpow2N/A

        \[\leadsto \frac{z}{y} \cdot \left(y \cdot y\right) + x \cdot {y}^{2} \]
      4. associate-*r*N/A

        \[\leadsto \left(\frac{z}{y} \cdot y\right) \cdot y + \color{blue}{x} \cdot {y}^{2} \]
      5. fma-defineN/A

        \[\leadsto \mathsf{fma}\left(\frac{z}{y} \cdot y, \color{blue}{y}, x \cdot {y}^{2}\right) \]
      6. associate-*l/N/A

        \[\leadsto \mathsf{fma}\left(\frac{z \cdot y}{y}, y, x \cdot {y}^{2}\right) \]
      7. associate-/l*N/A

        \[\leadsto \mathsf{fma}\left(z \cdot \frac{y}{y}, y, x \cdot {y}^{2}\right) \]
      8. *-inversesN/A

        \[\leadsto \mathsf{fma}\left(z \cdot 1, y, x \cdot {y}^{2}\right) \]
      9. *-rgt-identityN/A

        \[\leadsto \mathsf{fma}\left(z, y, x \cdot {y}^{2}\right) \]
      10. fma-defineN/A

        \[\leadsto z \cdot y + \color{blue}{x \cdot {y}^{2}} \]
      11. *-commutativeN/A

        \[\leadsto y \cdot z + \color{blue}{x} \cdot {y}^{2} \]
      12. unpow2N/A

        \[\leadsto y \cdot z + x \cdot \left(y \cdot \color{blue}{y}\right) \]
      13. associate-*r*N/A

        \[\leadsto y \cdot z + \left(x \cdot y\right) \cdot \color{blue}{y} \]
      14. *-commutativeN/A

        \[\leadsto y \cdot z + y \cdot \color{blue}{\left(x \cdot y\right)} \]
      15. distribute-lft-inN/A

        \[\leadsto y \cdot \color{blue}{\left(z + x \cdot y\right)} \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(z + x \cdot y\right)}\right) \]
      17. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(z, \color{blue}{\left(x \cdot y\right)}\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(z, \left(y \cdot \color{blue}{x}\right)\right)\right) \]
      19. *-lowering-*.f6493.2%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(z, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right)\right) \]
    5. Simplified93.2%

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

    if -1.9999999999999999e35 < y < 9.6000000000000001e-31

    1. Initial program 100.0%

      \[\left(x \cdot y + z\right) \cdot y + t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\color{blue}{z}, y\right), t\right) \]
    4. Step-by-step derivation
      1. Simplified93.1%

        \[\leadsto \color{blue}{z} \cdot y + t \]
    5. Recombined 2 regimes into one program.
    6. Final simplification93.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{+35}:\\ \;\;\;\;y \cdot \left(z + x \cdot y\right)\\ \mathbf{elif}\;y \leq 9.6 \cdot 10^{-31}:\\ \;\;\;\;t + y \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z + x \cdot y\right)\\ \end{array} \]
    7. Add Preprocessing

    Alternative 3: 79.0% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(x \cdot y\right)\\ \mathbf{if}\;y \leq -1.16 \cdot 10^{+54}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 3100000000:\\ \;\;\;\;t + y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (let* ((t_1 (* y (* x y))))
       (if (<= y -1.16e+54) t_1 (if (<= y 3100000000.0) (+ t (* y z)) t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = y * (x * y);
    	double tmp;
    	if (y <= -1.16e+54) {
    		tmp = t_1;
    	} else if (y <= 3100000000.0) {
    		tmp = t + (y * z);
    	} 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 * (x * y)
        if (y <= (-1.16d+54)) then
            tmp = t_1
        else if (y <= 3100000000.0d0) then
            tmp = t + (y * z)
        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 * (x * y);
    	double tmp;
    	if (y <= -1.16e+54) {
    		tmp = t_1;
    	} else if (y <= 3100000000.0) {
    		tmp = t + (y * z);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	t_1 = y * (x * y)
    	tmp = 0
    	if y <= -1.16e+54:
    		tmp = t_1
    	elif y <= 3100000000.0:
    		tmp = t + (y * z)
    	else:
    		tmp = t_1
    	return tmp
    
    function code(x, y, z, t)
    	t_1 = Float64(y * Float64(x * y))
    	tmp = 0.0
    	if (y <= -1.16e+54)
    		tmp = t_1;
    	elseif (y <= 3100000000.0)
    		tmp = Float64(t + Float64(y * z));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	t_1 = y * (x * y);
    	tmp = 0.0;
    	if (y <= -1.16e+54)
    		tmp = t_1;
    	elseif (y <= 3100000000.0)
    		tmp = t + (y * z);
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.16e+54], t$95$1, If[LessEqual[y, 3100000000.0], N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := y \cdot \left(x \cdot y\right)\\
    \mathbf{if}\;y \leq -1.16 \cdot 10^{+54}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;y \leq 3100000000:\\
    \;\;\;\;t + y \cdot z\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -1.1600000000000001e54 or 3.1e9 < y

      1. Initial program 99.9%

        \[\left(x \cdot y + z\right) \cdot y + t \]
      2. Add Preprocessing
      3. Taylor expanded in x around inf

        \[\leadsto \color{blue}{x \cdot {y}^{2}} \]
      4. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto x \cdot \left(y \cdot \color{blue}{y}\right) \]
        2. associate-*r*N/A

          \[\leadsto \left(x \cdot y\right) \cdot \color{blue}{y} \]
        3. *-commutativeN/A

          \[\leadsto y \cdot \color{blue}{\left(x \cdot y\right)} \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(x \cdot y\right)}\right) \]
        5. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(y, \left(y \cdot \color{blue}{x}\right)\right) \]
        6. *-lowering-*.f6479.0%

          \[\leadsto \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right) \]
      5. Simplified79.0%

        \[\leadsto \color{blue}{y \cdot \left(y \cdot x\right)} \]

      if -1.1600000000000001e54 < y < 3.1e9

      1. Initial program 99.9%

        \[\left(x \cdot y + z\right) \cdot y + t \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\color{blue}{z}, y\right), t\right) \]
      4. Step-by-step derivation
        1. Simplified90.9%

          \[\leadsto \color{blue}{z} \cdot y + t \]
      5. Recombined 2 regimes into one program.
      6. Final simplification85.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.16 \cdot 10^{+54}:\\ \;\;\;\;y \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;y \leq 3100000000:\\ \;\;\;\;t + y \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot y\right)\\ \end{array} \]
      7. Add Preprocessing

      Alternative 4: 65.8% accurate, 0.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(x \cdot y\right)\\ \mathbf{if}\;y \leq -2.65 \cdot 10^{+39}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2.95 \cdot 10^{-30}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (let* ((t_1 (* y (* x y))))
         (if (<= y -2.65e+39) t_1 (if (<= y 2.95e-30) t t_1))))
      double code(double x, double y, double z, double t) {
      	double t_1 = y * (x * y);
      	double tmp;
      	if (y <= -2.65e+39) {
      		tmp = t_1;
      	} else if (y <= 2.95e-30) {
      		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 * (x * y)
          if (y <= (-2.65d+39)) then
              tmp = t_1
          else if (y <= 2.95d-30) 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 * (x * y);
      	double tmp;
      	if (y <= -2.65e+39) {
      		tmp = t_1;
      	} else if (y <= 2.95e-30) {
      		tmp = t;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(x, y, z, t):
      	t_1 = y * (x * y)
      	tmp = 0
      	if y <= -2.65e+39:
      		tmp = t_1
      	elif y <= 2.95e-30:
      		tmp = t
      	else:
      		tmp = t_1
      	return tmp
      
      function code(x, y, z, t)
      	t_1 = Float64(y * Float64(x * y))
      	tmp = 0.0
      	if (y <= -2.65e+39)
      		tmp = t_1;
      	elseif (y <= 2.95e-30)
      		tmp = t;
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z, t)
      	t_1 = y * (x * y);
      	tmp = 0.0;
      	if (y <= -2.65e+39)
      		tmp = t_1;
      	elseif (y <= 2.95e-30)
      		tmp = t;
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.65e+39], t$95$1, If[LessEqual[y, 2.95e-30], t, t$95$1]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := y \cdot \left(x \cdot y\right)\\
      \mathbf{if}\;y \leq -2.65 \cdot 10^{+39}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;y \leq 2.95 \cdot 10^{-30}:\\
      \;\;\;\;t\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -2.64999999999999989e39 or 2.9499999999999999e-30 < y

        1. Initial program 99.9%

          \[\left(x \cdot y + z\right) \cdot y + t \]
        2. Add Preprocessing
        3. Taylor expanded in x around inf

          \[\leadsto \color{blue}{x \cdot {y}^{2}} \]
        4. Step-by-step derivation
          1. unpow2N/A

            \[\leadsto x \cdot \left(y \cdot \color{blue}{y}\right) \]
          2. associate-*r*N/A

            \[\leadsto \left(x \cdot y\right) \cdot \color{blue}{y} \]
          3. *-commutativeN/A

            \[\leadsto y \cdot \color{blue}{\left(x \cdot y\right)} \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(x \cdot y\right)}\right) \]
          5. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(y, \left(y \cdot \color{blue}{x}\right)\right) \]
          6. *-lowering-*.f6476.7%

            \[\leadsto \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right) \]
        5. Simplified76.7%

          \[\leadsto \color{blue}{y \cdot \left(y \cdot x\right)} \]

        if -2.64999999999999989e39 < y < 2.9499999999999999e-30

        1. Initial program 100.0%

          \[\left(x \cdot y + z\right) \cdot y + t \]
        2. Add Preprocessing
        3. Taylor expanded in y around 0

          \[\leadsto \color{blue}{t} \]
        4. Step-by-step derivation
          1. Simplified70.4%

            \[\leadsto \color{blue}{t} \]
        5. Recombined 2 regimes into one program.
        6. Final simplification73.4%

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.65 \cdot 10^{+39}:\\ \;\;\;\;y \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;y \leq 2.95 \cdot 10^{-30}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot y\right)\\ \end{array} \]
        7. Add Preprocessing

        Alternative 5: 49.6% accurate, 0.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.9 \cdot 10^{+107}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{+216}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (if (<= z -2.9e+107) (* y z) (if (<= z 1.15e+216) t (* y z))))
        double code(double x, double y, double z, double t) {
        	double tmp;
        	if (z <= -2.9e+107) {
        		tmp = y * z;
        	} else if (z <= 1.15e+216) {
        		tmp = t;
        	} else {
        		tmp = 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
            real(8) :: tmp
            if (z <= (-2.9d+107)) then
                tmp = y * z
            else if (z <= 1.15d+216) then
                tmp = t
            else
                tmp = y * z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z, double t) {
        	double tmp;
        	if (z <= -2.9e+107) {
        		tmp = y * z;
        	} else if (z <= 1.15e+216) {
        		tmp = t;
        	} else {
        		tmp = y * z;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t):
        	tmp = 0
        	if z <= -2.9e+107:
        		tmp = y * z
        	elif z <= 1.15e+216:
        		tmp = t
        	else:
        		tmp = y * z
        	return tmp
        
        function code(x, y, z, t)
        	tmp = 0.0
        	if (z <= -2.9e+107)
        		tmp = Float64(y * z);
        	elseif (z <= 1.15e+216)
        		tmp = t;
        	else
        		tmp = Float64(y * z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z, t)
        	tmp = 0.0;
        	if (z <= -2.9e+107)
        		tmp = y * z;
        	elseif (z <= 1.15e+216)
        		tmp = t;
        	else
        		tmp = y * z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_] := If[LessEqual[z, -2.9e+107], N[(y * z), $MachinePrecision], If[LessEqual[z, 1.15e+216], t, N[(y * z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -2.9 \cdot 10^{+107}:\\
        \;\;\;\;y \cdot z\\
        
        \mathbf{elif}\;z \leq 1.15 \cdot 10^{+216}:\\
        \;\;\;\;t\\
        
        \mathbf{else}:\\
        \;\;\;\;y \cdot z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -2.89999999999999988e107 or 1.14999999999999998e216 < z

          1. Initial program 100.0%

            \[\left(x \cdot y + z\right) \cdot y + t \]
          2. Add Preprocessing
          3. Taylor expanded in z around inf

            \[\leadsto \color{blue}{y \cdot z} \]
          4. Step-by-step derivation
            1. *-lowering-*.f6471.4%

              \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{z}\right) \]
          5. Simplified71.4%

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

          if -2.89999999999999988e107 < z < 1.14999999999999998e216

          1. Initial program 99.9%

            \[\left(x \cdot y + z\right) \cdot y + t \]
          2. Add Preprocessing
          3. Taylor expanded in y around 0

            \[\leadsto \color{blue}{t} \]
          4. Step-by-step derivation
            1. Simplified47.9%

              \[\leadsto \color{blue}{t} \]
          5. Recombined 2 regimes into one program.
          6. Add Preprocessing

          Alternative 6: 39.3% accurate, 9.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 99.9%

            \[\left(x \cdot y + z\right) \cdot y + t \]
          2. Add Preprocessing
          3. Taylor expanded in y around 0

            \[\leadsto \color{blue}{t} \]
          4. Step-by-step derivation
            1. Simplified41.0%

              \[\leadsto \color{blue}{t} \]
            2. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2024161 
            (FPCore (x y z t)
              :name "Language.Haskell.HsColour.ColourHighlight:unbase from hscolour-1.23"
              :precision binary64
              (+ (* (+ (* x y) z) y) t))