Graphics.Rendering.Chart.Axis.Types:hBufferRect from Chart-1.5.3

Percentage Accurate: 99.9% → 100.0%
Time: 3.5s
Alternatives: 5
Speedup: 1.8×

Specification

?
\[\begin{array}{l} \\ x + \frac{x - y}{2} \end{array} \]
(FPCore (x y) :precision binary64 (+ x (/ (- x y) 2.0)))
double code(double x, double y) {
	return x + ((x - y) / 2.0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x + ((x - y) / 2.0d0)
end function
public static double code(double x, double y) {
	return x + ((x - y) / 2.0);
}
def code(x, y):
	return x + ((x - y) / 2.0)
function code(x, y)
	return Float64(x + Float64(Float64(x - y) / 2.0))
end
function tmp = code(x, y)
	tmp = x + ((x - y) / 2.0);
end
code[x_, y_] := N[(x + N[(N[(x - y), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{x - y}{2}
\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.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{x - y}{2} \end{array} \]
(FPCore (x y) :precision binary64 (+ x (/ (- x y) 2.0)))
double code(double x, double y) {
	return x + ((x - y) / 2.0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x + ((x - y) / 2.0d0)
end function
public static double code(double x, double y) {
	return x + ((x - y) / 2.0);
}
def code(x, y):
	return x + ((x - y) / 2.0)
function code(x, y)
	return Float64(x + Float64(Float64(x - y) / 2.0))
end
function tmp = code(x, y)
	tmp = x + ((x - y) / 2.0);
end
code[x_, y_] := N[(x + N[(N[(x - y), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{x - y}{2}
\end{array}

Alternative 1: 100.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(1.5, x, -0.5 \cdot y\right) \end{array} \]
(FPCore (x y) :precision binary64 (fma 1.5 x (* -0.5 y)))
double code(double x, double y) {
	return fma(1.5, x, (-0.5 * y));
}
function code(x, y)
	return fma(1.5, x, Float64(-0.5 * y))
end
code[x_, y_] := N[(1.5 * x + N[(-0.5 * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(1.5, x, -0.5 \cdot y\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[x + \frac{x - y}{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-+.f64N/A

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

      \[\leadsto \color{blue}{\frac{x - y}{2} + x} \]
    3. flip-+N/A

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

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

      \[\leadsto \frac{\color{blue}{\frac{x - y}{2} \cdot \frac{x - y}{2} - x \cdot x}}{\frac{x - y}{2} - x} \]
    6. pow2N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{x - y}{2}\right)}^{2}} - x \cdot x}{\frac{x - y}{2} - x} \]
    7. lower-pow.f64N/A

      \[\leadsto \frac{\color{blue}{{\left(\frac{x - y}{2}\right)}^{2}} - x \cdot x}{\frac{x - y}{2} - x} \]
    8. lower-*.f64N/A

      \[\leadsto \frac{{\left(\frac{x - y}{2}\right)}^{2} - \color{blue}{x \cdot x}}{\frac{x - y}{2} - x} \]
    9. lower--.f6457.5

      \[\leadsto \frac{{\left(\frac{x - y}{2}\right)}^{2} - x \cdot x}{\color{blue}{\frac{x - y}{2} - x}} \]
  4. Applied rewrites57.5%

    \[\leadsto \color{blue}{\frac{{\left(\frac{x - y}{2}\right)}^{2} - x \cdot x}{\frac{x - y}{2} - x}} \]
  5. Taylor expanded in y around -inf

    \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(\frac{1}{2} + -1 \cdot \frac{2 \cdot x - \frac{1}{2} \cdot x}{y}\right)\right)} \]
  6. Step-by-step derivation
    1. Applied rewrites88.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{y}, 1.5, -0.5\right) \cdot y} \]
    2. Taylor expanded in x around 0

      \[\leadsto \frac{-1}{2} \cdot y + \color{blue}{\frac{3}{2} \cdot x} \]
    3. Step-by-step derivation
      1. Applied rewrites100.0%

        \[\leadsto \mathsf{fma}\left(1.5, \color{blue}{x}, -0.5 \cdot y\right) \]
      2. Final simplification100.0%

        \[\leadsto \mathsf{fma}\left(1.5, x, -0.5 \cdot y\right) \]
      3. Add Preprocessing

      Alternative 2: 76.4% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -8.8 \cdot 10^{-101} \lor \neg \left(y \leq 3.6 \cdot 10^{+17}\right):\\ \;\;\;\;\mathsf{fma}\left(y, -0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;1.5 \cdot x\\ \end{array} \end{array} \]
      (FPCore (x y)
       :precision binary64
       (if (or (<= y -8.8e-101) (not (<= y 3.6e+17))) (fma y -0.5 x) (* 1.5 x)))
      double code(double x, double y) {
      	double tmp;
      	if ((y <= -8.8e-101) || !(y <= 3.6e+17)) {
      		tmp = fma(y, -0.5, x);
      	} else {
      		tmp = 1.5 * x;
      	}
      	return tmp;
      }
      
      function code(x, y)
      	tmp = 0.0
      	if ((y <= -8.8e-101) || !(y <= 3.6e+17))
      		tmp = fma(y, -0.5, x);
      	else
      		tmp = Float64(1.5 * x);
      	end
      	return tmp
      end
      
      code[x_, y_] := If[Or[LessEqual[y, -8.8e-101], N[Not[LessEqual[y, 3.6e+17]], $MachinePrecision]], N[(y * -0.5 + x), $MachinePrecision], N[(1.5 * x), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -8.8 \cdot 10^{-101} \lor \neg \left(y \leq 3.6 \cdot 10^{+17}\right):\\
      \;\;\;\;\mathsf{fma}\left(y, -0.5, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;1.5 \cdot x\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -8.7999999999999996e-101 or 3.6e17 < y

        1. Initial program 99.9%

          \[x + \frac{x - y}{2} \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\frac{-1}{2} \cdot y + \frac{3}{2} \cdot x} \]
        4. Applied rewrites99.9%

          \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, -0.5, x\right)} \]
        5. Taylor expanded in x around 0

          \[\leadsto \mathsf{fma}\left(y, \frac{-1}{2}, x\right) \]
        6. Step-by-step derivation
          1. Applied rewrites78.9%

            \[\leadsto \mathsf{fma}\left(y, -0.5, x\right) \]

          if -8.7999999999999996e-101 < y < 3.6e17

          1. Initial program 99.8%

            \[x + \frac{x - y}{2} \]
          2. Add Preprocessing
          3. Taylor expanded in x around inf

            \[\leadsto \color{blue}{\frac{3}{2} \cdot x} \]
          4. Step-by-step derivation
            1. Applied rewrites80.7%

              \[\leadsto \color{blue}{1.5 \cdot x} \]
          5. Recombined 2 regimes into one program.
          6. Final simplification79.6%

            \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.8 \cdot 10^{-101} \lor \neg \left(y \leq 3.6 \cdot 10^{+17}\right):\\ \;\;\;\;\mathsf{fma}\left(y, -0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;1.5 \cdot x\\ \end{array} \]
          7. Add Preprocessing

          Alternative 3: 74.7% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.7 \cdot 10^{-16} \lor \neg \left(y \leq 3.6 \cdot 10^{+17}\right):\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;1.5 \cdot x\\ \end{array} \end{array} \]
          (FPCore (x y)
           :precision binary64
           (if (or (<= y -2.7e-16) (not (<= y 3.6e+17))) (* -0.5 y) (* 1.5 x)))
          double code(double x, double y) {
          	double tmp;
          	if ((y <= -2.7e-16) || !(y <= 3.6e+17)) {
          		tmp = -0.5 * y;
          	} else {
          		tmp = 1.5 * x;
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x, y)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8) :: tmp
              if ((y <= (-2.7d-16)) .or. (.not. (y <= 3.6d+17))) then
                  tmp = (-0.5d0) * y
              else
                  tmp = 1.5d0 * x
              end if
              code = tmp
          end function
          
          public static double code(double x, double y) {
          	double tmp;
          	if ((y <= -2.7e-16) || !(y <= 3.6e+17)) {
          		tmp = -0.5 * y;
          	} else {
          		tmp = 1.5 * x;
          	}
          	return tmp;
          }
          
          def code(x, y):
          	tmp = 0
          	if (y <= -2.7e-16) or not (y <= 3.6e+17):
          		tmp = -0.5 * y
          	else:
          		tmp = 1.5 * x
          	return tmp
          
          function code(x, y)
          	tmp = 0.0
          	if ((y <= -2.7e-16) || !(y <= 3.6e+17))
          		tmp = Float64(-0.5 * y);
          	else
          		tmp = Float64(1.5 * x);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y)
          	tmp = 0.0;
          	if ((y <= -2.7e-16) || ~((y <= 3.6e+17)))
          		tmp = -0.5 * y;
          	else
          		tmp = 1.5 * x;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_] := If[Or[LessEqual[y, -2.7e-16], N[Not[LessEqual[y, 3.6e+17]], $MachinePrecision]], N[(-0.5 * y), $MachinePrecision], N[(1.5 * x), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y \leq -2.7 \cdot 10^{-16} \lor \neg \left(y \leq 3.6 \cdot 10^{+17}\right):\\
          \;\;\;\;-0.5 \cdot y\\
          
          \mathbf{else}:\\
          \;\;\;\;1.5 \cdot x\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -2.69999999999999999e-16 or 3.6e17 < y

            1. Initial program 99.9%

              \[x + \frac{x - y}{2} \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{\frac{-1}{2} \cdot y} \]
            4. Step-by-step derivation
              1. Applied rewrites79.0%

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

              if -2.69999999999999999e-16 < y < 3.6e17

              1. Initial program 99.9%

                \[x + \frac{x - y}{2} \]
              2. Add Preprocessing
              3. Taylor expanded in x around inf

                \[\leadsto \color{blue}{\frac{3}{2} \cdot x} \]
              4. Step-by-step derivation
                1. Applied rewrites76.7%

                  \[\leadsto \color{blue}{1.5 \cdot x} \]
              5. Recombined 2 regimes into one program.
              6. Final simplification77.9%

                \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.7 \cdot 10^{-16} \lor \neg \left(y \leq 3.6 \cdot 10^{+17}\right):\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;1.5 \cdot x\\ \end{array} \]
              7. Add Preprocessing

              Alternative 4: 99.9% accurate, 1.8× speedup?

              \[\begin{array}{l} \\ \mathsf{fma}\left(y - x, -0.5, x\right) \end{array} \]
              (FPCore (x y) :precision binary64 (fma (- y x) -0.5 x))
              double code(double x, double y) {
              	return fma((y - x), -0.5, x);
              }
              
              function code(x, y)
              	return fma(Float64(y - x), -0.5, x)
              end
              
              code[x_, y_] := N[(N[(y - x), $MachinePrecision] * -0.5 + x), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              \mathsf{fma}\left(y - x, -0.5, x\right)
              \end{array}
              
              Derivation
              1. Initial program 99.9%

                \[x + \frac{x - y}{2} \]
              2. Add Preprocessing
              3. Taylor expanded in x around 0

                \[\leadsto \color{blue}{\frac{-1}{2} \cdot y + \frac{3}{2} \cdot x} \]
              4. Applied rewrites99.9%

                \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, -0.5, x\right)} \]
              5. Add Preprocessing

              Alternative 5: 49.5% accurate, 3.0× speedup?

              \[\begin{array}{l} \\ -0.5 \cdot y \end{array} \]
              (FPCore (x y) :precision binary64 (* -0.5 y))
              double code(double x, double y) {
              	return -0.5 * y;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x, y)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  code = (-0.5d0) * y
              end function
              
              public static double code(double x, double y) {
              	return -0.5 * y;
              }
              
              def code(x, y):
              	return -0.5 * y
              
              function code(x, y)
              	return Float64(-0.5 * y)
              end
              
              function tmp = code(x, y)
              	tmp = -0.5 * y;
              end
              
              code[x_, y_] := N[(-0.5 * y), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              -0.5 \cdot y
              \end{array}
              
              Derivation
              1. Initial program 99.9%

                \[x + \frac{x - y}{2} \]
              2. Add Preprocessing
              3. Taylor expanded in x around 0

                \[\leadsto \color{blue}{\frac{-1}{2} \cdot y} \]
              4. Step-by-step derivation
                1. Applied rewrites51.9%

                  \[\leadsto \color{blue}{-0.5 \cdot y} \]
                2. Add Preprocessing

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

                \[\begin{array}{l} \\ 1.5 \cdot x - 0.5 \cdot y \end{array} \]
                (FPCore (x y) :precision binary64 (- (* 1.5 x) (* 0.5 y)))
                double code(double x, double y) {
                	return (1.5 * x) - (0.5 * y);
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    code = (1.5d0 * x) - (0.5d0 * y)
                end function
                
                public static double code(double x, double y) {
                	return (1.5 * x) - (0.5 * y);
                }
                
                def code(x, y):
                	return (1.5 * x) - (0.5 * y)
                
                function code(x, y)
                	return Float64(Float64(1.5 * x) - Float64(0.5 * y))
                end
                
                function tmp = code(x, y)
                	tmp = (1.5 * x) - (0.5 * y);
                end
                
                code[x_, y_] := N[(N[(1.5 * x), $MachinePrecision] - N[(0.5 * y), $MachinePrecision]), $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                1.5 \cdot x - 0.5 \cdot y
                \end{array}
                

                Reproduce

                ?
                herbie shell --seed 2025018 
                (FPCore (x y)
                  :name "Graphics.Rendering.Chart.Axis.Types:hBufferRect from Chart-1.5.3"
                  :precision binary64
                
                  :alt
                  (! :herbie-platform default (- (* 3/2 x) (* 1/2 y)))
                
                  (+ x (/ (- x y) 2.0)))