Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B

Percentage Accurate: 99.9% → 99.9%
Time: 4.1s
Alternatives: 16
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(x + \cos y\right) - z \cdot \sin y \end{array} \]
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
	return (x + cos(y)) - (z * sin(y));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
	return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z):
	return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z)
	return Float64(Float64(x + cos(y)) - Float64(z * sin(y)))
end
function tmp = code(x, y, z)
	tmp = (x + cos(y)) - (z * sin(y));
end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + \cos y\right) - z \cdot \sin y
\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 16 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x + \cos y\right) - z \cdot \sin y \end{array} \]
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
	return (x + cos(y)) - (z * sin(y));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
	return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z):
	return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z)
	return Float64(Float64(x + cos(y)) - Float64(z * sin(y)))
end
function tmp = code(x, y, z)
	tmp = (x + cos(y)) - (z * sin(y));
end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \cos y - \left(\sin y \cdot z - x\right) \end{array} \]
(FPCore (x y z) :precision binary64 (- (cos y) (- (* (sin y) z) x)))
double code(double x, double y, double z) {
	return cos(y) - ((sin(y) * z) - x);
}
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 = cos(y) - ((sin(y) * z) - x)
end function
public static double code(double x, double y, double z) {
	return Math.cos(y) - ((Math.sin(y) * z) - x);
}
def code(x, y, z):
	return math.cos(y) - ((math.sin(y) * z) - x)
function code(x, y, z)
	return Float64(cos(y) - Float64(Float64(sin(y) * z) - x))
end
function tmp = code(x, y, z)
	tmp = cos(y) - ((sin(y) * z) - x);
end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] - N[(N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\left(x + \cos y\right) - z \cdot \sin y \]
  2. Step-by-step derivation
    1. lift--.f64N/A

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

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

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

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

      \[\leadsto \left(x + \cos y\right) - z \cdot \color{blue}{\sin y} \]
    6. *-lft-identityN/A

      \[\leadsto \left(x + \cos y\right) - \color{blue}{1 \cdot \left(z \cdot \sin y\right)} \]
    7. metadata-evalN/A

      \[\leadsto \left(x + \cos y\right) - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot \left(z \cdot \sin y\right) \]
    8. fp-cancel-sign-sub-invN/A

      \[\leadsto \color{blue}{\left(x + \cos y\right) + -1 \cdot \left(z \cdot \sin y\right)} \]
    9. associate-+r+N/A

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

      \[\leadsto \color{blue}{\left(\cos y + -1 \cdot \left(z \cdot \sin y\right)\right) + x} \]
    11. fp-cancel-sign-sub-invN/A

      \[\leadsto \color{blue}{\left(\cos y - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \sin y\right)\right)} + x \]
    12. metadata-evalN/A

      \[\leadsto \left(\cos y - \color{blue}{1} \cdot \left(z \cdot \sin y\right)\right) + x \]
    13. *-lft-identityN/A

      \[\leadsto \left(\cos y - \color{blue}{z \cdot \sin y}\right) + x \]
    14. associate-+l-N/A

      \[\leadsto \color{blue}{\cos y - \left(z \cdot \sin y - x\right)} \]
    15. lower--.f64N/A

      \[\leadsto \color{blue}{\cos y - \left(z \cdot \sin y - x\right)} \]
    16. lift-cos.f64N/A

      \[\leadsto \color{blue}{\cos y} - \left(z \cdot \sin y - x\right) \]
    17. lower--.f64N/A

      \[\leadsto \cos y - \color{blue}{\left(z \cdot \sin y - x\right)} \]
    18. *-commutativeN/A

      \[\leadsto \cos y - \left(\color{blue}{\sin y \cdot z} - x\right) \]
    19. lower-*.f64N/A

      \[\leadsto \cos y - \left(\color{blue}{\sin y \cdot z} - x\right) \]
    20. lift-sin.f6499.9

      \[\leadsto \cos y - \left(\color{blue}{\sin y} \cdot z - x\right) \]
  3. Applied rewrites99.9%

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

Alternative 2: 99.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \left(\sin y \cdot z - x\right)\\ \mathbf{if}\;x \leq -4.5 \cdot 10^{-14}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-15}:\\ \;\;\;\;\cos y - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 1.0 (- (* (sin y) z) x))))
   (if (<= x -4.5e-14) t_0 (if (<= x 5.5e-15) (- (cos y) (* z (sin y))) t_0))))
double code(double x, double y, double z) {
	double t_0 = 1.0 - ((sin(y) * z) - x);
	double tmp;
	if (x <= -4.5e-14) {
		tmp = t_0;
	} else if (x <= 5.5e-15) {
		tmp = cos(y) - (z * sin(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 = 1.0d0 - ((sin(y) * z) - x)
    if (x <= (-4.5d-14)) then
        tmp = t_0
    else if (x <= 5.5d-15) then
        tmp = cos(y) - (z * sin(y))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 - ((Math.sin(y) * z) - x);
	double tmp;
	if (x <= -4.5e-14) {
		tmp = t_0;
	} else if (x <= 5.5e-15) {
		tmp = Math.cos(y) - (z * Math.sin(y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 - ((math.sin(y) * z) - x)
	tmp = 0
	if x <= -4.5e-14:
		tmp = t_0
	elif x <= 5.5e-15:
		tmp = math.cos(y) - (z * math.sin(y))
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 - Float64(Float64(sin(y) * z) - x))
	tmp = 0.0
	if (x <= -4.5e-14)
		tmp = t_0;
	elseif (x <= 5.5e-15)
		tmp = Float64(cos(y) - Float64(z * sin(y)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 - ((sin(y) * z) - x);
	tmp = 0.0;
	if (x <= -4.5e-14)
		tmp = t_0;
	elseif (x <= 5.5e-15)
		tmp = cos(y) - (z * sin(y));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.5e-14], t$95$0, If[LessEqual[x, 5.5e-15], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 5.5 \cdot 10^{-15}:\\
\;\;\;\;\cos y - z \cdot \sin y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.4999999999999998e-14 or 5.5000000000000002e-15 < x

    1. Initial program 99.9%

      \[\left(x + \cos y\right) - z \cdot \sin y \]
    2. Step-by-step derivation
      1. lift--.f64N/A

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

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

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

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

        \[\leadsto \left(x + \cos y\right) - z \cdot \color{blue}{\sin y} \]
      6. *-lft-identityN/A

        \[\leadsto \left(x + \cos y\right) - \color{blue}{1 \cdot \left(z \cdot \sin y\right)} \]
      7. metadata-evalN/A

        \[\leadsto \left(x + \cos y\right) - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot \left(z \cdot \sin y\right) \]
      8. fp-cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(x + \cos y\right) + -1 \cdot \left(z \cdot \sin y\right)} \]
      9. associate-+r+N/A

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

        \[\leadsto \color{blue}{\left(\cos y + -1 \cdot \left(z \cdot \sin y\right)\right) + x} \]
      11. fp-cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(\cos y - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \sin y\right)\right)} + x \]
      12. metadata-evalN/A

        \[\leadsto \left(\cos y - \color{blue}{1} \cdot \left(z \cdot \sin y\right)\right) + x \]
      13. *-lft-identityN/A

        \[\leadsto \left(\cos y - \color{blue}{z \cdot \sin y}\right) + x \]
      14. associate-+l-N/A

        \[\leadsto \color{blue}{\cos y - \left(z \cdot \sin y - x\right)} \]
      15. lower--.f64N/A

        \[\leadsto \color{blue}{\cos y - \left(z \cdot \sin y - x\right)} \]
      16. lift-cos.f64N/A

        \[\leadsto \color{blue}{\cos y} - \left(z \cdot \sin y - x\right) \]
      17. lower--.f64N/A

        \[\leadsto \cos y - \color{blue}{\left(z \cdot \sin y - x\right)} \]
      18. *-commutativeN/A

        \[\leadsto \cos y - \left(\color{blue}{\sin y \cdot z} - x\right) \]
      19. lower-*.f64N/A

        \[\leadsto \cos y - \left(\color{blue}{\sin y \cdot z} - x\right) \]
      20. lift-sin.f6499.9

        \[\leadsto \cos y - \left(\color{blue}{\sin y} \cdot z - x\right) \]
    3. Applied rewrites99.9%

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

      \[\leadsto \color{blue}{1} - \left(\sin y \cdot z - x\right) \]
    5. Step-by-step derivation
      1. Applied rewrites98.8%

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

      if -4.4999999999999998e-14 < x < 5.5000000000000002e-15

      1. Initial program 99.9%

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

        \[\leadsto \color{blue}{\cos y} - z \cdot \sin y \]
      3. Step-by-step derivation
        1. lift-cos.f6499.9

          \[\leadsto \cos y - z \cdot \sin y \]
      4. Applied rewrites99.9%

        \[\leadsto \color{blue}{\cos y} - z \cdot \sin y \]
    6. Recombined 2 regimes into one program.
    7. Add Preprocessing

    Alternative 3: 98.6% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \left(\sin y \cdot z - x\right)\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{+35}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 0.00176:\\ \;\;\;\;\cos y + x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (- 1.0 (- (* (sin y) z) x))))
       (if (<= z -1.35e+35) t_0 (if (<= z 0.00176) (+ (cos y) x) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = 1.0 - ((sin(y) * z) - x);
    	double tmp;
    	if (z <= -1.35e+35) {
    		tmp = t_0;
    	} else if (z <= 0.00176) {
    		tmp = cos(y) + x;
    	} 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 = 1.0d0 - ((sin(y) * z) - x)
        if (z <= (-1.35d+35)) then
            tmp = t_0
        else if (z <= 0.00176d0) then
            tmp = cos(y) + x
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = 1.0 - ((Math.sin(y) * z) - x);
    	double tmp;
    	if (z <= -1.35e+35) {
    		tmp = t_0;
    	} else if (z <= 0.00176) {
    		tmp = Math.cos(y) + x;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = 1.0 - ((math.sin(y) * z) - x)
    	tmp = 0
    	if z <= -1.35e+35:
    		tmp = t_0
    	elif z <= 0.00176:
    		tmp = math.cos(y) + x
    	else:
    		tmp = t_0
    	return tmp
    
    function code(x, y, z)
    	t_0 = Float64(1.0 - Float64(Float64(sin(y) * z) - x))
    	tmp = 0.0
    	if (z <= -1.35e+35)
    		tmp = t_0;
    	elseif (z <= 0.00176)
    		tmp = Float64(cos(y) + x);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = 1.0 - ((sin(y) * z) - x);
    	tmp = 0.0;
    	if (z <= -1.35e+35)
    		tmp = t_0;
    	elseif (z <= 0.00176)
    		tmp = cos(y) + x;
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.35e+35], t$95$0, If[LessEqual[z, 0.00176], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := 1 - \left(\sin y \cdot z - x\right)\\
    \mathbf{if}\;z \leq -1.35 \cdot 10^{+35}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;z \leq 0.00176:\\
    \;\;\;\;\cos y + x\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -1.35000000000000001e35 or 0.00176000000000000006 < z

      1. Initial program 99.9%

        \[\left(x + \cos y\right) - z \cdot \sin y \]
      2. Step-by-step derivation
        1. lift--.f64N/A

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

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

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

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

          \[\leadsto \left(x + \cos y\right) - z \cdot \color{blue}{\sin y} \]
        6. *-lft-identityN/A

          \[\leadsto \left(x + \cos y\right) - \color{blue}{1 \cdot \left(z \cdot \sin y\right)} \]
        7. metadata-evalN/A

          \[\leadsto \left(x + \cos y\right) - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot \left(z \cdot \sin y\right) \]
        8. fp-cancel-sign-sub-invN/A

          \[\leadsto \color{blue}{\left(x + \cos y\right) + -1 \cdot \left(z \cdot \sin y\right)} \]
        9. associate-+r+N/A

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

          \[\leadsto \color{blue}{\left(\cos y + -1 \cdot \left(z \cdot \sin y\right)\right) + x} \]
        11. fp-cancel-sign-sub-invN/A

          \[\leadsto \color{blue}{\left(\cos y - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \sin y\right)\right)} + x \]
        12. metadata-evalN/A

          \[\leadsto \left(\cos y - \color{blue}{1} \cdot \left(z \cdot \sin y\right)\right) + x \]
        13. *-lft-identityN/A

          \[\leadsto \left(\cos y - \color{blue}{z \cdot \sin y}\right) + x \]
        14. associate-+l-N/A

          \[\leadsto \color{blue}{\cos y - \left(z \cdot \sin y - x\right)} \]
        15. lower--.f64N/A

          \[\leadsto \color{blue}{\cos y - \left(z \cdot \sin y - x\right)} \]
        16. lift-cos.f64N/A

          \[\leadsto \color{blue}{\cos y} - \left(z \cdot \sin y - x\right) \]
        17. lower--.f64N/A

          \[\leadsto \cos y - \color{blue}{\left(z \cdot \sin y - x\right)} \]
        18. *-commutativeN/A

          \[\leadsto \cos y - \left(\color{blue}{\sin y \cdot z} - x\right) \]
        19. lower-*.f64N/A

          \[\leadsto \cos y - \left(\color{blue}{\sin y \cdot z} - x\right) \]
        20. lift-sin.f6499.9

          \[\leadsto \cos y - \left(\color{blue}{\sin y} \cdot z - x\right) \]
      3. Applied rewrites99.9%

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

        \[\leadsto \color{blue}{1} - \left(\sin y \cdot z - x\right) \]
      5. Step-by-step derivation
        1. Applied rewrites99.4%

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

        if -1.35000000000000001e35 < z < 0.00176000000000000006

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{x + \cos y} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \cos y + \color{blue}{x} \]
          2. lower-+.f64N/A

            \[\leadsto \cos y + \color{blue}{x} \]
          3. lift-cos.f6497.8

            \[\leadsto \cos y + x \]
        4. Applied rewrites97.8%

          \[\leadsto \color{blue}{\cos y + x} \]
      6. Recombined 2 regimes into one program.
      7. Add Preprocessing

      Alternative 4: 98.2% accurate, 0.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \sin y\\ t_1 := \left(x + \cos y\right) - t\_0\\ t_2 := x - t\_0\\ \mathbf{if}\;t\_1 \leq -500000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+15}:\\ \;\;\;\;\cos y + x\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* z (sin y))) (t_1 (- (+ x (cos y)) t_0)) (t_2 (- x t_0)))
         (if (<= t_1 -500000000.0) t_2 (if (<= t_1 4e+15) (+ (cos y) x) t_2))))
      double code(double x, double y, double z) {
      	double t_0 = z * sin(y);
      	double t_1 = (x + cos(y)) - t_0;
      	double t_2 = x - t_0;
      	double tmp;
      	if (t_1 <= -500000000.0) {
      		tmp = t_2;
      	} else if (t_1 <= 4e+15) {
      		tmp = cos(y) + x;
      	} else {
      		tmp = t_2;
      	}
      	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) :: t_1
          real(8) :: t_2
          real(8) :: tmp
          t_0 = z * sin(y)
          t_1 = (x + cos(y)) - t_0
          t_2 = x - t_0
          if (t_1 <= (-500000000.0d0)) then
              tmp = t_2
          else if (t_1 <= 4d+15) then
              tmp = cos(y) + x
          else
              tmp = t_2
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double t_0 = z * Math.sin(y);
      	double t_1 = (x + Math.cos(y)) - t_0;
      	double t_2 = x - t_0;
      	double tmp;
      	if (t_1 <= -500000000.0) {
      		tmp = t_2;
      	} else if (t_1 <= 4e+15) {
      		tmp = Math.cos(y) + x;
      	} else {
      		tmp = t_2;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = z * math.sin(y)
      	t_1 = (x + math.cos(y)) - t_0
      	t_2 = x - t_0
      	tmp = 0
      	if t_1 <= -500000000.0:
      		tmp = t_2
      	elif t_1 <= 4e+15:
      		tmp = math.cos(y) + x
      	else:
      		tmp = t_2
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(z * sin(y))
      	t_1 = Float64(Float64(x + cos(y)) - t_0)
      	t_2 = Float64(x - t_0)
      	tmp = 0.0
      	if (t_1 <= -500000000.0)
      		tmp = t_2;
      	elseif (t_1 <= 4e+15)
      		tmp = Float64(cos(y) + x);
      	else
      		tmp = t_2;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = z * sin(y);
      	t_1 = (x + cos(y)) - t_0;
      	t_2 = x - t_0;
      	tmp = 0.0;
      	if (t_1 <= -500000000.0)
      		tmp = t_2;
      	elseif (t_1 <= 4e+15)
      		tmp = cos(y) + x;
      	else
      		tmp = t_2;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(x - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -500000000.0], t$95$2, If[LessEqual[t$95$1, 4e+15], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], t$95$2]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := z \cdot \sin y\\
      t_1 := \left(x + \cos y\right) - t\_0\\
      t_2 := x - t\_0\\
      \mathbf{if}\;t\_1 \leq -500000000:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+15}:\\
      \;\;\;\;\cos y + x\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_2\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -5e8 or 4e15 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y)))

        1. Initial program 99.9%

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

          \[\leadsto \color{blue}{x} - z \cdot \sin y \]
        3. Step-by-step derivation
          1. Applied rewrites99.7%

            \[\leadsto \color{blue}{x} - z \cdot \sin y \]

          if -5e8 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 4e15

          1. Initial program 100.0%

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

            \[\leadsto \color{blue}{x + \cos y} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \cos y + \color{blue}{x} \]
            2. lower-+.f64N/A

              \[\leadsto \cos y + \color{blue}{x} \]
            3. lift-cos.f6495.3

              \[\leadsto \cos y + x \]
          4. Applied rewrites95.3%

            \[\leadsto \color{blue}{\cos y + x} \]
        4. Recombined 2 regimes into one program.
        5. Add Preprocessing

        Alternative 5: 84.6% accurate, 1.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \sin y \cdot z\\ \mathbf{if}\;z \leq -4.4 \cdot 10^{+81}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{+18}:\\ \;\;\;\;\cos y + x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (let* ((t_0 (- 1.0 (* (sin y) z))))
           (if (<= z -4.4e+81) t_0 (if (<= z 7.2e+18) (+ (cos y) x) t_0))))
        double code(double x, double y, double z) {
        	double t_0 = 1.0 - (sin(y) * z);
        	double tmp;
        	if (z <= -4.4e+81) {
        		tmp = t_0;
        	} else if (z <= 7.2e+18) {
        		tmp = cos(y) + x;
        	} 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 = 1.0d0 - (sin(y) * z)
            if (z <= (-4.4d+81)) then
                tmp = t_0
            else if (z <= 7.2d+18) then
                tmp = cos(y) + x
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double t_0 = 1.0 - (Math.sin(y) * z);
        	double tmp;
        	if (z <= -4.4e+81) {
        		tmp = t_0;
        	} else if (z <= 7.2e+18) {
        		tmp = Math.cos(y) + x;
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	t_0 = 1.0 - (math.sin(y) * z)
        	tmp = 0
        	if z <= -4.4e+81:
        		tmp = t_0
        	elif z <= 7.2e+18:
        		tmp = math.cos(y) + x
        	else:
        		tmp = t_0
        	return tmp
        
        function code(x, y, z)
        	t_0 = Float64(1.0 - Float64(sin(y) * z))
        	tmp = 0.0
        	if (z <= -4.4e+81)
        		tmp = t_0;
        	elseif (z <= 7.2e+18)
        		tmp = Float64(cos(y) + x);
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	t_0 = 1.0 - (sin(y) * z);
        	tmp = 0.0;
        	if (z <= -4.4e+81)
        		tmp = t_0;
        	elseif (z <= 7.2e+18)
        		tmp = cos(y) + x;
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.4e+81], t$95$0, If[LessEqual[z, 7.2e+18], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := 1 - \sin y \cdot z\\
        \mathbf{if}\;z \leq -4.4 \cdot 10^{+81}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;z \leq 7.2 \cdot 10^{+18}:\\
        \;\;\;\;\cos y + x\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -4.39999999999999974e81 or 7.2e18 < z

          1. Initial program 99.9%

            \[\left(x + \cos y\right) - z \cdot \sin y \]
          2. Step-by-step derivation
            1. lift--.f64N/A

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

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

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

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

              \[\leadsto \left(x + \cos y\right) - z \cdot \color{blue}{\sin y} \]
            6. *-lft-identityN/A

              \[\leadsto \left(x + \cos y\right) - \color{blue}{1 \cdot \left(z \cdot \sin y\right)} \]
            7. metadata-evalN/A

              \[\leadsto \left(x + \cos y\right) - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot \left(z \cdot \sin y\right) \]
            8. fp-cancel-sign-sub-invN/A

              \[\leadsto \color{blue}{\left(x + \cos y\right) + -1 \cdot \left(z \cdot \sin y\right)} \]
            9. associate-+r+N/A

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

              \[\leadsto \color{blue}{\left(\cos y + -1 \cdot \left(z \cdot \sin y\right)\right) + x} \]
            11. fp-cancel-sign-sub-invN/A

              \[\leadsto \color{blue}{\left(\cos y - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \sin y\right)\right)} + x \]
            12. metadata-evalN/A

              \[\leadsto \left(\cos y - \color{blue}{1} \cdot \left(z \cdot \sin y\right)\right) + x \]
            13. *-lft-identityN/A

              \[\leadsto \left(\cos y - \color{blue}{z \cdot \sin y}\right) + x \]
            14. associate-+l-N/A

              \[\leadsto \color{blue}{\cos y - \left(z \cdot \sin y - x\right)} \]
            15. lower--.f64N/A

              \[\leadsto \color{blue}{\cos y - \left(z \cdot \sin y - x\right)} \]
            16. lift-cos.f64N/A

              \[\leadsto \color{blue}{\cos y} - \left(z \cdot \sin y - x\right) \]
            17. lower--.f64N/A

              \[\leadsto \cos y - \color{blue}{\left(z \cdot \sin y - x\right)} \]
            18. *-commutativeN/A

              \[\leadsto \cos y - \left(\color{blue}{\sin y \cdot z} - x\right) \]
            19. lower-*.f64N/A

              \[\leadsto \cos y - \left(\color{blue}{\sin y \cdot z} - x\right) \]
            20. lift-sin.f6499.9

              \[\leadsto \cos y - \left(\color{blue}{\sin y} \cdot z - x\right) \]
          3. Applied rewrites99.9%

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

            \[\leadsto \color{blue}{1} - \left(\sin y \cdot z - x\right) \]
          5. Step-by-step derivation
            1. Applied rewrites99.9%

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

              \[\leadsto 1 - \color{blue}{z \cdot \sin y} \]
            3. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto 1 - \sin y \cdot \color{blue}{z} \]
              2. lift-sin.f64N/A

                \[\leadsto 1 - \sin y \cdot z \]
              3. lift-*.f6469.6

                \[\leadsto 1 - \sin y \cdot \color{blue}{z} \]
            4. Applied rewrites69.6%

              \[\leadsto 1 - \color{blue}{\sin y \cdot z} \]

            if -4.39999999999999974e81 < z < 7.2e18

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{x + \cos y} \]
            3. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \cos y + \color{blue}{x} \]
              2. lower-+.f64N/A

                \[\leadsto \cos y + \color{blue}{x} \]
              3. lift-cos.f6495.1

                \[\leadsto \cos y + x \]
            4. Applied rewrites95.1%

              \[\leadsto \color{blue}{\cos y + x} \]
          6. Recombined 2 regimes into one program.
          7. Add Preprocessing

          Alternative 6: 81.2% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6.4 \cdot 10^{+86}:\\ \;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+163}:\\ \;\;\;\;\cos y + x\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) \cdot \sin y\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (<= z -6.4e+86)
             (- x (fma z y -1.0))
             (if (<= z 1.05e+163) (+ (cos y) x) (* (- z) (sin y)))))
          double code(double x, double y, double z) {
          	double tmp;
          	if (z <= -6.4e+86) {
          		tmp = x - fma(z, y, -1.0);
          	} else if (z <= 1.05e+163) {
          		tmp = cos(y) + x;
          	} else {
          		tmp = -z * sin(y);
          	}
          	return tmp;
          }
          
          function code(x, y, z)
          	tmp = 0.0
          	if (z <= -6.4e+86)
          		tmp = Float64(x - fma(z, y, -1.0));
          	elseif (z <= 1.05e+163)
          		tmp = Float64(cos(y) + x);
          	else
          		tmp = Float64(Float64(-z) * sin(y));
          	end
          	return tmp
          end
          
          code[x_, y_, z_] := If[LessEqual[z, -6.4e+86], N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e+163], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -6.4 \cdot 10^{+86}:\\
          \;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
          
          \mathbf{elif}\;z \leq 1.05 \cdot 10^{+163}:\\
          \;\;\;\;\cos y + x\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(-z\right) \cdot \sin y\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if z < -6.4000000000000001e86

            1. Initial program 99.9%

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

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

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

                \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) + 1 \cdot \color{blue}{1} \]
              3. fp-cancel-sign-sub-invN/A

                \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - \color{blue}{\left(\mathsf{neg}\left(1\right)\right) \cdot 1} \]
              4. metadata-evalN/A

                \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - -1 \cdot 1 \]
              5. metadata-evalN/A

                \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - -1 \]
              6. lower--.f64N/A

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

                \[\leadsto \left(x + \left(\mathsf{neg}\left(1\right)\right) \cdot \left(y \cdot z\right)\right) - -1 \]
              8. fp-cancel-sub-sign-invN/A

                \[\leadsto \left(x - 1 \cdot \left(y \cdot z\right)\right) - -1 \]
              9. *-lft-identityN/A

                \[\leadsto \left(x - y \cdot z\right) - -1 \]
              10. lower--.f64N/A

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

                \[\leadsto \left(x - z \cdot y\right) - -1 \]
              12. lower-*.f6454.8

                \[\leadsto \left(x - z \cdot y\right) - -1 \]
            4. Applied rewrites54.8%

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

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

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

                \[\leadsto \left(x - z \cdot y\right) - -1 \]
              4. associate--l-N/A

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

                \[\leadsto x - \color{blue}{\left(z \cdot y + -1\right)} \]
              6. lower-fma.f6454.8

                \[\leadsto x - \mathsf{fma}\left(z, \color{blue}{y}, -1\right) \]
            6. Applied rewrites54.8%

              \[\leadsto \color{blue}{x - \mathsf{fma}\left(z, y, -1\right)} \]

            if -6.4000000000000001e86 < z < 1.05e163

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{x + \cos y} \]
            3. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \cos y + \color{blue}{x} \]
              2. lower-+.f64N/A

                \[\leadsto \cos y + \color{blue}{x} \]
              3. lift-cos.f6489.3

                \[\leadsto \cos y + x \]
            4. Applied rewrites89.3%

              \[\leadsto \color{blue}{\cos y + x} \]

            if 1.05e163 < z

            1. Initial program 99.8%

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

              \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \sin y\right)} \]
            3. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto \mathsf{neg}\left(z \cdot \sin y\right) \]
              2. distribute-lft-neg-inN/A

                \[\leadsto \left(\mathsf{neg}\left(z\right)\right) \cdot \color{blue}{\sin y} \]
              3. lower-*.f64N/A

                \[\leadsto \left(\mathsf{neg}\left(z\right)\right) \cdot \color{blue}{\sin y} \]
              4. lower-neg.f64N/A

                \[\leadsto \left(-z\right) \cdot \sin \color{blue}{y} \]
              5. lift-sin.f6469.6

                \[\leadsto \left(-z\right) \cdot \sin y \]
            4. Applied rewrites69.6%

              \[\leadsto \color{blue}{\left(-z\right) \cdot \sin y} \]
          3. Recombined 3 regimes into one program.
          4. Add Preprocessing

          Alternative 7: 80.9% accurate, 1.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos y + x\\ \mathbf{if}\;y \leq -4.2:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 26000000000000:\\ \;\;\;\;\mathsf{fma}\left(\left(0.16666666666666666 \cdot \left(z \cdot y\right) - 0.5\right) \cdot y - z, y, x - -1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (+ (cos y) x)))
             (if (<= y -4.2)
               t_0
               (if (<= y 26000000000000.0)
                 (fma (- (* (- (* 0.16666666666666666 (* z y)) 0.5) y) z) y (- x -1.0))
                 t_0))))
          double code(double x, double y, double z) {
          	double t_0 = cos(y) + x;
          	double tmp;
          	if (y <= -4.2) {
          		tmp = t_0;
          	} else if (y <= 26000000000000.0) {
          		tmp = fma(((((0.16666666666666666 * (z * y)) - 0.5) * y) - z), y, (x - -1.0));
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          function code(x, y, z)
          	t_0 = Float64(cos(y) + x)
          	tmp = 0.0
          	if (y <= -4.2)
          		tmp = t_0;
          	elseif (y <= 26000000000000.0)
          		tmp = fma(Float64(Float64(Float64(Float64(0.16666666666666666 * Float64(z * y)) - 0.5) * y) - z), y, Float64(x - -1.0));
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -4.2], t$95$0, If[LessEqual[y, 26000000000000.0], N[(N[(N[(N[(N[(0.16666666666666666 * N[(z * y), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(x - -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \cos y + x\\
          \mathbf{if}\;y \leq -4.2:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;y \leq 26000000000000:\\
          \;\;\;\;\mathsf{fma}\left(\left(0.16666666666666666 \cdot \left(z \cdot y\right) - 0.5\right) \cdot y - z, y, x - -1\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -4.20000000000000018 or 2.6e13 < y

            1. Initial program 99.9%

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

              \[\leadsto \color{blue}{x + \cos y} \]
            3. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \cos y + \color{blue}{x} \]
              2. lower-+.f64N/A

                \[\leadsto \cos y + \color{blue}{x} \]
              3. lift-cos.f6462.8

                \[\leadsto \cos y + x \]
            4. Applied rewrites62.8%

              \[\leadsto \color{blue}{\cos y + x} \]

            if -4.20000000000000018 < y < 2.6e13

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{1 + \left(x + y \cdot \left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z\right)\right)} \]
            3. Step-by-step derivation
              1. +-commutativeN/A

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

                \[\leadsto \left(y \cdot \left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z\right) + x\right) + 1 \]
              3. associate-+l+N/A

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

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

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

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

                \[\leadsto \mathsf{fma}\left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z, y, 1 + x\right) \]
              8. *-commutativeN/A

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

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

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

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) \cdot y - z, y, 1 + x\right) \]
              12. *-commutativeN/A

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

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, 1 + x\right) \]
              14. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x + 1\right) \]
              15. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x + 1 \cdot 1\right) \]
              16. fp-cancel-sign-sub-invN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x - \left(\mathsf{neg}\left(1\right)\right) \cdot 1\right) \]
              17. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x - -1 \cdot 1\right) \]
              18. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x - -1\right) \]
            4. Applied rewrites98.5%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\left(0.16666666666666666 \cdot \left(z \cdot y\right) - 0.5\right) \cdot y - z, y, x - -1\right)} \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 8: 75.1% accurate, 0.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x + \cos y\right) - z \cdot \sin y\\ t_1 := x - \mathsf{fma}\left(z, y, -1\right)\\ \mathbf{if}\;t\_0 \leq -200000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 0.9998:\\ \;\;\;\;\cos y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (- (+ x (cos y)) (* z (sin y)))) (t_1 (- x (fma z y -1.0))))
             (if (<= t_0 -200000000.0) t_1 (if (<= t_0 0.9998) (cos y) t_1))))
          double code(double x, double y, double z) {
          	double t_0 = (x + cos(y)) - (z * sin(y));
          	double t_1 = x - fma(z, y, -1.0);
          	double tmp;
          	if (t_0 <= -200000000.0) {
          		tmp = t_1;
          	} else if (t_0 <= 0.9998) {
          		tmp = cos(y);
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          function code(x, y, z)
          	t_0 = Float64(Float64(x + cos(y)) - Float64(z * sin(y)))
          	t_1 = Float64(x - fma(z, y, -1.0))
          	tmp = 0.0
          	if (t_0 <= -200000000.0)
          		tmp = t_1;
          	elseif (t_0 <= 0.9998)
          		tmp = cos(y);
          	else
          		tmp = t_1;
          	end
          	return tmp
          end
          
          code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -200000000.0], t$95$1, If[LessEqual[t$95$0, 0.9998], N[Cos[y], $MachinePrecision], t$95$1]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \left(x + \cos y\right) - z \cdot \sin y\\
          t_1 := x - \mathsf{fma}\left(z, y, -1\right)\\
          \mathbf{if}\;t\_0 \leq -200000000:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;t\_0 \leq 0.9998:\\
          \;\;\;\;\cos y\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -2e8 or 0.99980000000000002 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y)))

            1. Initial program 99.9%

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

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

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

                \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) + 1 \cdot \color{blue}{1} \]
              3. fp-cancel-sign-sub-invN/A

                \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - \color{blue}{\left(\mathsf{neg}\left(1\right)\right) \cdot 1} \]
              4. metadata-evalN/A

                \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - -1 \cdot 1 \]
              5. metadata-evalN/A

                \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - -1 \]
              6. lower--.f64N/A

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

                \[\leadsto \left(x + \left(\mathsf{neg}\left(1\right)\right) \cdot \left(y \cdot z\right)\right) - -1 \]
              8. fp-cancel-sub-sign-invN/A

                \[\leadsto \left(x - 1 \cdot \left(y \cdot z\right)\right) - -1 \]
              9. *-lft-identityN/A

                \[\leadsto \left(x - y \cdot z\right) - -1 \]
              10. lower--.f64N/A

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

                \[\leadsto \left(x - z \cdot y\right) - -1 \]
              12. lower-*.f6472.5

                \[\leadsto \left(x - z \cdot y\right) - -1 \]
            4. Applied rewrites72.5%

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

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

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

                \[\leadsto \left(x - z \cdot y\right) - -1 \]
              4. associate--l-N/A

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

                \[\leadsto x - \color{blue}{\left(z \cdot y + -1\right)} \]
              6. lower-fma.f6472.5

                \[\leadsto x - \mathsf{fma}\left(z, \color{blue}{y}, -1\right) \]
            6. Applied rewrites72.5%

              \[\leadsto \color{blue}{x - \mathsf{fma}\left(z, y, -1\right)} \]

            if -2e8 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.99980000000000002

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{x + \cos y} \]
            3. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \cos y + \color{blue}{x} \]
              2. lower-+.f64N/A

                \[\leadsto \cos y + \color{blue}{x} \]
              3. lift-cos.f6495.0

                \[\leadsto \cos y + x \]
            4. Applied rewrites95.0%

              \[\leadsto \color{blue}{\cos y + x} \]
            5. Taylor expanded in x around 0

              \[\leadsto \cos y \]
            6. Step-by-step derivation
              1. lift-cos.f6490.8

                \[\leadsto \cos y \]
            7. Applied rewrites90.8%

              \[\leadsto \cos y \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 9: 70.1% accurate, 2.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.8 \cdot 10^{+20}:\\ \;\;\;\;x - -1\\ \mathbf{elif}\;y \leq 26000000000000:\\ \;\;\;\;\mathsf{fma}\left(\left(0.16666666666666666 \cdot \left(z \cdot y\right) - 0.5\right) \cdot y - z, y, x - -1\right)\\ \mathbf{else}:\\ \;\;\;\;x - -1\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (<= y -7.8e+20)
             (- x -1.0)
             (if (<= y 26000000000000.0)
               (fma (- (* (- (* 0.16666666666666666 (* z y)) 0.5) y) z) y (- x -1.0))
               (- x -1.0))))
          double code(double x, double y, double z) {
          	double tmp;
          	if (y <= -7.8e+20) {
          		tmp = x - -1.0;
          	} else if (y <= 26000000000000.0) {
          		tmp = fma(((((0.16666666666666666 * (z * y)) - 0.5) * y) - z), y, (x - -1.0));
          	} else {
          		tmp = x - -1.0;
          	}
          	return tmp;
          }
          
          function code(x, y, z)
          	tmp = 0.0
          	if (y <= -7.8e+20)
          		tmp = Float64(x - -1.0);
          	elseif (y <= 26000000000000.0)
          		tmp = fma(Float64(Float64(Float64(Float64(0.16666666666666666 * Float64(z * y)) - 0.5) * y) - z), y, Float64(x - -1.0));
          	else
          		tmp = Float64(x - -1.0);
          	end
          	return tmp
          end
          
          code[x_, y_, z_] := If[LessEqual[y, -7.8e+20], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 26000000000000.0], N[(N[(N[(N[(N[(0.16666666666666666 * N[(z * y), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(x - -1.0), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y \leq -7.8 \cdot 10^{+20}:\\
          \;\;\;\;x - -1\\
          
          \mathbf{elif}\;y \leq 26000000000000:\\
          \;\;\;\;\mathsf{fma}\left(\left(0.16666666666666666 \cdot \left(z \cdot y\right) - 0.5\right) \cdot y - z, y, x - -1\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;x - -1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -7.8e20 or 2.6e13 < y

            1. Initial program 99.9%

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

              \[\leadsto \color{blue}{1 + x} \]
            3. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto x + \color{blue}{1} \]
              2. metadata-evalN/A

                \[\leadsto x + 1 \cdot \color{blue}{1} \]
              3. fp-cancel-sign-sub-invN/A

                \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(1\right)\right) \cdot 1} \]
              4. metadata-evalN/A

                \[\leadsto x - -1 \cdot 1 \]
              5. metadata-evalN/A

                \[\leadsto x - -1 \]
              6. lower--.f6440.2

                \[\leadsto x - \color{blue}{-1} \]
            4. Applied rewrites40.2%

              \[\leadsto \color{blue}{x - -1} \]

            if -7.8e20 < y < 2.6e13

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{1 + \left(x + y \cdot \left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z\right)\right)} \]
            3. Step-by-step derivation
              1. +-commutativeN/A

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

                \[\leadsto \left(y \cdot \left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z\right) + x\right) + 1 \]
              3. associate-+l+N/A

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

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

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

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

                \[\leadsto \mathsf{fma}\left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z, y, 1 + x\right) \]
              8. *-commutativeN/A

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

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

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

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) \cdot y - z, y, 1 + x\right) \]
              12. *-commutativeN/A

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

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, 1 + x\right) \]
              14. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x + 1\right) \]
              15. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x + 1 \cdot 1\right) \]
              16. fp-cancel-sign-sub-invN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x - \left(\mathsf{neg}\left(1\right)\right) \cdot 1\right) \]
              17. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x - -1 \cdot 1\right) \]
              18. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x - -1\right) \]
            4. Applied rewrites96.2%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\left(0.16666666666666666 \cdot \left(z \cdot y\right) - 0.5\right) \cdot y - z, y, x - -1\right)} \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 10: 70.0% accurate, 2.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3300000:\\ \;\;\;\;x - -1\\ \mathbf{elif}\;y \leq 26000000000000:\\ \;\;\;\;1 - \left(\left(\mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \cdot y\right) \cdot z - x\right)\\ \mathbf{else}:\\ \;\;\;\;x - -1\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (<= y -3300000.0)
             (- x -1.0)
             (if (<= y 26000000000000.0)
               (- 1.0 (- (* (* (fma (* y y) -0.16666666666666666 1.0) y) z) x))
               (- x -1.0))))
          double code(double x, double y, double z) {
          	double tmp;
          	if (y <= -3300000.0) {
          		tmp = x - -1.0;
          	} else if (y <= 26000000000000.0) {
          		tmp = 1.0 - (((fma((y * y), -0.16666666666666666, 1.0) * y) * z) - x);
          	} else {
          		tmp = x - -1.0;
          	}
          	return tmp;
          }
          
          function code(x, y, z)
          	tmp = 0.0
          	if (y <= -3300000.0)
          		tmp = Float64(x - -1.0);
          	elseif (y <= 26000000000000.0)
          		tmp = Float64(1.0 - Float64(Float64(Float64(fma(Float64(y * y), -0.16666666666666666, 1.0) * y) * z) - x));
          	else
          		tmp = Float64(x - -1.0);
          	end
          	return tmp
          end
          
          code[x_, y_, z_] := If[LessEqual[y, -3300000.0], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 26000000000000.0], N[(1.0 - N[(N[(N[(N[(N[(y * y), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y \leq -3300000:\\
          \;\;\;\;x - -1\\
          
          \mathbf{elif}\;y \leq 26000000000000:\\
          \;\;\;\;1 - \left(\left(\mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \cdot y\right) \cdot z - x\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;x - -1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -3.3e6 or 2.6e13 < y

            1. Initial program 99.9%

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

              \[\leadsto \color{blue}{1 + x} \]
            3. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto x + \color{blue}{1} \]
              2. metadata-evalN/A

                \[\leadsto x + 1 \cdot \color{blue}{1} \]
              3. fp-cancel-sign-sub-invN/A

                \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(1\right)\right) \cdot 1} \]
              4. metadata-evalN/A

                \[\leadsto x - -1 \cdot 1 \]
              5. metadata-evalN/A

                \[\leadsto x - -1 \]
              6. lower--.f6440.1

                \[\leadsto x - \color{blue}{-1} \]
            4. Applied rewrites40.1%

              \[\leadsto \color{blue}{x - -1} \]

            if -3.3e6 < y < 2.6e13

            1. Initial program 100.0%

              \[\left(x + \cos y\right) - z \cdot \sin y \]
            2. Step-by-step derivation
              1. lift--.f64N/A

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

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

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

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

                \[\leadsto \left(x + \cos y\right) - z \cdot \color{blue}{\sin y} \]
              6. *-lft-identityN/A

                \[\leadsto \left(x + \cos y\right) - \color{blue}{1 \cdot \left(z \cdot \sin y\right)} \]
              7. metadata-evalN/A

                \[\leadsto \left(x + \cos y\right) - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot \left(z \cdot \sin y\right) \]
              8. fp-cancel-sign-sub-invN/A

                \[\leadsto \color{blue}{\left(x + \cos y\right) + -1 \cdot \left(z \cdot \sin y\right)} \]
              9. associate-+r+N/A

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

                \[\leadsto \color{blue}{\left(\cos y + -1 \cdot \left(z \cdot \sin y\right)\right) + x} \]
              11. fp-cancel-sign-sub-invN/A

                \[\leadsto \color{blue}{\left(\cos y - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \sin y\right)\right)} + x \]
              12. metadata-evalN/A

                \[\leadsto \left(\cos y - \color{blue}{1} \cdot \left(z \cdot \sin y\right)\right) + x \]
              13. *-lft-identityN/A

                \[\leadsto \left(\cos y - \color{blue}{z \cdot \sin y}\right) + x \]
              14. associate-+l-N/A

                \[\leadsto \color{blue}{\cos y - \left(z \cdot \sin y - x\right)} \]
              15. lower--.f64N/A

                \[\leadsto \color{blue}{\cos y - \left(z \cdot \sin y - x\right)} \]
              16. lift-cos.f64N/A

                \[\leadsto \color{blue}{\cos y} - \left(z \cdot \sin y - x\right) \]
              17. lower--.f64N/A

                \[\leadsto \cos y - \color{blue}{\left(z \cdot \sin y - x\right)} \]
              18. *-commutativeN/A

                \[\leadsto \cos y - \left(\color{blue}{\sin y \cdot z} - x\right) \]
              19. lower-*.f64N/A

                \[\leadsto \cos y - \left(\color{blue}{\sin y \cdot z} - x\right) \]
              20. lift-sin.f64100.0

                \[\leadsto \cos y - \left(\color{blue}{\sin y} \cdot z - x\right) \]
            3. Applied rewrites100.0%

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

              \[\leadsto \color{blue}{1} - \left(\sin y \cdot z - x\right) \]
            5. Step-by-step derivation
              1. Applied rewrites98.9%

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

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

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

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

                  \[\leadsto 1 - \left(\left(\left(\frac{-1}{6} \cdot {y}^{2} + 1\right) \cdot y\right) \cdot z - x\right) \]
                4. *-commutativeN/A

                  \[\leadsto 1 - \left(\left(\left({y}^{2} \cdot \frac{-1}{6} + 1\right) \cdot y\right) \cdot z - x\right) \]
                5. lower-fma.f64N/A

                  \[\leadsto 1 - \left(\left(\mathsf{fma}\left({y}^{2}, \frac{-1}{6}, 1\right) \cdot y\right) \cdot z - x\right) \]
                6. pow2N/A

                  \[\leadsto 1 - \left(\left(\mathsf{fma}\left(y \cdot y, \frac{-1}{6}, 1\right) \cdot y\right) \cdot z - x\right) \]
                7. lift-*.f6497.9

                  \[\leadsto 1 - \left(\left(\mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \cdot y\right) \cdot z - x\right) \]
              4. Applied rewrites97.9%

                \[\leadsto 1 - \left(\color{blue}{\left(\mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \cdot y\right)} \cdot z - x\right) \]
            6. Recombined 2 regimes into one program.
            7. Add Preprocessing

            Alternative 11: 69.9% accurate, 3.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+34}:\\ \;\;\;\;x - -1\\ \mathbf{elif}\;y \leq 23.5:\\ \;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, x - -1\right)\\ \mathbf{else}:\\ \;\;\;\;x - -1\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= y -1.4e+34)
               (- x -1.0)
               (if (<= y 23.5) (fma (- (* -0.5 y) z) y (- x -1.0)) (- x -1.0))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (y <= -1.4e+34) {
            		tmp = x - -1.0;
            	} else if (y <= 23.5) {
            		tmp = fma(((-0.5 * y) - z), y, (x - -1.0));
            	} else {
            		tmp = x - -1.0;
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if (y <= -1.4e+34)
            		tmp = Float64(x - -1.0);
            	elseif (y <= 23.5)
            		tmp = fma(Float64(Float64(-0.5 * y) - z), y, Float64(x - -1.0));
            	else
            		tmp = Float64(x - -1.0);
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[LessEqual[y, -1.4e+34], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 23.5], N[(N[(N[(-0.5 * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(x - -1.0), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -1.4 \cdot 10^{+34}:\\
            \;\;\;\;x - -1\\
            
            \mathbf{elif}\;y \leq 23.5:\\
            \;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, x - -1\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;x - -1\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -1.40000000000000004e34 or 23.5 < y

              1. Initial program 99.9%

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

                \[\leadsto \color{blue}{1 + x} \]
              3. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto x + \color{blue}{1} \]
                2. metadata-evalN/A

                  \[\leadsto x + 1 \cdot \color{blue}{1} \]
                3. fp-cancel-sign-sub-invN/A

                  \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(1\right)\right) \cdot 1} \]
                4. metadata-evalN/A

                  \[\leadsto x - -1 \cdot 1 \]
                5. metadata-evalN/A

                  \[\leadsto x - -1 \]
                6. lower--.f6440.2

                  \[\leadsto x - \color{blue}{-1} \]
              4. Applied rewrites40.2%

                \[\leadsto \color{blue}{x - -1} \]

              if -1.40000000000000004e34 < y < 23.5

              1. Initial program 100.0%

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

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

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

                  \[\leadsto \left(y \cdot \left(\frac{-1}{2} \cdot y - z\right) + x\right) + 1 \]
                3. associate-+l+N/A

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} \cdot y - z, y, 1 + x\right) \]
                9. +-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} \cdot y - z, y, x + 1\right) \]
                10. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} \cdot y - z, y, x + 1 \cdot 1\right) \]
                11. fp-cancel-sign-sub-invN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} \cdot y - z, y, x - \left(\mathsf{neg}\left(1\right)\right) \cdot 1\right) \]
                12. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} \cdot y - z, y, x - -1 \cdot 1\right) \]
                13. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\frac{-1}{2} \cdot y - z, y, x - -1\right) \]
                14. lower--.f6495.6

                  \[\leadsto \mathsf{fma}\left(-0.5 \cdot y - z, y, x - -1\right) \]
              4. Applied rewrites95.6%

                \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 \cdot y - z, y, x - -1\right)} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 12: 69.9% accurate, 4.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+44}:\\ \;\;\;\;x - -1\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+32}:\\ \;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\ \mathbf{else}:\\ \;\;\;\;x - -1\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= y -4.8e+44)
               (- x -1.0)
               (if (<= y 5.6e+32) (- x (fma z y -1.0)) (- x -1.0))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (y <= -4.8e+44) {
            		tmp = x - -1.0;
            	} else if (y <= 5.6e+32) {
            		tmp = x - fma(z, y, -1.0);
            	} else {
            		tmp = x - -1.0;
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if (y <= -4.8e+44)
            		tmp = Float64(x - -1.0);
            	elseif (y <= 5.6e+32)
            		tmp = Float64(x - fma(z, y, -1.0));
            	else
            		tmp = Float64(x - -1.0);
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[LessEqual[y, -4.8e+44], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 5.6e+32], N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -4.8 \cdot 10^{+44}:\\
            \;\;\;\;x - -1\\
            
            \mathbf{elif}\;y \leq 5.6 \cdot 10^{+32}:\\
            \;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;x - -1\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -4.80000000000000026e44 or 5.6e32 < y

              1. Initial program 99.9%

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

                \[\leadsto \color{blue}{1 + x} \]
              3. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto x + \color{blue}{1} \]
                2. metadata-evalN/A

                  \[\leadsto x + 1 \cdot \color{blue}{1} \]
                3. fp-cancel-sign-sub-invN/A

                  \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(1\right)\right) \cdot 1} \]
                4. metadata-evalN/A

                  \[\leadsto x - -1 \cdot 1 \]
                5. metadata-evalN/A

                  \[\leadsto x - -1 \]
                6. lower--.f6440.1

                  \[\leadsto x - \color{blue}{-1} \]
              4. Applied rewrites40.1%

                \[\leadsto \color{blue}{x - -1} \]

              if -4.80000000000000026e44 < y < 5.6e32

              1. Initial program 100.0%

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

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

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

                  \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) + 1 \cdot \color{blue}{1} \]
                3. fp-cancel-sign-sub-invN/A

                  \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - \color{blue}{\left(\mathsf{neg}\left(1\right)\right) \cdot 1} \]
                4. metadata-evalN/A

                  \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - -1 \cdot 1 \]
                5. metadata-evalN/A

                  \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - -1 \]
                6. lower--.f64N/A

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

                  \[\leadsto \left(x + \left(\mathsf{neg}\left(1\right)\right) \cdot \left(y \cdot z\right)\right) - -1 \]
                8. fp-cancel-sub-sign-invN/A

                  \[\leadsto \left(x - 1 \cdot \left(y \cdot z\right)\right) - -1 \]
                9. *-lft-identityN/A

                  \[\leadsto \left(x - y \cdot z\right) - -1 \]
                10. lower--.f64N/A

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

                  \[\leadsto \left(x - z \cdot y\right) - -1 \]
                12. lower-*.f6492.6

                  \[\leadsto \left(x - z \cdot y\right) - -1 \]
              4. Applied rewrites92.6%

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

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

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

                  \[\leadsto \left(x - z \cdot y\right) - -1 \]
                4. associate--l-N/A

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

                  \[\leadsto x - \color{blue}{\left(z \cdot y + -1\right)} \]
                6. lower-fma.f6492.6

                  \[\leadsto x - \mathsf{fma}\left(z, \color{blue}{y}, -1\right) \]
              6. Applied rewrites92.6%

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

            Alternative 13: 66.5% accurate, 5.1× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{-60}:\\ \;\;\;\;x - -1\\ \mathbf{elif}\;x \leq 18:\\ \;\;\;\;1 - z \cdot y\\ \mathbf{else}:\\ \;\;\;\;x - -1\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= x -5.6e-60) (- x -1.0) (if (<= x 18.0) (- 1.0 (* z y)) (- x -1.0))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (x <= -5.6e-60) {
            		tmp = x - -1.0;
            	} else if (x <= 18.0) {
            		tmp = 1.0 - (z * y);
            	} else {
            		tmp = x - -1.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) :: tmp
                if (x <= (-5.6d-60)) then
                    tmp = x - (-1.0d0)
                else if (x <= 18.0d0) then
                    tmp = 1.0d0 - (z * y)
                else
                    tmp = x - (-1.0d0)
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double tmp;
            	if (x <= -5.6e-60) {
            		tmp = x - -1.0;
            	} else if (x <= 18.0) {
            		tmp = 1.0 - (z * y);
            	} else {
            		tmp = x - -1.0;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	tmp = 0
            	if x <= -5.6e-60:
            		tmp = x - -1.0
            	elif x <= 18.0:
            		tmp = 1.0 - (z * y)
            	else:
            		tmp = x - -1.0
            	return tmp
            
            function code(x, y, z)
            	tmp = 0.0
            	if (x <= -5.6e-60)
            		tmp = Float64(x - -1.0);
            	elseif (x <= 18.0)
            		tmp = Float64(1.0 - Float64(z * y));
            	else
            		tmp = Float64(x - -1.0);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	tmp = 0.0;
            	if (x <= -5.6e-60)
            		tmp = x - -1.0;
            	elseif (x <= 18.0)
            		tmp = 1.0 - (z * y);
            	else
            		tmp = x - -1.0;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := If[LessEqual[x, -5.6e-60], N[(x - -1.0), $MachinePrecision], If[LessEqual[x, 18.0], N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;x \leq -5.6 \cdot 10^{-60}:\\
            \;\;\;\;x - -1\\
            
            \mathbf{elif}\;x \leq 18:\\
            \;\;\;\;1 - z \cdot y\\
            
            \mathbf{else}:\\
            \;\;\;\;x - -1\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if x < -5.6000000000000005e-60 or 18 < x

              1. Initial program 99.9%

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

                \[\leadsto \color{blue}{1 + x} \]
              3. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto x + \color{blue}{1} \]
                2. metadata-evalN/A

                  \[\leadsto x + 1 \cdot \color{blue}{1} \]
                3. fp-cancel-sign-sub-invN/A

                  \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(1\right)\right) \cdot 1} \]
                4. metadata-evalN/A

                  \[\leadsto x - -1 \cdot 1 \]
                5. metadata-evalN/A

                  \[\leadsto x - -1 \]
                6. lower--.f6479.4

                  \[\leadsto x - \color{blue}{-1} \]
              4. Applied rewrites79.4%

                \[\leadsto \color{blue}{x - -1} \]

              if -5.6000000000000005e-60 < x < 18

              1. Initial program 99.9%

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

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

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

                  \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) + 1 \cdot \color{blue}{1} \]
                3. fp-cancel-sign-sub-invN/A

                  \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - \color{blue}{\left(\mathsf{neg}\left(1\right)\right) \cdot 1} \]
                4. metadata-evalN/A

                  \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - -1 \cdot 1 \]
                5. metadata-evalN/A

                  \[\leadsto \left(x + -1 \cdot \left(y \cdot z\right)\right) - -1 \]
                6. lower--.f64N/A

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

                  \[\leadsto \left(x + \left(\mathsf{neg}\left(1\right)\right) \cdot \left(y \cdot z\right)\right) - -1 \]
                8. fp-cancel-sub-sign-invN/A

                  \[\leadsto \left(x - 1 \cdot \left(y \cdot z\right)\right) - -1 \]
                9. *-lft-identityN/A

                  \[\leadsto \left(x - y \cdot z\right) - -1 \]
                10. lower--.f64N/A

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

                  \[\leadsto \left(x - z \cdot y\right) - -1 \]
                12. lower-*.f6451.7

                  \[\leadsto \left(x - z \cdot y\right) - -1 \]
              4. Applied rewrites51.7%

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

                \[\leadsto 1 - \color{blue}{y \cdot z} \]
              6. Step-by-step derivation
                1. lower--.f64N/A

                  \[\leadsto 1 - y \cdot \color{blue}{z} \]
                2. *-commutativeN/A

                  \[\leadsto 1 - z \cdot y \]
                3. lift-*.f6451.1

                  \[\leadsto 1 - z \cdot y \]
              7. Applied rewrites51.1%

                \[\leadsto 1 - \color{blue}{z \cdot y} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 14: 61.5% accurate, 20.2× speedup?

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

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

              \[\leadsto \color{blue}{1 + x} \]
            3. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto x + \color{blue}{1} \]
              2. metadata-evalN/A

                \[\leadsto x + 1 \cdot \color{blue}{1} \]
              3. fp-cancel-sign-sub-invN/A

                \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(1\right)\right) \cdot 1} \]
              4. metadata-evalN/A

                \[\leadsto x - -1 \cdot 1 \]
              5. metadata-evalN/A

                \[\leadsto x - -1 \]
              6. lower--.f6461.5

                \[\leadsto x - \color{blue}{-1} \]
            4. Applied rewrites61.5%

              \[\leadsto \color{blue}{x - -1} \]
            5. Add Preprocessing

            Alternative 15: 60.7% accurate, 8.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -480:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 220000:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= x -480.0) x (if (<= x 220000.0) 1.0 x)))
            double code(double x, double y, double z) {
            	double tmp;
            	if (x <= -480.0) {
            		tmp = x;
            	} else if (x <= 220000.0) {
            		tmp = 1.0;
            	} else {
            		tmp = x;
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, 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 <= (-480.0d0)) then
                    tmp = x
                else if (x <= 220000.0d0) then
                    tmp = 1.0d0
                else
                    tmp = x
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double tmp;
            	if (x <= -480.0) {
            		tmp = x;
            	} else if (x <= 220000.0) {
            		tmp = 1.0;
            	} else {
            		tmp = x;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	tmp = 0
            	if x <= -480.0:
            		tmp = x
            	elif x <= 220000.0:
            		tmp = 1.0
            	else:
            		tmp = x
            	return tmp
            
            function code(x, y, z)
            	tmp = 0.0
            	if (x <= -480.0)
            		tmp = x;
            	elseif (x <= 220000.0)
            		tmp = 1.0;
            	else
            		tmp = x;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	tmp = 0.0;
            	if (x <= -480.0)
            		tmp = x;
            	elseif (x <= 220000.0)
            		tmp = 1.0;
            	else
            		tmp = x;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := If[LessEqual[x, -480.0], x, If[LessEqual[x, 220000.0], 1.0, x]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;x \leq -480:\\
            \;\;\;\;x\\
            
            \mathbf{elif}\;x \leq 220000:\\
            \;\;\;\;1\\
            
            \mathbf{else}:\\
            \;\;\;\;x\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if x < -480 or 2.2e5 < x

              1. Initial program 100.0%

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

                \[\leadsto \color{blue}{x} \]
              3. Step-by-step derivation
                1. Applied rewrites82.9%

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

                if -480 < x < 2.2e5

                1. Initial program 99.9%

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

                  \[\leadsto \color{blue}{1 + \left(x + y \cdot \left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z\right)\right)} \]
                3. Step-by-step derivation
                  1. +-commutativeN/A

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

                    \[\leadsto \left(y \cdot \left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z\right) + x\right) + 1 \]
                  3. associate-+l+N/A

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z, y, 1 + x\right) \]
                  8. *-commutativeN/A

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

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

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

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) \cdot y - z, y, 1 + x\right) \]
                  12. *-commutativeN/A

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

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, 1 + x\right) \]
                  14. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x + 1\right) \]
                  15. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x + 1 \cdot 1\right) \]
                  16. fp-cancel-sign-sub-invN/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x - \left(\mathsf{neg}\left(1\right)\right) \cdot 1\right) \]
                  17. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}\right) \cdot y - z, y, x - -1 \cdot 1\right) \]
                  18. metadata-evalN/A

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

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

                  \[\leadsto -1 \cdot \color{blue}{\left(z \cdot \left(-1 \cdot \frac{1 + \left(x + \frac{-1}{2} \cdot {y}^{2}\right)}{z} + y \cdot \left(1 + \frac{-1}{6} \cdot {y}^{2}\right)\right)\right)} \]
                6. Step-by-step derivation
                  1. associate-*r*N/A

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

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

                    \[\leadsto \left(\mathsf{neg}\left(z\right)\right) \cdot \left(-1 \cdot \frac{1 + \left(x + \frac{-1}{2} \cdot {y}^{2}\right)}{z} + \color{blue}{y} \cdot \left(1 + \frac{-1}{6} \cdot {y}^{2}\right)\right) \]
                  4. lift-neg.f64N/A

                    \[\leadsto \left(-z\right) \cdot \left(-1 \cdot \frac{1 + \left(x + \frac{-1}{2} \cdot {y}^{2}\right)}{z} + \color{blue}{y} \cdot \left(1 + \frac{-1}{6} \cdot {y}^{2}\right)\right) \]
                  5. +-commutativeN/A

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

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

                    \[\leadsto \left(-z\right) \cdot \mathsf{fma}\left(1 + \frac{-1}{6} \cdot {y}^{2}, y, -1 \cdot \frac{1 + \left(x + \frac{-1}{2} \cdot {y}^{2}\right)}{z}\right) \]
                  8. +-commutativeN/A

                    \[\leadsto \left(-z\right) \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot {y}^{2} + 1, y, -1 \cdot \frac{1 + \left(x + \frac{-1}{2} \cdot {y}^{2}\right)}{z}\right) \]
                  9. lower-fma.f64N/A

                    \[\leadsto \left(-z\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, {y}^{2}, 1\right), y, -1 \cdot \frac{1 + \left(x + \frac{-1}{2} \cdot {y}^{2}\right)}{z}\right) \]
                  10. unpow2N/A

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

                    \[\leadsto \left(-z\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, y \cdot y, 1\right), y, -1 \cdot \frac{1 + \left(x + \frac{-1}{2} \cdot {y}^{2}\right)}{z}\right) \]
                  12. mul-1-negN/A

                    \[\leadsto \left(-z\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, y \cdot y, 1\right), y, \mathsf{neg}\left(\frac{1 + \left(x + \frac{-1}{2} \cdot {y}^{2}\right)}{z}\right)\right) \]
                  13. lower-neg.f64N/A

                    \[\leadsto \left(-z\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, y \cdot y, 1\right), y, -\frac{1 + \left(x + \frac{-1}{2} \cdot {y}^{2}\right)}{z}\right) \]
                  14. lower-/.f64N/A

                    \[\leadsto \left(-z\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, y \cdot y, 1\right), y, -\frac{1 + \left(x + \frac{-1}{2} \cdot {y}^{2}\right)}{z}\right) \]
                7. Applied rewrites50.5%

                  \[\leadsto \left(-z\right) \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y \cdot y, 1\right), y, -\frac{\mathsf{fma}\left(y \cdot y, -0.5, x\right) + 1}{z}\right)} \]
                8. Taylor expanded in y around 0

                  \[\leadsto z \cdot \left(\frac{1}{z} + \color{blue}{\frac{x}{z}}\right) \]
                9. Step-by-step derivation
                  1. *-commutativeN/A

                    \[\leadsto \left(\frac{1}{z} + \frac{x}{z}\right) \cdot z \]
                  2. lower-*.f64N/A

                    \[\leadsto \left(\frac{1}{z} + \frac{x}{z}\right) \cdot z \]
                  3. div-add-revN/A

                    \[\leadsto \frac{1 + x}{z} \cdot z \]
                  4. lower-/.f64N/A

                    \[\leadsto \frac{1 + x}{z} \cdot z \]
                  5. +-commutativeN/A

                    \[\leadsto \frac{x + 1}{z} \cdot z \]
                  6. lower-+.f6440.2

                    \[\leadsto \frac{x + 1}{z} \cdot z \]
                10. Applied rewrites40.2%

                  \[\leadsto \frac{x + 1}{z} \cdot z \]
                11. Taylor expanded in x around 0

                  \[\leadsto 1 \]
                12. Step-by-step derivation
                  1. Applied rewrites39.1%

                    \[\leadsto 1 \]
                13. Recombined 2 regimes into one program.
                14. Add Preprocessing

                Alternative 16: 42.8% accurate, 72.9× speedup?

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

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

                  \[\leadsto \color{blue}{x} \]
                3. Step-by-step derivation
                  1. Applied rewrites42.8%

                    \[\leadsto \color{blue}{x} \]
                  2. Add Preprocessing

                  Reproduce

                  ?
                  herbie shell --seed 2025106 
                  (FPCore (x y z)
                    :name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
                    :precision binary64
                    (- (+ x (cos y)) (* z (sin y))))