Data.Colour.CIE:cieLAB from colour-2.3.3, A

Percentage Accurate: 99.7% → 99.7%
Time: 7.1s
Alternatives: 5
Speedup: 1.3×

Specification

?
\[\begin{array}{l} \\ \left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y \end{array} \]
(FPCore (x y) :precision binary64 (* (* (- x (/ 16.0 116.0)) 3.0) y))
double code(double x, double y) {
	return ((x - (16.0 / 116.0)) * 3.0) * y;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x - (16.0d0 / 116.0d0)) * 3.0d0) * y
end function
public static double code(double x, double y) {
	return ((x - (16.0 / 116.0)) * 3.0) * y;
}
def code(x, y):
	return ((x - (16.0 / 116.0)) * 3.0) * y
function code(x, y)
	return Float64(Float64(Float64(x - Float64(16.0 / 116.0)) * 3.0) * y)
end
function tmp = code(x, y)
	tmp = ((x - (16.0 / 116.0)) * 3.0) * y;
end
code[x_, y_] := N[(N[(N[(x - N[(16.0 / 116.0), $MachinePrecision]), $MachinePrecision] * 3.0), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot 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 5 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} \\ \left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y \end{array} \]
(FPCore (x y) :precision binary64 (* (* (- x (/ 16.0 116.0)) 3.0) y))
double code(double x, double y) {
	return ((x - (16.0 / 116.0)) * 3.0) * y;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x - (16.0d0 / 116.0d0)) * 3.0d0) * y
end function
public static double code(double x, double y) {
	return ((x - (16.0 / 116.0)) * 3.0) * y;
}
def code(x, y):
	return ((x - (16.0 / 116.0)) * 3.0) * y
function code(x, y)
	return Float64(Float64(Float64(x - Float64(16.0 / 116.0)) * 3.0) * y)
end
function tmp = code(x, y)
	tmp = ((x - (16.0 / 116.0)) * 3.0) * y;
end
code[x_, y_] := N[(N[(N[(x - N[(16.0 / 116.0), $MachinePrecision]), $MachinePrecision] * 3.0), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y
\end{array}

Alternative 1: 99.7% accurate, 1.3× speedup?

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

\\
\left(x \cdot 3 + -0.41379310344827586\right) \cdot y
\end{array}
Derivation
  1. Initial program 99.7%

    \[\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y \]
  2. Step-by-step derivation
    1. *-lowering-*.f64N/A

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x - \frac{16}{116}\right), 3\right), y\right) \]
    3. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x + \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{4}{29}\right)\right)\right), 3\right), y\right) \]
    6. metadata-eval99.7%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), 3\right), y\right) \]
  3. Simplified99.7%

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

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

      \[\leadsto \mathsf{*.f64}\left(\left(3 \cdot \left(x + \frac{-4}{29}\right)\right), y\right) \]
    3. distribute-lft-inN/A

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 3\right), \left(3 \cdot \frac{-4}{29}\right)\right), y\right) \]
    7. metadata-eval99.7%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 3\right), \frac{-12}{29}\right), y\right) \]
  6. Applied egg-rr99.7%

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

Alternative 2: 97.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.135:\\ \;\;\;\;\left(x \cdot 3\right) \cdot y\\ \mathbf{elif}\;x \leq 0.14:\\ \;\;\;\;-0.41379310344827586 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(3 \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -0.135)
   (* (* x 3.0) y)
   (if (<= x 0.14) (* -0.41379310344827586 y) (* x (* 3.0 y)))))
double code(double x, double y) {
	double tmp;
	if (x <= -0.135) {
		tmp = (x * 3.0) * y;
	} else if (x <= 0.14) {
		tmp = -0.41379310344827586 * y;
	} else {
		tmp = x * (3.0 * y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-0.135d0)) then
        tmp = (x * 3.0d0) * y
    else if (x <= 0.14d0) then
        tmp = (-0.41379310344827586d0) * y
    else
        tmp = x * (3.0d0 * y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -0.135) {
		tmp = (x * 3.0) * y;
	} else if (x <= 0.14) {
		tmp = -0.41379310344827586 * y;
	} else {
		tmp = x * (3.0 * y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -0.135:
		tmp = (x * 3.0) * y
	elif x <= 0.14:
		tmp = -0.41379310344827586 * y
	else:
		tmp = x * (3.0 * y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -0.135)
		tmp = Float64(Float64(x * 3.0) * y);
	elseif (x <= 0.14)
		tmp = Float64(-0.41379310344827586 * y);
	else
		tmp = Float64(x * Float64(3.0 * y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -0.135)
		tmp = (x * 3.0) * y;
	elseif (x <= 0.14)
		tmp = -0.41379310344827586 * y;
	else
		tmp = x * (3.0 * y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -0.135], N[(N[(x * 3.0), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[x, 0.14], N[(-0.41379310344827586 * y), $MachinePrecision], N[(x * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.135:\\
\;\;\;\;\left(x \cdot 3\right) \cdot y\\

\mathbf{elif}\;x \leq 0.14:\\
\;\;\;\;-0.41379310344827586 \cdot y\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(3 \cdot y\right)\\


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

    1. Initial program 99.7%

      \[\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y \]
    2. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x - \frac{16}{116}\right), 3\right), y\right) \]
      3. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x + \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{4}{29}\right)\right)\right), 3\right), y\right) \]
      6. metadata-eval99.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), 3\right), y\right) \]
    3. Simplified99.7%

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\color{blue}{x}, 3\right), y\right) \]
    6. Step-by-step derivation
      1. Simplified98.6%

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

      if -0.13500000000000001 < x < 0.14000000000000001

      1. Initial program 99.8%

        \[\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y \]
      2. Step-by-step derivation
        1. *-lowering-*.f64N/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x - \frac{16}{116}\right), 3\right), y\right) \]
        3. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x + \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
        4. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
        5. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{4}{29}\right)\right)\right), 3\right), y\right) \]
        6. metadata-eval99.8%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), 3\right), y\right) \]
      3. Simplified99.8%

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

        \[\leadsto \color{blue}{\frac{-12}{29} \cdot y} \]
      6. Step-by-step derivation
        1. *-lowering-*.f6497.4%

          \[\leadsto \mathsf{*.f64}\left(\frac{-12}{29}, \color{blue}{y}\right) \]
      7. Simplified97.4%

        \[\leadsto \color{blue}{-0.41379310344827586 \cdot y} \]

      if 0.14000000000000001 < x

      1. Initial program 99.6%

        \[\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y \]
      2. Step-by-step derivation
        1. *-lowering-*.f64N/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x - \frac{16}{116}\right), 3\right), y\right) \]
        3. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x + \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
        4. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
        5. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{4}{29}\right)\right)\right), 3\right), y\right) \]
        6. metadata-eval99.6%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), 3\right), y\right) \]
      3. Simplified99.6%

        \[\leadsto \color{blue}{\left(\left(x + -0.13793103448275862\right) \cdot 3\right) \cdot y} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. associate-*l*N/A

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), \left(\color{blue}{3} \cdot y\right)\right) \]
        4. *-lowering-*.f6499.6%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), \mathsf{*.f64}\left(3, \color{blue}{y}\right)\right) \]
      6. Applied egg-rr99.6%

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

        \[\leadsto \mathsf{*.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(3, y\right)\right) \]
      8. Step-by-step derivation
        1. Simplified98.2%

          \[\leadsto \color{blue}{x} \cdot \left(3 \cdot y\right) \]
      9. Recombined 3 regimes into one program.
      10. Add Preprocessing

      Alternative 3: 97.9% accurate, 0.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(3 \cdot y\right)\\ \mathbf{if}\;x \leq -0.135:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 0.14:\\ \;\;\;\;-0.41379310344827586 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y)
       :precision binary64
       (let* ((t_0 (* x (* 3.0 y))))
         (if (<= x -0.135) t_0 (if (<= x 0.14) (* -0.41379310344827586 y) t_0))))
      double code(double x, double y) {
      	double t_0 = x * (3.0 * y);
      	double tmp;
      	if (x <= -0.135) {
      		tmp = t_0;
      	} else if (x <= 0.14) {
      		tmp = -0.41379310344827586 * y;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8) :: t_0
          real(8) :: tmp
          t_0 = x * (3.0d0 * y)
          if (x <= (-0.135d0)) then
              tmp = t_0
          else if (x <= 0.14d0) then
              tmp = (-0.41379310344827586d0) * y
          else
              tmp = t_0
          end if
          code = tmp
      end function
      
      public static double code(double x, double y) {
      	double t_0 = x * (3.0 * y);
      	double tmp;
      	if (x <= -0.135) {
      		tmp = t_0;
      	} else if (x <= 0.14) {
      		tmp = -0.41379310344827586 * y;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, y):
      	t_0 = x * (3.0 * y)
      	tmp = 0
      	if x <= -0.135:
      		tmp = t_0
      	elif x <= 0.14:
      		tmp = -0.41379310344827586 * y
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, y)
      	t_0 = Float64(x * Float64(3.0 * y))
      	tmp = 0.0
      	if (x <= -0.135)
      		tmp = t_0;
      	elseif (x <= 0.14)
      		tmp = Float64(-0.41379310344827586 * y);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y)
      	t_0 = x * (3.0 * y);
      	tmp = 0.0;
      	if (x <= -0.135)
      		tmp = t_0;
      	elseif (x <= 0.14)
      		tmp = -0.41379310344827586 * y;
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_] := Block[{t$95$0 = N[(x * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -0.135], t$95$0, If[LessEqual[x, 0.14], N[(-0.41379310344827586 * y), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := x \cdot \left(3 \cdot y\right)\\
      \mathbf{if}\;x \leq -0.135:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 0.14:\\
      \;\;\;\;-0.41379310344827586 \cdot y\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < -0.13500000000000001 or 0.14000000000000001 < x

        1. Initial program 99.6%

          \[\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y \]
        2. Step-by-step derivation
          1. *-lowering-*.f64N/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x - \frac{16}{116}\right), 3\right), y\right) \]
          3. sub-negN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x + \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
          4. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
          5. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{4}{29}\right)\right)\right), 3\right), y\right) \]
          6. metadata-eval99.6%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), 3\right), y\right) \]
        3. Simplified99.6%

          \[\leadsto \color{blue}{\left(\left(x + -0.13793103448275862\right) \cdot 3\right) \cdot y} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. associate-*l*N/A

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), \left(\color{blue}{3} \cdot y\right)\right) \]
          4. *-lowering-*.f6499.6%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), \mathsf{*.f64}\left(3, \color{blue}{y}\right)\right) \]
        6. Applied egg-rr99.6%

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

          \[\leadsto \mathsf{*.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(3, y\right)\right) \]
        8. Step-by-step derivation
          1. Simplified98.3%

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

          if -0.13500000000000001 < x < 0.14000000000000001

          1. Initial program 99.8%

            \[\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y \]
          2. Step-by-step derivation
            1. *-lowering-*.f64N/A

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x - \frac{16}{116}\right), 3\right), y\right) \]
            3. sub-negN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x + \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
            4. +-lowering-+.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
            5. metadata-evalN/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{4}{29}\right)\right)\right), 3\right), y\right) \]
            6. metadata-eval99.8%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), 3\right), y\right) \]
          3. Simplified99.8%

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

            \[\leadsto \color{blue}{\frac{-12}{29} \cdot y} \]
          6. Step-by-step derivation
            1. *-lowering-*.f6497.4%

              \[\leadsto \mathsf{*.f64}\left(\frac{-12}{29}, \color{blue}{y}\right) \]
          7. Simplified97.4%

            \[\leadsto \color{blue}{-0.41379310344827586 \cdot y} \]
        9. Recombined 2 regimes into one program.
        10. Add Preprocessing

        Alternative 4: 99.7% accurate, 1.3× speedup?

        \[\begin{array}{l} \\ y \cdot \left(3 \cdot \left(x + -0.13793103448275862\right)\right) \end{array} \]
        (FPCore (x y) :precision binary64 (* y (* 3.0 (+ x -0.13793103448275862))))
        double code(double x, double y) {
        	return y * (3.0 * (x + -0.13793103448275862));
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = y * (3.0d0 * (x + (-0.13793103448275862d0)))
        end function
        
        public static double code(double x, double y) {
        	return y * (3.0 * (x + -0.13793103448275862));
        }
        
        def code(x, y):
        	return y * (3.0 * (x + -0.13793103448275862))
        
        function code(x, y)
        	return Float64(y * Float64(3.0 * Float64(x + -0.13793103448275862)))
        end
        
        function tmp = code(x, y)
        	tmp = y * (3.0 * (x + -0.13793103448275862));
        end
        
        code[x_, y_] := N[(y * N[(3.0 * N[(x + -0.13793103448275862), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        y \cdot \left(3 \cdot \left(x + -0.13793103448275862\right)\right)
        \end{array}
        
        Derivation
        1. Initial program 99.7%

          \[\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y \]
        2. Step-by-step derivation
          1. *-lowering-*.f64N/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x - \frac{16}{116}\right), 3\right), y\right) \]
          3. sub-negN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x + \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
          4. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
          5. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{4}{29}\right)\right)\right), 3\right), y\right) \]
          6. metadata-eval99.7%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), 3\right), y\right) \]
        3. Simplified99.7%

          \[\leadsto \color{blue}{\left(\left(x + -0.13793103448275862\right) \cdot 3\right) \cdot y} \]
        4. Add Preprocessing
        5. Final simplification99.7%

          \[\leadsto y \cdot \left(3 \cdot \left(x + -0.13793103448275862\right)\right) \]
        6. Add Preprocessing

        Alternative 5: 51.3% accurate, 3.0× speedup?

        \[\begin{array}{l} \\ -0.41379310344827586 \cdot y \end{array} \]
        (FPCore (x y) :precision binary64 (* -0.41379310344827586 y))
        double code(double x, double y) {
        	return -0.41379310344827586 * y;
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = (-0.41379310344827586d0) * y
        end function
        
        public static double code(double x, double y) {
        	return -0.41379310344827586 * y;
        }
        
        def code(x, y):
        	return -0.41379310344827586 * y
        
        function code(x, y)
        	return Float64(-0.41379310344827586 * y)
        end
        
        function tmp = code(x, y)
        	tmp = -0.41379310344827586 * y;
        end
        
        code[x_, y_] := N[(-0.41379310344827586 * y), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        -0.41379310344827586 \cdot y
        \end{array}
        
        Derivation
        1. Initial program 99.7%

          \[\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y \]
        2. Step-by-step derivation
          1. *-lowering-*.f64N/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x - \frac{16}{116}\right), 3\right), y\right) \]
          3. sub-negN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(x + \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
          4. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{16}{116}\right)\right)\right), 3\right), y\right) \]
          5. metadata-evalN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \left(\mathsf{neg}\left(\frac{4}{29}\right)\right)\right), 3\right), y\right) \]
          6. metadata-eval99.7%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(x, \frac{-4}{29}\right), 3\right), y\right) \]
        3. Simplified99.7%

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

          \[\leadsto \color{blue}{\frac{-12}{29} \cdot y} \]
        6. Step-by-step derivation
          1. *-lowering-*.f6452.6%

            \[\leadsto \mathsf{*.f64}\left(\frac{-12}{29}, \color{blue}{y}\right) \]
        7. Simplified52.6%

          \[\leadsto \color{blue}{-0.41379310344827586 \cdot y} \]
        8. Add Preprocessing

        Developer Target 1: 99.7% accurate, 1.3× speedup?

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

        Reproduce

        ?
        herbie shell --seed 2024158 
        (FPCore (x y)
          :name "Data.Colour.CIE:cieLAB from colour-2.3.3, A"
          :precision binary64
        
          :alt
          (! :herbie-platform default (* y (- (* x 3) 20689655172413793/50000000000000000)))
        
          (* (* (- x (/ 16.0 116.0)) 3.0) y))