Graphics.Rendering.Chart.Plot.Vectors:renderPlotVectors from Chart-1.5.3

Percentage Accurate: 77.9% → 100.0%
Time: 1.5s
Alternatives: 7
Speedup: 1.4×

Specification

?
\[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
(FPCore (x y)
  :precision binary64
  :pre TRUE
  (+ x (* (- 1.0 x) (- 1.0 y))))
double code(double x, double y) {
	return x + ((1.0 - x) * (1.0 - y));
}
real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x + ((1.0d0 - x) * (1.0d0 - y))
end function
public static double code(double x, double y) {
	return x + ((1.0 - x) * (1.0 - y));
}
def code(x, y):
	return x + ((1.0 - x) * (1.0 - y))
function code(x, y)
	return Float64(x + Float64(Float64(1.0 - x) * Float64(1.0 - y)))
end
function tmp = code(x, y)
	tmp = x + ((1.0 - x) * (1.0 - y));
end
code[x_, y_] := N[(x + N[(N[(1.0 - x), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y):
	x in [-inf, +inf],
	y in [-inf, +inf]
code: THEORY
BEGIN
f(x, y: real): real =
	x + (((1) - x) * ((1) - y))
END code
x + \left(1 - x\right) \cdot \left(1 - y\right)

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 7 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: 77.9% accurate, 1.0× speedup?

\[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
(FPCore (x y)
  :precision binary64
  :pre TRUE
  (+ x (* (- 1.0 x) (- 1.0 y))))
double code(double x, double y) {
	return x + ((1.0 - x) * (1.0 - y));
}
real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x + ((1.0d0 - x) * (1.0d0 - y))
end function
public static double code(double x, double y) {
	return x + ((1.0 - x) * (1.0 - y));
}
def code(x, y):
	return x + ((1.0 - x) * (1.0 - y))
function code(x, y)
	return Float64(x + Float64(Float64(1.0 - x) * Float64(1.0 - y)))
end
function tmp = code(x, y)
	tmp = x + ((1.0 - x) * (1.0 - y));
end
code[x_, y_] := N[(x + N[(N[(1.0 - x), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y):
	x in [-inf, +inf],
	y in [-inf, +inf]
code: THEORY
BEGIN
f(x, y: real): real =
	x + (((1) - x) * ((1) - y))
END code
x + \left(1 - x\right) \cdot \left(1 - y\right)

Alternative 1: 100.0% accurate, 1.4× speedup?

\[\mathsf{fma}\left(y, x - 1, 1\right) \]
(FPCore (x y)
  :precision binary64
  :pre TRUE
  (fma y (- x 1.0) 1.0))
double code(double x, double y) {
	return fma(y, (x - 1.0), 1.0);
}
function code(x, y)
	return fma(y, Float64(x - 1.0), 1.0)
end
code[x_, y_] := N[(y * N[(x - 1.0), $MachinePrecision] + 1.0), $MachinePrecision]
f(x, y):
	x in [-inf, +inf],
	y in [-inf, +inf]
code: THEORY
BEGIN
f(x, y: real): real =
	(y * (x - (1))) + (1)
END code
\mathsf{fma}\left(y, x - 1, 1\right)
Derivation
  1. Initial program 77.9%

    \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
  2. Taylor expanded in y around 0

    \[\leadsto 1 + -1 \cdot \left(y \cdot \left(1 - x\right)\right) \]
  3. Step-by-step derivation
    1. Applied rewrites100.0%

      \[\leadsto 1 + -1 \cdot \left(y \cdot \left(1 - x\right)\right) \]
    2. Step-by-step derivation
      1. Applied rewrites100.0%

        \[\leadsto \mathsf{fma}\left(y, x - 1, 1\right) \]
      2. Add Preprocessing

      Alternative 2: 88.6% accurate, 0.3× speedup?

      \[\begin{array}{l} t_0 := x + \left(1 - x\right) \cdot \left(1 - y\right)\\ t_1 := y \cdot \left(x - 1\right)\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{+15}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 2000000000000:\\ \;\;\;\;\mathsf{fma}\left(y, -1, 1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
      (FPCore (x y)
        :precision binary64
        :pre TRUE
        (let* ((t_0 (+ x (* (- 1.0 x) (- 1.0 y)))) (t_1 (* y (- x 1.0))))
        (if (<= t_0 -5e+15)
          t_1
          (if (<= t_0 2000000000000.0) (fma y -1.0 1.0) t_1))))
      double code(double x, double y) {
      	double t_0 = x + ((1.0 - x) * (1.0 - y));
      	double t_1 = y * (x - 1.0);
      	double tmp;
      	if (t_0 <= -5e+15) {
      		tmp = t_1;
      	} else if (t_0 <= 2000000000000.0) {
      		tmp = fma(y, -1.0, 1.0);
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(x, y)
      	t_0 = Float64(x + Float64(Float64(1.0 - x) * Float64(1.0 - y)))
      	t_1 = Float64(y * Float64(x - 1.0))
      	tmp = 0.0
      	if (t_0 <= -5e+15)
      		tmp = t_1;
      	elseif (t_0 <= 2000000000000.0)
      		tmp = fma(y, -1.0, 1.0);
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      code[x_, y_] := Block[{t$95$0 = N[(x + N[(N[(1.0 - x), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+15], t$95$1, If[LessEqual[t$95$0, 2000000000000.0], N[(y * -1.0 + 1.0), $MachinePrecision], t$95$1]]]]
      
      f(x, y):
      	x in [-inf, +inf],
      	y in [-inf, +inf]
      code: THEORY
      BEGIN
      f(x, y: real): real =
      	LET t_0 = (x + (((1) - x) * ((1) - y))) IN
      		LET t_1 = (y * (x - (1))) IN
      			LET tmp_1 = IF (t_0 <= (2e12)) THEN ((y * (-1)) + (1)) ELSE t_1 ENDIF IN
      			LET tmp = IF (t_0 <= (-5e15)) THEN t_1 ELSE tmp_1 ENDIF IN
      	tmp
      END code
      \begin{array}{l}
      t_0 := x + \left(1 - x\right) \cdot \left(1 - y\right)\\
      t_1 := y \cdot \left(x - 1\right)\\
      \mathbf{if}\;t\_0 \leq -5 \cdot 10^{+15}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;t\_0 \leq 2000000000000:\\
      \;\;\;\;\mathsf{fma}\left(y, -1, 1\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (+.f64 x (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 1 binary64) y))) < -5e15 or 2e12 < (+.f64 x (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 1 binary64) y)))

        1. Initial program 77.9%

          \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
        2. Taylor expanded in y around 0

          \[\leadsto 1 + -1 \cdot \left(y \cdot \left(1 - x\right)\right) \]
        3. Step-by-step derivation
          1. Applied rewrites100.0%

            \[\leadsto 1 + -1 \cdot \left(y \cdot \left(1 - x\right)\right) \]
          2. Step-by-step derivation
            1. Applied rewrites100.0%

              \[\leadsto \mathsf{fma}\left(y, x - 1, 1\right) \]
            2. Taylor expanded in y around inf

              \[\leadsto y \cdot \left(x - 1\right) \]
            3. Step-by-step derivation
              1. Applied rewrites62.9%

                \[\leadsto y \cdot \left(x - 1\right) \]

              if -5e15 < (+.f64 x (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 1 binary64) y))) < 2e12

              1. Initial program 77.9%

                \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
              2. Taylor expanded in y around 0

                \[\leadsto 1 + -1 \cdot \left(y \cdot \left(1 - x\right)\right) \]
              3. Step-by-step derivation
                1. Applied rewrites100.0%

                  \[\leadsto 1 + -1 \cdot \left(y \cdot \left(1 - x\right)\right) \]
                2. Step-by-step derivation
                  1. Applied rewrites100.0%

                    \[\leadsto \mathsf{fma}\left(y, x - 1, 1\right) \]
                  2. Taylor expanded in x around 0

                    \[\leadsto \mathsf{fma}\left(y, -1, 1\right) \]
                  3. Step-by-step derivation
                    1. Applied rewrites62.5%

                      \[\leadsto \mathsf{fma}\left(y, -1, 1\right) \]
                  4. Recombined 2 regimes into one program.
                  5. Add Preprocessing

                  Alternative 3: 86.9% accurate, 0.9× speedup?

                  \[\begin{array}{l} \mathbf{if}\;x \leq -9663365479874.781:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq 2.0258055932687762 \cdot 10^{+38}:\\ \;\;\;\;\mathsf{fma}\left(y, -1, 1\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
                  (FPCore (x y)
                    :precision binary64
                    :pre TRUE
                    (if (<= x -9663365479874.781)
                    (* x y)
                    (if (<= x 2.0258055932687762e+38) (fma y -1.0 1.0) (* x y))))
                  double code(double x, double y) {
                  	double tmp;
                  	if (x <= -9663365479874.781) {
                  		tmp = x * y;
                  	} else if (x <= 2.0258055932687762e+38) {
                  		tmp = fma(y, -1.0, 1.0);
                  	} else {
                  		tmp = x * y;
                  	}
                  	return tmp;
                  }
                  
                  function code(x, y)
                  	tmp = 0.0
                  	if (x <= -9663365479874.781)
                  		tmp = Float64(x * y);
                  	elseif (x <= 2.0258055932687762e+38)
                  		tmp = fma(y, -1.0, 1.0);
                  	else
                  		tmp = Float64(x * y);
                  	end
                  	return tmp
                  end
                  
                  code[x_, y_] := If[LessEqual[x, -9663365479874.781], N[(x * y), $MachinePrecision], If[LessEqual[x, 2.0258055932687762e+38], N[(y * -1.0 + 1.0), $MachinePrecision], N[(x * y), $MachinePrecision]]]
                  
                  f(x, y):
                  	x in [-inf, +inf],
                  	y in [-inf, +inf]
                  code: THEORY
                  BEGIN
                  f(x, y: real): real =
                  	LET tmp_1 = IF (x <= (202580559326877620351318635225240567808)) THEN ((y * (-1)) + (1)) ELSE (x * y) ENDIF IN
                  	LET tmp = IF (x <= (-966336547987478125e-5)) THEN (x * y) ELSE tmp_1 ENDIF IN
                  	tmp
                  END code
                  \begin{array}{l}
                  \mathbf{if}\;x \leq -9663365479874.781:\\
                  \;\;\;\;x \cdot y\\
                  
                  \mathbf{elif}\;x \leq 2.0258055932687762 \cdot 10^{+38}:\\
                  \;\;\;\;\mathsf{fma}\left(y, -1, 1\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;x \cdot y\\
                  
                  
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if x < -9663365479874.7812 or 2.0258055932687762e38 < x

                    1. Initial program 77.9%

                      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
                    2. Taylor expanded in x around -inf

                      \[\leadsto x \cdot y \]
                    3. Step-by-step derivation
                      1. Applied rewrites38.9%

                        \[\leadsto x \cdot y \]

                      if -9663365479874.7812 < x < 2.0258055932687762e38

                      1. Initial program 77.9%

                        \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
                      2. Taylor expanded in y around 0

                        \[\leadsto 1 + -1 \cdot \left(y \cdot \left(1 - x\right)\right) \]
                      3. Step-by-step derivation
                        1. Applied rewrites100.0%

                          \[\leadsto 1 + -1 \cdot \left(y \cdot \left(1 - x\right)\right) \]
                        2. Step-by-step derivation
                          1. Applied rewrites100.0%

                            \[\leadsto \mathsf{fma}\left(y, x - 1, 1\right) \]
                          2. Taylor expanded in x around 0

                            \[\leadsto \mathsf{fma}\left(y, -1, 1\right) \]
                          3. Step-by-step derivation
                            1. Applied rewrites62.5%

                              \[\leadsto \mathsf{fma}\left(y, -1, 1\right) \]
                          4. Recombined 2 regimes into one program.
                          5. Add Preprocessing

                          Alternative 4: 71.6% accurate, 0.2× speedup?

                          \[\begin{array}{l} t_0 := x + \left(1 - x\right) \cdot \left(1 - y\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;t\_0 \leq -5 \cdot 10^{+15}:\\ \;\;\;\;y \cdot -1\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;0 + 1\\ \mathbf{elif}\;t\_0 \leq 10^{+97}:\\ \;\;\;\;y \cdot -1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
                          (FPCore (x y)
                            :precision binary64
                            :pre TRUE
                            (let* ((t_0 (+ x (* (- 1.0 x) (- 1.0 y)))))
                            (if (<= t_0 (- INFINITY))
                              (* x y)
                              (if (<= t_0 -5e+15)
                                (* y -1.0)
                                (if (<= t_0 2.0)
                                  (+ 0.0 1.0)
                                  (if (<= t_0 1e+97) (* y -1.0) (* x y)))))))
                          double code(double x, double y) {
                          	double t_0 = x + ((1.0 - x) * (1.0 - y));
                          	double tmp;
                          	if (t_0 <= -((double) INFINITY)) {
                          		tmp = x * y;
                          	} else if (t_0 <= -5e+15) {
                          		tmp = y * -1.0;
                          	} else if (t_0 <= 2.0) {
                          		tmp = 0.0 + 1.0;
                          	} else if (t_0 <= 1e+97) {
                          		tmp = y * -1.0;
                          	} else {
                          		tmp = x * y;
                          	}
                          	return tmp;
                          }
                          
                          public static double code(double x, double y) {
                          	double t_0 = x + ((1.0 - x) * (1.0 - y));
                          	double tmp;
                          	if (t_0 <= -Double.POSITIVE_INFINITY) {
                          		tmp = x * y;
                          	} else if (t_0 <= -5e+15) {
                          		tmp = y * -1.0;
                          	} else if (t_0 <= 2.0) {
                          		tmp = 0.0 + 1.0;
                          	} else if (t_0 <= 1e+97) {
                          		tmp = y * -1.0;
                          	} else {
                          		tmp = x * y;
                          	}
                          	return tmp;
                          }
                          
                          def code(x, y):
                          	t_0 = x + ((1.0 - x) * (1.0 - y))
                          	tmp = 0
                          	if t_0 <= -math.inf:
                          		tmp = x * y
                          	elif t_0 <= -5e+15:
                          		tmp = y * -1.0
                          	elif t_0 <= 2.0:
                          		tmp = 0.0 + 1.0
                          	elif t_0 <= 1e+97:
                          		tmp = y * -1.0
                          	else:
                          		tmp = x * y
                          	return tmp
                          
                          function code(x, y)
                          	t_0 = Float64(x + Float64(Float64(1.0 - x) * Float64(1.0 - y)))
                          	tmp = 0.0
                          	if (t_0 <= Float64(-Inf))
                          		tmp = Float64(x * y);
                          	elseif (t_0 <= -5e+15)
                          		tmp = Float64(y * -1.0);
                          	elseif (t_0 <= 2.0)
                          		tmp = Float64(0.0 + 1.0);
                          	elseif (t_0 <= 1e+97)
                          		tmp = Float64(y * -1.0);
                          	else
                          		tmp = Float64(x * y);
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(x, y)
                          	t_0 = x + ((1.0 - x) * (1.0 - y));
                          	tmp = 0.0;
                          	if (t_0 <= -Inf)
                          		tmp = x * y;
                          	elseif (t_0 <= -5e+15)
                          		tmp = y * -1.0;
                          	elseif (t_0 <= 2.0)
                          		tmp = 0.0 + 1.0;
                          	elseif (t_0 <= 1e+97)
                          		tmp = y * -1.0;
                          	else
                          		tmp = x * y;
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[x_, y_] := Block[{t$95$0 = N[(x + N[(N[(1.0 - x), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(x * y), $MachinePrecision], If[LessEqual[t$95$0, -5e+15], N[(y * -1.0), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(0.0 + 1.0), $MachinePrecision], If[LessEqual[t$95$0, 1e+97], N[(y * -1.0), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]
                          
                          \begin{array}{l}
                          t_0 := x + \left(1 - x\right) \cdot \left(1 - y\right)\\
                          \mathbf{if}\;t\_0 \leq -\infty:\\
                          \;\;\;\;x \cdot y\\
                          
                          \mathbf{elif}\;t\_0 \leq -5 \cdot 10^{+15}:\\
                          \;\;\;\;y \cdot -1\\
                          
                          \mathbf{elif}\;t\_0 \leq 2:\\
                          \;\;\;\;0 + 1\\
                          
                          \mathbf{elif}\;t\_0 \leq 10^{+97}:\\
                          \;\;\;\;y \cdot -1\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;x \cdot y\\
                          
                          
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if (+.f64 x (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 1 binary64) y))) < -inf.0 or 1.0000000000000001e97 < (+.f64 x (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 1 binary64) y)))

                            1. Initial program 77.9%

                              \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
                            2. Taylor expanded in x around -inf

                              \[\leadsto x \cdot y \]
                            3. Step-by-step derivation
                              1. Applied rewrites38.9%

                                \[\leadsto x \cdot y \]

                              if -inf.0 < (+.f64 x (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 1 binary64) y))) < -5e15 or 2 < (+.f64 x (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 1 binary64) y))) < 1.0000000000000001e97

                              1. Initial program 77.9%

                                \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
                              2. Taylor expanded in y around 0

                                \[\leadsto 1 + -1 \cdot \left(y \cdot \left(1 - x\right)\right) \]
                              3. Step-by-step derivation
                                1. Applied rewrites100.0%

                                  \[\leadsto 1 + -1 \cdot \left(y \cdot \left(1 - x\right)\right) \]
                                2. Step-by-step derivation
                                  1. Applied rewrites100.0%

                                    \[\leadsto \mathsf{fma}\left(y, x - 1, 1\right) \]
                                  2. Taylor expanded in y around inf

                                    \[\leadsto y \cdot \left(x - 1\right) \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites62.9%

                                      \[\leadsto y \cdot \left(x - 1\right) \]
                                    2. Taylor expanded in x around 0

                                      \[\leadsto y \cdot -1 \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites26.4%

                                        \[\leadsto y \cdot -1 \]

                                      if -5e15 < (+.f64 x (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 1 binary64) y))) < 2

                                      1. Initial program 77.9%

                                        \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
                                      2. Taylor expanded in y around 0

                                        \[\leadsto x + \left(1 - x\right) \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites27.7%

                                          \[\leadsto x + \left(1 - x\right) \]
                                        2. Taylor expanded in x around 0

                                          \[\leadsto x + 1 \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites26.7%

                                            \[\leadsto x + 1 \]
                                          2. Taylor expanded in undef-var around zero

                                            \[\leadsto 0 + 1 \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites38.1%

                                              \[\leadsto 0 + 1 \]
                                          4. Recombined 3 regimes into one program.
                                          5. Add Preprocessing

                                          Alternative 5: 62.1% accurate, 1.0× speedup?

                                          \[\begin{array}{l} \mathbf{if}\;y \leq -7.398787557941889 \cdot 10^{-77}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.1233019634679706 \cdot 10^{-7}:\\ \;\;\;\;0 + 1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
                                          (FPCore (x y)
                                            :precision binary64
                                            :pre TRUE
                                            (if (<= y -7.398787557941889e-77)
                                            (* x y)
                                            (if (<= y 1.1233019634679706e-7) (+ 0.0 1.0) (* x y))))
                                          double code(double x, double y) {
                                          	double tmp;
                                          	if (y <= -7.398787557941889e-77) {
                                          		tmp = x * y;
                                          	} else if (y <= 1.1233019634679706e-7) {
                                          		tmp = 0.0 + 1.0;
                                          	} else {
                                          		tmp = x * y;
                                          	}
                                          	return tmp;
                                          }
                                          
                                          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 <= (-7.398787557941889d-77)) then
                                                  tmp = x * y
                                              else if (y <= 1.1233019634679706d-7) then
                                                  tmp = 0.0d0 + 1.0d0
                                              else
                                                  tmp = x * y
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double x, double y) {
                                          	double tmp;
                                          	if (y <= -7.398787557941889e-77) {
                                          		tmp = x * y;
                                          	} else if (y <= 1.1233019634679706e-7) {
                                          		tmp = 0.0 + 1.0;
                                          	} else {
                                          		tmp = x * y;
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(x, y):
                                          	tmp = 0
                                          	if y <= -7.398787557941889e-77:
                                          		tmp = x * y
                                          	elif y <= 1.1233019634679706e-7:
                                          		tmp = 0.0 + 1.0
                                          	else:
                                          		tmp = x * y
                                          	return tmp
                                          
                                          function code(x, y)
                                          	tmp = 0.0
                                          	if (y <= -7.398787557941889e-77)
                                          		tmp = Float64(x * y);
                                          	elseif (y <= 1.1233019634679706e-7)
                                          		tmp = Float64(0.0 + 1.0);
                                          	else
                                          		tmp = Float64(x * y);
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(x, y)
                                          	tmp = 0.0;
                                          	if (y <= -7.398787557941889e-77)
                                          		tmp = x * y;
                                          	elseif (y <= 1.1233019634679706e-7)
                                          		tmp = 0.0 + 1.0;
                                          	else
                                          		tmp = x * y;
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[x_, y_] := If[LessEqual[y, -7.398787557941889e-77], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.1233019634679706e-7], N[(0.0 + 1.0), $MachinePrecision], N[(x * y), $MachinePrecision]]]
                                          
                                          f(x, y):
                                          	x in [-inf, +inf],
                                          	y in [-inf, +inf]
                                          code: THEORY
                                          BEGIN
                                          f(x, y: real): real =
                                          	LET tmp_1 = IF (y <= (1123301963467970569704454451669117798218167081358842551708221435546875e-76)) THEN ((0) + (1)) ELSE (x * y) ENDIF IN
                                          	LET tmp = IF (y <= (-7398787557941888617686517894584122973779347148046538069064001885703742276403949176133255639575237768262726293578554447494614506223845400053473003812654436033228776958978170144012492632991546959164708141543087549507617950439453125e-305)) THEN (x * y) ELSE tmp_1 ENDIF IN
                                          	tmp
                                          END code
                                          \begin{array}{l}
                                          \mathbf{if}\;y \leq -7.398787557941889 \cdot 10^{-77}:\\
                                          \;\;\;\;x \cdot y\\
                                          
                                          \mathbf{elif}\;y \leq 1.1233019634679706 \cdot 10^{-7}:\\
                                          \;\;\;\;0 + 1\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;x \cdot y\\
                                          
                                          
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if y < -7.3987875579418886e-77 or 1.1233019634679706e-7 < y

                                            1. Initial program 77.9%

                                              \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
                                            2. Taylor expanded in x around -inf

                                              \[\leadsto x \cdot y \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites38.9%

                                                \[\leadsto x \cdot y \]

                                              if -7.3987875579418886e-77 < y < 1.1233019634679706e-7

                                              1. Initial program 77.9%

                                                \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
                                              2. Taylor expanded in y around 0

                                                \[\leadsto x + \left(1 - x\right) \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites27.7%

                                                  \[\leadsto x + \left(1 - x\right) \]
                                                2. Taylor expanded in x around 0

                                                  \[\leadsto x + 1 \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites26.7%

                                                    \[\leadsto x + 1 \]
                                                  2. Taylor expanded in undef-var around zero

                                                    \[\leadsto 0 + 1 \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites38.1%

                                                      \[\leadsto 0 + 1 \]
                                                  4. Recombined 2 regimes into one program.
                                                  5. Add Preprocessing

                                                  Alternative 6: 38.1% accurate, 3.3× speedup?

                                                  \[0 + 1 \]
                                                  (FPCore (x y)
                                                    :precision binary64
                                                    :pre TRUE
                                                    (+ 0.0 1.0))
                                                  double code(double x, double y) {
                                                  	return 0.0 + 1.0;
                                                  }
                                                  
                                                  real(8) function code(x, y)
                                                  use fmin_fmax_functions
                                                      real(8), intent (in) :: x
                                                      real(8), intent (in) :: y
                                                      code = 0.0d0 + 1.0d0
                                                  end function
                                                  
                                                  public static double code(double x, double y) {
                                                  	return 0.0 + 1.0;
                                                  }
                                                  
                                                  def code(x, y):
                                                  	return 0.0 + 1.0
                                                  
                                                  function code(x, y)
                                                  	return Float64(0.0 + 1.0)
                                                  end
                                                  
                                                  function tmp = code(x, y)
                                                  	tmp = 0.0 + 1.0;
                                                  end
                                                  
                                                  code[x_, y_] := N[(0.0 + 1.0), $MachinePrecision]
                                                  
                                                  f(x, y):
                                                  	x in [-inf, +inf],
                                                  	y in [-inf, +inf]
                                                  code: THEORY
                                                  BEGIN
                                                  f(x, y: real): real =
                                                  	(0) + (1)
                                                  END code
                                                  0 + 1
                                                  
                                                  Derivation
                                                  1. Initial program 77.9%

                                                    \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
                                                  2. Taylor expanded in y around 0

                                                    \[\leadsto x + \left(1 - x\right) \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites27.7%

                                                      \[\leadsto x + \left(1 - x\right) \]
                                                    2. Taylor expanded in x around 0

                                                      \[\leadsto x + 1 \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites26.7%

                                                        \[\leadsto x + 1 \]
                                                      2. Taylor expanded in undef-var around zero

                                                        \[\leadsto 0 + 1 \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites38.1%

                                                          \[\leadsto 0 + 1 \]
                                                        2. Add Preprocessing

                                                        Alternative 7: 26.7% accurate, 3.3× speedup?

                                                        \[x + 1 \]
                                                        (FPCore (x y)
                                                          :precision binary64
                                                          :pre TRUE
                                                          (+ x 1.0))
                                                        double code(double x, double y) {
                                                        	return x + 1.0;
                                                        }
                                                        
                                                        real(8) function code(x, y)
                                                        use fmin_fmax_functions
                                                            real(8), intent (in) :: x
                                                            real(8), intent (in) :: y
                                                            code = x + 1.0d0
                                                        end function
                                                        
                                                        public static double code(double x, double y) {
                                                        	return x + 1.0;
                                                        }
                                                        
                                                        def code(x, y):
                                                        	return x + 1.0
                                                        
                                                        function code(x, y)
                                                        	return Float64(x + 1.0)
                                                        end
                                                        
                                                        function tmp = code(x, y)
                                                        	tmp = x + 1.0;
                                                        end
                                                        
                                                        code[x_, y_] := N[(x + 1.0), $MachinePrecision]
                                                        
                                                        f(x, y):
                                                        	x in [-inf, +inf],
                                                        	y in [-inf, +inf]
                                                        code: THEORY
                                                        BEGIN
                                                        f(x, y: real): real =
                                                        	x + (1)
                                                        END code
                                                        x + 1
                                                        
                                                        Derivation
                                                        1. Initial program 77.9%

                                                          \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
                                                        2. Taylor expanded in y around 0

                                                          \[\leadsto x + \left(1 - x\right) \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites27.7%

                                                            \[\leadsto x + \left(1 - x\right) \]
                                                          2. Taylor expanded in x around 0

                                                            \[\leadsto x + 1 \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites26.7%

                                                              \[\leadsto x + 1 \]
                                                            2. Add Preprocessing

                                                            Reproduce

                                                            ?
                                                            herbie shell --seed 2026092 
                                                            (FPCore (x y)
                                                              :name "Graphics.Rendering.Chart.Plot.Vectors:renderPlotVectors from Chart-1.5.3"
                                                              :precision binary64
                                                              (+ x (* (- 1.0 x) (- 1.0 y))))