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

Percentage Accurate: 99.8% → 99.8%
Time: 3.5s
Alternatives: 7
Speedup: 1.0×

Specification

?
\[x \cdot \sin y + z \cdot \cos y \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (+ (* x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
	return (x * sin(y)) + (z * cos(y));
}
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]
f(x, y, z):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z: real): real =
	(x * (sin(y))) + (z * (cos(y)))
END code
x \cdot \sin y + 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 7 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

\[x \cdot \sin y + z \cdot \cos y \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (+ (* x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
	return (x * sin(y)) + (z * cos(y));
}
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]
f(x, y, z):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z: real): real =
	(x * (sin(y))) + (z * (cos(y)))
END code
x \cdot \sin y + z \cdot \cos y

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

    \[\leadsto x \cdot \sin y + z \cdot \cos y \]
  3. Step-by-step derivation
    1. Applied rewrites99.8%

      \[\leadsto \mathsf{fma}\left(x, \sin y, z \cdot \cos y\right) \]
    2. Add Preprocessing

    Alternative 2: 86.2% accurate, 1.6× speedup?

    \[\begin{array}{l} t_0 := x \cdot \sin y + z\\ \mathbf{if}\;x \leq -4.420245809256181 \cdot 10^{-50}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.3626467647767355 \cdot 10^{-51}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
    (FPCore (x y z)
      :precision binary64
      :pre TRUE
      (let* ((t_0 (+ (* x (sin y)) z)))
      (if (<= x -4.420245809256181e-50)
        t_0
        (if (<= x 2.3626467647767355e-51) (* z (cos y)) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = (x * sin(y)) + z;
    	double tmp;
    	if (x <= -4.420245809256181e-50) {
    		tmp = t_0;
    	} else if (x <= 2.3626467647767355e-51) {
    		tmp = z * cos(y);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z)
    use fmin_fmax_functions
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8) :: t_0
        real(8) :: tmp
        t_0 = (x * sin(y)) + z
        if (x <= (-4.420245809256181d-50)) then
            tmp = t_0
        else if (x <= 2.3626467647767355d-51) then
            tmp = z * cos(y)
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = (x * Math.sin(y)) + z;
    	double tmp;
    	if (x <= -4.420245809256181e-50) {
    		tmp = t_0;
    	} else if (x <= 2.3626467647767355e-51) {
    		tmp = z * Math.cos(y);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = (x * math.sin(y)) + z
    	tmp = 0
    	if x <= -4.420245809256181e-50:
    		tmp = t_0
    	elif x <= 2.3626467647767355e-51:
    		tmp = z * math.cos(y)
    	else:
    		tmp = t_0
    	return tmp
    
    function code(x, y, z)
    	t_0 = Float64(Float64(x * sin(y)) + z)
    	tmp = 0.0
    	if (x <= -4.420245809256181e-50)
    		tmp = t_0;
    	elseif (x <= 2.3626467647767355e-51)
    		tmp = Float64(z * cos(y));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = (x * sin(y)) + z;
    	tmp = 0.0;
    	if (x <= -4.420245809256181e-50)
    		tmp = t_0;
    	elseif (x <= 2.3626467647767355e-51)
    		tmp = z * cos(y);
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]}, If[LessEqual[x, -4.420245809256181e-50], t$95$0, If[LessEqual[x, 2.3626467647767355e-51], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
    
    f(x, y, z):
    	x in [-inf, +inf],
    	y in [-inf, +inf],
    	z in [-inf, +inf]
    code: THEORY
    BEGIN
    f(x, y, z: real): real =
    	LET t_0 = ((x * (sin(y))) + z) IN
    		LET tmp_1 = IF (x <= (236264676477673550497470444681180204913850868864713481278357873518707535048639999573918907749408215760656374148714740028348447824745048873040786929777823388576507568359375e-221)) THEN (z * (cos(y))) ELSE t_0 ENDIF IN
    		LET tmp = IF (x <= (-44202458092561807173146183805990310442416852708706562951185861630934021423055811815087956022190442979509568437286867776620587384972527189574975636787712574005126953125e-216)) THEN t_0 ELSE tmp_1 ENDIF IN
    	tmp
    END code
    \begin{array}{l}
    t_0 := x \cdot \sin y + z\\
    \mathbf{if}\;x \leq -4.420245809256181 \cdot 10^{-50}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 2.3626467647767355 \cdot 10^{-51}:\\
    \;\;\;\;z \cdot \cos y\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -4.4202458092561807e-50 or 2.3626467647767355e-51 < x

      1. Initial program 99.8%

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

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

          \[\leadsto x \cdot \sin y + z \]

        if -4.4202458092561807e-50 < x < 2.3626467647767355e-51

        1. Initial program 99.8%

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

          \[\leadsto z \cdot \cos y \]
        3. Step-by-step derivation
          1. Applied rewrites61.3%

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

        Alternative 3: 74.7% accurate, 1.7× speedup?

        \[\begin{array}{l} t_0 := x \cdot \sin y\\ \mathbf{if}\;x \leq -5.303324118852423 \cdot 10^{+58}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 42163196947676.83:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
        (FPCore (x y z)
          :precision binary64
          :pre TRUE
          (let* ((t_0 (* x (sin y))))
          (if (<= x -5.303324118852423e+58)
            t_0
            (if (<= x 42163196947676.83) (* z (cos y)) t_0))))
        double code(double x, double y, double z) {
        	double t_0 = x * sin(y);
        	double tmp;
        	if (x <= -5.303324118852423e+58) {
        		tmp = t_0;
        	} else if (x <= 42163196947676.83) {
        		tmp = z * cos(y);
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: t_0
            real(8) :: tmp
            t_0 = x * sin(y)
            if (x <= (-5.303324118852423d+58)) then
                tmp = t_0
            else if (x <= 42163196947676.83d0) then
                tmp = z * cos(y)
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double t_0 = x * Math.sin(y);
        	double tmp;
        	if (x <= -5.303324118852423e+58) {
        		tmp = t_0;
        	} else if (x <= 42163196947676.83) {
        		tmp = z * Math.cos(y);
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	t_0 = x * math.sin(y)
        	tmp = 0
        	if x <= -5.303324118852423e+58:
        		tmp = t_0
        	elif x <= 42163196947676.83:
        		tmp = z * math.cos(y)
        	else:
        		tmp = t_0
        	return tmp
        
        function code(x, y, z)
        	t_0 = Float64(x * sin(y))
        	tmp = 0.0
        	if (x <= -5.303324118852423e+58)
        		tmp = t_0;
        	elseif (x <= 42163196947676.83)
        		tmp = Float64(z * cos(y));
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	t_0 = x * sin(y);
        	tmp = 0.0;
        	if (x <= -5.303324118852423e+58)
        		tmp = t_0;
        	elseif (x <= 42163196947676.83)
        		tmp = z * cos(y);
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.303324118852423e+58], t$95$0, If[LessEqual[x, 42163196947676.83], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
        
        f(x, y, z):
        	x in [-inf, +inf],
        	y in [-inf, +inf],
        	z in [-inf, +inf]
        code: THEORY
        BEGIN
        f(x, y, z: real): real =
        	LET t_0 = (x * (sin(y))) IN
        		LET tmp_1 = IF (x <= (42163196947676828125e-6)) THEN (z * (cos(y))) ELSE t_0 ENDIF IN
        		LET tmp = IF (x <= (-53033241188524230452986401087403946910043584422941378478080)) THEN t_0 ELSE tmp_1 ENDIF IN
        	tmp
        END code
        \begin{array}{l}
        t_0 := x \cdot \sin y\\
        \mathbf{if}\;x \leq -5.303324118852423 \cdot 10^{+58}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;x \leq 42163196947676.83:\\
        \;\;\;\;z \cdot \cos y\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < -5.303324118852423e58 or 42163196947676.828 < x

          1. Initial program 99.8%

            \[x \cdot \sin y + z \cdot \cos y \]
          2. Taylor expanded in x around inf

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

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

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

                \[\leadsto x \cdot \sin y \]

              if -5.303324118852423e58 < x < 42163196947676.828

              1. Initial program 99.8%

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

                \[\leadsto z \cdot \cos y \]
              3. Step-by-step derivation
                1. Applied rewrites61.3%

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

              Alternative 4: 74.1% accurate, 1.7× speedup?

              \[\begin{array}{l} t_0 := x \cdot \sin y\\ \mathbf{if}\;y \leq -0.03908848034999349:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 202.07469642451426:\\ \;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(\mathsf{fma}\left(-0.5, z, \left(y \cdot x\right) \cdot -0.16666666666666666\right) \cdot y, y, z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
              (FPCore (x y z)
                :precision binary64
                :pre TRUE
                (let* ((t_0 (* x (sin y))))
                (if (<= y -0.03908848034999349)
                  t_0
                  (if (<= y 202.07469642451426)
                    (fma
                     x
                     y
                     (fma (* (fma -0.5 z (* (* y x) -0.16666666666666666)) y) y z))
                    t_0))))
              double code(double x, double y, double z) {
              	double t_0 = x * sin(y);
              	double tmp;
              	if (y <= -0.03908848034999349) {
              		tmp = t_0;
              	} else if (y <= 202.07469642451426) {
              		tmp = fma(x, y, fma((fma(-0.5, z, ((y * x) * -0.16666666666666666)) * y), y, z));
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	t_0 = Float64(x * sin(y))
              	tmp = 0.0
              	if (y <= -0.03908848034999349)
              		tmp = t_0;
              	elseif (y <= 202.07469642451426)
              		tmp = fma(x, y, fma(Float64(fma(-0.5, z, Float64(Float64(y * x) * -0.16666666666666666)) * y), y, z));
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.03908848034999349], t$95$0, If[LessEqual[y, 202.07469642451426], N[(x * y + N[(N[(N[(-0.5 * z + N[(N[(y * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] * y + z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
              
              f(x, y, z):
              	x in [-inf, +inf],
              	y in [-inf, +inf],
              	z in [-inf, +inf]
              code: THEORY
              BEGIN
              f(x, y, z: real): real =
              	LET t_0 = (x * (sin(y))) IN
              		LET tmp_1 = IF (y <= (202074696424514257842020015232264995574951171875e-45)) THEN ((x * y) + ((((((-5e-1) * z) + ((y * x) * (-1666666666666666574148081281236954964697360992431640625e-55))) * y) * y) + z)) ELSE t_0 ENDIF IN
              		LET tmp = IF (y <= (-390884803499934874171373166973353363573551177978515625e-55)) THEN t_0 ELSE tmp_1 ENDIF IN
              	tmp
              END code
              \begin{array}{l}
              t_0 := x \cdot \sin y\\
              \mathbf{if}\;y \leq -0.03908848034999349:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;y \leq 202.07469642451426:\\
              \;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(\mathsf{fma}\left(-0.5, z, \left(y \cdot x\right) \cdot -0.16666666666666666\right) \cdot y, y, z\right)\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < -0.039088480349993487 or 202.07469642451426 < y

                1. Initial program 99.8%

                  \[x \cdot \sin y + z \cdot \cos y \]
                2. Taylor expanded in x around inf

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

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

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

                      \[\leadsto x \cdot \sin y \]

                    if -0.039088480349993487 < y < 202.07469642451426

                    1. Initial program 99.8%

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

                      \[\leadsto z + y \cdot \left(x + y \cdot \left(\frac{-1}{2} \cdot z + \frac{-1}{6} \cdot \left(x \cdot y\right)\right)\right) \]
                    3. Step-by-step derivation
                      1. Applied rewrites51.5%

                        \[\leadsto z + y \cdot \left(x + y \cdot \mathsf{fma}\left(-0.5, z, -0.16666666666666666 \cdot \left(x \cdot y\right)\right)\right) \]
                      2. Step-by-step derivation
                        1. Applied rewrites51.5%

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

                      Alternative 5: 52.7% accurate, 12.8× speedup?

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

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

                        \[\leadsto z + x \cdot y \]
                      3. Step-by-step derivation
                        1. Applied rewrites52.7%

                          \[\leadsto z + x \cdot y \]
                        2. Step-by-step derivation
                          1. Applied rewrites52.7%

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

                          Alternative 6: 39.7% accurate, 9.8× speedup?

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

                            1. Initial program 99.8%

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

                              \[\leadsto z + x \cdot y \]
                            3. Step-by-step derivation
                              1. Applied rewrites52.7%

                                \[\leadsto z + x \cdot y \]
                              2. Taylor expanded in x around 0

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

                                  \[\leadsto z \]

                                if 2.5388631714506055e29 < x

                                1. Initial program 99.8%

                                  \[x \cdot \sin y + z \cdot \cos y \]
                                2. Taylor expanded in x around inf

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

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

                                    \[\leadsto x \cdot \left(y \cdot \left(1 + \frac{-1}{2} \cdot \frac{y \cdot z}{x}\right) + \frac{z}{x}\right) \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites45.5%

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

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

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

                                    Alternative 7: 39.3% accurate, 76.8× speedup?

                                    \[z \]
                                    (FPCore (x y z)
                                      :precision binary64
                                      :pre TRUE
                                      z)
                                    double code(double x, double y, double z) {
                                    	return z;
                                    }
                                    
                                    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
                                    
                                    f(x, y, z):
                                    	x in [-inf, +inf],
                                    	y in [-inf, +inf],
                                    	z in [-inf, +inf]
                                    code: THEORY
                                    BEGIN
                                    f(x, y, z: real): real =
                                    	z
                                    END code
                                    z
                                    
                                    Derivation
                                    1. Initial program 99.8%

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

                                      \[\leadsto z + x \cdot y \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites52.7%

                                        \[\leadsto z + x \cdot y \]
                                      2. Taylor expanded in x around 0

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

                                          \[\leadsto z \]
                                        2. Add Preprocessing

                                        Reproduce

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