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

Percentage Accurate: 99.9% → 99.9%
Time: 8.4s
Alternatives: 12
Speedup: 1.0×

Specification

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

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 12 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?

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

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\mathsf{fma}\left(\cos y, z, \sin y + x\right) \]
(FPCore (x y z) :precision binary64 (fma (cos y) z (+ (sin y) x)))
double code(double x, double y, double z) {
	return fma(cos(y), z, (sin(y) + x));
}
function code(x, y, z)
	return fma(cos(y), z, Float64(sin(y) + x))
end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(\cos y, z, \sin y + x\right)
Derivation
  1. Initial program 99.9%

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

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

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

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

      \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
    5. lower-fma.f6499.9%

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

      \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + \sin y}\right) \]
    7. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
    8. lower-+.f6499.9%

      \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
  3. Applied rewrites99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, z, \sin y + x\right)} \]
  4. Add Preprocessing

Alternative 2: 89.2% accurate, 1.4× speedup?

\[\begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -2.95 \cdot 10^{+178}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\ \mathbf{elif}\;z \leq -9.8 \cdot 10^{+62}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+78}:\\ \;\;\;\;\left(x + \sin y\right) + z\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) + t\_0\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (cos y))))
   (if (<= z -2.95e+178)
     (fma (cos y) z (+ x y))
     (if (<= z -9.8e+62)
       t_0
       (if (<= z 2.6e+78) (+ (+ x (sin y)) z) (+ (+ x y) t_0))))))
double code(double x, double y, double z) {
	double t_0 = z * cos(y);
	double tmp;
	if (z <= -2.95e+178) {
		tmp = fma(cos(y), z, (x + y));
	} else if (z <= -9.8e+62) {
		tmp = t_0;
	} else if (z <= 2.6e+78) {
		tmp = (x + sin(y)) + z;
	} else {
		tmp = (x + y) + t_0;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(z * cos(y))
	tmp = 0.0
	if (z <= -2.95e+178)
		tmp = fma(cos(y), z, Float64(x + y));
	elseif (z <= -9.8e+62)
		tmp = t_0;
	elseif (z <= 2.6e+78)
		tmp = Float64(Float64(x + sin(y)) + z);
	else
		tmp = Float64(Float64(x + y) + t_0);
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.95e+178], N[(N[Cos[y], $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.8e+62], t$95$0, If[LessEqual[z, 2.6e+78], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -2.95 \cdot 10^{+178}:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\

\mathbf{elif}\;z \leq -9.8 \cdot 10^{+62}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 2.6 \cdot 10^{+78}:\\
\;\;\;\;\left(x + \sin y\right) + z\\

\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + t\_0\\


\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.94999999999999992e178

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
      5. lower-fma.f6499.9%

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

        \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + \sin y}\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
      8. lower-+.f6499.9%

        \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
    3. Applied rewrites99.9%

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

      \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + y}\right) \]
    5. Step-by-step derivation
      1. lower-+.f6470.4%

        \[\leadsto \mathsf{fma}\left(\cos y, z, x + \color{blue}{y}\right) \]
    6. Applied rewrites70.4%

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

    if -2.94999999999999992e178 < z < -9.7999999999999994e62

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
      5. lower-fma.f6499.9%

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

        \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + \sin y}\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
      8. lower-+.f6499.9%

        \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
    3. Applied rewrites99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, z, x\right)} + \sin y \]
      6. +-commutativeN/A

        \[\leadsto \color{blue}{\sin y + \mathsf{fma}\left(\cos y, z, x\right)} \]
      7. sum-to-mult-revN/A

        \[\leadsto \color{blue}{\left(1 + \frac{\mathsf{fma}\left(\cos y, z, x\right)}{\sin y}\right) \cdot \sin y} \]
      8. add-to-fractionN/A

        \[\leadsto \color{blue}{\frac{1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)}{\sin y}} \cdot \sin y \]
      9. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\left(1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)\right) \cdot \sin y}{\sin y}} \]
      10. div-flipN/A

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

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

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

        \[\leadsto \frac{1}{\frac{\sin y}{\color{blue}{\left(1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)\right) \cdot \sin y}}} \]
    5. Applied rewrites96.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{\sin y}{\mathsf{fma}\left(\cos y, z, \sin y + x\right) \cdot \sin y}}} \]
    6. Taylor expanded in z around inf

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

        \[\leadsto z \cdot \color{blue}{\cos y} \]
      2. lower-cos.f6443.0%

        \[\leadsto z \cdot \cos y \]
    8. Applied rewrites43.0%

      \[\leadsto \color{blue}{z \cdot \cos y} \]

    if -9.7999999999999994e62 < z < 2.6e78

    1. Initial program 99.9%

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

      \[\leadsto \left(x + \sin y\right) + \color{blue}{z} \]
    3. Step-by-step derivation
      1. Applied rewrites82.1%

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

      if 2.6e78 < z

      1. Initial program 99.9%

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

        \[\leadsto \left(x + \color{blue}{y}\right) + z \cdot \cos y \]
      3. Step-by-step derivation
        1. Applied rewrites70.4%

          \[\leadsto \left(x + \color{blue}{y}\right) + z \cdot \cos y \]
      4. Recombined 4 regimes into one program.
      5. Add Preprocessing

      Alternative 3: 89.2% accurate, 1.4× speedup?

      \[\begin{array}{l} t_0 := \mathsf{fma}\left(\cos y, z, x + y\right)\\ \mathbf{if}\;z \leq -2.95 \cdot 10^{+178}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -9.8 \cdot 10^{+62}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+78}:\\ \;\;\;\;\left(x + \sin y\right) + z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (fma (cos y) z (+ x y))))
         (if (<= z -2.95e+178)
           t_0
           (if (<= z -9.8e+62)
             (* z (cos y))
             (if (<= z 2.6e+78) (+ (+ x (sin y)) z) t_0)))))
      double code(double x, double y, double z) {
      	double t_0 = fma(cos(y), z, (x + y));
      	double tmp;
      	if (z <= -2.95e+178) {
      		tmp = t_0;
      	} else if (z <= -9.8e+62) {
      		tmp = z * cos(y);
      	} else if (z <= 2.6e+78) {
      		tmp = (x + sin(y)) + z;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = fma(cos(y), z, Float64(x + y))
      	tmp = 0.0
      	if (z <= -2.95e+178)
      		tmp = t_0;
      	elseif (z <= -9.8e+62)
      		tmp = Float64(z * cos(y));
      	elseif (z <= 2.6e+78)
      		tmp = Float64(Float64(x + sin(y)) + z);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.95e+178], t$95$0, If[LessEqual[z, -9.8e+62], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+78], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], t$95$0]]]]
      
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(\cos y, z, x + y\right)\\
      \mathbf{if}\;z \leq -2.95 \cdot 10^{+178}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;z \leq -9.8 \cdot 10^{+62}:\\
      \;\;\;\;z \cdot \cos y\\
      
      \mathbf{elif}\;z \leq 2.6 \cdot 10^{+78}:\\
      \;\;\;\;\left(x + \sin y\right) + z\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -2.94999999999999992e178 or 2.6e78 < z

        1. Initial program 99.9%

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

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

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

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

            \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
          5. lower-fma.f6499.9%

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

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + \sin y}\right) \]
          7. +-commutativeN/A

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
          8. lower-+.f6499.9%

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
        3. Applied rewrites99.9%

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

          \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + y}\right) \]
        5. Step-by-step derivation
          1. lower-+.f6470.4%

            \[\leadsto \mathsf{fma}\left(\cos y, z, x + \color{blue}{y}\right) \]
        6. Applied rewrites70.4%

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

        if -2.94999999999999992e178 < z < -9.7999999999999994e62

        1. Initial program 99.9%

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

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

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

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

            \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
          5. lower-fma.f6499.9%

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

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + \sin y}\right) \]
          7. +-commutativeN/A

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
          8. lower-+.f6499.9%

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
        3. Applied rewrites99.9%

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, z, x\right)} + \sin y \]
          6. +-commutativeN/A

            \[\leadsto \color{blue}{\sin y + \mathsf{fma}\left(\cos y, z, x\right)} \]
          7. sum-to-mult-revN/A

            \[\leadsto \color{blue}{\left(1 + \frac{\mathsf{fma}\left(\cos y, z, x\right)}{\sin y}\right) \cdot \sin y} \]
          8. add-to-fractionN/A

            \[\leadsto \color{blue}{\frac{1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)}{\sin y}} \cdot \sin y \]
          9. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{\left(1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)\right) \cdot \sin y}{\sin y}} \]
          10. div-flipN/A

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

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

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

            \[\leadsto \frac{1}{\frac{\sin y}{\color{blue}{\left(1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)\right) \cdot \sin y}}} \]
        5. Applied rewrites96.4%

          \[\leadsto \color{blue}{\frac{1}{\frac{\sin y}{\mathsf{fma}\left(\cos y, z, \sin y + x\right) \cdot \sin y}}} \]
        6. Taylor expanded in z around inf

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

            \[\leadsto z \cdot \color{blue}{\cos y} \]
          2. lower-cos.f6443.0%

            \[\leadsto z \cdot \cos y \]
        8. Applied rewrites43.0%

          \[\leadsto \color{blue}{z \cdot \cos y} \]

        if -9.7999999999999994e62 < z < 2.6e78

        1. Initial program 99.9%

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

          \[\leadsto \left(x + \sin y\right) + \color{blue}{z} \]
        3. Step-by-step derivation
          1. Applied rewrites82.1%

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

        Alternative 4: 89.1% accurate, 0.9× speedup?

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

          1. Initial program 99.9%

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

            \[\leadsto \left(x + \sin y\right) + \color{blue}{z} \]
          3. Step-by-step derivation
            1. Applied rewrites82.1%

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

            if -1.9000000000000001e-135 < x < 4.10000000000000029e-23

            1. Initial program 99.9%

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

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

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

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

                \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
              5. lower-fma.f6499.9%

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

                \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + \sin y}\right) \]
              7. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
              8. lower-+.f6499.9%

                \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
            3. Applied rewrites99.9%

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

              \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y}\right) \]
            5. Step-by-step derivation
              1. lower-sin.f6458.5%

                \[\leadsto \mathsf{fma}\left(\cos y, z, \sin y\right) \]
            6. Applied rewrites58.5%

              \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y}\right) \]

            if 4.10000000000000029e-23 < x

            1. Initial program 99.9%

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

              \[\leadsto \left(x + \color{blue}{y}\right) + z \cdot \cos y \]
            3. Step-by-step derivation
              1. Applied rewrites70.4%

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

            Alternative 5: 85.9% accurate, 1.6× speedup?

            \[\begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -9.8 \cdot 10^{+62}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 9 \cdot 10^{+80}:\\ \;\;\;\;\left(x + \sin y\right) + z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (* z (cos y))))
               (if (<= z -9.8e+62) t_0 (if (<= z 9e+80) (+ (+ x (sin y)) z) t_0))))
            double code(double x, double y, double z) {
            	double t_0 = z * cos(y);
            	double tmp;
            	if (z <= -9.8e+62) {
            		tmp = t_0;
            	} else if (z <= 9e+80) {
            		tmp = (x + sin(y)) + z;
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: t_0
                real(8) :: tmp
                t_0 = z * cos(y)
                if (z <= (-9.8d+62)) then
                    tmp = t_0
                else if (z <= 9d+80) then
                    tmp = (x + sin(y)) + z
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = z * Math.cos(y);
            	double tmp;
            	if (z <= -9.8e+62) {
            		tmp = t_0;
            	} else if (z <= 9e+80) {
            		tmp = (x + Math.sin(y)) + z;
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = z * math.cos(y)
            	tmp = 0
            	if z <= -9.8e+62:
            		tmp = t_0
            	elif z <= 9e+80:
            		tmp = (x + math.sin(y)) + z
            	else:
            		tmp = t_0
            	return tmp
            
            function code(x, y, z)
            	t_0 = Float64(z * cos(y))
            	tmp = 0.0
            	if (z <= -9.8e+62)
            		tmp = t_0;
            	elseif (z <= 9e+80)
            		tmp = Float64(Float64(x + sin(y)) + z);
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = z * cos(y);
            	tmp = 0.0;
            	if (z <= -9.8e+62)
            		tmp = t_0;
            	elseif (z <= 9e+80)
            		tmp = (x + sin(y)) + z;
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.8e+62], t$95$0, If[LessEqual[z, 9e+80], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            t_0 := z \cdot \cos y\\
            \mathbf{if}\;z \leq -9.8 \cdot 10^{+62}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;z \leq 9 \cdot 10^{+80}:\\
            \;\;\;\;\left(x + \sin y\right) + z\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -9.7999999999999994e62 or 9.00000000000000013e80 < z

              1. Initial program 99.9%

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

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

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

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

                  \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
                5. lower-fma.f6499.9%

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

                  \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + \sin y}\right) \]
                7. +-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
                8. lower-+.f6499.9%

                  \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
              3. Applied rewrites99.9%

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

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

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

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

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

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, z, x\right)} + \sin y \]
                6. +-commutativeN/A

                  \[\leadsto \color{blue}{\sin y + \mathsf{fma}\left(\cos y, z, x\right)} \]
                7. sum-to-mult-revN/A

                  \[\leadsto \color{blue}{\left(1 + \frac{\mathsf{fma}\left(\cos y, z, x\right)}{\sin y}\right) \cdot \sin y} \]
                8. add-to-fractionN/A

                  \[\leadsto \color{blue}{\frac{1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)}{\sin y}} \cdot \sin y \]
                9. associate-*l/N/A

                  \[\leadsto \color{blue}{\frac{\left(1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)\right) \cdot \sin y}{\sin y}} \]
                10. div-flipN/A

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

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

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

                  \[\leadsto \frac{1}{\frac{\sin y}{\color{blue}{\left(1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)\right) \cdot \sin y}}} \]
              5. Applied rewrites96.4%

                \[\leadsto \color{blue}{\frac{1}{\frac{\sin y}{\mathsf{fma}\left(\cos y, z, \sin y + x\right) \cdot \sin y}}} \]
              6. Taylor expanded in z around inf

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

                  \[\leadsto z \cdot \color{blue}{\cos y} \]
                2. lower-cos.f6443.0%

                  \[\leadsto z \cdot \cos y \]
              8. Applied rewrites43.0%

                \[\leadsto \color{blue}{z \cdot \cos y} \]

              if -9.7999999999999994e62 < z < 9.00000000000000013e80

              1. Initial program 99.9%

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

                \[\leadsto \left(x + \sin y\right) + \color{blue}{z} \]
              3. Step-by-step derivation
                1. Applied rewrites82.1%

                  \[\leadsto \left(x + \sin y\right) + \color{blue}{z} \]
              4. Recombined 2 regimes into one program.
              5. Add Preprocessing

              Alternative 6: 73.0% accurate, 1.7× speedup?

              \[\begin{array}{l} \mathbf{if}\;x \leq -1.3 \cdot 10^{-108}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq 90:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (<= x -1.3e-108) (+ x z) (if (<= x 90.0) (* z (cos y)) (+ x z))))
              double code(double x, double y, double z) {
              	double tmp;
              	if (x <= -1.3e-108) {
              		tmp = x + z;
              	} else if (x <= 90.0) {
              		tmp = z * cos(y);
              	} else {
              		tmp = x + z;
              	}
              	return tmp;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x, y, z)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8), intent (in) :: z
                  real(8) :: tmp
                  if (x <= (-1.3d-108)) then
                      tmp = x + z
                  else if (x <= 90.0d0) then
                      tmp = z * cos(y)
                  else
                      tmp = x + z
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z) {
              	double tmp;
              	if (x <= -1.3e-108) {
              		tmp = x + z;
              	} else if (x <= 90.0) {
              		tmp = z * Math.cos(y);
              	} else {
              		tmp = x + z;
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	tmp = 0
              	if x <= -1.3e-108:
              		tmp = x + z
              	elif x <= 90.0:
              		tmp = z * math.cos(y)
              	else:
              		tmp = x + z
              	return tmp
              
              function code(x, y, z)
              	tmp = 0.0
              	if (x <= -1.3e-108)
              		tmp = Float64(x + z);
              	elseif (x <= 90.0)
              		tmp = Float64(z * cos(y));
              	else
              		tmp = Float64(x + z);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z)
              	tmp = 0.0;
              	if (x <= -1.3e-108)
              		tmp = x + z;
              	elseif (x <= 90.0)
              		tmp = z * cos(y);
              	else
              		tmp = x + z;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := If[LessEqual[x, -1.3e-108], N[(x + z), $MachinePrecision], If[LessEqual[x, 90.0], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
              
              \begin{array}{l}
              \mathbf{if}\;x \leq -1.3 \cdot 10^{-108}:\\
              \;\;\;\;x + z\\
              
              \mathbf{elif}\;x \leq 90:\\
              \;\;\;\;z \cdot \cos y\\
              
              \mathbf{else}:\\
              \;\;\;\;x + z\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if x < -1.29999999999999992e-108 or 90 < x

                1. Initial program 99.9%

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

                  \[\leadsto \color{blue}{x + z} \]
                3. Step-by-step derivation
                  1. lower-+.f6466.6%

                    \[\leadsto x + \color{blue}{z} \]
                4. Applied rewrites66.6%

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

                if -1.29999999999999992e-108 < x < 90

                1. Initial program 99.9%

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

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

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

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

                    \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
                  5. lower-fma.f6499.9%

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

                    \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + \sin y}\right) \]
                  7. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
                  8. lower-+.f6499.9%

                    \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
                3. Applied rewrites99.9%

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, z, x\right)} + \sin y \]
                  6. +-commutativeN/A

                    \[\leadsto \color{blue}{\sin y + \mathsf{fma}\left(\cos y, z, x\right)} \]
                  7. sum-to-mult-revN/A

                    \[\leadsto \color{blue}{\left(1 + \frac{\mathsf{fma}\left(\cos y, z, x\right)}{\sin y}\right) \cdot \sin y} \]
                  8. add-to-fractionN/A

                    \[\leadsto \color{blue}{\frac{1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)}{\sin y}} \cdot \sin y \]
                  9. associate-*l/N/A

                    \[\leadsto \color{blue}{\frac{\left(1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)\right) \cdot \sin y}{\sin y}} \]
                  10. div-flipN/A

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

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

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

                    \[\leadsto \frac{1}{\frac{\sin y}{\color{blue}{\left(1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)\right) \cdot \sin y}}} \]
                5. Applied rewrites96.4%

                  \[\leadsto \color{blue}{\frac{1}{\frac{\sin y}{\mathsf{fma}\left(\cos y, z, \sin y + x\right) \cdot \sin y}}} \]
                6. Taylor expanded in z around inf

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

                    \[\leadsto z \cdot \color{blue}{\cos y} \]
                  2. lower-cos.f6443.0%

                    \[\leadsto z \cdot \cos y \]
                8. Applied rewrites43.0%

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

              Alternative 7: 70.7% accurate, 2.4× speedup?

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

                1. Initial program 99.9%

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

                  \[\leadsto \color{blue}{x + z} \]
                3. Step-by-step derivation
                  1. lower-+.f6466.6%

                    \[\leadsto x + \color{blue}{z} \]
                4. Applied rewrites66.6%

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

                if -4 < y < 0.048000000000000001

                1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

              Alternative 8: 70.7% accurate, 2.4× speedup?

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

                1. Initial program 99.9%

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

                  \[\leadsto \color{blue}{x + z} \]
                3. Step-by-step derivation
                  1. lower-+.f6466.6%

                    \[\leadsto x + \color{blue}{z} \]
                4. Applied rewrites66.6%

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

                if -4 < y < 0.048000000000000001

                1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto x + \left(z + \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{2}, z, \frac{-1}{6} \cdot y\right), \color{blue}{y \cdot y}, y\right)\right) \]
                  10. lower-*.f6453.4%

                    \[\leadsto x + \left(z + \mathsf{fma}\left(\mathsf{fma}\left(-0.5, z, -0.16666666666666666 \cdot y\right), y \cdot \color{blue}{y}, y\right)\right) \]
                6. Applied rewrites53.4%

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

              Alternative 9: 70.3% accurate, 5.2× speedup?

              \[\begin{array}{l} \mathbf{if}\;y \leq -8.2 \cdot 10^{+82}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 20000:\\ \;\;\;\;x + \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (<= y -8.2e+82) (+ x z) (if (<= y 20000.0) (+ x (+ y z)) (+ x z))))
              double code(double x, double y, double z) {
              	double tmp;
              	if (y <= -8.2e+82) {
              		tmp = x + z;
              	} else if (y <= 20000.0) {
              		tmp = x + (y + z);
              	} else {
              		tmp = x + z;
              	}
              	return tmp;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x, y, z)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8), intent (in) :: z
                  real(8) :: tmp
                  if (y <= (-8.2d+82)) then
                      tmp = x + z
                  else if (y <= 20000.0d0) then
                      tmp = x + (y + z)
                  else
                      tmp = x + z
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z) {
              	double tmp;
              	if (y <= -8.2e+82) {
              		tmp = x + z;
              	} else if (y <= 20000.0) {
              		tmp = x + (y + z);
              	} else {
              		tmp = x + z;
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	tmp = 0
              	if y <= -8.2e+82:
              		tmp = x + z
              	elif y <= 20000.0:
              		tmp = x + (y + z)
              	else:
              		tmp = x + z
              	return tmp
              
              function code(x, y, z)
              	tmp = 0.0
              	if (y <= -8.2e+82)
              		tmp = Float64(x + z);
              	elseif (y <= 20000.0)
              		tmp = Float64(x + Float64(y + z));
              	else
              		tmp = Float64(x + z);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z)
              	tmp = 0.0;
              	if (y <= -8.2e+82)
              		tmp = x + z;
              	elseif (y <= 20000.0)
              		tmp = x + (y + z);
              	else
              		tmp = x + z;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := If[LessEqual[y, -8.2e+82], N[(x + z), $MachinePrecision], If[LessEqual[y, 20000.0], N[(x + N[(y + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
              
              \begin{array}{l}
              \mathbf{if}\;y \leq -8.2 \cdot 10^{+82}:\\
              \;\;\;\;x + z\\
              
              \mathbf{elif}\;y \leq 20000:\\
              \;\;\;\;x + \left(y + z\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;x + z\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < -8.1999999999999999e82 or 2e4 < y

                1. Initial program 99.9%

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

                  \[\leadsto \color{blue}{x + z} \]
                3. Step-by-step derivation
                  1. lower-+.f6466.6%

                    \[\leadsto x + \color{blue}{z} \]
                4. Applied rewrites66.6%

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

                if -8.1999999999999999e82 < y < 2e4

                1. Initial program 99.9%

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

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

                    \[\leadsto x + \color{blue}{\left(y + z\right)} \]
                  2. lower-+.f6461.3%

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

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

              Alternative 10: 68.4% accurate, 6.4× speedup?

              \[\begin{array}{l} \mathbf{if}\;x \leq -6.8 \cdot 10^{-90}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-145}:\\ \;\;\;\;y + z\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (<= x -6.8e-90) (+ x z) (if (<= x 2.5e-145) (+ y z) (+ x z))))
              double code(double x, double y, double z) {
              	double tmp;
              	if (x <= -6.8e-90) {
              		tmp = x + z;
              	} else if (x <= 2.5e-145) {
              		tmp = y + z;
              	} else {
              		tmp = x + z;
              	}
              	return tmp;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x, y, z)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8), intent (in) :: z
                  real(8) :: tmp
                  if (x <= (-6.8d-90)) then
                      tmp = x + z
                  else if (x <= 2.5d-145) then
                      tmp = y + z
                  else
                      tmp = x + z
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z) {
              	double tmp;
              	if (x <= -6.8e-90) {
              		tmp = x + z;
              	} else if (x <= 2.5e-145) {
              		tmp = y + z;
              	} else {
              		tmp = x + z;
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	tmp = 0
              	if x <= -6.8e-90:
              		tmp = x + z
              	elif x <= 2.5e-145:
              		tmp = y + z
              	else:
              		tmp = x + z
              	return tmp
              
              function code(x, y, z)
              	tmp = 0.0
              	if (x <= -6.8e-90)
              		tmp = Float64(x + z);
              	elseif (x <= 2.5e-145)
              		tmp = Float64(y + z);
              	else
              		tmp = Float64(x + z);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z)
              	tmp = 0.0;
              	if (x <= -6.8e-90)
              		tmp = x + z;
              	elseif (x <= 2.5e-145)
              		tmp = y + z;
              	else
              		tmp = x + z;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := If[LessEqual[x, -6.8e-90], N[(x + z), $MachinePrecision], If[LessEqual[x, 2.5e-145], N[(y + z), $MachinePrecision], N[(x + z), $MachinePrecision]]]
              
              \begin{array}{l}
              \mathbf{if}\;x \leq -6.8 \cdot 10^{-90}:\\
              \;\;\;\;x + z\\
              
              \mathbf{elif}\;x \leq 2.5 \cdot 10^{-145}:\\
              \;\;\;\;y + z\\
              
              \mathbf{else}:\\
              \;\;\;\;x + z\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if x < -6.79999999999999988e-90 or 2.4999999999999999e-145 < x

                1. Initial program 99.9%

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

                  \[\leadsto \color{blue}{x + z} \]
                3. Step-by-step derivation
                  1. lower-+.f6466.6%

                    \[\leadsto x + \color{blue}{z} \]
                4. Applied rewrites66.6%

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

                if -6.79999999999999988e-90 < x < 2.4999999999999999e-145

                1. Initial program 99.9%

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

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

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

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

                    \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
                  5. lower-fma.f6499.9%

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

                    \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + \sin y}\right) \]
                  7. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
                  8. lower-+.f6499.9%

                    \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
                3. Applied rewrites99.9%

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, z, x\right)} + \sin y \]
                  6. +-commutativeN/A

                    \[\leadsto \color{blue}{\sin y + \mathsf{fma}\left(\cos y, z, x\right)} \]
                  7. sum-to-mult-revN/A

                    \[\leadsto \color{blue}{\left(1 + \frac{\mathsf{fma}\left(\cos y, z, x\right)}{\sin y}\right) \cdot \sin y} \]
                  8. add-to-fractionN/A

                    \[\leadsto \color{blue}{\frac{1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)}{\sin y}} \cdot \sin y \]
                  9. associate-*l/N/A

                    \[\leadsto \color{blue}{\frac{\left(1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)\right) \cdot \sin y}{\sin y}} \]
                  10. div-flipN/A

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

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

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

                    \[\leadsto \frac{1}{\frac{\sin y}{\color{blue}{\left(1 \cdot \sin y + \mathsf{fma}\left(\cos y, z, x\right)\right) \cdot \sin y}}} \]
                5. Applied rewrites96.4%

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

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

                    \[\leadsto x + \color{blue}{\left(y + z\right)} \]
                  2. lower-+.f6461.3%

                    \[\leadsto x + \left(y + \color{blue}{z}\right) \]
                8. Applied rewrites61.3%

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

                  \[\leadsto y + \color{blue}{z} \]
                10. Step-by-step derivation
                  1. lower-+.f6429.5%

                    \[\leadsto y + z \]
                11. Applied rewrites29.5%

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

              Alternative 11: 66.6% accurate, 19.6× speedup?

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

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

                \[\leadsto \color{blue}{x + z} \]
              3. Step-by-step derivation
                1. lower-+.f6466.6%

                  \[\leadsto x + \color{blue}{z} \]
              4. Applied rewrites66.6%

                \[\leadsto \color{blue}{x + z} \]
              5. Add Preprocessing

              Alternative 12: 26.3% accurate, 73.1× speedup?

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

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

                \[\leadsto \color{blue}{x + z} \]
              3. Step-by-step derivation
                1. lower-+.f6466.6%

                  \[\leadsto x + \color{blue}{z} \]
              4. Applied rewrites66.6%

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

                \[\leadsto z \]
              6. Step-by-step derivation
                1. Applied rewrites26.3%

                  \[\leadsto z \]
                2. Add Preprocessing

                Reproduce

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