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

Percentage Accurate: 99.8% → 100.0%
Time: 8.6s
Alternatives: 10
Speedup: 1.2×

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 10 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.8% 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: 100.0% accurate, 1.2× speedup?

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

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

    \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
  2. Add Preprocessing
  3. Taylor expanded in y around inf 100.0%

    \[\leadsto 1 + \color{blue}{\left(3 + 4 \cdot \frac{x - z}{y}\right)} \]
  4. Step-by-step derivation
    1. +-commutative100.0%

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

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

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

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

Alternative 2: 57.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + z \cdot \frac{-4}{y}\\ t_1 := 1 + 4 \cdot \frac{x}{y}\\ \mathbf{if}\;x \leq -1.32 \cdot 10^{+118}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{+79}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -6.5 \cdot 10^{+45}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-63}:\\ \;\;\;\;4\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+46}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* z (/ -4.0 y)))) (t_1 (+ 1.0 (* 4.0 (/ x y)))))
   (if (<= x -1.32e+118)
     t_1
     (if (<= x -2.8e+79)
       t_0
       (if (<= x -6.5e+45)
         t_1
         (if (<= x -3e-63) 4.0 (if (<= x 9.5e+46) t_0 t_1)))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 + (z * (-4.0 / y));
	double t_1 = 1.0 + (4.0 * (x / y));
	double tmp;
	if (x <= -1.32e+118) {
		tmp = t_1;
	} else if (x <= -2.8e+79) {
		tmp = t_0;
	} else if (x <= -6.5e+45) {
		tmp = t_1;
	} else if (x <= -3e-63) {
		tmp = 4.0;
	} else if (x <= 9.5e+46) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 + (z * ((-4.0d0) / y))
    t_1 = 1.0d0 + (4.0d0 * (x / y))
    if (x <= (-1.32d+118)) then
        tmp = t_1
    else if (x <= (-2.8d+79)) then
        tmp = t_0
    else if (x <= (-6.5d+45)) then
        tmp = t_1
    else if (x <= (-3d-63)) then
        tmp = 4.0d0
    else if (x <= 9.5d+46) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 + (z * (-4.0 / y));
	double t_1 = 1.0 + (4.0 * (x / y));
	double tmp;
	if (x <= -1.32e+118) {
		tmp = t_1;
	} else if (x <= -2.8e+79) {
		tmp = t_0;
	} else if (x <= -6.5e+45) {
		tmp = t_1;
	} else if (x <= -3e-63) {
		tmp = 4.0;
	} else if (x <= 9.5e+46) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 + (z * (-4.0 / y))
	t_1 = 1.0 + (4.0 * (x / y))
	tmp = 0
	if x <= -1.32e+118:
		tmp = t_1
	elif x <= -2.8e+79:
		tmp = t_0
	elif x <= -6.5e+45:
		tmp = t_1
	elif x <= -3e-63:
		tmp = 4.0
	elif x <= 9.5e+46:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 + Float64(z * Float64(-4.0 / y)))
	t_1 = Float64(1.0 + Float64(4.0 * Float64(x / y)))
	tmp = 0.0
	if (x <= -1.32e+118)
		tmp = t_1;
	elseif (x <= -2.8e+79)
		tmp = t_0;
	elseif (x <= -6.5e+45)
		tmp = t_1;
	elseif (x <= -3e-63)
		tmp = 4.0;
	elseif (x <= 9.5e+46)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 + (z * (-4.0 / y));
	t_1 = 1.0 + (4.0 * (x / y));
	tmp = 0.0;
	if (x <= -1.32e+118)
		tmp = t_1;
	elseif (x <= -2.8e+79)
		tmp = t_0;
	elseif (x <= -6.5e+45)
		tmp = t_1;
	elseif (x <= -3e-63)
		tmp = 4.0;
	elseif (x <= 9.5e+46)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.32e+118], t$95$1, If[LessEqual[x, -2.8e+79], t$95$0, If[LessEqual[x, -6.5e+45], t$95$1, If[LessEqual[x, -3e-63], 4.0, If[LessEqual[x, 9.5e+46], t$95$0, t$95$1]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + z \cdot \frac{-4}{y}\\
t_1 := 1 + 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -1.32 \cdot 10^{+118}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -2.8 \cdot 10^{+79}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq -6.5 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -3 \cdot 10^{-63}:\\
\;\;\;\;4\\

\mathbf{elif}\;x \leq 9.5 \cdot 10^{+46}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.3199999999999999e118 or -2.8000000000000001e79 < x < -6.50000000000000034e45 or 9.5000000000000008e46 < x

    1. Initial program 100.0%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 73.3%

      \[\leadsto 1 + \color{blue}{4 \cdot \frac{x}{y}} \]
    4. Step-by-step derivation
      1. *-commutative73.3%

        \[\leadsto 1 + \color{blue}{\frac{x}{y} \cdot 4} \]
    5. Simplified73.3%

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

    if -1.3199999999999999e118 < x < -2.8000000000000001e79 or -2.99999999999999979e-63 < x < 9.5000000000000008e46

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 56.7%

      \[\leadsto 1 + \color{blue}{-4 \cdot \frac{z}{y}} \]
    4. Step-by-step derivation
      1. metadata-eval56.7%

        \[\leadsto 1 + \color{blue}{\left(-4\right)} \cdot \frac{z}{y} \]
      2. distribute-lft-neg-in56.7%

        \[\leadsto 1 + \color{blue}{\left(-4 \cdot \frac{z}{y}\right)} \]
      3. *-lft-identity56.7%

        \[\leadsto 1 + \left(-4 \cdot \frac{\color{blue}{1 \cdot z}}{y}\right) \]
      4. associate-*l/56.5%

        \[\leadsto 1 + \left(-4 \cdot \color{blue}{\left(\frac{1}{y} \cdot z\right)}\right) \]
      5. associate-*l*56.5%

        \[\leadsto 1 + \left(-\color{blue}{\left(4 \cdot \frac{1}{y}\right) \cdot z}\right) \]
      6. *-commutative56.5%

        \[\leadsto 1 + \left(-\color{blue}{z \cdot \left(4 \cdot \frac{1}{y}\right)}\right) \]
      7. distribute-rgt-neg-in56.5%

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

        \[\leadsto 1 + z \cdot \left(-\color{blue}{\frac{4 \cdot 1}{y}}\right) \]
      9. metadata-eval56.5%

        \[\leadsto 1 + z \cdot \left(-\frac{\color{blue}{4}}{y}\right) \]
      10. distribute-neg-frac56.5%

        \[\leadsto 1 + z \cdot \color{blue}{\frac{-4}{y}} \]
      11. metadata-eval56.5%

        \[\leadsto 1 + z \cdot \frac{\color{blue}{-4}}{y} \]
    5. Simplified56.5%

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

    if -6.50000000000000034e45 < x < -2.99999999999999979e-63

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 71.0%

      \[\leadsto 1 + \color{blue}{4 \cdot \frac{0.75 \cdot y - z}{y}} \]
    4. Step-by-step derivation
      1. div-sub71.0%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(\frac{0.75 \cdot y}{y} - \frac{z}{y}\right)} \]
      2. associate-/l*71.1%

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

        \[\leadsto 1 + 4 \cdot \left(0.75 \cdot \color{blue}{1} - \frac{z}{y}\right) \]
      4. metadata-eval71.1%

        \[\leadsto 1 + 4 \cdot \left(\color{blue}{0.75} - \frac{z}{y}\right) \]
      5. sub-neg71.1%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(0.75 + \left(-\frac{z}{y}\right)\right)} \]
      6. distribute-lft-in71.1%

        \[\leadsto 1 + \color{blue}{\left(4 \cdot 0.75 + 4 \cdot \left(-\frac{z}{y}\right)\right)} \]
      7. metadata-eval71.1%

        \[\leadsto 1 + \left(\color{blue}{3} + 4 \cdot \left(-\frac{z}{y}\right)\right) \]
      8. distribute-rgt-neg-in71.1%

        \[\leadsto 1 + \left(3 + \color{blue}{\left(-4 \cdot \frac{z}{y}\right)}\right) \]
      9. *-lft-identity71.1%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \frac{\color{blue}{1 \cdot z}}{y}\right)\right) \]
      10. associate-*l/71.1%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \color{blue}{\left(\frac{1}{y} \cdot z\right)}\right)\right) \]
      11. associate-*l*71.1%

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

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{z \cdot \left(4 \cdot \frac{1}{y}\right)}\right)\right) \]
      13. distribute-rgt-neg-in71.1%

        \[\leadsto 1 + \left(3 + \color{blue}{z \cdot \left(-4 \cdot \frac{1}{y}\right)}\right) \]
      14. associate-*r/71.1%

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

        \[\leadsto 1 + \left(3 + z \cdot \left(-\frac{\color{blue}{4}}{y}\right)\right) \]
      16. distribute-neg-frac71.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.32 \cdot 10^{+118}:\\ \;\;\;\;1 + 4 \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{+79}:\\ \;\;\;\;1 + z \cdot \frac{-4}{y}\\ \mathbf{elif}\;x \leq -6.5 \cdot 10^{+45}:\\ \;\;\;\;1 + 4 \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-63}:\\ \;\;\;\;4\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+46}:\\ \;\;\;\;1 + z \cdot \frac{-4}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + 4 \cdot \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 57.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + \frac{z \cdot -4}{y}\\ t_1 := 1 + 4 \cdot \frac{x}{y}\\ \mathbf{if}\;x \leq -1.1 \cdot 10^{+119}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -2.35 \cdot 10^{+75}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{+47}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-65}:\\ \;\;\;\;4\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{+52}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ 1.0 (/ (* z -4.0) y))) (t_1 (+ 1.0 (* 4.0 (/ x y)))))
   (if (<= x -1.1e+119)
     t_1
     (if (<= x -2.35e+75)
       t_0
       (if (<= x -1.9e+47)
         t_1
         (if (<= x -6e-65) 4.0 (if (<= x 1.95e+52) t_0 t_1)))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 + ((z * -4.0) / y);
	double t_1 = 1.0 + (4.0 * (x / y));
	double tmp;
	if (x <= -1.1e+119) {
		tmp = t_1;
	} else if (x <= -2.35e+75) {
		tmp = t_0;
	} else if (x <= -1.9e+47) {
		tmp = t_1;
	} else if (x <= -6e-65) {
		tmp = 4.0;
	} else if (x <= 1.95e+52) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = 1.0d0 + ((z * (-4.0d0)) / y)
    t_1 = 1.0d0 + (4.0d0 * (x / y))
    if (x <= (-1.1d+119)) then
        tmp = t_1
    else if (x <= (-2.35d+75)) then
        tmp = t_0
    else if (x <= (-1.9d+47)) then
        tmp = t_1
    else if (x <= (-6d-65)) then
        tmp = 4.0d0
    else if (x <= 1.95d+52) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 + ((z * -4.0) / y);
	double t_1 = 1.0 + (4.0 * (x / y));
	double tmp;
	if (x <= -1.1e+119) {
		tmp = t_1;
	} else if (x <= -2.35e+75) {
		tmp = t_0;
	} else if (x <= -1.9e+47) {
		tmp = t_1;
	} else if (x <= -6e-65) {
		tmp = 4.0;
	} else if (x <= 1.95e+52) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 + ((z * -4.0) / y)
	t_1 = 1.0 + (4.0 * (x / y))
	tmp = 0
	if x <= -1.1e+119:
		tmp = t_1
	elif x <= -2.35e+75:
		tmp = t_0
	elif x <= -1.9e+47:
		tmp = t_1
	elif x <= -6e-65:
		tmp = 4.0
	elif x <= 1.95e+52:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 + Float64(Float64(z * -4.0) / y))
	t_1 = Float64(1.0 + Float64(4.0 * Float64(x / y)))
	tmp = 0.0
	if (x <= -1.1e+119)
		tmp = t_1;
	elseif (x <= -2.35e+75)
		tmp = t_0;
	elseif (x <= -1.9e+47)
		tmp = t_1;
	elseif (x <= -6e-65)
		tmp = 4.0;
	elseif (x <= 1.95e+52)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 + ((z * -4.0) / y);
	t_1 = 1.0 + (4.0 * (x / y));
	tmp = 0.0;
	if (x <= -1.1e+119)
		tmp = t_1;
	elseif (x <= -2.35e+75)
		tmp = t_0;
	elseif (x <= -1.9e+47)
		tmp = t_1;
	elseif (x <= -6e-65)
		tmp = 4.0;
	elseif (x <= 1.95e+52)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.1e+119], t$95$1, If[LessEqual[x, -2.35e+75], t$95$0, If[LessEqual[x, -1.9e+47], t$95$1, If[LessEqual[x, -6e-65], 4.0, If[LessEqual[x, 1.95e+52], t$95$0, t$95$1]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + \frac{z \cdot -4}{y}\\
t_1 := 1 + 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -1.1 \cdot 10^{+119}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -2.35 \cdot 10^{+75}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq -1.9 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -6 \cdot 10^{-65}:\\
\;\;\;\;4\\

\mathbf{elif}\;x \leq 1.95 \cdot 10^{+52}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.1000000000000001e119 or -2.34999999999999992e75 < x < -1.9000000000000002e47 or 1.95e52 < x

    1. Initial program 100.0%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 73.3%

      \[\leadsto 1 + \color{blue}{4 \cdot \frac{x}{y}} \]
    4. Step-by-step derivation
      1. *-commutative73.3%

        \[\leadsto 1 + \color{blue}{\frac{x}{y} \cdot 4} \]
    5. Simplified73.3%

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

    if -1.1000000000000001e119 < x < -2.34999999999999992e75 or -5.99999999999999996e-65 < x < 1.95e52

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 56.7%

      \[\leadsto 1 + \color{blue}{-4 \cdot \frac{z}{y}} \]
    4. Step-by-step derivation
      1. *-commutative56.7%

        \[\leadsto 1 + \color{blue}{\frac{z}{y} \cdot -4} \]
      2. associate-*l/56.7%

        \[\leadsto 1 + \color{blue}{\frac{z \cdot -4}{y}} \]
    5. Simplified56.7%

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

    if -1.9000000000000002e47 < x < -5.99999999999999996e-65

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 71.0%

      \[\leadsto 1 + \color{blue}{4 \cdot \frac{0.75 \cdot y - z}{y}} \]
    4. Step-by-step derivation
      1. div-sub71.0%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(\frac{0.75 \cdot y}{y} - \frac{z}{y}\right)} \]
      2. associate-/l*71.1%

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

        \[\leadsto 1 + 4 \cdot \left(0.75 \cdot \color{blue}{1} - \frac{z}{y}\right) \]
      4. metadata-eval71.1%

        \[\leadsto 1 + 4 \cdot \left(\color{blue}{0.75} - \frac{z}{y}\right) \]
      5. sub-neg71.1%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(0.75 + \left(-\frac{z}{y}\right)\right)} \]
      6. distribute-lft-in71.1%

        \[\leadsto 1 + \color{blue}{\left(4 \cdot 0.75 + 4 \cdot \left(-\frac{z}{y}\right)\right)} \]
      7. metadata-eval71.1%

        \[\leadsto 1 + \left(\color{blue}{3} + 4 \cdot \left(-\frac{z}{y}\right)\right) \]
      8. distribute-rgt-neg-in71.1%

        \[\leadsto 1 + \left(3 + \color{blue}{\left(-4 \cdot \frac{z}{y}\right)}\right) \]
      9. *-lft-identity71.1%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \frac{\color{blue}{1 \cdot z}}{y}\right)\right) \]
      10. associate-*l/71.1%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \color{blue}{\left(\frac{1}{y} \cdot z\right)}\right)\right) \]
      11. associate-*l*71.1%

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

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{z \cdot \left(4 \cdot \frac{1}{y}\right)}\right)\right) \]
      13. distribute-rgt-neg-in71.1%

        \[\leadsto 1 + \left(3 + \color{blue}{z \cdot \left(-4 \cdot \frac{1}{y}\right)}\right) \]
      14. associate-*r/71.1%

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

        \[\leadsto 1 + \left(3 + z \cdot \left(-\frac{\color{blue}{4}}{y}\right)\right) \]
      16. distribute-neg-frac71.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{+119}:\\ \;\;\;\;1 + 4 \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -2.35 \cdot 10^{+75}:\\ \;\;\;\;1 + \frac{z \cdot -4}{y}\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{+47}:\\ \;\;\;\;1 + 4 \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-65}:\\ \;\;\;\;4\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{+52}:\\ \;\;\;\;1 + \frac{z \cdot -4}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + 4 \cdot \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 85.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.32 \cdot 10^{+118} \lor \neg \left(x \leq -2.1 \cdot 10^{+79} \lor \neg \left(x \leq -2.2 \cdot 10^{-55}\right) \land x \leq 1.8 \cdot 10^{+44}\right):\\ \;\;\;\;1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;4 + \frac{z \cdot -4}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -1.32e+118)
         (not (or (<= x -2.1e+79) (and (not (<= x -2.2e-55)) (<= x 1.8e+44)))))
   (+ 1.0 (+ 3.0 (* 4.0 (/ x y))))
   (+ 4.0 (/ (* z -4.0) y))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.32e+118) || !((x <= -2.1e+79) || (!(x <= -2.2e-55) && (x <= 1.8e+44)))) {
		tmp = 1.0 + (3.0 + (4.0 * (x / y)));
	} else {
		tmp = 4.0 + ((z * -4.0) / 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 <= (-1.32d+118)) .or. (.not. (x <= (-2.1d+79)) .or. (.not. (x <= (-2.2d-55))) .and. (x <= 1.8d+44))) then
        tmp = 1.0d0 + (3.0d0 + (4.0d0 * (x / y)))
    else
        tmp = 4.0d0 + ((z * (-4.0d0)) / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.32e+118) || !((x <= -2.1e+79) || (!(x <= -2.2e-55) && (x <= 1.8e+44)))) {
		tmp = 1.0 + (3.0 + (4.0 * (x / y)));
	} else {
		tmp = 4.0 + ((z * -4.0) / y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -1.32e+118) or not ((x <= -2.1e+79) or (not (x <= -2.2e-55) and (x <= 1.8e+44))):
		tmp = 1.0 + (3.0 + (4.0 * (x / y)))
	else:
		tmp = 4.0 + ((z * -4.0) / y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -1.32e+118) || !((x <= -2.1e+79) || (!(x <= -2.2e-55) && (x <= 1.8e+44))))
		tmp = Float64(1.0 + Float64(3.0 + Float64(4.0 * Float64(x / y))));
	else
		tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -1.32e+118) || ~(((x <= -2.1e+79) || (~((x <= -2.2e-55)) && (x <= 1.8e+44)))))
		tmp = 1.0 + (3.0 + (4.0 * (x / y)));
	else
		tmp = 4.0 + ((z * -4.0) / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.32e+118], N[Not[Or[LessEqual[x, -2.1e+79], And[N[Not[LessEqual[x, -2.2e-55]], $MachinePrecision], LessEqual[x, 1.8e+44]]]], $MachinePrecision]], N[(1.0 + N[(3.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{+118} \lor \neg \left(x \leq -2.1 \cdot 10^{+79} \lor \neg \left(x \leq -2.2 \cdot 10^{-55}\right) \land x \leq 1.8 \cdot 10^{+44}\right):\\
\;\;\;\;1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\

\mathbf{else}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.3199999999999999e118 or -2.10000000000000008e79 < x < -2.2e-55 or 1.8e44 < x

    1. Initial program 100.0%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 100.0%

      \[\leadsto 1 + \color{blue}{\left(3 + 4 \cdot \frac{x - z}{y}\right)} \]
    4. Step-by-step derivation
      1. +-commutative100.0%

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

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

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

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

    if -1.3199999999999999e118 < x < -2.10000000000000008e79 or -2.2e-55 < x < 1.8e44

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 94.0%

      \[\leadsto 1 + \color{blue}{4 \cdot \frac{0.75 \cdot y - z}{y}} \]
    4. Step-by-step derivation
      1. div-sub94.0%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(\frac{0.75 \cdot y}{y} - \frac{z}{y}\right)} \]
      2. associate-/l*94.1%

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

        \[\leadsto 1 + 4 \cdot \left(0.75 \cdot \color{blue}{1} - \frac{z}{y}\right) \]
      4. metadata-eval94.1%

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

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(0.75 + \left(-\frac{z}{y}\right)\right)} \]
      6. distribute-lft-in94.1%

        \[\leadsto 1 + \color{blue}{\left(4 \cdot 0.75 + 4 \cdot \left(-\frac{z}{y}\right)\right)} \]
      7. metadata-eval94.1%

        \[\leadsto 1 + \left(\color{blue}{3} + 4 \cdot \left(-\frac{z}{y}\right)\right) \]
      8. distribute-rgt-neg-in94.1%

        \[\leadsto 1 + \left(3 + \color{blue}{\left(-4 \cdot \frac{z}{y}\right)}\right) \]
      9. *-lft-identity94.1%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \frac{\color{blue}{1 \cdot z}}{y}\right)\right) \]
      10. associate-*l/93.9%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \color{blue}{\left(\frac{1}{y} \cdot z\right)}\right)\right) \]
      11. associate-*l*93.9%

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{\left(4 \cdot \frac{1}{y}\right) \cdot z}\right)\right) \]
      12. *-commutative93.9%

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{z \cdot \left(4 \cdot \frac{1}{y}\right)}\right)\right) \]
      13. distribute-rgt-neg-in93.9%

        \[\leadsto 1 + \left(3 + \color{blue}{z \cdot \left(-4 \cdot \frac{1}{y}\right)}\right) \]
      14. associate-*r/93.9%

        \[\leadsto 1 + \left(3 + z \cdot \left(-\color{blue}{\frac{4 \cdot 1}{y}}\right)\right) \]
      15. metadata-eval93.9%

        \[\leadsto 1 + \left(3 + z \cdot \left(-\frac{\color{blue}{4}}{y}\right)\right) \]
      16. distribute-neg-frac93.9%

        \[\leadsto 1 + \left(3 + z \cdot \color{blue}{\frac{-4}{y}}\right) \]
      17. metadata-eval93.9%

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

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

      \[\leadsto \color{blue}{4 + -4 \cdot \frac{z}{y}} \]
    7. Step-by-step derivation
      1. associate-*r/94.1%

        \[\leadsto 4 + \color{blue}{\frac{-4 \cdot z}{y}} \]
    8. Simplified94.1%

      \[\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.32 \cdot 10^{+118} \lor \neg \left(x \leq -2.1 \cdot 10^{+79} \lor \neg \left(x \leq -2.2 \cdot 10^{-55}\right) \land x \leq 1.8 \cdot 10^{+44}\right):\\ \;\;\;\;1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;4 + \frac{z \cdot -4}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 85.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 4 + \frac{z \cdot -4}{y}\\ t_1 := 1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\ \mathbf{if}\;x \leq -1.32 \cdot 10^{+118}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{+76}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -2.75 \cdot 10^{-55}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 5.9 \cdot 10^{+52}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{4}{\frac{y}{x - z}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ 4.0 (/ (* z -4.0) y))) (t_1 (+ 1.0 (+ 3.0 (* 4.0 (/ x y))))))
   (if (<= x -1.32e+118)
     t_1
     (if (<= x -1.6e+76)
       t_0
       (if (<= x -2.75e-55)
         t_1
         (if (<= x 5.9e+52) t_0 (+ 1.0 (/ 4.0 (/ y (- x z))))))))))
double code(double x, double y, double z) {
	double t_0 = 4.0 + ((z * -4.0) / y);
	double t_1 = 1.0 + (3.0 + (4.0 * (x / y)));
	double tmp;
	if (x <= -1.32e+118) {
		tmp = t_1;
	} else if (x <= -1.6e+76) {
		tmp = t_0;
	} else if (x <= -2.75e-55) {
		tmp = t_1;
	} else if (x <= 5.9e+52) {
		tmp = t_0;
	} else {
		tmp = 1.0 + (4.0 / (y / (x - z)));
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = 4.0d0 + ((z * (-4.0d0)) / y)
    t_1 = 1.0d0 + (3.0d0 + (4.0d0 * (x / y)))
    if (x <= (-1.32d+118)) then
        tmp = t_1
    else if (x <= (-1.6d+76)) then
        tmp = t_0
    else if (x <= (-2.75d-55)) then
        tmp = t_1
    else if (x <= 5.9d+52) then
        tmp = t_0
    else
        tmp = 1.0d0 + (4.0d0 / (y / (x - z)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 4.0 + ((z * -4.0) / y);
	double t_1 = 1.0 + (3.0 + (4.0 * (x / y)));
	double tmp;
	if (x <= -1.32e+118) {
		tmp = t_1;
	} else if (x <= -1.6e+76) {
		tmp = t_0;
	} else if (x <= -2.75e-55) {
		tmp = t_1;
	} else if (x <= 5.9e+52) {
		tmp = t_0;
	} else {
		tmp = 1.0 + (4.0 / (y / (x - z)));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 4.0 + ((z * -4.0) / y)
	t_1 = 1.0 + (3.0 + (4.0 * (x / y)))
	tmp = 0
	if x <= -1.32e+118:
		tmp = t_1
	elif x <= -1.6e+76:
		tmp = t_0
	elif x <= -2.75e-55:
		tmp = t_1
	elif x <= 5.9e+52:
		tmp = t_0
	else:
		tmp = 1.0 + (4.0 / (y / (x - z)))
	return tmp
function code(x, y, z)
	t_0 = Float64(4.0 + Float64(Float64(z * -4.0) / y))
	t_1 = Float64(1.0 + Float64(3.0 + Float64(4.0 * Float64(x / y))))
	tmp = 0.0
	if (x <= -1.32e+118)
		tmp = t_1;
	elseif (x <= -1.6e+76)
		tmp = t_0;
	elseif (x <= -2.75e-55)
		tmp = t_1;
	elseif (x <= 5.9e+52)
		tmp = t_0;
	else
		tmp = Float64(1.0 + Float64(4.0 / Float64(y / Float64(x - z))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 4.0 + ((z * -4.0) / y);
	t_1 = 1.0 + (3.0 + (4.0 * (x / y)));
	tmp = 0.0;
	if (x <= -1.32e+118)
		tmp = t_1;
	elseif (x <= -1.6e+76)
		tmp = t_0;
	elseif (x <= -2.75e-55)
		tmp = t_1;
	elseif (x <= 5.9e+52)
		tmp = t_0;
	else
		tmp = 1.0 + (4.0 / (y / (x - z)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(3.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.32e+118], t$95$1, If[LessEqual[x, -1.6e+76], t$95$0, If[LessEqual[x, -2.75e-55], t$95$1, If[LessEqual[x, 5.9e+52], t$95$0, N[(1.0 + N[(4.0 / N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 4 + \frac{z \cdot -4}{y}\\
t_1 := 1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\
\mathbf{if}\;x \leq -1.32 \cdot 10^{+118}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -1.6 \cdot 10^{+76}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq -2.75 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 5.9 \cdot 10^{+52}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;1 + \frac{4}{\frac{y}{x - z}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.3199999999999999e118 or -1.59999999999999988e76 < x < -2.7499999999999999e-55

    1. Initial program 100.0%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 100.0%

      \[\leadsto 1 + \color{blue}{\left(3 + 4 \cdot \frac{x - z}{y}\right)} \]
    4. Step-by-step derivation
      1. +-commutative100.0%

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

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

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

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

    if -1.3199999999999999e118 < x < -1.59999999999999988e76 or -2.7499999999999999e-55 < x < 5.89999999999999996e52

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 94.0%

      \[\leadsto 1 + \color{blue}{4 \cdot \frac{0.75 \cdot y - z}{y}} \]
    4. Step-by-step derivation
      1. div-sub94.0%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(\frac{0.75 \cdot y}{y} - \frac{z}{y}\right)} \]
      2. associate-/l*94.1%

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

        \[\leadsto 1 + 4 \cdot \left(0.75 \cdot \color{blue}{1} - \frac{z}{y}\right) \]
      4. metadata-eval94.1%

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

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(0.75 + \left(-\frac{z}{y}\right)\right)} \]
      6. distribute-lft-in94.1%

        \[\leadsto 1 + \color{blue}{\left(4 \cdot 0.75 + 4 \cdot \left(-\frac{z}{y}\right)\right)} \]
      7. metadata-eval94.1%

        \[\leadsto 1 + \left(\color{blue}{3} + 4 \cdot \left(-\frac{z}{y}\right)\right) \]
      8. distribute-rgt-neg-in94.1%

        \[\leadsto 1 + \left(3 + \color{blue}{\left(-4 \cdot \frac{z}{y}\right)}\right) \]
      9. *-lft-identity94.1%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \frac{\color{blue}{1 \cdot z}}{y}\right)\right) \]
      10. associate-*l/93.9%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \color{blue}{\left(\frac{1}{y} \cdot z\right)}\right)\right) \]
      11. associate-*l*93.9%

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{\left(4 \cdot \frac{1}{y}\right) \cdot z}\right)\right) \]
      12. *-commutative93.9%

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{z \cdot \left(4 \cdot \frac{1}{y}\right)}\right)\right) \]
      13. distribute-rgt-neg-in93.9%

        \[\leadsto 1 + \left(3 + \color{blue}{z \cdot \left(-4 \cdot \frac{1}{y}\right)}\right) \]
      14. associate-*r/93.9%

        \[\leadsto 1 + \left(3 + z \cdot \left(-\color{blue}{\frac{4 \cdot 1}{y}}\right)\right) \]
      15. metadata-eval93.9%

        \[\leadsto 1 + \left(3 + z \cdot \left(-\frac{\color{blue}{4}}{y}\right)\right) \]
      16. distribute-neg-frac93.9%

        \[\leadsto 1 + \left(3 + z \cdot \color{blue}{\frac{-4}{y}}\right) \]
      17. metadata-eval93.9%

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

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

      \[\leadsto \color{blue}{4 + -4 \cdot \frac{z}{y}} \]
    7. Step-by-step derivation
      1. associate-*r/94.1%

        \[\leadsto 4 + \color{blue}{\frac{-4 \cdot z}{y}} \]
    8. Simplified94.1%

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

    if 5.89999999999999996e52 < x

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 86.7%

      \[\leadsto 1 + \frac{4 \cdot \left(\color{blue}{x} - z\right)}{y} \]
    4. Step-by-step derivation
      1. clear-num86.6%

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

        \[\leadsto 1 + \color{blue}{{\left(\frac{y}{4 \cdot \left(x - z\right)}\right)}^{-1}} \]
      3. *-un-lft-identity86.6%

        \[\leadsto 1 + {\left(\frac{\color{blue}{1 \cdot y}}{4 \cdot \left(x - z\right)}\right)}^{-1} \]
      4. times-frac86.6%

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

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

      \[\leadsto 1 + \color{blue}{{\left(0.25 \cdot \frac{y}{x - z}\right)}^{-1}} \]
    6. Step-by-step derivation
      1. unpow-186.6%

        \[\leadsto 1 + \color{blue}{\frac{1}{0.25 \cdot \frac{y}{x - z}}} \]
      2. associate-/r*86.6%

        \[\leadsto 1 + \color{blue}{\frac{\frac{1}{0.25}}{\frac{y}{x - z}}} \]
      3. metadata-eval86.6%

        \[\leadsto 1 + \frac{\color{blue}{4}}{\frac{y}{x - z}} \]
    7. Simplified86.6%

      \[\leadsto 1 + \color{blue}{\frac{4}{\frac{y}{x - z}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.32 \cdot 10^{+118}:\\ \;\;\;\;1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{+76}:\\ \;\;\;\;4 + \frac{z \cdot -4}{y}\\ \mathbf{elif}\;x \leq -2.75 \cdot 10^{-55}:\\ \;\;\;\;1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;x \leq 5.9 \cdot 10^{+52}:\\ \;\;\;\;4 + \frac{z \cdot -4}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{4}{\frac{y}{x - z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 85.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 4 + \frac{z \cdot -4}{y}\\ t_1 := 1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\ \mathbf{if}\;x \leq -1.7 \cdot 10^{+118}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{+78}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-55}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 4.05 \cdot 10^{+43}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{4 \cdot \left(x - z\right)}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ 4.0 (/ (* z -4.0) y))) (t_1 (+ 1.0 (+ 3.0 (* 4.0 (/ x y))))))
   (if (<= x -1.7e+118)
     t_1
     (if (<= x -6.2e+78)
       t_0
       (if (<= x -2.25e-55)
         t_1
         (if (<= x 4.05e+43) t_0 (+ 1.0 (/ (* 4.0 (- x z)) y))))))))
double code(double x, double y, double z) {
	double t_0 = 4.0 + ((z * -4.0) / y);
	double t_1 = 1.0 + (3.0 + (4.0 * (x / y)));
	double tmp;
	if (x <= -1.7e+118) {
		tmp = t_1;
	} else if (x <= -6.2e+78) {
		tmp = t_0;
	} else if (x <= -2.25e-55) {
		tmp = t_1;
	} else if (x <= 4.05e+43) {
		tmp = t_0;
	} else {
		tmp = 1.0 + ((4.0 * (x - z)) / 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 4.0d0 + ((z * (-4.0d0)) / y)
    t_1 = 1.0d0 + (3.0d0 + (4.0d0 * (x / y)))
    if (x <= (-1.7d+118)) then
        tmp = t_1
    else if (x <= (-6.2d+78)) then
        tmp = t_0
    else if (x <= (-2.25d-55)) then
        tmp = t_1
    else if (x <= 4.05d+43) then
        tmp = t_0
    else
        tmp = 1.0d0 + ((4.0d0 * (x - z)) / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 4.0 + ((z * -4.0) / y);
	double t_1 = 1.0 + (3.0 + (4.0 * (x / y)));
	double tmp;
	if (x <= -1.7e+118) {
		tmp = t_1;
	} else if (x <= -6.2e+78) {
		tmp = t_0;
	} else if (x <= -2.25e-55) {
		tmp = t_1;
	} else if (x <= 4.05e+43) {
		tmp = t_0;
	} else {
		tmp = 1.0 + ((4.0 * (x - z)) / y);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 4.0 + ((z * -4.0) / y)
	t_1 = 1.0 + (3.0 + (4.0 * (x / y)))
	tmp = 0
	if x <= -1.7e+118:
		tmp = t_1
	elif x <= -6.2e+78:
		tmp = t_0
	elif x <= -2.25e-55:
		tmp = t_1
	elif x <= 4.05e+43:
		tmp = t_0
	else:
		tmp = 1.0 + ((4.0 * (x - z)) / y)
	return tmp
function code(x, y, z)
	t_0 = Float64(4.0 + Float64(Float64(z * -4.0) / y))
	t_1 = Float64(1.0 + Float64(3.0 + Float64(4.0 * Float64(x / y))))
	tmp = 0.0
	if (x <= -1.7e+118)
		tmp = t_1;
	elseif (x <= -6.2e+78)
		tmp = t_0;
	elseif (x <= -2.25e-55)
		tmp = t_1;
	elseif (x <= 4.05e+43)
		tmp = t_0;
	else
		tmp = Float64(1.0 + Float64(Float64(4.0 * Float64(x - z)) / y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 4.0 + ((z * -4.0) / y);
	t_1 = 1.0 + (3.0 + (4.0 * (x / y)));
	tmp = 0.0;
	if (x <= -1.7e+118)
		tmp = t_1;
	elseif (x <= -6.2e+78)
		tmp = t_0;
	elseif (x <= -2.25e-55)
		tmp = t_1;
	elseif (x <= 4.05e+43)
		tmp = t_0;
	else
		tmp = 1.0 + ((4.0 * (x - z)) / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(3.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.7e+118], t$95$1, If[LessEqual[x, -6.2e+78], t$95$0, If[LessEqual[x, -2.25e-55], t$95$1, If[LessEqual[x, 4.05e+43], t$95$0, N[(1.0 + N[(N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 4 + \frac{z \cdot -4}{y}\\
t_1 := 1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{+118}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -6.2 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq -2.25 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 4.05 \cdot 10^{+43}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.69999999999999993e118 or -6.2e78 < x < -2.24999999999999985e-55

    1. Initial program 100.0%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 100.0%

      \[\leadsto 1 + \color{blue}{\left(3 + 4 \cdot \frac{x - z}{y}\right)} \]
    4. Step-by-step derivation
      1. +-commutative100.0%

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

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

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

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

    if -1.69999999999999993e118 < x < -6.2e78 or -2.24999999999999985e-55 < x < 4.0499999999999998e43

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 94.0%

      \[\leadsto 1 + \color{blue}{4 \cdot \frac{0.75 \cdot y - z}{y}} \]
    4. Step-by-step derivation
      1. div-sub94.0%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(\frac{0.75 \cdot y}{y} - \frac{z}{y}\right)} \]
      2. associate-/l*94.0%

        \[\leadsto 1 + 4 \cdot \left(\color{blue}{0.75 \cdot \frac{y}{y}} - \frac{z}{y}\right) \]
      3. *-inverses94.0%

        \[\leadsto 1 + 4 \cdot \left(0.75 \cdot \color{blue}{1} - \frac{z}{y}\right) \]
      4. metadata-eval94.0%

        \[\leadsto 1 + 4 \cdot \left(\color{blue}{0.75} - \frac{z}{y}\right) \]
      5. sub-neg94.0%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(0.75 + \left(-\frac{z}{y}\right)\right)} \]
      6. distribute-lft-in94.0%

        \[\leadsto 1 + \color{blue}{\left(4 \cdot 0.75 + 4 \cdot \left(-\frac{z}{y}\right)\right)} \]
      7. metadata-eval94.0%

        \[\leadsto 1 + \left(\color{blue}{3} + 4 \cdot \left(-\frac{z}{y}\right)\right) \]
      8. distribute-rgt-neg-in94.0%

        \[\leadsto 1 + \left(3 + \color{blue}{\left(-4 \cdot \frac{z}{y}\right)}\right) \]
      9. *-lft-identity94.0%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \frac{\color{blue}{1 \cdot z}}{y}\right)\right) \]
      10. associate-*l/93.9%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \color{blue}{\left(\frac{1}{y} \cdot z\right)}\right)\right) \]
      11. associate-*l*93.9%

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{\left(4 \cdot \frac{1}{y}\right) \cdot z}\right)\right) \]
      12. *-commutative93.9%

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{z \cdot \left(4 \cdot \frac{1}{y}\right)}\right)\right) \]
      13. distribute-rgt-neg-in93.9%

        \[\leadsto 1 + \left(3 + \color{blue}{z \cdot \left(-4 \cdot \frac{1}{y}\right)}\right) \]
      14. associate-*r/93.9%

        \[\leadsto 1 + \left(3 + z \cdot \left(-\color{blue}{\frac{4 \cdot 1}{y}}\right)\right) \]
      15. metadata-eval93.9%

        \[\leadsto 1 + \left(3 + z \cdot \left(-\frac{\color{blue}{4}}{y}\right)\right) \]
      16. distribute-neg-frac93.9%

        \[\leadsto 1 + \left(3 + z \cdot \color{blue}{\frac{-4}{y}}\right) \]
      17. metadata-eval93.9%

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

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

      \[\leadsto \color{blue}{4 + -4 \cdot \frac{z}{y}} \]
    7. Step-by-step derivation
      1. associate-*r/94.0%

        \[\leadsto 4 + \color{blue}{\frac{-4 \cdot z}{y}} \]
    8. Simplified94.0%

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

    if 4.0499999999999998e43 < x

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 86.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+118}:\\ \;\;\;\;1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{+78}:\\ \;\;\;\;4 + \frac{z \cdot -4}{y}\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-55}:\\ \;\;\;\;1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;x \leq 4.05 \cdot 10^{+43}:\\ \;\;\;\;4 + \frac{z \cdot -4}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{4 \cdot \left(x - z\right)}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 55.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{+34} \lor \neg \left(z \leq 1.25 \cdot 10^{+58}\right):\\ \;\;\;\;1 + z \cdot \frac{-4}{y}\\ \mathbf{else}:\\ \;\;\;\;4\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -2.6e+34) (not (<= z 1.25e+58))) (+ 1.0 (* z (/ -4.0 y))) 4.0))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -2.6e+34) || !(z <= 1.25e+58)) {
		tmp = 1.0 + (z * (-4.0 / 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 ((z <= (-2.6d+34)) .or. (.not. (z <= 1.25d+58))) then
        tmp = 1.0d0 + (z * ((-4.0d0) / y))
    else
        tmp = 4.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -2.6e+34) || !(z <= 1.25e+58)) {
		tmp = 1.0 + (z * (-4.0 / y));
	} else {
		tmp = 4.0;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -2.6e+34) or not (z <= 1.25e+58):
		tmp = 1.0 + (z * (-4.0 / y))
	else:
		tmp = 4.0
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -2.6e+34) || !(z <= 1.25e+58))
		tmp = Float64(1.0 + Float64(z * Float64(-4.0 / y)));
	else
		tmp = 4.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -2.6e+34) || ~((z <= 1.25e+58)))
		tmp = 1.0 + (z * (-4.0 / y));
	else
		tmp = 4.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.6e+34], N[Not[LessEqual[z, 1.25e+58]], $MachinePrecision]], N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+34} \lor \neg \left(z \leq 1.25 \cdot 10^{+58}\right):\\
\;\;\;\;1 + z \cdot \frac{-4}{y}\\

\mathbf{else}:\\
\;\;\;\;4\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.59999999999999997e34 or 1.24999999999999996e58 < z

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 67.0%

      \[\leadsto 1 + \color{blue}{-4 \cdot \frac{z}{y}} \]
    4. Step-by-step derivation
      1. metadata-eval67.0%

        \[\leadsto 1 + \color{blue}{\left(-4\right)} \cdot \frac{z}{y} \]
      2. distribute-lft-neg-in67.0%

        \[\leadsto 1 + \color{blue}{\left(-4 \cdot \frac{z}{y}\right)} \]
      3. *-lft-identity67.0%

        \[\leadsto 1 + \left(-4 \cdot \frac{\color{blue}{1 \cdot z}}{y}\right) \]
      4. associate-*l/66.9%

        \[\leadsto 1 + \left(-4 \cdot \color{blue}{\left(\frac{1}{y} \cdot z\right)}\right) \]
      5. associate-*l*66.9%

        \[\leadsto 1 + \left(-\color{blue}{\left(4 \cdot \frac{1}{y}\right) \cdot z}\right) \]
      6. *-commutative66.9%

        \[\leadsto 1 + \left(-\color{blue}{z \cdot \left(4 \cdot \frac{1}{y}\right)}\right) \]
      7. distribute-rgt-neg-in66.9%

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

        \[\leadsto 1 + z \cdot \left(-\color{blue}{\frac{4 \cdot 1}{y}}\right) \]
      9. metadata-eval66.9%

        \[\leadsto 1 + z \cdot \left(-\frac{\color{blue}{4}}{y}\right) \]
      10. distribute-neg-frac66.9%

        \[\leadsto 1 + z \cdot \color{blue}{\frac{-4}{y}} \]
      11. metadata-eval66.9%

        \[\leadsto 1 + z \cdot \frac{\color{blue}{-4}}{y} \]
    5. Simplified66.9%

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

    if -2.59999999999999997e34 < z < 1.24999999999999996e58

    1. Initial program 100.0%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 58.6%

      \[\leadsto 1 + \color{blue}{4 \cdot \frac{0.75 \cdot y - z}{y}} \]
    4. Step-by-step derivation
      1. div-sub58.6%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(\frac{0.75 \cdot y}{y} - \frac{z}{y}\right)} \]
      2. associate-/l*58.6%

        \[\leadsto 1 + 4 \cdot \left(\color{blue}{0.75 \cdot \frac{y}{y}} - \frac{z}{y}\right) \]
      3. *-inverses58.6%

        \[\leadsto 1 + 4 \cdot \left(0.75 \cdot \color{blue}{1} - \frac{z}{y}\right) \]
      4. metadata-eval58.6%

        \[\leadsto 1 + 4 \cdot \left(\color{blue}{0.75} - \frac{z}{y}\right) \]
      5. sub-neg58.6%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(0.75 + \left(-\frac{z}{y}\right)\right)} \]
      6. distribute-lft-in58.6%

        \[\leadsto 1 + \color{blue}{\left(4 \cdot 0.75 + 4 \cdot \left(-\frac{z}{y}\right)\right)} \]
      7. metadata-eval58.6%

        \[\leadsto 1 + \left(\color{blue}{3} + 4 \cdot \left(-\frac{z}{y}\right)\right) \]
      8. distribute-rgt-neg-in58.6%

        \[\leadsto 1 + \left(3 + \color{blue}{\left(-4 \cdot \frac{z}{y}\right)}\right) \]
      9. *-lft-identity58.6%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \frac{\color{blue}{1 \cdot z}}{y}\right)\right) \]
      10. associate-*l/58.6%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \color{blue}{\left(\frac{1}{y} \cdot z\right)}\right)\right) \]
      11. associate-*l*58.6%

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{\left(4 \cdot \frac{1}{y}\right) \cdot z}\right)\right) \]
      12. *-commutative58.6%

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{z \cdot \left(4 \cdot \frac{1}{y}\right)}\right)\right) \]
      13. distribute-rgt-neg-in58.6%

        \[\leadsto 1 + \left(3 + \color{blue}{z \cdot \left(-4 \cdot \frac{1}{y}\right)}\right) \]
      14. associate-*r/58.6%

        \[\leadsto 1 + \left(3 + z \cdot \left(-\color{blue}{\frac{4 \cdot 1}{y}}\right)\right) \]
      15. metadata-eval58.6%

        \[\leadsto 1 + \left(3 + z \cdot \left(-\frac{\color{blue}{4}}{y}\right)\right) \]
      16. distribute-neg-frac58.6%

        \[\leadsto 1 + \left(3 + z \cdot \color{blue}{\frac{-4}{y}}\right) \]
      17. metadata-eval58.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{+34} \lor \neg \left(z \leq 1.25 \cdot 10^{+58}\right):\\ \;\;\;\;1 + z \cdot \frac{-4}{y}\\ \mathbf{else}:\\ \;\;\;\;4\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 81.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+118} \lor \neg \left(x \leq 7.8 \cdot 10^{+100}\right):\\
\;\;\;\;1 + 4 \cdot \frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.75000000000000008e118 or 7.8e100 < x

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 76.6%

      \[\leadsto 1 + \color{blue}{4 \cdot \frac{x}{y}} \]
    4. Step-by-step derivation
      1. *-commutative76.6%

        \[\leadsto 1 + \color{blue}{\frac{x}{y} \cdot 4} \]
    5. Simplified76.6%

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

    if -1.75000000000000008e118 < x < 7.8e100

    1. Initial program 99.9%

      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 85.3%

      \[\leadsto 1 + \color{blue}{4 \cdot \frac{0.75 \cdot y - z}{y}} \]
    4. Step-by-step derivation
      1. div-sub85.3%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(\frac{0.75 \cdot y}{y} - \frac{z}{y}\right)} \]
      2. associate-/l*85.3%

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

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

        \[\leadsto 1 + 4 \cdot \left(\color{blue}{0.75} - \frac{z}{y}\right) \]
      5. sub-neg85.3%

        \[\leadsto 1 + 4 \cdot \color{blue}{\left(0.75 + \left(-\frac{z}{y}\right)\right)} \]
      6. distribute-lft-in85.3%

        \[\leadsto 1 + \color{blue}{\left(4 \cdot 0.75 + 4 \cdot \left(-\frac{z}{y}\right)\right)} \]
      7. metadata-eval85.3%

        \[\leadsto 1 + \left(\color{blue}{3} + 4 \cdot \left(-\frac{z}{y}\right)\right) \]
      8. distribute-rgt-neg-in85.3%

        \[\leadsto 1 + \left(3 + \color{blue}{\left(-4 \cdot \frac{z}{y}\right)}\right) \]
      9. *-lft-identity85.3%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \frac{\color{blue}{1 \cdot z}}{y}\right)\right) \]
      10. associate-*l/85.2%

        \[\leadsto 1 + \left(3 + \left(-4 \cdot \color{blue}{\left(\frac{1}{y} \cdot z\right)}\right)\right) \]
      11. associate-*l*85.2%

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{\left(4 \cdot \frac{1}{y}\right) \cdot z}\right)\right) \]
      12. *-commutative85.2%

        \[\leadsto 1 + \left(3 + \left(-\color{blue}{z \cdot \left(4 \cdot \frac{1}{y}\right)}\right)\right) \]
      13. distribute-rgt-neg-in85.2%

        \[\leadsto 1 + \left(3 + \color{blue}{z \cdot \left(-4 \cdot \frac{1}{y}\right)}\right) \]
      14. associate-*r/85.2%

        \[\leadsto 1 + \left(3 + z \cdot \left(-\color{blue}{\frac{4 \cdot 1}{y}}\right)\right) \]
      15. metadata-eval85.2%

        \[\leadsto 1 + \left(3 + z \cdot \left(-\frac{\color{blue}{4}}{y}\right)\right) \]
      16. distribute-neg-frac85.2%

        \[\leadsto 1 + \left(3 + z \cdot \color{blue}{\frac{-4}{y}}\right) \]
      17. metadata-eval85.2%

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

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

      \[\leadsto \color{blue}{4 + -4 \cdot \frac{z}{y}} \]
    7. Step-by-step derivation
      1. associate-*r/85.3%

        \[\leadsto 4 + \color{blue}{\frac{-4 \cdot z}{y}} \]
    8. Simplified85.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.75 \cdot 10^{+118} \lor \neg \left(x \leq 7.8 \cdot 10^{+100}\right):\\ \;\;\;\;1 + 4 \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;4 + \frac{z \cdot -4}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 99.8% accurate, 1.2× speedup?

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

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

    \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
  2. Add Preprocessing
  3. Taylor expanded in y around inf 100.0%

    \[\leadsto 1 + \color{blue}{\left(3 + 4 \cdot \frac{x - z}{y}\right)} \]
  4. Step-by-step derivation
    1. +-commutative100.0%

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

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

    \[\leadsto 1 + \color{blue}{\left(\frac{4 \cdot \left(x - z\right)}{y} + 3\right)} \]
  6. Step-by-step derivation
    1. clear-num69.8%

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

      \[\leadsto 1 + \color{blue}{{\left(\frac{y}{4 \cdot \left(x - z\right)}\right)}^{-1}} \]
    3. *-un-lft-identity69.8%

      \[\leadsto 1 + {\left(\frac{\color{blue}{1 \cdot y}}{4 \cdot \left(x - z\right)}\right)}^{-1} \]
    4. times-frac69.8%

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

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

    \[\leadsto 1 + \left(\color{blue}{{\left(0.25 \cdot \frac{y}{x - z}\right)}^{-1}} + 3\right) \]
  8. Step-by-step derivation
    1. unpow-169.8%

      \[\leadsto 1 + \color{blue}{\frac{1}{0.25 \cdot \frac{y}{x - z}}} \]
    2. associate-/r*69.8%

      \[\leadsto 1 + \color{blue}{\frac{\frac{1}{0.25}}{\frac{y}{x - z}}} \]
    3. metadata-eval69.8%

      \[\leadsto 1 + \frac{\color{blue}{4}}{\frac{y}{x - z}} \]
  9. Simplified99.8%

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

    \[\leadsto 1 + \left(3 + \frac{4}{\frac{y}{x - z}}\right) \]
  11. Add Preprocessing

Alternative 10: 34.3% 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 99.9%

    \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 68.2%

    \[\leadsto 1 + \color{blue}{4 \cdot \frac{0.75 \cdot y - z}{y}} \]
  4. Step-by-step derivation
    1. div-sub68.2%

      \[\leadsto 1 + 4 \cdot \color{blue}{\left(\frac{0.75 \cdot y}{y} - \frac{z}{y}\right)} \]
    2. associate-/l*68.2%

      \[\leadsto 1 + 4 \cdot \left(\color{blue}{0.75 \cdot \frac{y}{y}} - \frac{z}{y}\right) \]
    3. *-inverses68.2%

      \[\leadsto 1 + 4 \cdot \left(0.75 \cdot \color{blue}{1} - \frac{z}{y}\right) \]
    4. metadata-eval68.2%

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

      \[\leadsto 1 + 4 \cdot \color{blue}{\left(0.75 + \left(-\frac{z}{y}\right)\right)} \]
    6. distribute-lft-in68.2%

      \[\leadsto 1 + \color{blue}{\left(4 \cdot 0.75 + 4 \cdot \left(-\frac{z}{y}\right)\right)} \]
    7. metadata-eval68.2%

      \[\leadsto 1 + \left(\color{blue}{3} + 4 \cdot \left(-\frac{z}{y}\right)\right) \]
    8. distribute-rgt-neg-in68.2%

      \[\leadsto 1 + \left(3 + \color{blue}{\left(-4 \cdot \frac{z}{y}\right)}\right) \]
    9. *-lft-identity68.2%

      \[\leadsto 1 + \left(3 + \left(-4 \cdot \frac{\color{blue}{1 \cdot z}}{y}\right)\right) \]
    10. associate-*l/68.1%

      \[\leadsto 1 + \left(3 + \left(-4 \cdot \color{blue}{\left(\frac{1}{y} \cdot z\right)}\right)\right) \]
    11. associate-*l*68.1%

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

      \[\leadsto 1 + \left(3 + \left(-\color{blue}{z \cdot \left(4 \cdot \frac{1}{y}\right)}\right)\right) \]
    13. distribute-rgt-neg-in68.1%

      \[\leadsto 1 + \left(3 + \color{blue}{z \cdot \left(-4 \cdot \frac{1}{y}\right)}\right) \]
    14. associate-*r/68.1%

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

      \[\leadsto 1 + \left(3 + z \cdot \left(-\frac{\color{blue}{4}}{y}\right)\right) \]
    16. distribute-neg-frac68.1%

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

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

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

    \[\leadsto \color{blue}{4} \]
  7. Final simplification37.2%

    \[\leadsto 4 \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2024066 
(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)))