Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A

Percentage Accurate: 99.7% → 99.8%
Time: 9.4s
Alternatives: 8
Speedup: 1.4×

Specification

?
\[\begin{array}{l} \\ 1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 1.0d0 + ((4.0d0 * ((x + (y * 0.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z):
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z)
	return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y))
end
function tmp = code(x, y, z)
	tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\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 8 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.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 1.0d0 + ((4.0d0 * ((x + (y * 0.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z):
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z)
	return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y))
end
function tmp = code(x, y, z)
	tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\end{array}

Alternative 1: 99.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ 4 + \frac{4}{y} \cdot \left(x - z\right) \end{array} \]
(FPCore (x y z) :precision binary64 (+ 4.0 (* (/ 4.0 y) (- x z))))
double code(double x, double y, double z) {
	return 4.0 + ((4.0 / y) * (x - z));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 4.0d0 + ((4.0d0 / y) * (x - z))
end function
public static double code(double x, double y, double z) {
	return 4.0 + ((4.0 / y) * (x - z));
}
def code(x, y, z):
	return 4.0 + ((4.0 / y) * (x - z))
function code(x, y, z)
	return Float64(4.0 + Float64(Float64(4.0 / y) * Float64(x - z)))
end
function tmp = code(x, y, z)
	tmp = 4.0 + ((4.0 / y) * (x - z));
end
code[x_, y_, z_] := N[(4.0 + N[(N[(4.0 / y), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
4 + \frac{4}{y} \cdot \left(x - z\right)
\end{array}
Derivation
  1. Initial program 98.8%

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

      \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
    2. +-commutativeN/A

      \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
    3. associate--l+N/A

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

      \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
    5. associate-+r+N/A

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

      \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
    7. associate-*l/N/A

      \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
    8. associate-/l*N/A

      \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
    9. *-inversesN/A

      \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
    10. metadata-evalN/A

      \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
    11. metadata-evalN/A

      \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
    12. metadata-evalN/A

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

      \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
    14. associate-*l/N/A

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

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

      \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
    17. --lowering--.f6499.3%

      \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
  3. Simplified99.3%

    \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

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

      \[\leadsto \mathsf{+.f64}\left(4, \mathsf{*.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\color{blue}{x} - z\right)\right)\right) \]
    6. --lowering--.f6499.8%

      \[\leadsto \mathsf{+.f64}\left(4, \mathsf{*.f64}\left(\mathsf{/.f64}\left(4, y\right), \mathsf{\_.f64}\left(x, \color{blue}{z}\right)\right)\right) \]
  6. Applied egg-rr99.8%

    \[\leadsto 4 + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)} \]
  7. Add Preprocessing

Alternative 2: 54.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -11500:\\ \;\;\;\;\frac{4}{y} \cdot x\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-119}:\\ \;\;\;\;\frac{z \cdot -4}{y}\\ \mathbf{elif}\;x \leq 8 \cdot 10^{+38}:\\ \;\;\;\;4\\ \mathbf{else}:\\ \;\;\;\;\frac{4 \cdot x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -11500.0)
   (* (/ 4.0 y) x)
   (if (<= x -3.7e-119)
     (/ (* z -4.0) y)
     (if (<= x 8e+38) 4.0 (/ (* 4.0 x) y)))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -11500.0) {
		tmp = (4.0 / y) * x;
	} else if (x <= -3.7e-119) {
		tmp = (z * -4.0) / y;
	} else if (x <= 8e+38) {
		tmp = 4.0;
	} else {
		tmp = (4.0 * x) / y;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-11500.0d0)) then
        tmp = (4.0d0 / y) * x
    else if (x <= (-3.7d-119)) then
        tmp = (z * (-4.0d0)) / y
    else if (x <= 8d+38) then
        tmp = 4.0d0
    else
        tmp = (4.0d0 * x) / y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -11500.0) {
		tmp = (4.0 / y) * x;
	} else if (x <= -3.7e-119) {
		tmp = (z * -4.0) / y;
	} else if (x <= 8e+38) {
		tmp = 4.0;
	} else {
		tmp = (4.0 * x) / y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -11500.0:
		tmp = (4.0 / y) * x
	elif x <= -3.7e-119:
		tmp = (z * -4.0) / y
	elif x <= 8e+38:
		tmp = 4.0
	else:
		tmp = (4.0 * x) / y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -11500.0)
		tmp = Float64(Float64(4.0 / y) * x);
	elseif (x <= -3.7e-119)
		tmp = Float64(Float64(z * -4.0) / y);
	elseif (x <= 8e+38)
		tmp = 4.0;
	else
		tmp = Float64(Float64(4.0 * x) / y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -11500.0)
		tmp = (4.0 / y) * x;
	elseif (x <= -3.7e-119)
		tmp = (z * -4.0) / y;
	elseif (x <= 8e+38)
		tmp = 4.0;
	else
		tmp = (4.0 * x) / y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -11500.0], N[(N[(4.0 / y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, -3.7e-119], N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 8e+38], 4.0, N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -11500:\\
\;\;\;\;\frac{4}{y} \cdot x\\

\mathbf{elif}\;x \leq -3.7 \cdot 10^{-119}:\\
\;\;\;\;\frac{z \cdot -4}{y}\\

\mathbf{elif}\;x \leq 8 \cdot 10^{+38}:\\
\;\;\;\;4\\

\mathbf{else}:\\
\;\;\;\;\frac{4 \cdot x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -11500

    1. Initial program 97.3%

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

        \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
      2. +-commutativeN/A

        \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
      3. associate--l+N/A

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

        \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
      5. associate-+r+N/A

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

        \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
      7. associate-*l/N/A

        \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      8. associate-/l*N/A

        \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      9. *-inversesN/A

        \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      10. metadata-evalN/A

        \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      11. metadata-evalN/A

        \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
      12. metadata-evalN/A

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

        \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
      14. associate-*l/N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
      17. --lowering--.f6497.3%

        \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
    3. Simplified97.3%

      \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{4 \cdot \frac{x}{y}} \]
    6. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{4 \cdot x}{\color{blue}{y}} \]
      2. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, x\right), y\right) \]
    7. Simplified76.8%

      \[\leadsto \color{blue}{\frac{4 \cdot x}{y}} \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{x \cdot 4}{y} \]
      2. associate-/l*N/A

        \[\leadsto x \cdot \color{blue}{\frac{4}{y}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{4}{y}\right)}\right) \]
      4. /-lowering-/.f6477.9%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(4, \color{blue}{y}\right)\right) \]
    9. Applied egg-rr77.9%

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

    if -11500 < x < -3.7000000000000001e-119

    1. Initial program 96.4%

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

        \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
      2. +-commutativeN/A

        \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
      3. associate--l+N/A

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

        \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
      5. associate-+r+N/A

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

        \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
      7. associate-*l/N/A

        \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      8. associate-/l*N/A

        \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      9. *-inversesN/A

        \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      10. metadata-evalN/A

        \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      11. metadata-evalN/A

        \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
      12. metadata-evalN/A

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

        \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
      14. associate-*l/N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
      17. --lowering--.f64100.0%

        \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf

      \[\leadsto \color{blue}{-4 \cdot \frac{z}{y}} \]
    6. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{-4 \cdot z}{\color{blue}{y}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(-4 \cdot z\right), \color{blue}{y}\right) \]
      3. *-lowering-*.f6461.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(-4, z\right), y\right) \]
    7. Simplified61.3%

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

    if -3.7000000000000001e-119 < x < 7.99999999999999982e38

    1. Initial program 99.8%

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

        \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
      2. +-commutativeN/A

        \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
      3. associate--l+N/A

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

        \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
      5. associate-+r+N/A

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

        \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
      7. associate-*l/N/A

        \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      8. associate-/l*N/A

        \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      9. *-inversesN/A

        \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      10. metadata-evalN/A

        \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
      11. metadata-evalN/A

        \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
      12. metadata-evalN/A

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

        \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
      14. associate-*l/N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
      17. --lowering--.f64100.0%

        \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf

      \[\leadsto \color{blue}{4} \]
    6. Step-by-step derivation
      1. Simplified54.2%

        \[\leadsto \color{blue}{4} \]

      if 7.99999999999999982e38 < x

      1. Initial program 100.0%

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

          \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
        2. +-commutativeN/A

          \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
        3. associate--l+N/A

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

          \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
        5. associate-+r+N/A

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

          \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
        7. associate-*l/N/A

          \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        8. associate-/l*N/A

          \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        9. *-inversesN/A

          \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        10. metadata-evalN/A

          \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        11. metadata-evalN/A

          \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
        12. metadata-evalN/A

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

          \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
        14. associate-*l/N/A

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

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

          \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
        17. --lowering--.f64100.0%

          \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
      3. Simplified100.0%

        \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
      4. Add Preprocessing
      5. Taylor expanded in x around inf

        \[\leadsto \color{blue}{4 \cdot \frac{x}{y}} \]
      6. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \frac{4 \cdot x}{\color{blue}{y}} \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(4 \cdot x\right), \color{blue}{y}\right) \]
        3. *-lowering-*.f6478.4%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, x\right), y\right) \]
      7. Simplified78.4%

        \[\leadsto \color{blue}{\frac{4 \cdot x}{y}} \]
    7. Recombined 4 regimes into one program.
    8. Final simplification66.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -11500:\\ \;\;\;\;\frac{4}{y} \cdot x\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-119}:\\ \;\;\;\;\frac{z \cdot -4}{y}\\ \mathbf{elif}\;x \leq 8 \cdot 10^{+38}:\\ \;\;\;\;4\\ \mathbf{else}:\\ \;\;\;\;\frac{4 \cdot x}{y}\\ \end{array} \]
    9. Add Preprocessing

    Alternative 3: 54.0% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{4}{y} \cdot x\\ \mathbf{if}\;x \leq -6200:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -4.8 \cdot 10^{-123}:\\ \;\;\;\;\frac{z \cdot -4}{y}\\ \mathbf{elif}\;x \leq 10^{+39}:\\ \;\;\;\;4\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (* (/ 4.0 y) x)))
       (if (<= x -6200.0)
         t_0
         (if (<= x -4.8e-123) (/ (* z -4.0) y) (if (<= x 1e+39) 4.0 t_0)))))
    double code(double x, double y, double z) {
    	double t_0 = (4.0 / y) * x;
    	double tmp;
    	if (x <= -6200.0) {
    		tmp = t_0;
    	} else if (x <= -4.8e-123) {
    		tmp = (z * -4.0) / y;
    	} else if (x <= 1e+39) {
    		tmp = 4.0;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8) :: t_0
        real(8) :: tmp
        t_0 = (4.0d0 / y) * x
        if (x <= (-6200.0d0)) then
            tmp = t_0
        else if (x <= (-4.8d-123)) then
            tmp = (z * (-4.0d0)) / y
        else if (x <= 1d+39) then
            tmp = 4.0d0
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = (4.0 / y) * x;
    	double tmp;
    	if (x <= -6200.0) {
    		tmp = t_0;
    	} else if (x <= -4.8e-123) {
    		tmp = (z * -4.0) / y;
    	} else if (x <= 1e+39) {
    		tmp = 4.0;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = (4.0 / y) * x
    	tmp = 0
    	if x <= -6200.0:
    		tmp = t_0
    	elif x <= -4.8e-123:
    		tmp = (z * -4.0) / y
    	elif x <= 1e+39:
    		tmp = 4.0
    	else:
    		tmp = t_0
    	return tmp
    
    function code(x, y, z)
    	t_0 = Float64(Float64(4.0 / y) * x)
    	tmp = 0.0
    	if (x <= -6200.0)
    		tmp = t_0;
    	elseif (x <= -4.8e-123)
    		tmp = Float64(Float64(z * -4.0) / y);
    	elseif (x <= 1e+39)
    		tmp = 4.0;
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = (4.0 / y) * x;
    	tmp = 0.0;
    	if (x <= -6200.0)
    		tmp = t_0;
    	elseif (x <= -4.8e-123)
    		tmp = (z * -4.0) / y;
    	elseif (x <= 1e+39)
    		tmp = 4.0;
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -6200.0], t$95$0, If[LessEqual[x, -4.8e-123], N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 1e+39], 4.0, t$95$0]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{4}{y} \cdot x\\
    \mathbf{if}\;x \leq -6200:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq -4.8 \cdot 10^{-123}:\\
    \;\;\;\;\frac{z \cdot -4}{y}\\
    
    \mathbf{elif}\;x \leq 10^{+39}:\\
    \;\;\;\;4\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if x < -6200 or 9.9999999999999994e38 < x

      1. Initial program 98.4%

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

          \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
        2. +-commutativeN/A

          \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
        3. associate--l+N/A

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

          \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
        5. associate-+r+N/A

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

          \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
        7. associate-*l/N/A

          \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        8. associate-/l*N/A

          \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        9. *-inversesN/A

          \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        10. metadata-evalN/A

          \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        11. metadata-evalN/A

          \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
        12. metadata-evalN/A

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

          \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
        14. associate-*l/N/A

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

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

          \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
        17. --lowering--.f6498.4%

          \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
      3. Simplified98.4%

        \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
      4. Add Preprocessing
      5. Taylor expanded in x around inf

        \[\leadsto \color{blue}{4 \cdot \frac{x}{y}} \]
      6. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \frac{4 \cdot x}{\color{blue}{y}} \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(4 \cdot x\right), \color{blue}{y}\right) \]
        3. *-lowering-*.f6477.5%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, x\right), y\right) \]
      7. Simplified77.5%

        \[\leadsto \color{blue}{\frac{4 \cdot x}{y}} \]
      8. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{x \cdot 4}{y} \]
        2. associate-/l*N/A

          \[\leadsto x \cdot \color{blue}{\frac{4}{y}} \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{4}{y}\right)}\right) \]
        4. /-lowering-/.f6478.1%

          \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(4, \color{blue}{y}\right)\right) \]
      9. Applied egg-rr78.1%

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

      if -6200 < x < -4.8e-123

      1. Initial program 96.4%

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

          \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
        2. +-commutativeN/A

          \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
        3. associate--l+N/A

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

          \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
        5. associate-+r+N/A

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

          \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
        7. associate-*l/N/A

          \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        8. associate-/l*N/A

          \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        9. *-inversesN/A

          \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        10. metadata-evalN/A

          \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        11. metadata-evalN/A

          \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
        12. metadata-evalN/A

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

          \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
        14. associate-*l/N/A

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

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

          \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
        17. --lowering--.f64100.0%

          \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
      3. Simplified100.0%

        \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
      4. Add Preprocessing
      5. Taylor expanded in z around inf

        \[\leadsto \color{blue}{-4 \cdot \frac{z}{y}} \]
      6. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \frac{-4 \cdot z}{\color{blue}{y}} \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(-4 \cdot z\right), \color{blue}{y}\right) \]
        3. *-lowering-*.f6461.3%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(-4, z\right), y\right) \]
      7. Simplified61.3%

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

      if -4.8e-123 < x < 9.9999999999999994e38

      1. Initial program 99.8%

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

          \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
        2. +-commutativeN/A

          \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
        3. associate--l+N/A

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

          \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
        5. associate-+r+N/A

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

          \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
        7. associate-*l/N/A

          \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        8. associate-/l*N/A

          \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        9. *-inversesN/A

          \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        10. metadata-evalN/A

          \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
        11. metadata-evalN/A

          \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
        12. metadata-evalN/A

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

          \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
        14. associate-*l/N/A

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

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

          \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
        17. --lowering--.f64100.0%

          \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
      3. Simplified100.0%

        \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
      4. Add Preprocessing
      5. Taylor expanded in y around inf

        \[\leadsto \color{blue}{4} \]
      6. Step-by-step derivation
        1. Simplified54.2%

          \[\leadsto \color{blue}{4} \]
      7. Recombined 3 regimes into one program.
      8. Final simplification66.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6200:\\ \;\;\;\;\frac{4}{y} \cdot x\\ \mathbf{elif}\;x \leq -4.8 \cdot 10^{-123}:\\ \;\;\;\;\frac{z \cdot -4}{y}\\ \mathbf{elif}\;x \leq 10^{+39}:\\ \;\;\;\;4\\ \mathbf{else}:\\ \;\;\;\;\frac{4}{y} \cdot x\\ \end{array} \]
      9. Add Preprocessing

      Alternative 4: 54.1% accurate, 0.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{4}{y} \cdot x\\ \mathbf{if}\;x \leq -19000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{-123}:\\ \;\;\;\;z \cdot \frac{-4}{y}\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{+40}:\\ \;\;\;\;4\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* (/ 4.0 y) x)))
         (if (<= x -19000.0)
           t_0
           (if (<= x -3.6e-123) (* z (/ -4.0 y)) (if (<= x 4.2e+40) 4.0 t_0)))))
      double code(double x, double y, double z) {
      	double t_0 = (4.0 / y) * x;
      	double tmp;
      	if (x <= -19000.0) {
      		tmp = t_0;
      	} else if (x <= -3.6e-123) {
      		tmp = z * (-4.0 / y);
      	} else if (x <= 4.2e+40) {
      		tmp = 4.0;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      real(8) function code(x, y, z)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8) :: t_0
          real(8) :: tmp
          t_0 = (4.0d0 / y) * x
          if (x <= (-19000.0d0)) then
              tmp = t_0
          else if (x <= (-3.6d-123)) then
              tmp = z * ((-4.0d0) / y)
          else if (x <= 4.2d+40) then
              tmp = 4.0d0
          else
              tmp = t_0
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double t_0 = (4.0 / y) * x;
      	double tmp;
      	if (x <= -19000.0) {
      		tmp = t_0;
      	} else if (x <= -3.6e-123) {
      		tmp = z * (-4.0 / y);
      	} else if (x <= 4.2e+40) {
      		tmp = 4.0;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = (4.0 / y) * x
      	tmp = 0
      	if x <= -19000.0:
      		tmp = t_0
      	elif x <= -3.6e-123:
      		tmp = z * (-4.0 / y)
      	elif x <= 4.2e+40:
      		tmp = 4.0
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(Float64(4.0 / y) * x)
      	tmp = 0.0
      	if (x <= -19000.0)
      		tmp = t_0;
      	elseif (x <= -3.6e-123)
      		tmp = Float64(z * Float64(-4.0 / y));
      	elseif (x <= 4.2e+40)
      		tmp = 4.0;
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = (4.0 / y) * x;
      	tmp = 0.0;
      	if (x <= -19000.0)
      		tmp = t_0;
      	elseif (x <= -3.6e-123)
      		tmp = z * (-4.0 / y);
      	elseif (x <= 4.2e+40)
      		tmp = 4.0;
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -19000.0], t$95$0, If[LessEqual[x, -3.6e-123], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.2e+40], 4.0, t$95$0]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{4}{y} \cdot x\\
      \mathbf{if}\;x \leq -19000:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq -3.6 \cdot 10^{-123}:\\
      \;\;\;\;z \cdot \frac{-4}{y}\\
      
      \mathbf{elif}\;x \leq 4.2 \cdot 10^{+40}:\\
      \;\;\;\;4\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if x < -19000 or 4.2000000000000002e40 < x

        1. Initial program 98.4%

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

            \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
          2. +-commutativeN/A

            \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
          3. associate--l+N/A

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

            \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
          5. associate-+r+N/A

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

            \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
          7. associate-*l/N/A

            \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          8. associate-/l*N/A

            \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          9. *-inversesN/A

            \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          10. metadata-evalN/A

            \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          11. metadata-evalN/A

            \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
          12. metadata-evalN/A

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

            \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
          14. associate-*l/N/A

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

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

            \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
          17. --lowering--.f6498.4%

            \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
        3. Simplified98.4%

          \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
        4. Add Preprocessing
        5. Taylor expanded in x around inf

          \[\leadsto \color{blue}{4 \cdot \frac{x}{y}} \]
        6. Step-by-step derivation
          1. associate-*r/N/A

            \[\leadsto \frac{4 \cdot x}{\color{blue}{y}} \]
          2. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\left(4 \cdot x\right), \color{blue}{y}\right) \]
          3. *-lowering-*.f6477.5%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, x\right), y\right) \]
        7. Simplified77.5%

          \[\leadsto \color{blue}{\frac{4 \cdot x}{y}} \]
        8. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \frac{x \cdot 4}{y} \]
          2. associate-/l*N/A

            \[\leadsto x \cdot \color{blue}{\frac{4}{y}} \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{4}{y}\right)}\right) \]
          4. /-lowering-/.f6478.1%

            \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(4, \color{blue}{y}\right)\right) \]
        9. Applied egg-rr78.1%

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

        if -19000 < x < -3.5999999999999997e-123

        1. Initial program 96.4%

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

            \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
          2. +-commutativeN/A

            \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
          3. associate--l+N/A

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

            \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
          5. associate-+r+N/A

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

            \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
          7. associate-*l/N/A

            \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          8. associate-/l*N/A

            \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          9. *-inversesN/A

            \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          10. metadata-evalN/A

            \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          11. metadata-evalN/A

            \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
          12. metadata-evalN/A

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

            \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
          14. associate-*l/N/A

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

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

            \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
          17. --lowering--.f64100.0%

            \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
        3. Simplified100.0%

          \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. *-commutativeN/A

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

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

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

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

            \[\leadsto \mathsf{+.f64}\left(4, \mathsf{*.f64}\left(\mathsf{/.f64}\left(4, y\right), \left(\color{blue}{x} - z\right)\right)\right) \]
          6. --lowering--.f6499.8%

            \[\leadsto \mathsf{+.f64}\left(4, \mathsf{*.f64}\left(\mathsf{/.f64}\left(4, y\right), \mathsf{\_.f64}\left(x, \color{blue}{z}\right)\right)\right) \]
        6. Applied egg-rr99.8%

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

          \[\leadsto \color{blue}{-4 \cdot \frac{z}{y}} \]
        8. Step-by-step derivation
          1. associate-*r/N/A

            \[\leadsto \frac{-4 \cdot z}{\color{blue}{y}} \]
          2. *-commutativeN/A

            \[\leadsto \frac{z \cdot -4}{y} \]
          3. associate-/l*N/A

            \[\leadsto z \cdot \color{blue}{\frac{-4}{y}} \]
          4. metadata-evalN/A

            \[\leadsto z \cdot \frac{\mathsf{neg}\left(4\right)}{y} \]
          5. distribute-neg-fracN/A

            \[\leadsto z \cdot \left(\mathsf{neg}\left(\frac{4}{y}\right)\right) \]
          6. metadata-evalN/A

            \[\leadsto z \cdot \left(\mathsf{neg}\left(\frac{4 \cdot 1}{y}\right)\right) \]
          7. associate-*r/N/A

            \[\leadsto z \cdot \left(\mathsf{neg}\left(4 \cdot \frac{1}{y}\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(z, \color{blue}{\left(\mathsf{neg}\left(4 \cdot \frac{1}{y}\right)\right)}\right) \]
          9. associate-*r/N/A

            \[\leadsto \mathsf{*.f64}\left(z, \left(\mathsf{neg}\left(\frac{4 \cdot 1}{y}\right)\right)\right) \]
          10. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(z, \left(\mathsf{neg}\left(\frac{4}{y}\right)\right)\right) \]
          11. distribute-neg-fracN/A

            \[\leadsto \mathsf{*.f64}\left(z, \left(\frac{\mathsf{neg}\left(4\right)}{\color{blue}{y}}\right)\right) \]
          12. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(z, \left(\frac{-4}{y}\right)\right) \]
          13. /-lowering-/.f6461.1%

            \[\leadsto \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(-4, \color{blue}{y}\right)\right) \]
        9. Simplified61.1%

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

        if -3.5999999999999997e-123 < x < 4.2000000000000002e40

        1. Initial program 99.8%

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

            \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
          2. +-commutativeN/A

            \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
          3. associate--l+N/A

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

            \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
          5. associate-+r+N/A

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

            \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
          7. associate-*l/N/A

            \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          8. associate-/l*N/A

            \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          9. *-inversesN/A

            \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          10. metadata-evalN/A

            \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
          11. metadata-evalN/A

            \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
          12. metadata-evalN/A

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

            \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
          14. associate-*l/N/A

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

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

            \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
          17. --lowering--.f64100.0%

            \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
        3. Simplified100.0%

          \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
        4. Add Preprocessing
        5. Taylor expanded in y around inf

          \[\leadsto \color{blue}{4} \]
        6. Step-by-step derivation
          1. Simplified54.2%

            \[\leadsto \color{blue}{4} \]
        7. Recombined 3 regimes into one program.
        8. Final simplification66.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -19000:\\ \;\;\;\;\frac{4}{y} \cdot x\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{-123}:\\ \;\;\;\;z \cdot \frac{-4}{y}\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{+40}:\\ \;\;\;\;4\\ \mathbf{else}:\\ \;\;\;\;\frac{4}{y} \cdot x\\ \end{array} \]
        9. Add Preprocessing

        Alternative 5: 86.2% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := 4 \cdot \frac{x - z}{y}\\ \mathbf{if}\;x \leq -1.65 \cdot 10^{+35}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 3.05 \cdot 10^{+40}:\\ \;\;\;\;4 + \frac{z \cdot -4}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (let* ((t_0 (* 4.0 (/ (- x z) y))))
           (if (<= x -1.65e+35)
             t_0
             (if (<= x 3.05e+40) (+ 4.0 (/ (* z -4.0) y)) t_0))))
        double code(double x, double y, double z) {
        	double t_0 = 4.0 * ((x - z) / y);
        	double tmp;
        	if (x <= -1.65e+35) {
        		tmp = t_0;
        	} else if (x <= 3.05e+40) {
        		tmp = 4.0 + ((z * -4.0) / y);
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: t_0
            real(8) :: tmp
            t_0 = 4.0d0 * ((x - z) / y)
            if (x <= (-1.65d+35)) then
                tmp = t_0
            else if (x <= 3.05d+40) then
                tmp = 4.0d0 + ((z * (-4.0d0)) / y)
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double t_0 = 4.0 * ((x - z) / y);
        	double tmp;
        	if (x <= -1.65e+35) {
        		tmp = t_0;
        	} else if (x <= 3.05e+40) {
        		tmp = 4.0 + ((z * -4.0) / y);
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	t_0 = 4.0 * ((x - z) / y)
        	tmp = 0
        	if x <= -1.65e+35:
        		tmp = t_0
        	elif x <= 3.05e+40:
        		tmp = 4.0 + ((z * -4.0) / y)
        	else:
        		tmp = t_0
        	return tmp
        
        function code(x, y, z)
        	t_0 = Float64(4.0 * Float64(Float64(x - z) / y))
        	tmp = 0.0
        	if (x <= -1.65e+35)
        		tmp = t_0;
        	elseif (x <= 3.05e+40)
        		tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y));
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	t_0 = 4.0 * ((x - z) / y);
        	tmp = 0.0;
        	if (x <= -1.65e+35)
        		tmp = t_0;
        	elseif (x <= 3.05e+40)
        		tmp = 4.0 + ((z * -4.0) / y);
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.65e+35], t$95$0, If[LessEqual[x, 3.05e+40], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := 4 \cdot \frac{x - z}{y}\\
        \mathbf{if}\;x \leq -1.65 \cdot 10^{+35}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;x \leq 3.05 \cdot 10^{+40}:\\
        \;\;\;\;4 + \frac{z \cdot -4}{y}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < -1.6500000000000001e35 or 3.05e40 < x

          1. Initial program 98.3%

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

              \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
            2. +-commutativeN/A

              \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
            3. associate--l+N/A

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

              \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
            5. associate-+r+N/A

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

              \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
            7. associate-*l/N/A

              \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            8. associate-/l*N/A

              \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            9. *-inversesN/A

              \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            10. metadata-evalN/A

              \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            11. metadata-evalN/A

              \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
            12. metadata-evalN/A

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

              \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
            14. associate-*l/N/A

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

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

              \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
            17. --lowering--.f6498.3%

              \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
          3. Simplified98.3%

            \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
          4. Add Preprocessing
          5. Taylor expanded in y around 0

            \[\leadsto \color{blue}{4 \cdot \frac{x - z}{y}} \]
          6. Step-by-step derivation
            1. *-lowering-*.f64N/A

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

              \[\leadsto \mathsf{*.f64}\left(4, \mathsf{/.f64}\left(\left(x - z\right), \color{blue}{y}\right)\right) \]
            3. --lowering--.f6493.0%

              \[\leadsto \mathsf{*.f64}\left(4, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x, z\right), y\right)\right) \]
          7. Simplified93.0%

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

          if -1.6500000000000001e35 < x < 3.05e40

          1. Initial program 99.2%

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

              \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
            2. +-commutativeN/A

              \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
            3. associate--l+N/A

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

              \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
            5. associate-+r+N/A

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

              \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
            7. associate-*l/N/A

              \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            8. associate-/l*N/A

              \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            9. *-inversesN/A

              \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            10. metadata-evalN/A

              \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            11. metadata-evalN/A

              \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
            12. metadata-evalN/A

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

              \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
            14. associate-*l/N/A

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

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

              \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
            17. --lowering--.f64100.0%

              \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
          3. Simplified100.0%

            \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
          4. Add Preprocessing
          5. Taylor expanded in x around 0

            \[\leadsto \color{blue}{4 + -4 \cdot \frac{z}{y}} \]
          6. Step-by-step derivation
            1. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(-4 \cdot \frac{z}{y}\right)}\right) \]
            2. associate-*r/N/A

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

              \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\left(-4 \cdot z\right), \color{blue}{y}\right)\right) \]
            4. *-lowering-*.f6490.8%

              \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(-4, z\right), y\right)\right) \]
          7. Simplified90.8%

            \[\leadsto \color{blue}{4 + \frac{-4 \cdot z}{y}} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification91.7%

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.65 \cdot 10^{+35}:\\ \;\;\;\;4 \cdot \frac{x - z}{y}\\ \mathbf{elif}\;x \leq 3.05 \cdot 10^{+40}:\\ \;\;\;\;4 + \frac{z \cdot -4}{y}\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \frac{x - z}{y}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 6: 80.1% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.8 \cdot 10^{+137}:\\ \;\;\;\;4\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{+111}:\\ \;\;\;\;4 \cdot \frac{x - z}{y}\\ \mathbf{else}:\\ \;\;\;\;4\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y -5.8e+137) 4.0 (if (<= y 4.5e+111) (* 4.0 (/ (- x z) y)) 4.0)))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -5.8e+137) {
        		tmp = 4.0;
        	} else if (y <= 4.5e+111) {
        		tmp = 4.0 * ((x - z) / y);
        	} else {
        		tmp = 4.0;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if (y <= (-5.8d+137)) then
                tmp = 4.0d0
            else if (y <= 4.5d+111) then
                tmp = 4.0d0 * ((x - z) / y)
            else
                tmp = 4.0d0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -5.8e+137) {
        		tmp = 4.0;
        	} else if (y <= 4.5e+111) {
        		tmp = 4.0 * ((x - z) / y);
        	} else {
        		tmp = 4.0;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= -5.8e+137:
        		tmp = 4.0
        	elif y <= 4.5e+111:
        		tmp = 4.0 * ((x - z) / y)
        	else:
        		tmp = 4.0
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -5.8e+137)
        		tmp = 4.0;
        	elseif (y <= 4.5e+111)
        		tmp = Float64(4.0 * Float64(Float64(x - z) / y));
        	else
        		tmp = 4.0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= -5.8e+137)
        		tmp = 4.0;
        	elseif (y <= 4.5e+111)
        		tmp = 4.0 * ((x - z) / y);
        	else
        		tmp = 4.0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -5.8e+137], 4.0, If[LessEqual[y, 4.5e+111], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -5.8 \cdot 10^{+137}:\\
        \;\;\;\;4\\
        
        \mathbf{elif}\;y \leq 4.5 \cdot 10^{+111}:\\
        \;\;\;\;4 \cdot \frac{x - z}{y}\\
        
        \mathbf{else}:\\
        \;\;\;\;4\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -5.79999999999999969e137 or 4.50000000000000001e111 < y

          1. Initial program 98.5%

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

              \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
            2. +-commutativeN/A

              \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
            3. associate--l+N/A

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

              \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
            5. associate-+r+N/A

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

              \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
            7. associate-*l/N/A

              \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            8. associate-/l*N/A

              \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            9. *-inversesN/A

              \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            10. metadata-evalN/A

              \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
            11. metadata-evalN/A

              \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
            12. metadata-evalN/A

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

              \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
            14. associate-*l/N/A

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

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

              \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
            17. --lowering--.f64100.0%

              \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
          3. Simplified100.0%

            \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
          4. Add Preprocessing
          5. Taylor expanded in y around inf

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

              \[\leadsto \color{blue}{4} \]

            if -5.79999999999999969e137 < y < 4.50000000000000001e111

            1. Initial program 99.0%

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

                \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
              2. +-commutativeN/A

                \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
              3. associate--l+N/A

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

                \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
              5. associate-+r+N/A

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

                \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
              7. associate-*l/N/A

                \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              8. associate-/l*N/A

                \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              9. *-inversesN/A

                \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              10. metadata-evalN/A

                \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              11. metadata-evalN/A

                \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
              12. metadata-evalN/A

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

                \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
              14. associate-*l/N/A

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

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

                \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
              17. --lowering--.f6499.0%

                \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
            3. Simplified99.0%

              \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
            4. Add Preprocessing
            5. Taylor expanded in y around 0

              \[\leadsto \color{blue}{4 \cdot \frac{x - z}{y}} \]
            6. Step-by-step derivation
              1. *-lowering-*.f64N/A

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

                \[\leadsto \mathsf{*.f64}\left(4, \mathsf{/.f64}\left(\left(x - z\right), \color{blue}{y}\right)\right) \]
              3. --lowering--.f6483.6%

                \[\leadsto \mathsf{*.f64}\left(4, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x, z\right), y\right)\right) \]
            7. Simplified83.6%

              \[\leadsto \color{blue}{4 \cdot \frac{x - z}{y}} \]
          7. Recombined 2 regimes into one program.
          8. Add Preprocessing

          Alternative 7: 54.2% accurate, 0.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{4}{y} \cdot x\\ \mathbf{if}\;x \leq -7 \cdot 10^{+35}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 7.4 \cdot 10^{+37}:\\ \;\;\;\;4\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (* (/ 4.0 y) x)))
             (if (<= x -7e+35) t_0 (if (<= x 7.4e+37) 4.0 t_0))))
          double code(double x, double y, double z) {
          	double t_0 = (4.0 / y) * x;
          	double tmp;
          	if (x <= -7e+35) {
          		tmp = t_0;
          	} else if (x <= 7.4e+37) {
          		tmp = 4.0;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          real(8) function code(x, y, z)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8) :: t_0
              real(8) :: tmp
              t_0 = (4.0d0 / y) * x
              if (x <= (-7d+35)) then
                  tmp = t_0
              else if (x <= 7.4d+37) then
                  tmp = 4.0d0
              else
                  tmp = t_0
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double t_0 = (4.0 / y) * x;
          	double tmp;
          	if (x <= -7e+35) {
          		tmp = t_0;
          	} else if (x <= 7.4e+37) {
          		tmp = 4.0;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	t_0 = (4.0 / y) * x
          	tmp = 0
          	if x <= -7e+35:
          		tmp = t_0
          	elif x <= 7.4e+37:
          		tmp = 4.0
          	else:
          		tmp = t_0
          	return tmp
          
          function code(x, y, z)
          	t_0 = Float64(Float64(4.0 / y) * x)
          	tmp = 0.0
          	if (x <= -7e+35)
          		tmp = t_0;
          	elseif (x <= 7.4e+37)
          		tmp = 4.0;
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	t_0 = (4.0 / y) * x;
          	tmp = 0.0;
          	if (x <= -7e+35)
          		tmp = t_0;
          	elseif (x <= 7.4e+37)
          		tmp = 4.0;
          	else
          		tmp = t_0;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -7e+35], t$95$0, If[LessEqual[x, 7.4e+37], 4.0, t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{4}{y} \cdot x\\
          \mathbf{if}\;x \leq -7 \cdot 10^{+35}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;x \leq 7.4 \cdot 10^{+37}:\\
          \;\;\;\;4\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x < -7.0000000000000001e35 or 7.3999999999999999e37 < x

            1. Initial program 98.3%

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

                \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
              2. +-commutativeN/A

                \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
              3. associate--l+N/A

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

                \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
              5. associate-+r+N/A

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

                \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
              7. associate-*l/N/A

                \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              8. associate-/l*N/A

                \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              9. *-inversesN/A

                \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              10. metadata-evalN/A

                \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              11. metadata-evalN/A

                \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
              12. metadata-evalN/A

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

                \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
              14. associate-*l/N/A

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

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

                \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
              17. --lowering--.f6498.3%

                \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
            3. Simplified98.3%

              \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
            4. Add Preprocessing
            5. Taylor expanded in x around inf

              \[\leadsto \color{blue}{4 \cdot \frac{x}{y}} \]
            6. Step-by-step derivation
              1. associate-*r/N/A

                \[\leadsto \frac{4 \cdot x}{\color{blue}{y}} \]
              2. /-lowering-/.f64N/A

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, x\right), y\right) \]
            7. Simplified81.0%

              \[\leadsto \color{blue}{\frac{4 \cdot x}{y}} \]
            8. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \frac{x \cdot 4}{y} \]
              2. associate-/l*N/A

                \[\leadsto x \cdot \color{blue}{\frac{4}{y}} \]
              3. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{4}{y}\right)}\right) \]
              4. /-lowering-/.f6481.7%

                \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(4, \color{blue}{y}\right)\right) \]
            9. Applied egg-rr81.7%

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

            if -7.0000000000000001e35 < x < 7.3999999999999999e37

            1. Initial program 99.2%

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

                \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
              2. +-commutativeN/A

                \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
              3. associate--l+N/A

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

                \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
              5. associate-+r+N/A

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

                \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
              7. associate-*l/N/A

                \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              8. associate-/l*N/A

                \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              9. *-inversesN/A

                \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              10. metadata-evalN/A

                \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              11. metadata-evalN/A

                \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
              12. metadata-evalN/A

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

                \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
              14. associate-*l/N/A

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

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

                \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
              17. --lowering--.f64100.0%

                \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
            3. Simplified100.0%

              \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
            4. Add Preprocessing
            5. Taylor expanded in y around inf

              \[\leadsto \color{blue}{4} \]
            6. Step-by-step derivation
              1. Simplified50.3%

                \[\leadsto \color{blue}{4} \]
            7. Recombined 2 regimes into one program.
            8. Final simplification63.9%

              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{+35}:\\ \;\;\;\;\frac{4}{y} \cdot x\\ \mathbf{elif}\;x \leq 7.4 \cdot 10^{+37}:\\ \;\;\;\;4\\ \mathbf{else}:\\ \;\;\;\;\frac{4}{y} \cdot x\\ \end{array} \]
            9. Add Preprocessing

            Alternative 8: 33.9% accurate, 13.0× speedup?

            \[\begin{array}{l} \\ 4 \end{array} \]
            (FPCore (x y z) :precision binary64 4.0)
            double code(double x, double y, double z) {
            	return 4.0;
            }
            
            real(8) function code(x, y, z)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                code = 4.0d0
            end function
            
            public static double code(double x, double y, double z) {
            	return 4.0;
            }
            
            def code(x, y, z):
            	return 4.0
            
            function code(x, y, z)
            	return 4.0
            end
            
            function tmp = code(x, y, z)
            	tmp = 4.0;
            end
            
            code[x_, y_, z_] := 4.0
            
            \begin{array}{l}
            
            \\
            4
            \end{array}
            
            Derivation
            1. Initial program 98.8%

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

                \[\leadsto 1 + \frac{4}{y} \cdot \color{blue}{\left(\left(x + y \cdot \frac{3}{4}\right) - z\right)} \]
              2. +-commutativeN/A

                \[\leadsto 1 + \frac{4}{y} \cdot \left(\left(y \cdot \frac{3}{4} + x\right) - z\right) \]
              3. associate--l+N/A

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

                \[\leadsto 1 + \left(\frac{4}{y} \cdot \left(y \cdot \frac{3}{4}\right) + \color{blue}{\frac{4}{y} \cdot \left(x - z\right)}\right) \]
              5. associate-+r+N/A

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

                \[\leadsto \left(1 + \left(\frac{4}{y} \cdot y\right) \cdot \frac{3}{4}\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
              7. associate-*l/N/A

                \[\leadsto \left(1 + \frac{4 \cdot y}{y} \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              8. associate-/l*N/A

                \[\leadsto \left(1 + \left(4 \cdot \frac{y}{y}\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              9. *-inversesN/A

                \[\leadsto \left(1 + \left(4 \cdot 1\right) \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              10. metadata-evalN/A

                \[\leadsto \left(1 + 4 \cdot \frac{3}{4}\right) + \frac{4}{y} \cdot \left(x - z\right) \]
              11. metadata-evalN/A

                \[\leadsto \left(1 + 3\right) + \frac{4}{\color{blue}{y}} \cdot \left(x - z\right) \]
              12. metadata-evalN/A

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

                \[\leadsto \mathsf{+.f64}\left(4, \color{blue}{\left(\frac{4}{y} \cdot \left(x - z\right)\right)}\right) \]
              14. associate-*l/N/A

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

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

                \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \left(x - z\right)\right), y\right)\right) \]
              17. --lowering--.f6499.3%

                \[\leadsto \mathsf{+.f64}\left(4, \mathsf{/.f64}\left(\mathsf{*.f64}\left(4, \mathsf{\_.f64}\left(x, z\right)\right), y\right)\right) \]
            3. Simplified99.3%

              \[\leadsto \color{blue}{4 + \frac{4 \cdot \left(x - z\right)}{y}} \]
            4. Add Preprocessing
            5. Taylor expanded in y around inf

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

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

              Reproduce

              ?
              herbie shell --seed 2024138 
              (FPCore (x y z)
                :name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A"
                :precision binary64
                (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))