Graphics.Rendering.Chart.Drawing:drawTextsR from Chart-1.5.3

Percentage Accurate: 98.0% → 100.0%
Time: 2.0s
Alternatives: 8
Speedup: 1.3×

Specification

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

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

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 98.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \left(z + y\right) \cdot x - z \end{array} \]
(FPCore (x y z) :precision binary64 (- (* (+ z y) x) z))
double code(double x, double y, double z) {
	return ((z + y) * x) - z;
}
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, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((z + y) * x) - z
end function
public static double code(double x, double y, double z) {
	return ((z + y) * x) - z;
}
def code(x, y, z):
	return ((z + y) * x) - z
function code(x, y, z)
	return Float64(Float64(Float64(z + y) * x) - z)
end
function tmp = code(x, y, z)
	tmp = ((z + y) * x) - z;
end
code[x_, y_, z_] := N[(N[(N[(z + y), $MachinePrecision] * x), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}

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

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

    \[\leadsto \color{blue}{-1 \cdot z + x \cdot \left(y + z\right)} \]
  3. Step-by-step derivation
    1. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(-1, \color{blue}{z}, x \cdot \left(y + z\right)\right) \]
    2. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
    3. lower-+.f64100.0

      \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
  4. Applied rewrites100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right)} \]
  5. Step-by-step derivation
    1. lift-fma.f64N/A

      \[\leadsto -1 \cdot z + \color{blue}{x \cdot \left(y + z\right)} \]
    2. lift-*.f64N/A

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

      \[\leadsto x \cdot \left(y + z\right) + \color{blue}{-1 \cdot z} \]
    4. lift-*.f64N/A

      \[\leadsto x \cdot \left(y + z\right) + -1 \cdot \color{blue}{z} \]
    5. mul-1-negN/A

      \[\leadsto x \cdot \left(y + z\right) + \left(\mathsf{neg}\left(z\right)\right) \]
    6. sub-flip-reverseN/A

      \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
    7. lower--.f64100.0

      \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
    8. lift-*.f64N/A

      \[\leadsto x \cdot \left(y + z\right) - z \]
    9. *-commutativeN/A

      \[\leadsto \left(y + z\right) \cdot x - z \]
    10. lower-*.f64100.0

      \[\leadsto \left(y + z\right) \cdot x - z \]
    11. lift-+.f64N/A

      \[\leadsto \left(y + z\right) \cdot x - z \]
    12. +-commutativeN/A

      \[\leadsto \left(z + y\right) \cdot x - z \]
    13. lower-+.f64100.0

      \[\leadsto \left(z + y\right) \cdot x - z \]
  6. Applied rewrites100.0%

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

Alternative 2: 99.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(y + z\right)\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;y \cdot x - z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ y z))))
   (if (<= x -1.0) t_0 (if (<= x 1.0) (- (* y x) z) t_0))))
double code(double x, double y, double z) {
	double t_0 = x * (y + z);
	double tmp;
	if (x <= -1.0) {
		tmp = t_0;
	} else if (x <= 1.0) {
		tmp = (y * x) - z;
	} else {
		tmp = t_0;
	}
	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, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * (y + z)
    if (x <= (-1.0d0)) then
        tmp = t_0
    else if (x <= 1.0d0) then
        tmp = (y * x) - z
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (y + z);
	double tmp;
	if (x <= -1.0) {
		tmp = t_0;
	} else if (x <= 1.0) {
		tmp = (y * x) - z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (y + z)
	tmp = 0
	if x <= -1.0:
		tmp = t_0
	elif x <= 1.0:
		tmp = (y * x) - z
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(y + z))
	tmp = 0.0
	if (x <= -1.0)
		tmp = t_0;
	elseif (x <= 1.0)
		tmp = Float64(Float64(y * x) - z);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (y + z);
	tmp = 0.0;
	if (x <= -1.0)
		tmp = t_0;
	elseif (x <= 1.0)
		tmp = (y * x) - z;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 1.0], N[(N[(y * x), $MachinePrecision] - z), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(y + z\right)\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;y \cdot x - z\\

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


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

    1. Initial program 98.0%

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

      \[\leadsto \color{blue}{x \cdot \left(y + z\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(y + z\right)} \]
      2. lower-+.f6465.5

        \[\leadsto x \cdot \left(y + \color{blue}{z}\right) \]
    4. Applied rewrites65.5%

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

    if -1 < x < 1

    1. Initial program 98.0%

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

      \[\leadsto \color{blue}{-1 \cdot z + x \cdot \left(y + z\right)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-1, \color{blue}{z}, x \cdot \left(y + z\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
      3. lower-+.f64100.0

        \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
    4. Applied rewrites100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto -1 \cdot z + \color{blue}{x \cdot \left(y + z\right)} \]
      2. lift-*.f64N/A

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

        \[\leadsto x \cdot \left(y + z\right) + \color{blue}{-1 \cdot z} \]
      4. lift-*.f64N/A

        \[\leadsto x \cdot \left(y + z\right) + -1 \cdot \color{blue}{z} \]
      5. mul-1-negN/A

        \[\leadsto x \cdot \left(y + z\right) + \left(\mathsf{neg}\left(z\right)\right) \]
      6. sub-flip-reverseN/A

        \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
      7. lower--.f64100.0

        \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
      8. lift-*.f64N/A

        \[\leadsto x \cdot \left(y + z\right) - z \]
      9. *-commutativeN/A

        \[\leadsto \left(y + z\right) \cdot x - z \]
      10. lower-*.f64100.0

        \[\leadsto \left(y + z\right) \cdot x - z \]
      11. lift-+.f64N/A

        \[\leadsto \left(y + z\right) \cdot x - z \]
      12. +-commutativeN/A

        \[\leadsto \left(z + y\right) \cdot x - z \]
      13. lower-+.f64100.0

        \[\leadsto \left(z + y\right) \cdot x - z \]
    6. Applied rewrites100.0%

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

      \[\leadsto z \cdot x - z \]
    8. Step-by-step derivation
      1. Applied rewrites61.6%

        \[\leadsto z \cdot x - z \]
      2. Taylor expanded in y around inf

        \[\leadsto y \cdot x - z \]
      3. Step-by-step derivation
        1. Applied rewrites76.2%

          \[\leadsto y \cdot x - z \]
      4. Recombined 2 regimes into one program.
      5. Add Preprocessing

      Alternative 3: 86.3% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+91}:\\ \;\;\;\;z \cdot \left(x - 1\right)\\ \mathbf{elif}\;z \leq 6.3 \cdot 10^{-21}:\\ \;\;\;\;y \cdot x - z\\ \mathbf{else}:\\ \;\;\;\;z \cdot x - z\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= z -4.3e+91)
         (* z (- x 1.0))
         (if (<= z 6.3e-21) (- (* y x) z) (- (* z x) z))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (z <= -4.3e+91) {
      		tmp = z * (x - 1.0);
      	} else if (z <= 6.3e-21) {
      		tmp = (y * x) - z;
      	} else {
      		tmp = (z * x) - z;
      	}
      	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, z)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8) :: tmp
          if (z <= (-4.3d+91)) then
              tmp = z * (x - 1.0d0)
          else if (z <= 6.3d-21) then
              tmp = (y * x) - z
          else
              tmp = (z * x) - z
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double tmp;
      	if (z <= -4.3e+91) {
      		tmp = z * (x - 1.0);
      	} else if (z <= 6.3e-21) {
      		tmp = (y * x) - z;
      	} else {
      		tmp = (z * x) - z;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	tmp = 0
      	if z <= -4.3e+91:
      		tmp = z * (x - 1.0)
      	elif z <= 6.3e-21:
      		tmp = (y * x) - z
      	else:
      		tmp = (z * x) - z
      	return tmp
      
      function code(x, y, z)
      	tmp = 0.0
      	if (z <= -4.3e+91)
      		tmp = Float64(z * Float64(x - 1.0));
      	elseif (z <= 6.3e-21)
      		tmp = Float64(Float64(y * x) - z);
      	else
      		tmp = Float64(Float64(z * x) - z);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	tmp = 0.0;
      	if (z <= -4.3e+91)
      		tmp = z * (x - 1.0);
      	elseif (z <= 6.3e-21)
      		tmp = (y * x) - z;
      	else
      		tmp = (z * x) - z;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := If[LessEqual[z, -4.3e+91], N[(z * N[(x - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.3e-21], N[(N[(y * x), $MachinePrecision] - z), $MachinePrecision], N[(N[(z * x), $MachinePrecision] - z), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;z \leq -4.3 \cdot 10^{+91}:\\
      \;\;\;\;z \cdot \left(x - 1\right)\\
      
      \mathbf{elif}\;z \leq 6.3 \cdot 10^{-21}:\\
      \;\;\;\;y \cdot x - z\\
      
      \mathbf{else}:\\
      \;\;\;\;z \cdot x - z\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -4.3000000000000001e91

        1. Initial program 98.0%

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

          \[\leadsto \color{blue}{z \cdot \left(x - 1\right)} \]
        3. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto z \cdot \color{blue}{\left(x - 1\right)} \]
          2. lower--.f6461.6

            \[\leadsto z \cdot \left(x - \color{blue}{1}\right) \]
        4. Applied rewrites61.6%

          \[\leadsto \color{blue}{z \cdot \left(x - 1\right)} \]

        if -4.3000000000000001e91 < z < 6.3e-21

        1. Initial program 98.0%

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

          \[\leadsto \color{blue}{-1 \cdot z + x \cdot \left(y + z\right)} \]
        3. Step-by-step derivation
          1. lower-fma.f64N/A

            \[\leadsto \mathsf{fma}\left(-1, \color{blue}{z}, x \cdot \left(y + z\right)\right) \]
          2. lower-*.f64N/A

            \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
          3. lower-+.f64100.0

            \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
        4. Applied rewrites100.0%

          \[\leadsto \color{blue}{\mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right)} \]
        5. Step-by-step derivation
          1. lift-fma.f64N/A

            \[\leadsto -1 \cdot z + \color{blue}{x \cdot \left(y + z\right)} \]
          2. lift-*.f64N/A

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

            \[\leadsto x \cdot \left(y + z\right) + \color{blue}{-1 \cdot z} \]
          4. lift-*.f64N/A

            \[\leadsto x \cdot \left(y + z\right) + -1 \cdot \color{blue}{z} \]
          5. mul-1-negN/A

            \[\leadsto x \cdot \left(y + z\right) + \left(\mathsf{neg}\left(z\right)\right) \]
          6. sub-flip-reverseN/A

            \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
          7. lower--.f64100.0

            \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
          8. lift-*.f64N/A

            \[\leadsto x \cdot \left(y + z\right) - z \]
          9. *-commutativeN/A

            \[\leadsto \left(y + z\right) \cdot x - z \]
          10. lower-*.f64100.0

            \[\leadsto \left(y + z\right) \cdot x - z \]
          11. lift-+.f64N/A

            \[\leadsto \left(y + z\right) \cdot x - z \]
          12. +-commutativeN/A

            \[\leadsto \left(z + y\right) \cdot x - z \]
          13. lower-+.f64100.0

            \[\leadsto \left(z + y\right) \cdot x - z \]
        6. Applied rewrites100.0%

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

          \[\leadsto z \cdot x - z \]
        8. Step-by-step derivation
          1. Applied rewrites61.6%

            \[\leadsto z \cdot x - z \]
          2. Taylor expanded in y around inf

            \[\leadsto y \cdot x - z \]
          3. Step-by-step derivation
            1. Applied rewrites76.2%

              \[\leadsto y \cdot x - z \]

            if 6.3e-21 < z

            1. Initial program 98.0%

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

              \[\leadsto \color{blue}{-1 \cdot z + x \cdot \left(y + z\right)} \]
            3. Step-by-step derivation
              1. lower-fma.f64N/A

                \[\leadsto \mathsf{fma}\left(-1, \color{blue}{z}, x \cdot \left(y + z\right)\right) \]
              2. lower-*.f64N/A

                \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
              3. lower-+.f64100.0

                \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
            4. Applied rewrites100.0%

              \[\leadsto \color{blue}{\mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right)} \]
            5. Step-by-step derivation
              1. lift-fma.f64N/A

                \[\leadsto -1 \cdot z + \color{blue}{x \cdot \left(y + z\right)} \]
              2. lift-*.f64N/A

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

                \[\leadsto x \cdot \left(y + z\right) + \color{blue}{-1 \cdot z} \]
              4. lift-*.f64N/A

                \[\leadsto x \cdot \left(y + z\right) + -1 \cdot \color{blue}{z} \]
              5. mul-1-negN/A

                \[\leadsto x \cdot \left(y + z\right) + \left(\mathsf{neg}\left(z\right)\right) \]
              6. sub-flip-reverseN/A

                \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
              7. lower--.f64100.0

                \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
              8. lift-*.f64N/A

                \[\leadsto x \cdot \left(y + z\right) - z \]
              9. *-commutativeN/A

                \[\leadsto \left(y + z\right) \cdot x - z \]
              10. lower-*.f64100.0

                \[\leadsto \left(y + z\right) \cdot x - z \]
              11. lift-+.f64N/A

                \[\leadsto \left(y + z\right) \cdot x - z \]
              12. +-commutativeN/A

                \[\leadsto \left(z + y\right) \cdot x - z \]
              13. lower-+.f64100.0

                \[\leadsto \left(z + y\right) \cdot x - z \]
            6. Applied rewrites100.0%

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

              \[\leadsto z \cdot x - z \]
            8. Step-by-step derivation
              1. Applied rewrites61.6%

                \[\leadsto z \cdot x - z \]
            9. Recombined 3 regimes into one program.
            10. Add Preprocessing

            Alternative 4: 86.3% accurate, 0.9× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(x - 1\right)\\ \mathbf{if}\;z \leq -4.3 \cdot 10^{+91}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 6.3 \cdot 10^{-21}:\\ \;\;\;\;y \cdot x - z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (* z (- x 1.0))))
               (if (<= z -4.3e+91) t_0 (if (<= z 6.3e-21) (- (* y x) z) t_0))))
            double code(double x, double y, double z) {
            	double t_0 = z * (x - 1.0);
            	double tmp;
            	if (z <= -4.3e+91) {
            		tmp = t_0;
            	} else if (z <= 6.3e-21) {
            		tmp = (y * x) - z;
            	} else {
            		tmp = t_0;
            	}
            	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, z)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: t_0
                real(8) :: tmp
                t_0 = z * (x - 1.0d0)
                if (z <= (-4.3d+91)) then
                    tmp = t_0
                else if (z <= 6.3d-21) then
                    tmp = (y * x) - z
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = z * (x - 1.0);
            	double tmp;
            	if (z <= -4.3e+91) {
            		tmp = t_0;
            	} else if (z <= 6.3e-21) {
            		tmp = (y * x) - z;
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = z * (x - 1.0)
            	tmp = 0
            	if z <= -4.3e+91:
            		tmp = t_0
            	elif z <= 6.3e-21:
            		tmp = (y * x) - z
            	else:
            		tmp = t_0
            	return tmp
            
            function code(x, y, z)
            	t_0 = Float64(z * Float64(x - 1.0))
            	tmp = 0.0
            	if (z <= -4.3e+91)
            		tmp = t_0;
            	elseif (z <= 6.3e-21)
            		tmp = Float64(Float64(y * x) - z);
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = z * (x - 1.0);
            	tmp = 0.0;
            	if (z <= -4.3e+91)
            		tmp = t_0;
            	elseif (z <= 6.3e-21)
            		tmp = (y * x) - z;
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.3e+91], t$95$0, If[LessEqual[z, 6.3e-21], N[(N[(y * x), $MachinePrecision] - z), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := z \cdot \left(x - 1\right)\\
            \mathbf{if}\;z \leq -4.3 \cdot 10^{+91}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;z \leq 6.3 \cdot 10^{-21}:\\
            \;\;\;\;y \cdot x - z\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -4.3000000000000001e91 or 6.3e-21 < z

              1. Initial program 98.0%

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

                \[\leadsto \color{blue}{z \cdot \left(x - 1\right)} \]
              3. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto z \cdot \color{blue}{\left(x - 1\right)} \]
                2. lower--.f6461.6

                  \[\leadsto z \cdot \left(x - \color{blue}{1}\right) \]
              4. Applied rewrites61.6%

                \[\leadsto \color{blue}{z \cdot \left(x - 1\right)} \]

              if -4.3000000000000001e91 < z < 6.3e-21

              1. Initial program 98.0%

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

                \[\leadsto \color{blue}{-1 \cdot z + x \cdot \left(y + z\right)} \]
              3. Step-by-step derivation
                1. lower-fma.f64N/A

                  \[\leadsto \mathsf{fma}\left(-1, \color{blue}{z}, x \cdot \left(y + z\right)\right) \]
                2. lower-*.f64N/A

                  \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
                3. lower-+.f64100.0

                  \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
              4. Applied rewrites100.0%

                \[\leadsto \color{blue}{\mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right)} \]
              5. Step-by-step derivation
                1. lift-fma.f64N/A

                  \[\leadsto -1 \cdot z + \color{blue}{x \cdot \left(y + z\right)} \]
                2. lift-*.f64N/A

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

                  \[\leadsto x \cdot \left(y + z\right) + \color{blue}{-1 \cdot z} \]
                4. lift-*.f64N/A

                  \[\leadsto x \cdot \left(y + z\right) + -1 \cdot \color{blue}{z} \]
                5. mul-1-negN/A

                  \[\leadsto x \cdot \left(y + z\right) + \left(\mathsf{neg}\left(z\right)\right) \]
                6. sub-flip-reverseN/A

                  \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
                7. lower--.f64100.0

                  \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
                8. lift-*.f64N/A

                  \[\leadsto x \cdot \left(y + z\right) - z \]
                9. *-commutativeN/A

                  \[\leadsto \left(y + z\right) \cdot x - z \]
                10. lower-*.f64100.0

                  \[\leadsto \left(y + z\right) \cdot x - z \]
                11. lift-+.f64N/A

                  \[\leadsto \left(y + z\right) \cdot x - z \]
                12. +-commutativeN/A

                  \[\leadsto \left(z + y\right) \cdot x - z \]
                13. lower-+.f64100.0

                  \[\leadsto \left(z + y\right) \cdot x - z \]
              6. Applied rewrites100.0%

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

                \[\leadsto z \cdot x - z \]
              8. Step-by-step derivation
                1. Applied rewrites61.6%

                  \[\leadsto z \cdot x - z \]
                2. Taylor expanded in y around inf

                  \[\leadsto y \cdot x - z \]
                3. Step-by-step derivation
                  1. Applied rewrites76.2%

                    \[\leadsto y \cdot x - z \]
                4. Recombined 2 regimes into one program.
                5. Add Preprocessing

                Alternative 5: 75.0% accurate, 0.9× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(x - 1\right)\\ \mathbf{if}\;z \leq -1.3 \cdot 10^{-57}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-145}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (let* ((t_0 (* z (- x 1.0))))
                   (if (<= z -1.3e-57) t_0 (if (<= z 5.8e-145) (* x y) t_0))))
                double code(double x, double y, double z) {
                	double t_0 = z * (x - 1.0);
                	double tmp;
                	if (z <= -1.3e-57) {
                		tmp = t_0;
                	} else if (z <= 5.8e-145) {
                		tmp = x * y;
                	} else {
                		tmp = t_0;
                	}
                	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, z)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8) :: t_0
                    real(8) :: tmp
                    t_0 = z * (x - 1.0d0)
                    if (z <= (-1.3d-57)) then
                        tmp = t_0
                    else if (z <= 5.8d-145) then
                        tmp = x * y
                    else
                        tmp = t_0
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z) {
                	double t_0 = z * (x - 1.0);
                	double tmp;
                	if (z <= -1.3e-57) {
                		tmp = t_0;
                	} else if (z <= 5.8e-145) {
                		tmp = x * y;
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	t_0 = z * (x - 1.0)
                	tmp = 0
                	if z <= -1.3e-57:
                		tmp = t_0
                	elif z <= 5.8e-145:
                		tmp = x * y
                	else:
                		tmp = t_0
                	return tmp
                
                function code(x, y, z)
                	t_0 = Float64(z * Float64(x - 1.0))
                	tmp = 0.0
                	if (z <= -1.3e-57)
                		tmp = t_0;
                	elseif (z <= 5.8e-145)
                		tmp = Float64(x * y);
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	t_0 = z * (x - 1.0);
                	tmp = 0.0;
                	if (z <= -1.3e-57)
                		tmp = t_0;
                	elseif (z <= 5.8e-145)
                		tmp = x * y;
                	else
                		tmp = t_0;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e-57], t$95$0, If[LessEqual[z, 5.8e-145], N[(x * y), $MachinePrecision], t$95$0]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := z \cdot \left(x - 1\right)\\
                \mathbf{if}\;z \leq -1.3 \cdot 10^{-57}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;z \leq 5.8 \cdot 10^{-145}:\\
                \;\;\;\;x \cdot y\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if z < -1.29999999999999993e-57 or 5.79999999999999968e-145 < z

                  1. Initial program 98.0%

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

                    \[\leadsto \color{blue}{z \cdot \left(x - 1\right)} \]
                  3. Step-by-step derivation
                    1. lower-*.f64N/A

                      \[\leadsto z \cdot \color{blue}{\left(x - 1\right)} \]
                    2. lower--.f6461.6

                      \[\leadsto z \cdot \left(x - \color{blue}{1}\right) \]
                  4. Applied rewrites61.6%

                    \[\leadsto \color{blue}{z \cdot \left(x - 1\right)} \]

                  if -1.29999999999999993e-57 < z < 5.79999999999999968e-145

                  1. Initial program 98.0%

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

                    \[\leadsto \color{blue}{-1 \cdot z + x \cdot \left(y + z\right)} \]
                  3. Step-by-step derivation
                    1. lower-fma.f64N/A

                      \[\leadsto \mathsf{fma}\left(-1, \color{blue}{z}, x \cdot \left(y + z\right)\right) \]
                    2. lower-*.f64N/A

                      \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
                    3. lower-+.f64100.0

                      \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
                  4. Applied rewrites100.0%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right)} \]
                  5. Step-by-step derivation
                    1. lift-fma.f64N/A

                      \[\leadsto -1 \cdot z + \color{blue}{x \cdot \left(y + z\right)} \]
                    2. lift-*.f64N/A

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

                      \[\leadsto x \cdot \left(y + z\right) + \color{blue}{-1 \cdot z} \]
                    4. lift-*.f64N/A

                      \[\leadsto x \cdot \left(y + z\right) + -1 \cdot \color{blue}{z} \]
                    5. mul-1-negN/A

                      \[\leadsto x \cdot \left(y + z\right) + \left(\mathsf{neg}\left(z\right)\right) \]
                    6. sub-flip-reverseN/A

                      \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
                    7. lower--.f64100.0

                      \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
                    8. lift-*.f64N/A

                      \[\leadsto x \cdot \left(y + z\right) - z \]
                    9. *-commutativeN/A

                      \[\leadsto \left(y + z\right) \cdot x - z \]
                    10. lower-*.f64100.0

                      \[\leadsto \left(y + z\right) \cdot x - z \]
                    11. lift-+.f64N/A

                      \[\leadsto \left(y + z\right) \cdot x - z \]
                    12. +-commutativeN/A

                      \[\leadsto \left(z + y\right) \cdot x - z \]
                    13. lower-+.f64100.0

                      \[\leadsto \left(z + y\right) \cdot x - z \]
                  6. Applied rewrites100.0%

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

                    \[\leadsto z \cdot x - z \]
                  8. Step-by-step derivation
                    1. Applied rewrites61.6%

                      \[\leadsto z \cdot x - z \]
                    2. Taylor expanded in y around inf

                      \[\leadsto \color{blue}{x \cdot y} \]
                    3. Step-by-step derivation
                      1. lower-*.f6442.3

                        \[\leadsto x \cdot \color{blue}{y} \]
                    4. Applied rewrites42.3%

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

                  Alternative 6: 61.2% accurate, 0.8× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1050000:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{-23}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+207}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (<= x -1050000.0)
                     (* x y)
                     (if (<= x 1.32e-23) (- z) (if (<= x 1.25e+207) (* x y) (* x z)))))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if (x <= -1050000.0) {
                  		tmp = x * y;
                  	} else if (x <= 1.32e-23) {
                  		tmp = -z;
                  	} else if (x <= 1.25e+207) {
                  		tmp = x * y;
                  	} else {
                  		tmp = x * z;
                  	}
                  	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, z)
                  use fmin_fmax_functions
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      real(8) :: tmp
                      if (x <= (-1050000.0d0)) then
                          tmp = x * y
                      else if (x <= 1.32d-23) then
                          tmp = -z
                      else if (x <= 1.25d+207) then
                          tmp = x * y
                      else
                          tmp = x * z
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y, double z) {
                  	double tmp;
                  	if (x <= -1050000.0) {
                  		tmp = x * y;
                  	} else if (x <= 1.32e-23) {
                  		tmp = -z;
                  	} else if (x <= 1.25e+207) {
                  		tmp = x * y;
                  	} else {
                  		tmp = x * z;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y, z):
                  	tmp = 0
                  	if x <= -1050000.0:
                  		tmp = x * y
                  	elif x <= 1.32e-23:
                  		tmp = -z
                  	elif x <= 1.25e+207:
                  		tmp = x * y
                  	else:
                  		tmp = x * z
                  	return tmp
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if (x <= -1050000.0)
                  		tmp = Float64(x * y);
                  	elseif (x <= 1.32e-23)
                  		tmp = Float64(-z);
                  	elseif (x <= 1.25e+207)
                  		tmp = Float64(x * y);
                  	else
                  		tmp = Float64(x * z);
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y, z)
                  	tmp = 0.0;
                  	if (x <= -1050000.0)
                  		tmp = x * y;
                  	elseif (x <= 1.32e-23)
                  		tmp = -z;
                  	elseif (x <= 1.25e+207)
                  		tmp = x * y;
                  	else
                  		tmp = x * z;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_, z_] := If[LessEqual[x, -1050000.0], N[(x * y), $MachinePrecision], If[LessEqual[x, 1.32e-23], (-z), If[LessEqual[x, 1.25e+207], N[(x * y), $MachinePrecision], N[(x * z), $MachinePrecision]]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;x \leq -1050000:\\
                  \;\;\;\;x \cdot y\\
                  
                  \mathbf{elif}\;x \leq 1.32 \cdot 10^{-23}:\\
                  \;\;\;\;-z\\
                  
                  \mathbf{elif}\;x \leq 1.25 \cdot 10^{+207}:\\
                  \;\;\;\;x \cdot y\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;x \cdot z\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 3 regimes
                  2. if x < -1.05e6 or 1.31999999999999994e-23 < x < 1.25e207

                    1. Initial program 98.0%

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

                      \[\leadsto \color{blue}{-1 \cdot z + x \cdot \left(y + z\right)} \]
                    3. Step-by-step derivation
                      1. lower-fma.f64N/A

                        \[\leadsto \mathsf{fma}\left(-1, \color{blue}{z}, x \cdot \left(y + z\right)\right) \]
                      2. lower-*.f64N/A

                        \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
                      3. lower-+.f64100.0

                        \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
                    4. Applied rewrites100.0%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right)} \]
                    5. Step-by-step derivation
                      1. lift-fma.f64N/A

                        \[\leadsto -1 \cdot z + \color{blue}{x \cdot \left(y + z\right)} \]
                      2. lift-*.f64N/A

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

                        \[\leadsto x \cdot \left(y + z\right) + \color{blue}{-1 \cdot z} \]
                      4. lift-*.f64N/A

                        \[\leadsto x \cdot \left(y + z\right) + -1 \cdot \color{blue}{z} \]
                      5. mul-1-negN/A

                        \[\leadsto x \cdot \left(y + z\right) + \left(\mathsf{neg}\left(z\right)\right) \]
                      6. sub-flip-reverseN/A

                        \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
                      7. lower--.f64100.0

                        \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
                      8. lift-*.f64N/A

                        \[\leadsto x \cdot \left(y + z\right) - z \]
                      9. *-commutativeN/A

                        \[\leadsto \left(y + z\right) \cdot x - z \]
                      10. lower-*.f64100.0

                        \[\leadsto \left(y + z\right) \cdot x - z \]
                      11. lift-+.f64N/A

                        \[\leadsto \left(y + z\right) \cdot x - z \]
                      12. +-commutativeN/A

                        \[\leadsto \left(z + y\right) \cdot x - z \]
                      13. lower-+.f64100.0

                        \[\leadsto \left(z + y\right) \cdot x - z \]
                    6. Applied rewrites100.0%

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

                      \[\leadsto z \cdot x - z \]
                    8. Step-by-step derivation
                      1. Applied rewrites61.6%

                        \[\leadsto z \cdot x - z \]
                      2. Taylor expanded in y around inf

                        \[\leadsto \color{blue}{x \cdot y} \]
                      3. Step-by-step derivation
                        1. lower-*.f6442.3

                          \[\leadsto x \cdot \color{blue}{y} \]
                      4. Applied rewrites42.3%

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

                      if -1.05e6 < x < 1.31999999999999994e-23

                      1. Initial program 98.0%

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

                        \[\leadsto \color{blue}{-1 \cdot z} \]
                      3. Step-by-step derivation
                        1. lower-*.f6436.3

                          \[\leadsto -1 \cdot \color{blue}{z} \]
                      4. Applied rewrites36.3%

                        \[\leadsto \color{blue}{-1 \cdot z} \]
                      5. Step-by-step derivation
                        1. lift-*.f64N/A

                          \[\leadsto -1 \cdot \color{blue}{z} \]
                        2. mul-1-negN/A

                          \[\leadsto \mathsf{neg}\left(z\right) \]
                        3. lower-neg.f6436.3

                          \[\leadsto -z \]
                      6. Applied rewrites36.3%

                        \[\leadsto -z \]

                      if 1.25e207 < x

                      1. Initial program 98.0%

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

                        \[\leadsto \color{blue}{x \cdot \left(y + z\right)} \]
                      3. Step-by-step derivation
                        1. lower-*.f64N/A

                          \[\leadsto x \cdot \color{blue}{\left(y + z\right)} \]
                        2. lower-+.f6465.5

                          \[\leadsto x \cdot \left(y + \color{blue}{z}\right) \]
                      4. Applied rewrites65.5%

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

                        \[\leadsto x \cdot z \]
                      6. Step-by-step derivation
                        1. Applied rewrites27.7%

                          \[\leadsto x \cdot z \]
                      7. Recombined 3 regimes into one program.
                      8. Add Preprocessing

                      Alternative 7: 60.9% accurate, 1.1× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1050000:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{-23}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
                      (FPCore (x y z)
                       :precision binary64
                       (if (<= x -1050000.0) (* x y) (if (<= x 1.32e-23) (- z) (* x y))))
                      double code(double x, double y, double z) {
                      	double tmp;
                      	if (x <= -1050000.0) {
                      		tmp = x * y;
                      	} else if (x <= 1.32e-23) {
                      		tmp = -z;
                      	} else {
                      		tmp = x * y;
                      	}
                      	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, z)
                      use fmin_fmax_functions
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          real(8) :: tmp
                          if (x <= (-1050000.0d0)) then
                              tmp = x * y
                          else if (x <= 1.32d-23) then
                              tmp = -z
                          else
                              tmp = x * y
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y, double z) {
                      	double tmp;
                      	if (x <= -1050000.0) {
                      		tmp = x * y;
                      	} else if (x <= 1.32e-23) {
                      		tmp = -z;
                      	} else {
                      		tmp = x * y;
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y, z):
                      	tmp = 0
                      	if x <= -1050000.0:
                      		tmp = x * y
                      	elif x <= 1.32e-23:
                      		tmp = -z
                      	else:
                      		tmp = x * y
                      	return tmp
                      
                      function code(x, y, z)
                      	tmp = 0.0
                      	if (x <= -1050000.0)
                      		tmp = Float64(x * y);
                      	elseif (x <= 1.32e-23)
                      		tmp = Float64(-z);
                      	else
                      		tmp = Float64(x * y);
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y, z)
                      	tmp = 0.0;
                      	if (x <= -1050000.0)
                      		tmp = x * y;
                      	elseif (x <= 1.32e-23)
                      		tmp = -z;
                      	else
                      		tmp = x * y;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_, z_] := If[LessEqual[x, -1050000.0], N[(x * y), $MachinePrecision], If[LessEqual[x, 1.32e-23], (-z), N[(x * y), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;x \leq -1050000:\\
                      \;\;\;\;x \cdot y\\
                      
                      \mathbf{elif}\;x \leq 1.32 \cdot 10^{-23}:\\
                      \;\;\;\;-z\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;x \cdot y\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if x < -1.05e6 or 1.31999999999999994e-23 < x

                        1. Initial program 98.0%

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

                          \[\leadsto \color{blue}{-1 \cdot z + x \cdot \left(y + z\right)} \]
                        3. Step-by-step derivation
                          1. lower-fma.f64N/A

                            \[\leadsto \mathsf{fma}\left(-1, \color{blue}{z}, x \cdot \left(y + z\right)\right) \]
                          2. lower-*.f64N/A

                            \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
                          3. lower-+.f64100.0

                            \[\leadsto \mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right) \]
                        4. Applied rewrites100.0%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(-1, z, x \cdot \left(y + z\right)\right)} \]
                        5. Step-by-step derivation
                          1. lift-fma.f64N/A

                            \[\leadsto -1 \cdot z + \color{blue}{x \cdot \left(y + z\right)} \]
                          2. lift-*.f64N/A

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

                            \[\leadsto x \cdot \left(y + z\right) + \color{blue}{-1 \cdot z} \]
                          4. lift-*.f64N/A

                            \[\leadsto x \cdot \left(y + z\right) + -1 \cdot \color{blue}{z} \]
                          5. mul-1-negN/A

                            \[\leadsto x \cdot \left(y + z\right) + \left(\mathsf{neg}\left(z\right)\right) \]
                          6. sub-flip-reverseN/A

                            \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
                          7. lower--.f64100.0

                            \[\leadsto x \cdot \left(y + z\right) - \color{blue}{z} \]
                          8. lift-*.f64N/A

                            \[\leadsto x \cdot \left(y + z\right) - z \]
                          9. *-commutativeN/A

                            \[\leadsto \left(y + z\right) \cdot x - z \]
                          10. lower-*.f64100.0

                            \[\leadsto \left(y + z\right) \cdot x - z \]
                          11. lift-+.f64N/A

                            \[\leadsto \left(y + z\right) \cdot x - z \]
                          12. +-commutativeN/A

                            \[\leadsto \left(z + y\right) \cdot x - z \]
                          13. lower-+.f64100.0

                            \[\leadsto \left(z + y\right) \cdot x - z \]
                        6. Applied rewrites100.0%

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

                          \[\leadsto z \cdot x - z \]
                        8. Step-by-step derivation
                          1. Applied rewrites61.6%

                            \[\leadsto z \cdot x - z \]
                          2. Taylor expanded in y around inf

                            \[\leadsto \color{blue}{x \cdot y} \]
                          3. Step-by-step derivation
                            1. lower-*.f6442.3

                              \[\leadsto x \cdot \color{blue}{y} \]
                          4. Applied rewrites42.3%

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

                          if -1.05e6 < x < 1.31999999999999994e-23

                          1. Initial program 98.0%

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

                            \[\leadsto \color{blue}{-1 \cdot z} \]
                          3. Step-by-step derivation
                            1. lower-*.f6436.3

                              \[\leadsto -1 \cdot \color{blue}{z} \]
                          4. Applied rewrites36.3%

                            \[\leadsto \color{blue}{-1 \cdot z} \]
                          5. Step-by-step derivation
                            1. lift-*.f64N/A

                              \[\leadsto -1 \cdot \color{blue}{z} \]
                            2. mul-1-negN/A

                              \[\leadsto \mathsf{neg}\left(z\right) \]
                            3. lower-neg.f6436.3

                              \[\leadsto -z \]
                          6. Applied rewrites36.3%

                            \[\leadsto -z \]
                        9. Recombined 2 regimes into one program.
                        10. Add Preprocessing

                        Alternative 8: 36.3% accurate, 6.2× speedup?

                        \[\begin{array}{l} \\ -z \end{array} \]
                        (FPCore (x y z) :precision binary64 (- z))
                        double code(double x, double y, double z) {
                        	return -z;
                        }
                        
                        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, z)
                        use fmin_fmax_functions
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            real(8), intent (in) :: z
                            code = -z
                        end function
                        
                        public static double code(double x, double y, double z) {
                        	return -z;
                        }
                        
                        def code(x, y, z):
                        	return -z
                        
                        function code(x, y, z)
                        	return Float64(-z)
                        end
                        
                        function tmp = code(x, y, z)
                        	tmp = -z;
                        end
                        
                        code[x_, y_, z_] := (-z)
                        
                        \begin{array}{l}
                        
                        \\
                        -z
                        \end{array}
                        
                        Derivation
                        1. Initial program 98.0%

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

                          \[\leadsto \color{blue}{-1 \cdot z} \]
                        3. Step-by-step derivation
                          1. lower-*.f6436.3

                            \[\leadsto -1 \cdot \color{blue}{z} \]
                        4. Applied rewrites36.3%

                          \[\leadsto \color{blue}{-1 \cdot z} \]
                        5. Step-by-step derivation
                          1. lift-*.f64N/A

                            \[\leadsto -1 \cdot \color{blue}{z} \]
                          2. mul-1-negN/A

                            \[\leadsto \mathsf{neg}\left(z\right) \]
                          3. lower-neg.f6436.3

                            \[\leadsto -z \]
                        6. Applied rewrites36.3%

                          \[\leadsto -z \]
                        7. Add Preprocessing

                        Reproduce

                        ?
                        herbie shell --seed 2025142 
                        (FPCore (x y z)
                          :name "Graphics.Rendering.Chart.Drawing:drawTextsR from Chart-1.5.3"
                          :precision binary64
                          (+ (* x y) (* (- x 1.0) z)))