Diagrams.ThreeD.Transform:aboutX from diagrams-lib-1.3.0.3, A

Percentage Accurate: 99.8% → 99.8%
Time: 7.8s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x \cdot \cos y - 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}

\\
x \cdot \cos y - z \cdot \sin y
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 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.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \cos y - 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}

\\
x \cdot \cos y - z \cdot \sin y
\end{array}

Alternative 1: 99.8% accurate, 0.4× speedup?

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

\\
\left(-x\right) \cdot \frac{{0}^{2} - {\cos y}^{2}}{\cos y} - z \cdot \sin y
\end{array}
Derivation
  1. Initial program 99.7%

    \[x \cdot \cos y - z \cdot \sin y \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-cos.f64N/A

      \[\leadsto x \cdot \color{blue}{\cos y} - z \cdot \sin y \]
    2. sin-+PI/2-revN/A

      \[\leadsto x \cdot \color{blue}{\sin \left(y + \frac{\mathsf{PI}\left(\right)}{2}\right)} - z \cdot \sin y \]
    3. sin-sumN/A

      \[\leadsto x \cdot \color{blue}{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) + \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)} - z \cdot \sin y \]
    4. flip-+N/A

      \[\leadsto x \cdot \color{blue}{\frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}} - z \cdot \sin y \]
    5. remove-double-negN/A

      \[\leadsto x \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} - z \cdot \sin y \]
    6. sin-neg-revN/A

      \[\leadsto x \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(\sin \left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} - z \cdot \sin y \]
    7. cos-+PI/2-revN/A

      \[\leadsto x \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} - z \cdot \sin y \]
    8. cos-neg-revN/A

      \[\leadsto x \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} - z \cdot \sin y \]
    9. sin-+PI/2-revN/A

      \[\leadsto x \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} - z \cdot \sin y \]
    10. cos-sumN/A

      \[\leadsto x \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}} - z \cdot \sin y \]
    11. cos-+PI/2-revN/A

      \[\leadsto x \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\mathsf{neg}\left(\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)}} - z \cdot \sin y \]
    12. sin-+PI/2-revN/A

      \[\leadsto x \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)}\right)} - z \cdot \sin y \]
    13. cos-neg-revN/A

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

      \[\leadsto x \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} - z \cdot \sin y \]
  4. Applied rewrites99.8%

    \[\leadsto x \cdot \color{blue}{\frac{{\left(0 \cdot \sin y\right)}^{2} - {\left(1 \cdot \cos y\right)}^{2}}{-\cos y}} - z \cdot \sin y \]
  5. Final simplification99.8%

    \[\leadsto \left(-x\right) \cdot \frac{{0}^{2} - {\cos y}^{2}}{\cos y} - z \cdot \sin y \]
  6. Add Preprocessing

Alternative 2: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \cos y - 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}

\\
x \cdot \cos y - z \cdot \sin y
\end{array}
Derivation
  1. Initial program 99.7%

    \[x \cdot \cos y - z \cdot \sin y \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 3: 85.3% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+27} \lor \neg \left(z \leq 2.7 \cdot 10^{-84}\right):\\ \;\;\;\;x \cdot 1 - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -1.2e+27) (not (<= z 2.7e-84)))
   (- (* x 1.0) (* z (sin y)))
   (* (cos y) x)))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.2e+27) || !(z <= 2.7e-84)) {
		tmp = (x * 1.0) - (z * sin(y));
	} else {
		tmp = cos(y) * 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 ((z <= (-1.2d+27)) .or. (.not. (z <= 2.7d-84))) then
        tmp = (x * 1.0d0) - (z * sin(y))
    else
        tmp = cos(y) * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.2e+27) || !(z <= 2.7e-84)) {
		tmp = (x * 1.0) - (z * Math.sin(y));
	} else {
		tmp = Math.cos(y) * x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -1.2e+27) or not (z <= 2.7e-84):
		tmp = (x * 1.0) - (z * math.sin(y))
	else:
		tmp = math.cos(y) * x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1.2e+27) || !(z <= 2.7e-84))
		tmp = Float64(Float64(x * 1.0) - Float64(z * sin(y)));
	else
		tmp = Float64(cos(y) * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -1.2e+27) || ~((z <= 2.7e-84)))
		tmp = (x * 1.0) - (z * sin(y));
	else
		tmp = cos(y) * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.2e+27], N[Not[LessEqual[z, 2.7e-84]], $MachinePrecision]], N[(N[(x * 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+27} \lor \neg \left(z \leq 2.7 \cdot 10^{-84}\right):\\
\;\;\;\;x \cdot 1 - z \cdot \sin y\\

\mathbf{else}:\\
\;\;\;\;\cos y \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.19999999999999999e27 or 2.6999999999999999e-84 < z

    1. Initial program 99.8%

      \[x \cdot \cos y - z \cdot \sin y \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

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

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

      if -1.19999999999999999e27 < z < 2.6999999999999999e-84

      1. Initial program 99.7%

        \[x \cdot \cos y - z \cdot \sin y \]
      2. Add Preprocessing
      3. Taylor expanded in x around inf

        \[\leadsto \color{blue}{x \cdot \left(\cos y + -1 \cdot \frac{z \cdot \sin y}{x}\right)} \]
      4. Step-by-step derivation
        1. distribute-lft-inN/A

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

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

          \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos y \cdot x}\right)\right)\right)\right) + x \cdot \left(-1 \cdot \frac{z \cdot \sin y}{x}\right) \]
        4. distribute-lft-neg-outN/A

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

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

          \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(-1 \cdot \frac{z \cdot \sin y}{x}\right) \cdot x} \]
        7. mul-1-negN/A

          \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{z \cdot \sin y}{x}\right)\right)} \cdot x \]
        8. distribute-lft-neg-outN/A

          \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{z \cdot \sin y}{x} \cdot x\right)\right)} \]
        9. distribute-neg-inN/A

          \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(-1 \cdot \cos y\right) \cdot x + \frac{z \cdot \sin y}{x} \cdot x\right)\right)} \]
        10. distribute-rgt-inN/A

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

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

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

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \cos y + \frac{z \cdot \sin y}{x}\right)\right)\right) \cdot x} \]
      5. Applied rewrites99.8%

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

        \[\leadsto \cos y \cdot x \]
      7. Step-by-step derivation
        1. Applied rewrites90.9%

          \[\leadsto \cos y \cdot x \]
      8. Recombined 2 regimes into one program.
      9. Final simplification89.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+27} \lor \neg \left(z \leq 2.7 \cdot 10^{-84}\right):\\ \;\;\;\;x \cdot 1 - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot x\\ \end{array} \]
      10. Add Preprocessing

      Alternative 4: 85.3% accurate, 1.7× speedup?

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

        1. Initial program 99.8%

          \[x \cdot \cos y - z \cdot \sin y \]
        2. Add Preprocessing
        3. Taylor expanded in y around 0

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\sin y \cdot \left(-z\right)} + x \cdot 1 \]
            7. lower-fma.f6490.4

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

              \[\leadsto \mathsf{fma}\left(\sin y, -z, \color{blue}{x \cdot 1}\right) \]
            9. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(\sin y, -z, \color{blue}{1 \cdot x}\right) \]
            10. lower-*.f6490.4

              \[\leadsto \mathsf{fma}\left(\sin y, -z, \color{blue}{1 \cdot x}\right) \]
          3. Applied rewrites90.4%

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

          if -1.19999999999999999e27 < z < 2.6999999999999999e-84

          1. Initial program 99.7%

            \[x \cdot \cos y - z \cdot \sin y \]
          2. Add Preprocessing
          3. Taylor expanded in x around inf

            \[\leadsto \color{blue}{x \cdot \left(\cos y + -1 \cdot \frac{z \cdot \sin y}{x}\right)} \]
          4. Step-by-step derivation
            1. distribute-lft-inN/A

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

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

              \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos y \cdot x}\right)\right)\right)\right) + x \cdot \left(-1 \cdot \frac{z \cdot \sin y}{x}\right) \]
            4. distribute-lft-neg-outN/A

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

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

              \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(-1 \cdot \frac{z \cdot \sin y}{x}\right) \cdot x} \]
            7. mul-1-negN/A

              \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{z \cdot \sin y}{x}\right)\right)} \cdot x \]
            8. distribute-lft-neg-outN/A

              \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{z \cdot \sin y}{x} \cdot x\right)\right)} \]
            9. distribute-neg-inN/A

              \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(-1 \cdot \cos y\right) \cdot x + \frac{z \cdot \sin y}{x} \cdot x\right)\right)} \]
            10. distribute-rgt-inN/A

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

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

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

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \cos y + \frac{z \cdot \sin y}{x}\right)\right)\right) \cdot x} \]
          5. Applied rewrites99.8%

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

            \[\leadsto \cos y \cdot x \]
          7. Step-by-step derivation
            1. Applied rewrites90.9%

              \[\leadsto \cos y \cdot x \]

            if 2.6999999999999999e-84 < z

            1. Initial program 99.7%

              \[x \cdot \cos y - z \cdot \sin y \]
            2. Add Preprocessing
            3. Taylor expanded in y around 0

              \[\leadsto x \cdot \color{blue}{1} - z \cdot \sin y \]
            4. Step-by-step derivation
              1. Applied rewrites85.8%

                \[\leadsto x \cdot \color{blue}{1} - z \cdot \sin y \]
            5. Recombined 3 regimes into one program.
            6. Add Preprocessing

            Alternative 5: 74.2% accurate, 1.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.2 \cdot 10^{+83} \lor \neg \left(z \leq 3.2 \cdot 10^{+95}\right):\\ \;\;\;\;\left(-z\right) \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot x\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (or (<= z -2.2e+83) (not (<= z 3.2e+95)))
               (* (- z) (sin y))
               (* (cos y) x)))
            double code(double x, double y, double z) {
            	double tmp;
            	if ((z <= -2.2e+83) || !(z <= 3.2e+95)) {
            		tmp = -z * sin(y);
            	} else {
            		tmp = cos(y) * 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 ((z <= (-2.2d+83)) .or. (.not. (z <= 3.2d+95))) then
                    tmp = -z * sin(y)
                else
                    tmp = cos(y) * x
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double tmp;
            	if ((z <= -2.2e+83) || !(z <= 3.2e+95)) {
            		tmp = -z * Math.sin(y);
            	} else {
            		tmp = Math.cos(y) * x;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	tmp = 0
            	if (z <= -2.2e+83) or not (z <= 3.2e+95):
            		tmp = -z * math.sin(y)
            	else:
            		tmp = math.cos(y) * x
            	return tmp
            
            function code(x, y, z)
            	tmp = 0.0
            	if ((z <= -2.2e+83) || !(z <= 3.2e+95))
            		tmp = Float64(Float64(-z) * sin(y));
            	else
            		tmp = Float64(cos(y) * x);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	tmp = 0.0;
            	if ((z <= -2.2e+83) || ~((z <= 3.2e+95)))
            		tmp = -z * sin(y);
            	else
            		tmp = cos(y) * x;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := If[Or[LessEqual[z, -2.2e+83], N[Not[LessEqual[z, 3.2e+95]], $MachinePrecision]], N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * x), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;z \leq -2.2 \cdot 10^{+83} \lor \neg \left(z \leq 3.2 \cdot 10^{+95}\right):\\
            \;\;\;\;\left(-z\right) \cdot \sin y\\
            
            \mathbf{else}:\\
            \;\;\;\;\cos y \cdot x\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -2.19999999999999999e83 or 3.2000000000000001e95 < z

              1. Initial program 99.7%

                \[x \cdot \cos y - z \cdot \sin y \]
              2. Add Preprocessing
              3. Taylor expanded in x around 0

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

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

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

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

                  \[\leadsto \color{blue}{\left(-z\right)} \cdot \sin y \]
                5. lower-sin.f6477.9

                  \[\leadsto \left(-z\right) \cdot \color{blue}{\sin y} \]
              5. Applied rewrites77.9%

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

              if -2.19999999999999999e83 < z < 3.2000000000000001e95

              1. Initial program 99.8%

                \[x \cdot \cos y - z \cdot \sin y \]
              2. Add Preprocessing
              3. Taylor expanded in x around inf

                \[\leadsto \color{blue}{x \cdot \left(\cos y + -1 \cdot \frac{z \cdot \sin y}{x}\right)} \]
              4. Step-by-step derivation
                1. distribute-lft-inN/A

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

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

                  \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos y \cdot x}\right)\right)\right)\right) + x \cdot \left(-1 \cdot \frac{z \cdot \sin y}{x}\right) \]
                4. distribute-lft-neg-outN/A

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

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

                  \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(-1 \cdot \frac{z \cdot \sin y}{x}\right) \cdot x} \]
                7. mul-1-negN/A

                  \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{z \cdot \sin y}{x}\right)\right)} \cdot x \]
                8. distribute-lft-neg-outN/A

                  \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{z \cdot \sin y}{x} \cdot x\right)\right)} \]
                9. distribute-neg-inN/A

                  \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(-1 \cdot \cos y\right) \cdot x + \frac{z \cdot \sin y}{x} \cdot x\right)\right)} \]
                10. distribute-rgt-inN/A

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

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

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

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \cos y + \frac{z \cdot \sin y}{x}\right)\right)\right) \cdot x} \]
              5. Applied rewrites99.2%

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

                \[\leadsto \cos y \cdot x \]
              7. Step-by-step derivation
                1. Applied rewrites81.0%

                  \[\leadsto \cos y \cdot x \]
              8. Recombined 2 regimes into one program.
              9. Final simplification79.9%

                \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.2 \cdot 10^{+83} \lor \neg \left(z \leq 3.2 \cdot 10^{+95}\right):\\ \;\;\;\;\left(-z\right) \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot x\\ \end{array} \]
              10. Add Preprocessing

              Alternative 6: 75.2% accurate, 1.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.00145 \lor \neg \left(y \leq 0.0042\right):\\ \;\;\;\;\cos y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(y \cdot x\right) \cdot -0.5 - z, y, x\right)\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (or (<= y -0.00145) (not (<= y 0.0042)))
                 (* (cos y) x)
                 (fma (- (* (* y x) -0.5) z) y x)))
              double code(double x, double y, double z) {
              	double tmp;
              	if ((y <= -0.00145) || !(y <= 0.0042)) {
              		tmp = cos(y) * x;
              	} else {
              		tmp = fma((((y * x) * -0.5) - z), y, x);
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	tmp = 0.0
              	if ((y <= -0.00145) || !(y <= 0.0042))
              		tmp = Float64(cos(y) * x);
              	else
              		tmp = fma(Float64(Float64(Float64(y * x) * -0.5) - z), y, x);
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := If[Or[LessEqual[y, -0.00145], N[Not[LessEqual[y, 0.0042]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[(y * x), $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision] * y + x), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;y \leq -0.00145 \lor \neg \left(y \leq 0.0042\right):\\
              \;\;\;\;\cos y \cdot x\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(\left(y \cdot x\right) \cdot -0.5 - z, y, x\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < -0.00145 or 0.00419999999999999974 < y

                1. Initial program 99.6%

                  \[x \cdot \cos y - z \cdot \sin y \]
                2. Add Preprocessing
                3. Taylor expanded in x around inf

                  \[\leadsto \color{blue}{x \cdot \left(\cos y + -1 \cdot \frac{z \cdot \sin y}{x}\right)} \]
                4. Step-by-step derivation
                  1. distribute-lft-inN/A

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

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

                    \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos y \cdot x}\right)\right)\right)\right) + x \cdot \left(-1 \cdot \frac{z \cdot \sin y}{x}\right) \]
                  4. distribute-lft-neg-outN/A

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

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

                    \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(-1 \cdot \frac{z \cdot \sin y}{x}\right) \cdot x} \]
                  7. mul-1-negN/A

                    \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{z \cdot \sin y}{x}\right)\right)} \cdot x \]
                  8. distribute-lft-neg-outN/A

                    \[\leadsto \left(\mathsf{neg}\left(\left(-1 \cdot \cos y\right) \cdot x\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{z \cdot \sin y}{x} \cdot x\right)\right)} \]
                  9. distribute-neg-inN/A

                    \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(-1 \cdot \cos y\right) \cdot x + \frac{z \cdot \sin y}{x} \cdot x\right)\right)} \]
                  10. distribute-rgt-inN/A

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

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

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

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

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

                  \[\leadsto \cos y \cdot x \]
                7. Step-by-step derivation
                  1. Applied rewrites53.9%

                    \[\leadsto \cos y \cdot x \]

                  if -0.00145 < y < 0.00419999999999999974

                  1. Initial program 100.0%

                    \[x \cdot \cos y - z \cdot \sin y \]
                  2. Add Preprocessing
                  3. Taylor expanded in y around 0

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot x\right)} \cdot \frac{-1}{2} - z, y, x\right) \]
                    8. lower-*.f64100.0

                      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot x\right)} \cdot -0.5 - z, y, x\right) \]
                  5. Applied rewrites100.0%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y \cdot x\right) \cdot -0.5 - z, y, x\right)} \]
                8. Recombined 2 regimes into one program.
                9. Final simplification76.2%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.00145 \lor \neg \left(y \leq 0.0042\right):\\ \;\;\;\;\cos y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(y \cdot x\right) \cdot -0.5 - z, y, x\right)\\ \end{array} \]
                10. Add Preprocessing

                Alternative 7: 52.5% accurate, 23.8× speedup?

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

                  \[x \cdot \cos y - z \cdot \sin y \]
                2. Add Preprocessing
                3. Taylor expanded in y around 0

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), y, x\right)} \]
                  6. lower-neg.f6451.3

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

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

                Alternative 8: 52.5% accurate, 23.8× speedup?

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

                  \[x \cdot \cos y - z \cdot \sin y \]
                2. Add Preprocessing
                3. Taylor expanded in y around 0

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), y, x\right)} \]
                  6. lower-neg.f6451.3

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

                  \[\leadsto \color{blue}{\mathsf{fma}\left(-z, y, x\right)} \]
                6. Step-by-step derivation
                  1. Applied rewrites51.3%

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

                  Alternative 9: 17.0% accurate, 26.8× speedup?

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

                    \[x \cdot \cos y - z \cdot \sin y \]
                  2. Add Preprocessing
                  3. Taylor expanded in y around 0

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

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

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

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

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

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), y, x\right)} \]
                    6. lower-neg.f6451.3

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

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

                    \[\leadsto -1 \cdot \color{blue}{\left(y \cdot z\right)} \]
                  7. Step-by-step derivation
                    1. Applied rewrites18.2%

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

                    Reproduce

                    ?
                    herbie shell --seed 2024350 
                    (FPCore (x y z)
                      :name "Diagrams.ThreeD.Transform:aboutX from diagrams-lib-1.3.0.3, A"
                      :precision binary64
                      (- (* x (cos y)) (* z (sin y))))